If you have this problem with Internet Explorer you can try to set IE to
not use HTTP/1.1 but only 1.0 (this is in the avanced section of the
options dialog). If this solves your problem you have discovered one of
the many HTTP related bugs in IE and you can't do anything against it.

Christof

Per Hubinette wrote:

> Hi I have had the same problem for a week now. I have a applet
> communicating with a servlet.I can write a object to the servlet but
> when I try to read back a object to the applet I get an error.The
> error occures when I try to make the inputstream from the servlet to
> an objectinputstream.Please help /Pelle
> Hubinette Error:java.io.StreamCorruptedException: Caught EOFException
> while reading the stream headerat
> java.io.ObjectInputStream.readStreamHeader(Unknown Source)at
> java.io.ObjectInputStream.<init>(Unknown Source)at
> Appe$Appeproxyservlet.skickastrang(Appe.java:71)at
> Appe.init(Appe.java:38)at sun.applet.AppletPanel.run(Unknown Source)at
> java.lang.Thread.run(Unknown Source)  Applet:import java.io.*;
> import java.util.*;
> import java.awt.*;
> import java.net.*;
> import java.applet.*; public class Appe extends Applet{
>  public void init()
>  {
>   try {
>    URL codebase = this.getCodeBase();
>    Appeproxyservlet aserv=new Appeproxyservlet(servletBase);
>    aserv.skickastrang("pelle �r b�st");
>
>   } catch (Exception ex) {
>    ex.printStackTrace();
>   }
>   }
> class  Appeproxyservlet {
>   URL servlet;
>  URL webBase;
>  ObjectInputStream in;
>  public Appeproxyservlet(URL web){
>   webBase = web;
>  }
>  public void skickastrang(String data) throws Exception {
>   servlet = new URL(webBase, "servlet/AppeServlet101");
>   URLConnection con = servlet.openConnection();
>   con.setDoInput(true);
>   con.setDoOutput(true);
>   con.setUseCaches(false);
>   con.setRequestProperty("Content-Type",
> "application/x-www-form-urlencoded");
>   ObjectOutputStream out = new
> ObjectOutputStream(con.getOutputStream());
>   out.writeObject(data);
>
>   InputStream inp=con.getInputStream(); // this works fine
>
>   in=new ObjectInputStream(inp); // this doesn't work
>
>   String id = (String)in.readObject();
>
>   in.close();
>   out.flush();
>   out.close();
>  }
> }
> } Servlet:import java.io.*;
> import java.util.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> public class AppeServlet101 extends HttpServlet
> {
> public void service(HttpServletRequest req, HttpServletResponse resp)
>  throws ServletException, IOException
>  {
>   ObjectInputStream in = new ObjectInputStream(req.getInputStream() );
>
>   ObjectOutputStream out = new ObjectOutputStream(
> resp.getOutputStream() );
>   try {
>    String st=(String)in.readObject();
>    st=st+"PELLE PELLE";
>    out.writeObject(st);
>    in.close();
>    out.close();
>   } catch (Exception e) {
>       in.close();
>       out.close();
>       e.printStackTrace(); }
>  }
> }

--
!try; do()

___________________________________________________________________________
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

Reply via email to