org.apache.jena.riot.web
Class HttpOp

java.lang.Object
  extended by org.apache.jena.riot.web.HttpOp

public class HttpOp
extends Object

Simplified HTTP operations; simplification means only supporting certain uses of HTTP. The expectation is that the simplified operations in this class can be used by other code to generate more application specific HTTP interactions (e.g. SPARQL queries). For more complicated requirements of HTTP, then the application wil need to use org.apache.http.client directly.

For HTTP GET, the application supplies a URL, the accept header string, and a list of handlers to deal with different content type responses.

For HTTP POST, the application supplies a URL, content, the accept header string, and a list of handlers to deal with different content type responses, or no response is expected.

For HTTP PUT, the application supplies a URL, content, the accept header string

See Also:
HttpNames, for HTTP related constants, WebContent, for content type name constants

Nested Class Summary
static class HttpOp.CaptureInput
          TypedInputStream from an HTTP response.
static class HttpOp.CaptureString
          Capture response as a string (UTF-8 assumed)
 
Field Summary
static String ARQ_USER_AGENT
          Constant for the default User-Agent header that ARQ will use
 
Constructor Summary
HttpOp()
           
 
Method Summary
static void applyAuthentication(org.apache.http.impl.client.AbstractHttpClient client, String target, org.apache.http.protocol.HttpContext context, HttpAuthenticator authenticator)
          Applies authentication to the given client as appropriate
static void applyUserAgent(org.apache.http.HttpMessage message)
          Applies the configured User-Agent string to the HTTP request
static org.apache.http.client.HttpClient createCachingHttpClient()
          Create an HttpClient that performs connection pooling.
static void execHttpDelete(String url)
          Executes a HTTP DELETE operation
static void execHttpDelete(String url, HttpResponseHandler handler)
          Executes a HTTP DELETE operation
static void execHttpDelete(String url, HttpResponseHandler handler, org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext, HttpAuthenticator authenticator)
          Executes a HTTP DELETE operation
static TypedInputStream execHttpGet(String url)
          Executes a HTTP GET and return a TypedInputStream.
static TypedInputStream execHttpGet(String url, String acceptHeader)
          Executes a HTTP GET and return a TypedInputStream.
static TypedInputStream execHttpGet(String url, String acceptHeader, org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext, HttpAuthenticator authenticator)
          Executes a HTTP GET and returns a TypedInputStream
static void execHttpGet(String url, String acceptHeader, HttpResponseHandler handler)
          Executes a HTTP Get request, handling the response with given handler.
static void execHttpGet(String url, String acceptHeader, HttpResponseHandler handler, HttpAuthenticator authenticator)
          Executes a HTTP Get request handling the response with the given handler.
static void execHttpGet(String url, String acceptHeader, HttpResponseHandler handler, org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext, HttpAuthenticator authenticator)
          Executes a HTTP Get request handling the response with one of the given handlers
static String execHttpGetString(String url)
          Convenience operation to execute a GET with no content negtotiation and return the response as a string.
static String execHttpGetString(String url, String acceptHeader)
          Convenience operation to execute a GET and return the response as a string
static void execHttpHead(String url)
          Executes a HTTP HEAD operation
static void execHttpHead(String url, String acceptString, HttpResponseHandler handler)
          Executes a HTTP HEAD operation
static void execHttpHead(String url, String acceptString, HttpResponseHandler handler, org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext, HttpAuthenticator authenticator)
          Executes a HTTP HEAD operation
static void execHttpPost(String url, org.apache.http.HttpEntity entity)
          Executes a HTTP POST of the given entity
static void execHttpPost(String url, org.apache.http.HttpEntity entity, org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext, HttpAuthenticator authenticator)
          POST with response body.
static void execHttpPost(String url, org.apache.http.HttpEntity entity, String acceptString, HttpResponseHandler handler)
          Executes a HTTP Post
static void execHttpPost(String url, org.apache.http.HttpEntity entity, String acceptHeader, HttpResponseHandler handler, org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext, HttpAuthenticator authenticator)
          POST with response body.
static void execHttpPost(String url, String contentType, InputStream input, long length)
          Executes a HTTP POST with a request body from an input stream without response body with no response handling
