Wrox Home  
Search P2P Archive for: Go

  Return to Index  

j2ee thread: java.io.StreamCorruptedException: Caught EOFException while reading the stream header


Message #1 by snissen@i... on Thu, 6 Jun 2002 21:45:21
Well if anybody has read this post. I figgered it out.  I am doing a nono.

I thought that you send GET data through the setRequestProperty method.  
It turns out that you need to URLEncode the data onto the URL string.

Yes, I feel stupid.



> Here is the Applet code:

>       URLConnection servletConnection = servSend.openConnection(); */
 >      URL url = new URL
(> "http://127.0.0.1:8080/servlet/sssweb.MatchingSequenceServlet");
 >      URLConnection connection = url.openConnection
();connection.setDoInput
(> true);
 >      connection.setDoOutput(true);
 >      connection.setUseCaches(false);
 >      connection.setRequestProperty("inputSequence", seq);
 >      connection.setRequestProperty("algorithm",algo);
 >    

>       ObjectInputStream in = new ObjectInputStream
(> connection.getInputStream());  //this is where it breaks

> Servlet Code: 

>    String contentType = "application/x-java-serialized-object";
 >    response.setContentType(contentType);

>     //recieve the input sequence and determine it's validity; if it 
passes 
s> earch the database
 >    String inputSequence = request.getParameter("inputSequence");
 >    System.out.println("In Servelt");
 >    //validate
 >    if(inputSequence != null)
 >    {
 >    if(isGoodLetter(request.getParameter("inputSequence")))
 >    {
 >      String algorithm = request.getParameter("algorithm");
 >      if(algorithm.equals("straightMatch"))
 >          {
 >             matchSeqList = algo.straightMatch(inputSequence, dbConnect);
 >             System.out.println("Still There...");
 >          }

>       //send matches through an ObjectOutputStream to the Applet
 >      ObjectOutputStream objStream = new ObjectOutputStream
(> response.getOutputStream());
 >      System.out.println("Sending NucSeq ArrayList to applet..."); 
 >      objStream.writeObject(matchSeqList);
 >      objStream.flush();
 >      objStream.close();
T> hanks!!

  Return to Index