W3C home > Mailing lists > Public > www-jigsaw@w3.org > July to August 2001

FW: hanging in HttpManager.RunRequest() (repost?)

From: Owen Roberts <oroberts@baltimore.com>
Date: Thu, 2 Aug 2001 16:25:51 +0100
Message-ID: <B15225F53DF1D411B80B0002A5097D9F32DECC@irlms02.ie.baltimore.com>
To: www-jigsaw@w3.org

> sorry if this hits the group twice...
> 
> -----Original Message-----
> From: Owen Roberts [mailto:owen@utvinternet.com]
> Sent: 01 August 2001 22:58
> To: jigsaw@w3.org
> Cc: Owen Roberts
> Subject: hanging in HttpManager.RunRequest()
> 
> 
> Hi all,
> 
> I've trawled through some of the post archive but couldn't see this
> mentioned... any help appreciated...
> 
> Im use HttpManager to POST binary data to an octet stream using source
> from Jigsaw 2.2.0. (Java 1.2.2)
> 
> My code is basically calling the below in a loop:
>         {
>                 HttpManager   manager = HttpManager.getManager() ;
> 
>                 org.w3c.www.protocol.http.Request request =
> manager.createRequest() ;
>                 request.setMethod("POST");
>                 request.setURL(new URL("http://" + m_hostname +
> "/servlet/MVServlet"));
>                 
>                 ByteArrayOutputStream byteStream = new
> ByteArrayOutputStream(100);
>                 ObjectOutputStream objOut = new
> ObjectOutputStream(byteStream)            ;
>                 objOut.writeObject(myObjectDerivedFromSerializable);
>                 objOut.flush();
>                 
>                 byte[] byteReq = byteStream.toByteArray();
>                 request.setContentType(MimeType.APPLICATION_OCTET_STREAM);
>                 request.setContentLength(byteReq.length);
>                 
>                 //give stream to the http request.
>                 request.setOutputStream(
>                     new
> ByteArrayInputStream(byteReq));//java.io.InputStream in);                
>                     
>                 //hangs here ...
>                 Reply    reply = manager.runRequest(request);
>         }
> 
> anyway, so the loop runs 5-6 times before hanging at runRequest...
> and I traced it down to the line
>             reply = srv.runRequest(request);
> in HttpManager.runRequest() by putting breakpoints after it that never get
> hit.
> 
> The (GenericServlet derived) servlet on the other end just takes thes
> treamed object in and streams another back in reply. Its hosted on Jigsaw2
> .2.0.
> 
> The code for the Servlet service method is below. Everything works fine
> for 5-6 loops of the client before it hangs. the Servlet does not get the
> request on the last runRequest() that hangs...
> 
> thanks very much for your time,
> Owen
> 
>     public void service(ServletRequest req, 
>                         ServletResponse res)
>                     throws ServletException, IOException 
>     {
>         try
>         {
>             if( req.getContentLength() > 0)
>             {
>                                 
>                 ServletInputStream inStr = req.getInputStream();
>                 ObjectInputStream streamFromClient = 
>                                         new ObjectInputStream(inStr);
>                         
>                 Object objReq = streamFromClient.readObject();
> 
>                 if (objReq instanceof MyRequest)
>                 {
>                                         
>                     MyRequest clientReq = (MyRequest)objReq;
>                 
>                     .....
>                     
>  
> res.setContentType(MimeType.APPLICATION_OCTET_STREAM.toString());
>                     
>                     ObjectOutputStream streamToClient = 
>                             new ObjectOutputStream(res.getOutputStream());
>                             
>                     streamToClient.writeObject(myResponse.getResponse());
>                     
>                     streamToClient.flush();      
>                     
>                     return;
>                 }
>                 else
>                 {
>                     ...fail                    
>                 }
>             }
>             else
>            { 
>                 ...fail
>             }
>         }
>         catch (ClassNotFoundException e)
>         {
>             ...fail
>         }
>     }
> }
> 
> 
> 


-----------------------------------------------------------------------------
Baltimore Technologies plc will not be liable for direct,  special,  indirect 
or consequential  damages  arising  from  alteration of  the contents of this
message by a third party or as a result of any virus being passed on.

In addition, certain Marketing collateral may be added from time to time to
promote Baltimore Technologies products, services, Global e-Security or
appearance at trade shows and conferences.

This footnote confirms that this email message has been swept by
Baltimore MIMEsweeper for Content Security threats, including
computer viruses.
   http://www.baltimore.com
Received on Thursday, 2 August 2001 11:28:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:35 GMT