Re: response.sendRedirect problem in Tomcat 5.0.18

2004-02-01 Thread Ben Souther
You'll need to structure your code so that you either write to the out stream 
or perform a sendRedirect.  There has never been a version of Tomcat that 
would allow otherwise.  This is the same in PHP, ASP, and I imagine any other 
web scripting language.

A sendRedirect does nothing more than send back a bodyless header with a 
Location: url  parameter.

You can't send a header once you've started writing to the body of the 
message.  You also can't write to the body after sending a redirect (which is 
why you need to add a return statement just after the redirect).



On Sunday 01 February 2004 06:55 am, you wrote:
 Hi Ben,

 Thanks for your assistance, I added return ; statements directly after
 the redirects but this didn't stop the errors.  I am currently having the
 code checked and will let you know what eventuates.

 Should there be no out.print statements above the response.sendRedirect
 lines in the jsp code ?
 There are also out.write statements in the jsp code above the redirect
 lines, could these also cause a problem ?

 The code was not erroring like this when using Tomcat 4.1.24 or 5.0.16, do
 you think this is due to Tomcat 5.0.18 being more strict with syntax ?

 Thanks for your time,

 Regards
 Anthony


 From: Ben Souther [EMAIL PROTECTED]

 Reply-To: [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Subject: Re: response.sendRedirect problem in Tomcat 5.0.18
 Date: Sat, 31 Jan 2004 23:53:41 -0500
 
 On Saturday 31 January 2004 11:32 pm, you wrote:
   at org.apache.jsp.product_jsp._jspService(product_jsp.java:283)
 
 If you go into your work directory, and look at product_jsp.java line 283,
 you will see exactly what's causing the problem.
 
 Without seeing your code, I can't be sure what the problem is but 99% of
 the
 time when I see an illegal state exception it caused by one of two things.
 
 Either you've written someting to the out stream before redirecting
 (setting
 content type or any out.print statements)  or you didn't  put a return
 statement just after the redirect.
 
 If neither of these is the case and you can post your code, attach your
  JSP and the product_jsp.java code I'll take a stab at it.
 
 -Ben
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 _
 Hot chart ringtones and polyphonics. Go to
 http://ninemsn.com.au/mobilemania/default.asp

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



response.sendRedirect problem in Tomcat 5.0.18

2004-01-31 Thread Anthony Gray
Hi All,

Repost due to a spelling error - sorry:

I'm having a problem with response.sendRedirect lines when running Tomcat 
5.0.18.  I don't have this issue when using tomcat 5.0.16.  Do you know if 
this function has been changed in tomcat 5.0.18 ?  I am able to call the 
respective pages successfully but not using the redirect.

I'm currently running Apache 2, Tomcat 5.0.18 and jk2.

The pages error with the following :

*
java.lang.IllegalStateException
at 
org.apache.coyote.tomcat5.CoyoteResponseFacade.sendRedirect(CoyoteResponseFacade.java:399)
at org.apache.jsp.product_jsp._jspService(product_jsp.java:283)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at 
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:578)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:324)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:395)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:673)
at 
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:615)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:786)
at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:536)
*

TIA
Anthony
_
ninemsn Premium transforms your e-mail with colours, photos and animated 
text. Click here  http://ninemsn.com.au/premium/landing.asp

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: response.sendRedirect problem in Tomcat 5.0.18

2004-01-31 Thread Ben Souther
On Saturday 31 January 2004 11:32 pm, you wrote:
 at org.apache.jsp.product_jsp._jspService(product_jsp.java:283)

If you go into your work directory, and look at product_jsp.java line 283, 
you will see exactly what's causing the problem.

Without seeing your code, I can't be sure what the problem is but 99% of the 
time when I see an illegal state exception it caused by one of two things.

Either you've written someting to the out stream before redirecting (setting 
content type or any out.print statements)  or you didn't  put a return 
statement just after the redirect. 

If neither of these is the case and you can post your code, attach your JSP 
and the product_jsp.java code I'll take a stab at it.

-Ben

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]