You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nilesh Shastrakar <ni...@extenprise.com> on 2006/07/17 14:59:38 UTC

How to redirect URLs

Dear All,

 

I have setup the Tomcat sever and Application, its working fine..

but I got the long URL now I want to make it short

Ex : 

 

http://www.abc.om/test/JSP/ondemand/rdtest/login.jsp

 

I want www.abc.com/forward  if  someone  types this URL in browser the site
should 

Redirect to above URL.

 

Could anyone please help me how to do it in Tomcat?

 

Regards

Nilesh.

 

 


Re: How to redirect URLs

Posted by Martin Gainty <mg...@hotmail.com>.
Assuming your workers.properties have enabled forwardAll = true (that is the Apache workers say all requests go to Tomcat)
http://tomcat.apache.org/tomcat-4.0-doc/config/ajp.html

From Tomcat
Create a request dispatcher using a path calculated as follows: {ServletPath} + "/" + {ServletSelector} + {PathRemainder} 

2 avenues
1)RequestDispatcher.forward() will forward the request to the constructed ServletPath/ServletSelector/PathRemainder or
2)<jsp:forward>
http://java.sun.com/products/jsp/tags/11/syntaxref11.fm9.html
whereas the URL can be either absolute ot relative to current JSP

Be mindful that 
The request and the response objects come from the original Servlet's service method and forwards are routed before any response is provided,
http://java.sun.com/j2ee/sdk_1.2.1/techdocs/api/javax/servlet/RequestDispatcher.html#forward(javax.servlet.ServletRequest,%20javax.servlet.ServletResponse)

HTH,
Martin --
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



----- Original Message ----- 
From: "Nilesh Shastrakar" <ni...@extenprise.com>
To: "'Tomcat Users List'" <us...@tomcat.apache.org>; "'Martin Gainty'" <mg...@hotmail.com>
Sent: Tuesday, July 18, 2006 12:21 AM
Subject: RE: How to redirect URLs


> Thnaks for help,
> 
> But where do I specify forward for /test/JSP/ondemand/rdtest/login.jsp
> 
> If someone type the url www.abc.com/forward it should redierct to above jsp.
> 
> Regards
> Nilesh,
> -----Original Message-----
> From: Martin Gainty [mailto:mgainty@hotmail.com] 
> Sent: Monday, July 17, 2006 7:31 PM
> To: Tomcat Users List
> Subject: Re: How to redirect URLs
> 
> I would suggest in the forward webapp web.xml that you update the
> welcome-file-list to point to your jsp
> e.g.
> web.xml contents of www.abc.com (forward webapp)
> 
> <welcome-file-list>
>  <welcome-file>/test/JSP/ondemand/rdtest/login.jsp</welcome-file>
> </welcome-file-list>
> 
> M-
> *********************************************************************
> This email message and any files transmitted with it contain confidential
> information intended only for the person(s) to whom this email message is
> addressed.  If you have received this email message in error, please notify
> the sender immediately by telephone or email and destroy the original
> message without making a copy.  Thank you.
> 
> 
> 
> ----- Original Message ----- 
> From: "Nilesh Shastrakar" <ni...@extenprise.com>
> To: <us...@tomcat.apache.org>
> Sent: Monday, July 17, 2006 8:59 AM
> Subject: How to redirect URLs 
> 
> 
>> Dear All,
>> 
>> 
>> 
>> I have setup the Tomcat sever and Application, its working fine..
>> 
>> but I got the long URL now I want to make it short
>> 
>> Ex : 
>> 
>> 
>> 
>> http://www.abc.om/test/JSP/ondemand/rdtest/login.jsp
>> 
>> 
>> 
>> I want www.abc.com/forward  if  someone  types this URL in browser the
> site
>> should 
>> 
>> Redirect to above URL.
>> 
>> 
>> 
>> Could anyone please help me how to do it in Tomcat?
>> 
>> 
>> 
>> Regards
>> 
>> Nilesh.
>> 
>> 
>> 
>> 
>> 
>>
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
>

RE: How to redirect URLs

Posted by Nilesh Shastrakar <ni...@extenprise.com>.
Thnaks for help,

But where do I specify forward for /test/JSP/ondemand/rdtest/login.jsp

If someone type the url www.abc.com/forward it should redierct to above jsp.

Regards
Nilesh,
-----Original Message-----
From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Monday, July 17, 2006 7:31 PM
To: Tomcat Users List
Subject: Re: How to redirect URLs

I would suggest in the forward webapp web.xml that you update the
welcome-file-list to point to your jsp
e.g.
web.xml contents of www.abc.com (forward webapp)

<welcome-file-list>
  <welcome-file>/test/JSP/ondemand/rdtest/login.jsp</welcome-file>
</welcome-file-list>

M-
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



----- Original Message ----- 
From: "Nilesh Shastrakar" <ni...@extenprise.com>
To: <us...@tomcat.apache.org>
Sent: Monday, July 17, 2006 8:59 AM
Subject: How to redirect URLs 


> Dear All,
> 
> 
> 
> I have setup the Tomcat sever and Application, its working fine..
> 
> but I got the long URL now I want to make it short
> 
> Ex : 
> 
> 
> 
> http://www.abc.om/test/JSP/ondemand/rdtest/login.jsp
> 
> 
> 
> I want www.abc.com/forward  if  someone  types this URL in browser the
site
> should 
> 
> Redirect to above URL.
> 
> 
> 
> Could anyone please help me how to do it in Tomcat?
> 
> 
> 
> Regards
> 
> Nilesh.
> 
> 
> 
> 
> 
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to redirect URLs

Posted by Martin Gainty <mg...@hotmail.com>.
I would suggest in the forward webapp web.xml that you update the welcome-file-list to point to your jsp
e.g.
web.xml contents of www.abc.com (forward webapp)

<welcome-file-list>
  <welcome-file>/test/JSP/ondemand/rdtest/login.jsp</welcome-file>
</welcome-file-list>

M-
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



----- Original Message ----- 
From: "Nilesh Shastrakar" <ni...@extenprise.com>
To: <us...@tomcat.apache.org>
Sent: Monday, July 17, 2006 8:59 AM
Subject: How to redirect URLs 


> Dear All,
> 
> 
> 
> I have setup the Tomcat sever and Application, its working fine..
> 
> but I got the long URL now I want to make it short
> 
> Ex : 
> 
> 
> 
> http://www.abc.om/test/JSP/ondemand/rdtest/login.jsp
> 
> 
> 
> I want www.abc.com/forward  if  someone  types this URL in browser the site
> should 
> 
> Redirect to above URL.
> 
> 
> 
> Could anyone please help me how to do it in Tomcat?
> 
> 
> 
> Regards
> 
> Nilesh.
> 
> 
> 
> 
> 
>

Re: How to redirect URLs

Posted by Barrie Selack <bs...@digipixart.com>.
I've been using this Url Rewrite Filter for several years now.. and it's
actively developed with new features.

<http://tuckey.org/urlrewrite/>

Regards,
Barrie


>Dear All,
>
> 
>
>I have setup the Tomcat sever and Application, its working fine..
>
>but I got the long URL now I want to make it short
>
>Ex : 
>
> 
>
>http://www.abc.om/test/JSP/ondemand/rdtest/login.jsp
>
> 
>
>I want www.abc.com/forward  if  someone  types this URL in browser the site
>should 
>
>Redirect to above URL.
>
> 
>
>Could anyone please help me how to do it in Tomcat?
>
> 
>
>Regards
>
>Nilesh.
>
> 
>
> 
>



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org