Let's say we've got a servlet such as
==
 protected void doGet(HttpServletRequest request, HttpServletResponse 
response)
   throws ServletException, IOException
 {
  RequestDispatcher rd = getServletContext().getRequestDispatcher("/target");
  
  String s;
  s = "Launcher: response is " 
   + response.getClass().getName() 
   + (response.isCommitted() ? ", commited" : "");
  System.err.println(s);
  
  response.setContentType("text/plain; charset=koi8-r");
  PrintWriter out = response.getWriter();
  s = "Launcher: response is " 
   + response.getClass().getName() 
   + (response.isCommitted() ? ", commited" : "");
  out.println(s);
  System.err.println(s);
  
  rd.include(request, response);
  
  out.flush();
  s = "Launcher: response is " 
   + response.getClass().getName() 
   + (response.isCommitted() ? ", commited" : "");
  out.println(s);
  System.err.println(s);
  
  rd.include(request, response);
  s = "Launcher: response is " 
   + response.getClass().getName() 
   + (response.isCommitted() ? ", commited" : "");
  out.println(s);
  System.err.println(s); 
  
  out.flush();
 }
==

Let's say we have another servlet such as
==
 protected void doGet(HttpServletRequest request, HttpServletResponse 
response)
   throws ServletException, IOException
 {
  String s;
  s = "Target: response is " 
   + response.getClass().getName() 
   + (response.isCommitted() ? ", commited" : "");
  System.err.println(s);
  
  response.setContentType("text/plain; charset=koi8-r");
  
  PrintWriter out = response.getWriter();
  s = "Target: response is " 
   + response.getClass().getName() 
   + (response.isCommitted() ? ", commited" : "");
  System.err.println(s);
  out.println(s);
  
  out.flush();
  s = "Target: response is " 
   + response.getClass().getName() 
   + (response.isCommitted() ? ", commited" : "");
  out.println(s);
  System.err.println(s);
 }
==

Let's say we map them to '/launcher' and '/target'.
Let's say we call target on resin, we will get this on stderr:

==
Launcher: response is com.caucho.server.http.HttpResponse
Launcher: response is com.caucho.server.http.HttpResponse
Target: response is com.caucho.server.webapp.DispatchResponse
Target: response is com.caucho.server.webapp.DispatchResponse
Target: response is com.caucho.server.webapp.DispatchResponse, commited
Launcher: response is com.caucho.server.http.HttpResponse, commited
Target: response is com.caucho.server.webapp.DispatchResponse, commited
Target: response is com.caucho.server.webapp.DispatchResponse, commited
Target: response is com.caucho.server.webapp.DispatchResponse, commited
Launcher: response is com.caucho.server.http.HttpResponse, commited
==
You see? DispatchResponse isComitted() always on the second run. Before Target 
did anything with that response.
I don't think that's correct because it guaranties that some servlets will 
break. Like those who use forward().

I'll investigate that case further.
Is there anything in J2EE docs to cover up current behavior?


_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to