I use JSP to call JavaBean, JavaBean then call the servlet. The servlet then serialize HttpServletResponse and wrap it in a class Addition and send it back to JavaBean.
i have got
org.apache.coyote.tomcat5.CoyoteResponseFacade
and IOException in the servlet
The following is the code in servlet
The following is the debug message
do post
paranull
within cookiename:hello
before write
exception in servlet
org.apache.coyote.tomcat5.CoyoteResponseFacade
ioexception in cookietool post
i have got
org.apache.coyote.tomcat5.CoyoteResponseFacade
and IOException in the servlet
The following is the code in servlet
Code:
package base;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.net.*;
public class CookieServlet extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
System.out.println("para"+request.getQueryString());
String name = request.getParameter("NAME");
String value = request.getParameter("VALUE");
if (name!=null && name.trim().length()>0)
{
if (value!=null && value.length()>0)
{
System.out.println("within cookie"+name+":"+value);
Cookie cookie =
new LongLivedCookie(name, value);
response.addCookie(cookie);
}
}
try {
// create an Object input Stream.
Addition A = new Addition(1001,response);
response.setContentType("application/octet-stream");
System.out.println("before write");
ObjectOutputStream oos =
new ObjectOutputStream(response.getOutputStream());
oos.writeObject(A);
System.out.println("after write");
oos.flush();
oos.close();
}
catch( Exception cnfe){
System.out.println("exception in servlet");
System.err.println(cnfe.getMessage());
}
}
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
System.out.println("do post");
doGet(request, response);
}
}
do post
paranull
within cookiename:hello
before write
exception in servlet
org.apache.coyote.tomcat5.CoyoteResponseFacade
ioexception in cookietool post