static void execHttpPost(String url, String contentType, InputStream input, long length, String acceptType, HttpResponseHandler handler)
          Executes a HTTP POST with request body from an input stream and response handling.
static void execHttpPost(String url, String contentType, InputStream input, long length, String acceptType, HttpResponseHandler handler, org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext, HttpAuthenticator authenticator)
          Executes a HTTP POST with request body from an input stream and response handling.
static void execHttpPost(String url, String contentType, String content)
          Executes a HTTP POST with the given contentype/string as the request body and throws away success responses, failure responses will throw an error.
static void execHttpPost(String url, String contentType, String content, org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext, HttpAuthenticator authenticator)
          Executes a HTTP POST with a string as the request body and response handling
static void execHttpPost(String url, String contentType, String content, String acceptType, HttpResponseHandler handler, org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext, HttpAuthenticator authenticator)
          Executes a HTTP POST with a string as the request body and response handling
static void execHttpPostForm(String url, Params params)
          Executes a HTTP POST.
static void execHttpPostForm(String url, Params params, String acceptString, HttpResponseHandler handler)
          Executes a HTTP POST form operation
static void execHttpPostForm(String url, Params params, String acceptHeader, HttpResponseHandler handler, org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext, HttpAuthenticator authenticator)
          Executes a HTTP POST form operation
static TypedInputStream execHttpPostFormStream(String url, Params params, String acceptHeader)
          Executes a HTTP POST and returns a TypedInputStream, The TypedInputStream must be closed.
static TypedInputStream execHttpPostFormStream(String url, Params params, String acceptHeader, org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext, HttpAuthenticator authenticator)
          Executes a HTTP POST Form and returns a TypedInputStream
static void execHttpPut(String url, org.apache.http.HttpEntity entity)
          Executes a HTTP PUT operation
static void execHttpPut(String url, org.apache.http.HttpEntity entity, org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext, HttpAuthenticator authenticator)
          Executes a HTTP PUT operation
static void execHttpPut(String url, String contentType, InputStream input, long length)
          Executes a HTTP PUT operation
static void execHttpPut(String url, String contentType, InputStream input, long length, org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext, HttpAuthenticator authenticator)
          Executes a HTTP PUT operation
static void execHttpPut(String url, String contentType, String content)
          Executes a HTTP PUT operation
static void execHttpPut(String url, String contentType, String content, org.apache.http.client.HttpClient httpClient, org.apache.http.protocol.HttpContext httpContext, HttpAuthenticator authenticator)
          Executes a HTTP PUT operation
static HttpAuthenticator getDefaultAuthenticator()
          Gets the default authenticator used for authenticate requests if no specific authenticator is provided.
static org.apache.http.client.HttpClient getDefaultHttpClient()
          Return the current default HttpClient.
static boolean getUseDefaultClientWithAuthentication()
          Gets whether the configured default HttpClient will be used in conjunction with authentication.
static String getUserAgent()
          Gets the User-Agent string that ARQ is applying to all HTTP requests
static void setDefaultAuthenticator(HttpAuthenticator authenticator)
          Sets the default authenticator used for authenticate requests if no specific authenticator is provided.
static void setDefaultHttpClient(org.apache.http.client.HttpClient httpClient)
           Performance can be improved by using a shared HttpClient that uses connection pooling.
static void setUseDefaultClientWithAuthentication(boolean useWithAuth)
          Sets whether the configured default HttpClient will be used in conjunction with authentication.
static void setUserAgent(String userAgent)
          Sets the User-Agent string that ARQ will apply to all HTTP requests
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARQ_USER_AGENT

public static final String ARQ_USER_AGENT
Constant for the default User-Agent header that ARQ will use

Constructor Detail

HttpOp

public HttpOp()
Method Detail

getDefaultAuthenticator

public static HttpAuthenticator getDefaultAuthenticator()
Gets the default authenticator used for authenticate requests if no specific authenticator is provided.

Returns:
HTTP authenticator

setDefaultAuthenticator

