tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Gainty" <mgai...@hotmail.com>
Subject Re: How to redirect URLs
Date Tue, 18 Jul 2006 15:20:30 GMT
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" <nilesh@extenprise.com>
To: "'Tomcat Users List'" <users@tomcat.apache.org>; "'Martin Gainty'" <mgainty@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" <nilesh@extenprise.com>
> To: <users@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
> 
>
Mime
View raw message