Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > HttpServletResponse

Reply
Thread Tools

HttpServletResponse

 
 
sridevisd@gmail.com
Guest
Posts: n/a
 
      12-08-2004
I am trying to do a
response.sendRedirect("http://"+"/servlet/MyServlet");

I get an error:
java.io.IOException: Response has been closed

I try to do the same in a different servlet it works.
Could anyone tell me why I get this error.

Thanks in advance
Sridevi

 
Reply With Quote
 
 
 
 
Andrea Desole
Guest
Posts: n/a
 
      12-08-2004
It looks like the response writer has been closed.
You should also check that the response has not been committed, as
defined in the HttpServletResponse documentation.

wrote:
> I am trying to do a
> response.sendRedirect("http://"+"/servlet/MyServlet");
>
> I get an error:
> java.io.IOException: Response has been closed
>
> I try to do the same in a different servlet it works.
> Could anyone tell me why I get this error.
>
> Thanks in advance
> Sridevi
>

 
Reply With Quote
 
 
 
 
Steve Sobol
Guest
Posts: n/a
 
      12-08-2004
wrote:
> I am trying to do a
> response.sendRedirect("http://"+"/servlet/MyServlet");
>
> I get an error:
> java.io.IOException: Response has been closed


Well, that is probably because you're trying to redirect to the URL

http:///servlet/MyServlet

That doesn't work.

If /servlet/MyServlet is served at the same hostname as the page you're
redirecting from, for example if you're redirecting from
http://abc.def.org/some.jsp to http://abc.def.org/servlet/MyServlet, then you
can do this:

response.sendRedirect("/servlet/MyServlet")

otherwise you need to include the full URL.

--
JustThe.net Internet & New Media Services, http://JustThe.net/
Steven J. Sobol, Geek In Charge / 888.480.4NET (463 /
PGP Key available from your friendly local key server (0xE3AE35ED)
Apple Valley, California Nothing scares me anymore. I have three kids.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HttpServletResponse - does sendError terminate request stream? Tim Java 0 10-19-2004 03:57 PM
what is the relation between HTTPServletResponse setContentLength header and keep-alive Naresh Agarwal Java 1 05-29-2004 10:01 AM
Problem closing connection in HTTPServletResponse Naresh Agarwal Java 0 05-28-2004 08:47 AM
javax.servlet.http.HttpServletResponse.sendError() nullyfies any addHeader() Joerg Mueller-Tolk Java 2 12-03-2003 02:03 PM
HttpServletResponse.sendError Mike Landis Java 1 08-09-2003 12:53 AM



Advertisments