Checking GZIP Compression [Java Code]

ReqBin is the best online checking gzip compression tool. To test gzip compression for any resource, make a GET request to that resource. When gzip compression is enabled, response headers contain the Content-Encoding: gzip header and other headers. Validate returned strings with syntax highlighting and code validators. Click Send to execute the Check GZIP Compression request online and see the results. The Java code was automatically generated for the Check Gzip Compression example.
Checking GZIP Compression [Java Code] Send
GET /echo HTTP/1.1
Host: reqbin.com

Updated: Viewed: 17849 times
Java code for Check Gzip Compression example

Java code for Check Gzip Compression Example

This Java code snippet was generated automatically for the Check Gzip Compression example.
<< Back to the Check Gzip Compression example

What is Accept-Encoding?

The Accept-Encoding HTTP Request Header is an algorithm for comparing HTTP request headers. HTTP clients tell servers what encoding they support. In response, the server will respond in whichever encoding format is supported. The server uses content negotiation to select an offer and notifies the client with a Content-Encoding response header.

GZIP Compression Format Syntax

The following is an example of gzip compression in an HTTP response:

GZIP Compression Format Syntax
Content-Encoding: gzip

GZIP Compression Example

The following is an example GET request to the ReqBin echo URL:

Client Request Example
GET /echo HTTP/1.1
Host: reqbin.com

Server response to our GET request with Content-Encoding HTTP header:

Server Response Example
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Connection: keep-alive
...
Content-Encoding: gzip

See also

Generate code snippets for Java and other programming languages

Convert your Check Gzip Compression request to the PHP, JavaScript/AJAX, Node.js, Curl/Bash, Python, Java, C#/.NET code snippets using the Java code generator.