Well I though you might have had it, but I've added a closeWriter method and
still no dice. See anything I'm overlooking (some dumb mistake from too
many hours of staring at it)?
I'm using a controller servlet with handler classes. In the handler for my
"submit" I have:
AtOnceServletResponse htmlWrapper =
new AtOnceServletResponse(response, client.getFilePath() +
RequestDispatcher rd =
request.getRequestDispatcher(template.getTemplateName());
rd.include(request, htmlWrapper);
htmlWrapper.closeWriter();
The closeWriter() method simply calls the PrintWriter's close() method.
In the main servlet, it still throws an error when I try to do a redirect or
forward.
Frustrating.
> -----Original Message-----
> From: Martin van den Bemt [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 13, 2001 11:02 AM
> To: Tomcat Users List
> Subject: RE: [servlets] Error when wrapping a response object
>
> Close the writer you have opened to write to the html stream
> should (if I'm
> not mistaking) make this work.
>
> Mvgr,
> Martin
>
> > -----Original Message-----
> > From: Jay Wright [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, November 13, 2001 8:09 PM
> > To: '[EMAIL PROTECTED]'
> > Subject: FW: [servlets] Error when wrapping a response object
> >
> >
> >
> > Has anyone using Tomcat seen a problem like this? In short, I am
> > wrapping a
> > response object so I can write the HTML to a file. Then, I
> would like to
> > use the ReqeustDispatcher to forward the response or at the
> very least use
> > the response objects sendRedirect to go to the next page.
> >
> > With Resin, this works fine. In Tomcat, I get an error which
> > wont allow me
> > to do either becuase the response object is "committed." The
> > attached email
> > explains further.
> >
> > Any one seen this before?
> >
> > Jay
> >
> > -----Original Message-----
> > From: Jay Wright [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, November 02, 2001 10:36 AM
> > To: Servlets
> > Subject: [servlets] Error when wrapping a response object
> >
> >
> >
> > Hi all,
> >
> > I am getting a servlet error which has something to do with
> a wrapped
> > response object.
> >
> > With Resin, I have created a servlet that wraps a response
> object for the
> > purpose of writing the response's html to a file. This complete
> > successfully, then the RequestDispatcher forwards the
> request to a jsp,
> > which in effect displays a thank you page. It works wonderfully.
> >
> > When I deploy the same application to Tomcat, I get the
> following error:
> >
> > java.lang.IllegalStateException: Cannot forward after
> response has been
> > committed
> > at
> > org.apache.catalina.core.ApplicationDispatcher.doForward(Unknown
> > Source)
> > at
> org.apache.catalina.core.ApplicationDispatcher.forward(Unknown
> > Source)
> > at atonce.mas.web.MainServlet.doGet(MainServlet.java:88)
> >
> > Apparently the two servlet containers handle this
> differently. As curious
> > as this is, I'm more concerned with getting the tomcat version
> > working. Is
> > there anything I can do to "uncommit" the response? I assume
> > not. I could
> > use a sendRedirect, but would prefer to stick with the
> RequestDispatchers
> > forward method to be consistent and standard with my servlet model.
> >
> > Any ideas?
> >
> > Thanks,
> > Jay
> >
> > ---
> > SIGS Conference for Java Development
> > Targeted, focused classes, expertise level classes
> > taught by Java gurus, rigorous tutorials, and
> > exhibit floor makes SIGS Conference for Java
> > Development a learning experience unlike any
> > other. Join over 10,000 developers and programmers
> > from across the U.S. and around the world who
> > have benefited from attending SIGS/101 Conferences.
> > http://www.javadevcon.com
> > ---
> > You are currently subscribed to servlets as: [EMAIL PROTECTED]
> > To unsubscribe send a blank email to
> [EMAIL PROTECTED]
> >
> > --
> > To unsubscribe:
<mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>