I did this and it did fix the "weird" problem. However, it still takes 4
secs to display the redirected page using Netscape with Apache and Jserv
under NT.
dino
-----Original Message-----
From: Spencer Ridder <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Friday, September 17, 1999 7:56 PM
Subject: Re: sendRedirect problem
>Hi Dino,
>
>I tried your sample program and found it to behave just as you said.
>
>The problem is that doPost() cannot send a redirect to the doGet()
>method of the same servlet.
>
>Break your servlet into two servlets, one having a doGet() method
>and the other having a doPost() method, and it should work.
>
>--
>Spencer Ridder
>[EMAIL PROTECTED]
>
>Like my advice?
>I'm looking for a contract/job.
>
>
>Dino Valente wrote:
>>
>> I'm having lots of problems with Netscape if I use the `sendRedirect'
method
>> from HttpServletResponse.
>>
>> I am using Apache and Jserv under NT.
>>
>> However, I will first describe my use of it with the hopes that an
>> alternative way can be presented.
>>
>> doPost(...) {
>> retrieve values from getParameters()
>> validate values
>> if (error)
>> display error page
>> else
>> update database;
>> resp.sendRedirect(redirectedURL+ args);
>> }
>>
>> Under IE 4.0, everything works fine and redirection is quick. However,
under
>> Netscape 4.61, it takes about 5-10 seconds before the redirected page is
>> displayed (and under servlet runner an exception occurs:
>> java.net.SocketException: Socket read failed).
>>
>> So I tried to narrow the problem down and created a small example using
>> sendRedirect. Then it becomes wierder. The code is:
>>
>> import java.io.*;
>> import javax.servlet.*;
>> import javax.servlet.http.*;
>> public class Test2Servlet extends HttpServlet {
>> public void doGet(HttpServletRequest req, HttpServletResponse resp)
>> throws ServletException, IOException {
>> resp.setContentType("text/html");
>> PrintWriter out = resp.getWriter();
>> out.println("<HTML><HEAD>");
>> out.println("<TITLE>HTML directory");
>> out.println("</TITLE></HEAD><BODY TEXT=\"#800000\"
>> BGCOLOR=\"#FEFBEB\"><FORM METHOD=\"POST\" >");
>> out.println("<BR><INPUT TYPE=\"SUBMIT\" VALUE=\"Test redirect\"
>> NAME=\"Test redirect\">");
>> out.println("</FORM></BODY></HTML>");
>> out.close();
>> }
>> public void doPost(final HttpServletRequest req,
>> HttpServletResponse resp)
>> throws ServletException, IOException {
>> String abs = HttpUtils.getRequestURL(req).toString();
>> System.err.println( "Redirecting to: " + abs + " resp class name:" +
>> resp.getClass().getName());
>> resp.sendRedirect( abs );
>> }
>> }
>>
>> Once again, it works fine for IE under both servlet runner and Jserv.
Under
>> Netscape and Jserv, if I press "Test redirect" I get the following
output:
>>
>> Found
>>
>> The document has moved here.
>>
>> Apache/1.3.6 Server at mymachinename Port 80
>>
>> Under Netscape and servlet runner, I get
>>
>> Document moved
>>
>> This document has moved here.
>>
>> I really need to have the functionality of sendRedirect so I can pass
>> arguments to the redirected servlet. I am using JSK2.0.
>>
>> Can anyone help here (or perhaps suggest an alternative way)?
>>
>> dino
>>
>>
___________________________________________________________________________
>> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
>> of the message "signoff SERVLET-INTEREST".
>>
>> Archives: http://archives.java.sun.com/archives/servlet-interest.html
>> Resources: http://java.sun.com/products/servlet/external-resources.html
>> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html