public static void setDefaultAuthenticator(HttpAuthenticator authenticator)
Sets the default authenticator used for authenticate requests if no specific authenticator is provided. May be set to null to turn off default authentication, when set to null users must manually configure authentication.

Parameters:
authenticator - Authenticator

getDefaultHttpClient

public static org.apache.http.client.HttpClient getDefaultHttpClient()
Return the current default HttpClient. This may be null, meaning a new HttpClient is created each time, if none is provided in the HttpOp function call.

Returns:
Default HTTP Client

setDefaultHttpClient

public static void setDefaultHttpClient(org.apache.http.client.HttpClient httpClient)

Performance can be improved by using a shared HttpClient that uses connection pooling. However, pool management is complicated and can lead to starvation (the system locks-up, especially on Java6; it's JVM sensitive).

The default HttpClient is not used if an HttpAuthenticator is provided since this can potentially leak authentication credentials to be leaked between requests to different services. However in some cases it may be valuable to share the client regardless in which case you can also set the

Set to "null" to create a new HttpClient for each call (default behaviour, more reliable, but slower when many HTTP operation are attempted).

See the Apache Http Client documentation for more details.

Parameters:
httpClient - HTTP Client

getUseDefaultClientWithAuthentication

public static boolean getUseDefaultClientWithAuthentication()
Gets whether the configured default HttpClient will be used in conjunction with authentication.

This defaults to false because this can potentially leak authentication credentials between requests to different services. However in some cases it may be valuable to share the client regardless e.g. when you have a specially configured HttpClient for your environment.

Returns:
True if the configured default client will be used with authentication, false otherwise

setUseDefaultClientWithAuthentication

public static void setUseDefaultClientWithAuthentication(boolean useWithAuth)
Sets whether the configured default HttpClient will be used in conjunction with authentication.

This defaults to false because this can potentially leak authentication credentials between requests to different services. However in some cases it may be valuable to share the client regardless e.g. when you have a specially configured HttpClient for your environment.

Parameters:
useWithAuth - True if the configured default client should be used with authentication, false if it should not

createCachingHttpClient

public static org.apache.http.client.HttpClient createCachingHttpClient()
Create an HttpClient that performs connection pooling. This can be used with setDefaultHttpClient(org.apache.http.client.HttpClient) or provided in the HttpOp calls.


getUserAgent

public static String getUserAgent()
Gets the User-Agent string that ARQ is applying to all HTTP requests

Returns:
User-Agent string

setUserAgent

public static void setUserAgent(String userAgent)
Sets the User-Agent string that ARQ will apply to all HTTP requests

Parameters:
userAgent - User-Agent string

execHttpGet

public static void execHttpGet(String url,
                               String acceptHeader,
                               HttpResponseHandler handler)
Executes a HTTP Get request, handling the response with given handler.

HTTP responses 400 and 500 become exceptions.

Parameters:
url - URL
acceptHeader - Accept Header
handler - Response Handler

execHttpGet

public static void execHttpGet(String url,
                               String acceptHeader,
                               HttpResponseHandler handler,
                               HttpAuthenticator authenticator)
Executes a HTTP Get request handling the response with the given handler.

HTTP responses 400 and 500 become exceptions.

Parameters:
url - URL
acceptHeader - Accept Header
handler - Response Handler
authenticator - HTTP Authenticator

execHttpGet

public static void execHttpGet(String url,
                               String acceptHeader,
                               HttpResponseHandler handler,
                               org.apache.http.client.HttpClient httpClient,
                               org.apache.http.protocol.HttpContext httpContext,
                               HttpAuthenticator authenticator)
Executes a HTTP Get request handling the response with one of the given handlers

The acceptHeader string is any legal value for HTTP Accept: field.

The handlers are the set of content types (without charset), used to dispatch the response body for handling.

HTTP responses 400 and 500 become exceptions.

Parameters:
url - URL
acceptHeader - Accept Header
handler - Response handler called to process the response
httpClient - HTTP Client
httpContext - HTTP Context
authenticator - HTTP Authenticator

execHttpGet

public static TypedInputStream execHttpGet(String url)
Executes a HTTP GET and return a TypedInputStream. The stream must be closed after use.

The acceptHeader string is any legal value for HTTP Accept: field.

Parameters:
url - URL
Returns:
TypedInputStream

execHttpGet

public static TypedInputStream execHttpGet(String url,
                                           String acceptHeader)
Executes a HTTP GET and return a TypedInputStream. The stream must be closed after use.

The acceptHeader string is any legal value for HTTP Accept: field.

Parameters:
url - URL
acceptHeader - Accept Header
Returns:
TypedInputStream or null if the URL returns 404.

execHttpGet

public static TypedInputStream execHttpGet(String url,
                                           String acceptHeader,
                                           org.apache.http.client.HttpClient httpClient,
                                           org.apache.http.protocol.HttpContext httpContext,
                                           HttpAuthenticator authenticator)
Executes a HTTP GET and returns a TypedInputStream

A 404 will result in a null stream being returned, any other error code results in an exception.

Parameters:
url - URL
acceptHeader - Accept Header
httpClient - HTTP Client
httpContext - HTTP Context
authenticator - HTTP Authenticator
Returns:
TypedInputStream or null if the URL returns 404.

execHttpGetString

public static String execHttpGetString(String url)
Convenience operation to execute a GET with no content negtotiation and return the response as a string.

Parameters:
url - URL
Returns:
Response as a string

execHttpGetString

public static String execHttpGetString(String url,
                                       String acceptHeader)
Convenience operation to execute a GET and return the response as a string

Parameters:
url - URL
acceptHeader - Accept header.
Returns:
Response as a string

execHttpPost

public static void execHttpPost(String url,
                                String contentType,
                                String content)
Executes a HTTP POST with the given contentype/string as the request body and throws away success responses, failure responses will throw an error.

Parameters:
url - URL
contentType - Content Type to POST
content - Content to POST

execHttpPost

public static void execHttpPost(String url,
                                String contentType,
                                String content,
                                org.apache.http.client.HttpClient httpClient,
                                org.apache.http.protocol.HttpContext httpContext,
                                HttpAuthenticator authenticator)
Executes a HTTP POST with a string as the request body and response handling

Parameters:
url - URL
contentType - Content Type to POST
content - Content to POST
httpClient - HTTP Client
httpContext - HTTP Context
authenticator - HTTP Authenticator

execHttpPost

public static void execHttpPost(String url,
                                String contentType,
                                String content,
                                String acceptType,
                                HttpResponseHandler handler,
                                org.apache.http.client.HttpClient httpClient,
                                org.apache.http.protocol.HttpContext httpContext,
                                HttpAuthenticator authenticator)
Executes a HTTP POST with a string as the request body and response handling

Parameters:
url - URL
contentType - Content Type to POST
content - Content to POST
acceptType - Accept Type
handler - Response handler called to process the response
httpClient - HTTP Client
httpContext - HTTP Context
authenticator - HTTP Authenticator

execHttpPost

public static void execHttpPost(String url,
                                String contentType,
                                InputStream input,
                                long length)
Executes a HTTP POST with a request body from an input stream without response body with no response handling

Parameters:
url - URL
contentType - Content Type to POST
input - Input Stream to POST from
length - Amount of content to POST

execHttpPost

public static void execHttpPost(String url,
                                String contentType,
                                InputStream input,
                                long length,
                                String acceptType,
                                HttpResponseHandler handler)
Executes a HTTP POST with request body from an input stream and response handling.

The input stream is assumed to be UTF-8.

Parameters:
url - URL
contentType - Content Type to POST
input - Input Stream to POST content from
length - Length of content to POST
acceptType - Accept Type
handler - Response handler called to process the response

execHttpPost

public static void execHttpPost(String url,
                                String contentType,
                                InputStream input,
                                long length,
                                String acceptType,
                                HttpResponseHandler handler,
                                org.apache.http.client.HttpClient httpClient,
                                org.apache.http.protocol.HttpContext httpContext,
                                HttpAuthenticator authenticator)
Executes a HTTP POST with request body from an input stream and response handling.

The input stream is assumed to be UTF-8.

Parameters:
url - URL
contentType - Content Type to POST
input - Input Stream to POST content from
length - Length of content to POST
acceptType - Accept Type
handler - Response handler called to process the response
httpClient - HTTP Client
httpContext - HTTP Context
authenticator - HTTP Authenticator

execHttpPost

public static void execHttpPost(String url,
                                org.apache.http.HttpEntity entity)
Executes a HTTP POST of the given entity

Parameters:
url - URL
entity - Entity to POST

execHttpPost

public static void execHttpPost(String url,
                                org.apache.http.HttpEntity entity,
                                String acceptString,
                                HttpResponseHandler handler)
Executes a HTTP Post

Parameters:
url - URL
entity - Entity to POST
acceptString - Accept Header
handler - Response Handler

execHttpPost

public static void execHttpPost(String url,
                                org.apache.http.HttpEntity entity,
                                org.apache.http.client.HttpClient httpClient,
                                org.apache.http.protocol.HttpContext httpContext,
                                HttpAuthenticator authenticator)
POST with response body.

The content for the POST body comes from the HttpEntity.

Additional headers e.g. for authentication can be injected through an HttpContext

Parameters:
url - URL
entity - Entity to POST
httpClient - HTTP Client
httpContext - HTTP Context
authenticator - HTTP Authenticator

execHttpPost

public static void execHttpPost(String url,
                                org.apache.http.HttpEntity entity,
                                String acceptHeader,
                                HttpResponseHandler handler,
                                org.apache.http.client.HttpClient httpClient,
                                org.apache.http.protocol.HttpContext httpContext,
                                HttpAuthenticator authenticator)
POST with response body.

The content for the POST body comes from the HttpEntity.

Additional headers e.g. for authentication can be injected through an HttpContext

Parameters:
url - URL
entity - Entity to POST
acceptHeader - Accept Header
handler - Response handler called to process the response
httpClient - HTTP Client
httpContext - HTTP Context
authenticator - HTTP Authenticator

execHttpPostFormStream

public static TypedInputStream execHttpPostFormStream(String url,
                                                      Params params,
                                                      String acceptHeader)
Executes a HTTP POST and returns a TypedInputStream, The TypedInputStream must be closed.

Parameters:
url - URL
params - Parameters to POST
acceptHeader -

execHttpPostForm

public static void execHttpPostForm(String url,
                                    Params params)
Executes a HTTP POST.

Parameters:
url - URL
params - Parameters to POST

execHttpPostFormStream

public static TypedInputStream execHttpPostFormStream(String url,
                                                      Params params,
                                                      String acceptHeader,
                                                      org.apache.http.client.HttpClient httpClient,
                                                      org.apache.http.protocol.HttpContext httpContext,
                                                      HttpAuthenticator authenticator)
Executes a HTTP POST Form and returns a TypedInputStream

The acceptHeader string is any legal value for HTTP Accept: field.

A 404 will result in a null stream being returned, any other error code results in an exception.

Parameters:
url - URL
acceptHeader - Accept Header
params - Parameters to POST
httpClient - HTTP Client
httpContext - HTTP Context
authenticator - HTTP Authenticator

execHttpPostForm

public static void execHttpPostForm(String url,
                                    Params params,
                                    String acceptString,
                                    HttpResponseHandler handler)
Executes a HTTP POST form operation

Parameters:
url - URL
params - Form parameters to POST
acceptString - Accept Header
handler - Response handler called to process the response

execHttpPostForm

public static void execHttpPostForm(String url,
                                    Params params,
                                    String acceptHeader,
                                    HttpResponseHandler handler,
                                    org.apache.http.client.HttpClient httpClient,
                                    org.apache.http.protocol.HttpContext httpContext,
                                    HttpAuthenticator authenticator)
Executes a HTTP POST form operation

Parameters:
url - URL
params - Form parameters to POST
acceptHeader - Accept Header
handler - Response handler called to process the response
httpClient - HTTP Client
httpContext - HTTP Context
authenticator - HTTP Authenticator

execHttpPut

public static void execHttpPut(String url,
                               String contentType,
                               String content)
Executes a HTTP PUT operation

Parameters:
url - URL
contentType - Content Type for the PUT
content - Content for the PUT

execHttpPut

public static void execHttpPut(String url,
                               String contentType,
                               String content,
                               org.apache.http.client.HttpClient httpClient,
                               org.apache.http.protocol.HttpContext httpContext,
                               HttpAuthenticator authenticator)
Executes a HTTP PUT operation

Parameters:
url - URL
contentType - Content Type for the PUT
content - Content for the PUT
httpClient - HTTP Client
httpContext - HTTP Context
authenticator - HTTP Authenticator

execHttpPut

public static void execHttpPut(String url,
                               String contentType,
                               InputStream input,
                               long length)
Executes a HTTP PUT operation

Parameters:
url - URL
contentType - Content Type for the PUT
input - Input Stream to read PUT content from
length - Amount of content to PUT

execHttpPut

public static void execHttpPut(String url,
                               String contentType,
                               InputStream input,
                               long length,
                               org.apache.http.client.HttpClient httpClient,
                               org.apache.http.protocol.HttpContext httpContext,
                               HttpAuthenticator authenticator)
Executes a HTTP PUT operation

Parameters:
url - URL
contentType - Content Type for the PUT
input - Input Stream to read PUT content from
length - Amount of content to PUT
httpClient - HTTP Client
httpContext - HTTP Context
authenticator - HTTP Authenticator

execHttpPut

public static void execHttpPut(String url,
                               org.apache.http.HttpEntity entity)
Executes a HTTP PUT operation

Parameters:
url - URL
entity - HTTP Entity to PUT

execHttpPut

public static void execHttpPut(String url,
                               org.apache.http.HttpEntity entity,
                               org.apache.http.client.HttpClient httpClient,
                               org.apache.http.protocol.HttpContext httpContext,
                               HttpAuthenticator authenticator)
Executes a HTTP PUT operation

Parameters:
url - URL
entity - HTTP Entity to PUT
httpClient - HTTP Client
httpContext - HTTP Context
authenticator - HTTP Authenticator

execHttpHead

public static void execHttpHead(String url)
Executes a HTTP HEAD operation

Parameters:
url - URL

execHttpHead

public static void execHttpHead(String url,
                                String acceptString,
                                HttpResponseHandler handler)
Executes a HTTP HEAD operation

Parameters:
url - URL
acceptString - Accept Header
handler - Response Handler

execHttpHead

public static void execHttpHead(String url,
                                String acceptString,
                                HttpResponseHandler handler,
                                org.apache.http.client.HttpClient httpClient,
                                org.apache.http.protocol.HttpContext httpContext,
                                HttpAuthenticator authenticator)
Executes a HTTP HEAD operation

Parameters:
url - URL
acceptString - Accept Header
handler - Response Handler
httpClient - HTTP Client
httpContext - HTTP Context
authenticator - HTTP Authenticator

execHttpDelete

public static void execHttpDelete(String url)
Executes a HTTP DELETE operation

Parameters:
url - URL

execHttpDelete

public static void execHttpDelete(String url,
                                  HttpResponseHandler handler)
Executes a HTTP DELETE operation

Parameters:
url - URL
handler - Response Handler

execHttpDelete

public static void execHttpDelete(String url,
                                  HttpResponseHandler handler,
                                  org.apache.http.client.HttpClient httpClient,
                                  org.apache.http.protocol.HttpContext httpContext,
                                  HttpAuthenticator authenticator)
Executes a HTTP DELETE operation

Parameters:
url - URL
handler - Response Handler
httpClient - HTTP Client
httpContext - HTTP Context
authenticator - HTTP Authenticator

applyUserAgent

public static void applyUserAgent(org.apache.http.HttpMessage message)
Applies the configured User-Agent string to the HTTP request

Parameters:
message - HTTP request

applyAuthentication

public static void applyAuthentication(org.apache.http.impl.client.AbstractHttpClient client,
                                       String target,
                                       org.apache.http.protocol.HttpContext context,
                                       HttpAuthenticator authenticator)
Applies authentication to the given client as appropriate

If a null authenticator is provided this method tries to use the registered default authenticator which may be set via the setDefaultAuthenticator(HttpAuthenticator) method.

Parameters:
client - HTTP Client
target - Target URI
context - HTTP Context
authenticator - HTTP Authenticator


Licenced under the Apache License, Version 2.0