Category: Apache
Java TAR example – compress and decompress *.tar or *.tar.gz files
This tutorial demonstrate how to compress files or directories recursively in .tar or .tar.gz format and how to decompress a .tar or .tar.gz file. Project Structure Let’s start by looking at the project structure....
Java 7z Seven Zip Example – compress and decompress a file
In this tutorial we demonstrate how to compress files to 7z format recursively and decompress 7z files. 7-Zip also known as 7z is a compressed archive file format that supports several different data compression,...
Java GZIP Example – compress and decompress a file using Java
In this tutorial we demonstrate how to use GZIP to compress and decompress a file. Gzip is a file format and a software application used for file compression and decompression. GZIP is used to...
Apache HttpClient 4.5 Multipart Upload Request Example
In this tutorial, we demonstrate how to do a multipart upload http request using Apache HttpClient 4.5. Maven dependencies We use maven to manage our dependencies and are using Apache HttpClient version 4.5. Add...
Apache HttpClient 4.5 Custom HTTP Headers Example
An HTTP message can contain a number of headers describing properties of the message such as content length, content type, authorization and so on. HttpClient provides methods to retrieve, add, remove and enumerate headers....
Apache HttpClient 4.5 Redirect Handling Requests Example
HttpClient handles all types of redirects automatically, except those explicitly prohibited by the HTTP specification as requiring user intervention. See Other (status code 303) redirects on POST and PUT requests are converted to GET...
Apache HttpClient 4.5 HTML FORM POST Example
Many applications need to simulate the process of submitting an HTML form, for instance, in order to log in to a web application or submit input data. HttpClient provides the entity class UrlEncodedFormEntity to...
Apache HttpClient Cache 4.5 Http Caching Example
HttpClient Cache provides an HTTP/1.1-compliant caching layer to be used with HttpClient–the Java equivalent of a browser cache. The following example uses the CacheConfig of the HttpClient Cache library. Maven dependencies We use maven...
Apache HttpClient 4.5 HttpRequestRetryHandler Example
In the following example we show how to create a custom HttpRequestRetryHandler in order to enable a custom exception recovery mechanism. When using this interface, we need to implement the retryRequest method. This allows...