hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrš Petr (EXT) <PAn...@CSAS.CZ>
Subject RE: Httpclient under weblogic 7.0
Date Wed, 30 Mar 2005 10:59:34 GMT
Hi Roland,

thanks for good advice with wrapper, I will do it that way. One question about buffer size.
What problems can occur when I use larger buffer in Buffered stream than is size of buffer
in undelying socket?

Thanks,
Petr

> -----Original Message-----
> From: Roland Weber [mailto:ROLWEBER@de.ibm.com]
> Sent: Wednesday, March 30, 2005 9:53 AM
> To: HttpClient Project
> Subject: Re: Httpclient under weblogic 7.0
> 
> 
> Hello Petr,
> 
> this looks to me like the JSSE implements only part of the
> socket methods. The problem originates from the fact that
> java.net.Socket is a class rather than an interface. A class
> that implements SSL sockets has to be derived from the
> plain Socket class, and needs to override all methods that
> will actually be used. Your JSSE implementation returns
> a socket implementation that does override, among others,
> Socket.getInputStream and Socket.getOutputStream, but
> obviously not Socket.getSendBufferSize. When HttpClient
> calls that method, the code in the base class java.net.Socket
> gets executed. That code reports that the socket is not open,
> because the base class method has never been asked to
> open a socket, due to the overrides.
> The best solution I can think of is to modify your factory
> for SSL sockets. Instead of returning the SSL socket
> directly, create another wrapper for it. The wrapper has
> to forward the method invocations supported by the SSL
> socket there, and can implement workarounds for other
> methods - in this case getSendBufferSize. You should
> experiment a little to determine the actual buffer size
> used for sending, it's probably rather 2K or 4K than just
> 1 byte. Here is a code outline to get you started:
> 
> class MySocketWrapper extends java.net.Socket
> {
>   private Socket wrapped_socket;
>   MySocketWrapper(Socket ws) { wrapped_socket = ws; }
>   InputStream getInputStream() { return 
> wrapped_socket.getInputStream(); }
>   OutputStream getOutputStream() { return 
> wrapped_socket.getOutputStream(); } 
>   // lots more of the invocation forwarding stuff
>   // and here are the workarounds
>   int getSendBufferSize() { return 4096; } // or whatever fits
>   // more, if necessary
> }
> 
> hope that helps,
>   Roland
> 
Mime
View raw message