This example shows you how to get the Http response header values in Java.
The HttpURLConnection‘s follow redirect is just an indicator, in fact it won’t help you to do the “real” http redirection, you still need to handle it manually.
This article shows you how to use Apache HttpClient to send HTTP GET/POST request.
In this article, we will show you two examples to make HTTP GET/POST request via following APIs
Eclipse IDE prompts warning on new DefaultHttpClient, mark this class as deprecated.
To view the request or response HTTP headers in Google Chrome, take the following steps :
This tutorial demonstrates how to use Apache HttpClient 4.5 to make a Http GET request. The Http GET method represents a representation of the specified resource. This could be as simple as getting an HTML page, or Getting resources formatted in JSON, XML or etc. Requests using HTTP GET Request methods should be Idempotent, meaning: these should only retrieve data and should have no other effects.
This tutorial demonstrates how to use Apache HttpClient 4.5 to make a Http POST request. The HTTP POST request method requests that the server accepts the entity enclosed in the request as a new subordinate of the web resource identified by the URI. The posted data can be, but is not limited to, an annotation for existing resources or data formatted JSON, XML or submitted FORM data. The server can use the posted data to update resources in the database, or process this data.
This tutorial demonstrates how to use Apache HttpClient 4.5 to make a Http PUT request. The HTTP PUT Request Method requests that the server accepts and stores the entity enclosed in the supplied URI. If the URI refers to an already existing resource, it is modified; if the URI does not point to an existing resource, then the server can create the resource with that URI.
This tutorial demonstrates how to use Apache HttpClient 4.5 to make a Http DELETE request. The HTTP DELETE Request Method requests deletes the resource specified by the URI.
The following tutorial demonstrates how to obtain the certificates from the resource server using Apache HttpClient 4.5. Certificates are used to secure the connection between the client and server over HTTPS using SSL/TLS. When you need details about the certificate, for example: when does the certificate expire?, who issued the certificate? or etc. You need to read the server certificate. In the following example we explain in detail how you can do this.
Typically, a developer will use self-signed certificates on his local machine or in development stage of the project. HttpClient (and web browsers) will not accept untrusted connections, by default. However, we can configure the HttpClient to allow untrusted self-signed certificates.
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 us to define a custom retry count mechanism and exception recovery mechanism. Take a look at the following tutorial.
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.
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 facilitate the process. The following tutorial shows how to send HTML Form parameters using apache HttpClient 4.5.