tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: HttpServletResponse.sendRedirect() not working?
Date Tue, 17 Feb 2009 02:28:36 GMT

if you were forwarding..that would be a TC error

a redirect sends response back to browser-client  
its up to browser-client to then accept the response and re-direct the client Request to new
url

//an alternative strategy would be to build the URL consisting of URL and http-get parameters
e.g.
String url_string ="http://somehost.com"+"&parm1=value1&parm2=value2";
//call the URL directly (essantially a forward as the session is preserved)
java.net.URL url = new java.net.URL(url_string);
//read the response from url into Buffered Reader
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));

HTH
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender.
This transmission is of a confidential nature and Sender does not endorse distribution to
any party other than intended recipient. Sender does not necessarily endorse content contained
within this transmission. 




> Date: Mon, 16 Feb 2009 17:55:09 -0800
> From: dbwbca@yahoo.com
> To: users@tomcat.apache.org
> Subject: HttpServletResponse.sendRedirect() not working?
> 
> 
> I'm having a problem with Tomcat 6.0.18 that I don't understand. I'm invoking
> HttpServletResponse.sendRedirect() but no redirect is being sent to the
> browser. Is there a valid reason why this might occur, or is this likley a
> bug in Tomcat?
> 
> My code has thrown an exception prior to invoking the redirect but I can't
> find anything in the Servlet spec that would indicate this is a problem. The
> HttpServletResponse.sendRedirect() is within a try/catch block and no
> exception is being thrown in response to sendRedirect(). My app is built on
> Grails (which in turn is built on top of Spring) and I don't fully
> understand the exception resolution process used by my frameworks, but I
> have verified that sendRedirect() is being executed and not throwing an
> exception. This same code is working as desired when executed on Jetty (i.e.
> the desired redirect is received by the browser) but when executed in Tomcat
> I see the default Tomcat error page displayed rather than the redirect.
> 
> Any advice or suggestions would be appreciated.
> -- 
> View this message in context: http://www.nabble.com/HttpServletResponse.sendRedirect%28%29-not-working--tp22049004p22049004.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

_________________________________________________________________
See how Windows connects the people, information, and fun that are part of your life.
http://clk.atdmt.com/MRT/go/msnnkwxp1020093175mrt/direct/01/
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message