(Somthing went wrong with the previous posting !!)
Hi there,
I do have a small problem sending serialized objects from applets
to servlets. Most assumably, the problem has to do with setting
the correct MIME type....)
Consult code given below (which is from the applet)
URLConnection connection = null;
try {
URL url = new URL( this.getCodeBase() + "servlet/FooBarServlet );
connection = url.openConnection();
connection.setDoInput( true );
connection.setDoOutput( true );
connection.setUseCaches( false );
connection.setDefaultUseCaches( false );
connection.setRequestProperty( "Content-type", "application/octetstream" );
ObjectOutputStream oos =
new ObjectOutputStream( connection.getOutputStream() );
oos.writeObject( fooBar );
oos.flush();
oos.close();
} catch (Exception e ) {
e.printStackTrace();
}
The FooBarServlet code snipplet:
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
// Get taxonomy
FooBar fooBar = null;
try {
ObjectInputStream ois =
new ObjectInputStream( request.getInputStream() );
fooBar = (FooBar) ois.readObject();
ois.close();
} catch ( ClassNotFoundException cnfe ) {
cnfe.printStackTrace();
return;
}
}
Someway, somehow, this servlet doesn't receive the FooBar object. I tried
a lot. Can someone please give me some suggestions what the problem can be ?
Thanks,
Leonard Wolters
___________________________________________________________________________
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