Re: Chunked GZIP processing using Java Sockets



Sockets give me the control on handling network problems and server
responses the way I like it to. I need the total control - so for my
needs I know I cannot use JRE HTTPConnectionURL APIs.

So I guess I need to do this:

InputSptream is = new
unGZipstream(de-chunkstream(socket.getinputstream());

And then I need to find the chunkingstream code.

Also, how do I strip the headers before calling the above line? Just
advance the stream until the input stream is past the headers? I can
do readLine() perhaps 13/14 times to get the stream to point to the
dechnked/gzip data in the stream.

Thanks


tom fredriksen wrote:
aztechnology@xxxxxxxxx wrote:
Hi,

My java client program is reading web sites using low level sockets.
The response from the web site HTML is chunked and gzipped. I am aware
of the HTTPClient and JRE's HTTPUrlConnection APIs that can handle this
directly, however; I must use the low level socket due to the error
control that I need to implement is not available via HTTPClient/JRE.

Can anyone be kind enough to point me how to read http response that is
chunked and gzipped using java sockets? Are thre any classes that
provide the ability to coalesce the chunked stream and then deflate the
zipped contents?

Could you give a little more information as to why you need to use the
socket? It seems to me as bad design doing it that way, maybe I am wrong
though. Could you not have it as to separate tasks? Where the socket
operation handles any errors while the API handles all non error
situations, that way you would have automatic dechunking and gzipping,
while at the same time error control.

I am sorry if this sounds like a bad idea, but I dont have any info on
architecture so its difficult to say if there is a better way of doing
it. It just sound to me like what you have now is not good architecture:(

/tom

.



Relevant Pages

  • Java can do it ... why not .NET ?
    ... I have a C# control that I want to embed in IE which need to connect back to ... the host server using sockets to display a status image. ... Is there any way to make a socket connection that will work on a default ...
    (microsoft.public.dotnet.security)
  • Re: Web stuff
    ... > I thought sockets was not possible with the Plug-In? ... > We chose not to use the plug-in on a project a couple of years ago ... If you have control over that, ...
    (comp.lang.tcl)
  • Re: read()/write() versus recv()/send()
    ... > fxn@hashref.com (Xavier Noria) wrote: ... >>If you don't need that additional control, ... send/recv because read/write is *not* allowed for sockets on that OS. ...
    (comp.unix.programmer)
  • Re: How do I make a port to accept connections from locl ip only?
    ... I have the policies set to drop. ... sockets and will try it soon. ... > MySQL access controls (which are designed to control access based on which ...
    (comp.os.linux.security)
  • Re: Unix domain socket leak in 6-STABLE
    ... > In my case the sockets are closed only if I stop the samba processes. ... I write the following perl script: ... ale firefox-bi 1323 11 stream -> ...
    (freebsd-stable)