Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > HTTP Accept-Encoding

Reply
Thread Tools

HTTP Accept-Encoding

 
 
Roedy Green
Guest
Posts: n/a
 
      08-03-2008
When you are writing Java code to pretend to be a browser, doing HTTP
POSTs and GETs there are four possible Content-Encodings:

deflate: zlib format defined in RFC 1950 plus the deflate compression
mechanism described in RFC 1951.

gzip, alias x-gzip: Java-style gzip RFC 1952 Lempel-Ziv coding with a
32 bit CRC.

compress, alias x-compress, UNIX compress

identity means as-is, no compression. Use in the Content-Request
header, but not the Content-Encoding header. Just leave out the
Content-Encoding if it is identity.

The way I have handled it as ask for identity or gzip, see what comes
back and if necesary fire up GZIP.

So my questions:

1. Can Java be persuaded to do this deflating for you automatically or
semi-automatically.

2. does Java support deflate and compress?

3. what are the relative merits of the three compression schemes?

--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
 
 
 
Arne Vajh°j
Guest
Posts: n/a
 
      08-03-2008
Roedy Green wrote:
> When you are writing Java code to pretend to be a browser, doing HTTP
> POSTs and GETs there are four possible Content-Encodings:
>
> deflate: zlib format defined in RFC 1950 plus the deflate compression
> mechanism described in RFC 1951.
>
> gzip, alias x-gzip: Java-style gzip RFC 1952 Lempel-Ziv coding with a
> 32 bit CRC.
>
> compress, alias x-compress, UNIX compress
>
> identity means as-is, no compression. Use in the Content-Request
> header, but not the Content-Encoding header. Just leave out the
> Content-Encoding if it is identity.
>
> The way I have handled it as ask for identity or gzip, see what comes
> back and if necesary fire up GZIP.
>
> So my questions:
>
> 1. Can Java be persuaded to do this deflating for you automatically or
> semi-automatically.


Not (Http)URLConnection. I don't even think HttpClient does it.

> 2. does Java support deflate and compress?


Deflate is in java.util.zip !

Compress is not in standard Java, but I will guess you can
find an implementation somewhere.

Don't spend too much time on it. It is not used much in HTTP context.

> 3. what are the relative merits of the three compression schemes?


Deflate is the basic ZIP algorithm which is of the LZ77 family. It
is very widely used.

GZIP is the same algorithm, but with a header and a trailer.

Compress or LZC is an implementation of LZW which is of the LZ78
family.

Compress does not provide as good a compression as ZIP. The only
advantage it has is CPU and memory usage. Not relevant in Java SE
context on modern hardware.

Arne
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTTP SOAP/HTTP GET/HTTP POST milan_9211 Software 0 01-10-2011 02:10 PM
The Web server reported the following error when attempting to create or open the Web project located at the following URL: 'http://localhost/822319ev1'. 'HTTP/1.1 500 Internal Server Error'. chanmm ASP .Net 2 09-07-2010 07:37 AM
Split Tunnel Blocks http through tunnel but passes http around tunnel a.nonny mouse Cisco 2 09-19-2004 12:10 AM
Getting "HTTP Error 403 - Forbidden" at http://localhost/quickstart/ASPPlus/ Scott MCSD 1 08-04-2004 05:28 PM
HttpModule -- how to intercept urls like http://localhost/abc/def or http://localhost/abc/def/ where abc, def are non virtual dir Jiong Feng ASP .Net 0 11-19-2003 05:29 AM



Advertisments