Package de.galan.commons.net.flux
Class CommonHttpClient
- java.lang.Object
-
- de.galan.commons.net.flux.CommonHttpClient
-
- All Implemented Interfaces:
HttpClient
public class CommonHttpClient extends Object implements HttpClient
Provides a simple HTTP client for most use-cases, reusable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCommonHttpClient.TimeoutThreadSome sites may have timeouts, but the connection timeout does not seem to work reliably.
-
Constructor Summary
Constructors Constructor Description CommonHttpClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AuthenticatorcreateAuthenticator(HttpOptions options)protected voidputAuthorization(URLConnection connection, String header, String username, String password)protected Responserequest(Method method, Map<String,String> extraHeader, byte[] body, URL url, HttpOptions options)Responserequest(String resource)Responserequest(String resource, Method method, Map<String,String> extraHeader, Map<String,List<String>> parameters, byte[] body, HttpOptions options)Responserequest(String protocol, String host, Integer port, String path, Method method, Map<String,String> extraHeader, Map<String,List<String>> parameters, byte[] body)protected voidstartTimeoutThread(HttpURLConnection connection, HttpOptions options)
-
-
-
Method Detail
-
request
public Response request(String resource) throws HttpClientException
- Throws:
HttpClientException
-
request
public Response request(String protocol, String host, Integer port, String path, Method method, Map<String,String> extraHeader, Map<String,List<String>> parameters, byte[] body) throws HttpClientException
- Throws:
HttpClientException
-
request
public Response request(String resource, Method method, Map<String,String> extraHeader, Map<String,List<String>> parameters, byte[] body, HttpOptions options) throws HttpClientException
- Specified by:
requestin interfaceHttpClient- Throws:
HttpClientException
-
request
protected Response request(Method method, Map<String,String> extraHeader, byte[] body, URL url, HttpOptions options) throws HttpClientException
- Throws:
HttpClientException
-
createAuthenticator
protected Authenticator createAuthenticator(HttpOptions options)
-
putAuthorization
protected void putAuthorization(URLConnection connection, String header, String username, String password)
-
startTimeoutThread
protected void startTimeoutThread(HttpURLConnection connection, HttpOptions options)
-
-