Class HTTPBuilder
- java.lang.Object
-
- groovyx.net.http.HTTPBuilder
-
- Direct Known Subclasses:
AsyncHTTPBuilder,RESTClient
public class HTTPBuilder extends java.lang.ObjectGroovy DSL for easily making HTTP requests, and handling request and response data. This class adds a number of convenience mechanisms built on top of Apache HTTPClient for things like URL-encoded POSTs and REST requests that require building and parsing JSON or XML. Convenient access to a few common authentication methods is also available.
Conventions
HTTPBuilder has properties for default headers, URI, contentType, etc. All of these values are also assignable (and in many cases, in much finer detail) from the
HTTPBuilder.RequestConfigDelegateas well. In any cases where the value is not set on the delegate (from within a request closure,) the builder's default value is used.For instance, any methods that do not take a
uriparameter assume you will set theuriproperty in the request closure or use HTTPBuilder's assigneddefault URI.Response Parsing
By default, HTTPBuilder uses
ContentType.ANYas the default content-type. This means the value of the request'sAcceptheader is*/*, and the response parser is determined based on the responsecontent-typeheader.If any contentType is given (either in
setContentType(Object)or as a request method parameter), the builder will attempt to parse the response using that content-type, regardless of what the server actually responds with.Examples:
Perform an HTTP GET and print the response:def http = new HTTPBuilder('http://www.google.com') http.get( path : '/search', contentType : TEXT, query : [q:'Groovy'] ) { resp, reader -> println "response status: ${resp.statusLine}" println 'Response data: -----' System.out << reader println '\n--------------------' }Long form for other HTTP methods, and response-code-specific handlers. This is roughly equivalent to the above example.def http = new HTTPBuilder('http://www.google.com/search?q=groovy') http.request( GET, TEXT ) { req -> // executed for all successful responses: response.success = { resp, reader -> println 'my response handler!' assert resp.statusLine.statusCode == 200 println resp.statusLine System.out << reader // print response stream } // executed only if the response status code is 401: response.'404' = { resp -> println 'not found!' } }You can also set a default response handler called for any status code > 399 that is not matched to a specific handler. Setting the value outside a request closure means it will apply to all future requests with this HTTPBuilder instance:http.handler.failure = { resp -> println "Unexpected failure: ${resp.statusLine}" }And... Automatic response parsing for registered content types!http.request( 'http://ajax.googleapis.com', GET, JSON ) { uri.path = '/ajax/services/search/web' uri.query = [ v:'1.0', q: 'Calvin and Hobbes' ] response.success = { resp, json -> assert json.size() == 3 println "Query response: " json.responseData.results.each { println " ${it.titleNoFormatting} : ${it.visibleUrl}" } } }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classHTTPBuilder.RequestConfigDelegateEncloses all properties and method calls used within therequest(Object, Method, Object, Closure)'config' closure argument.
-
Field Summary
Fields Modifier and Type Field Description protected AuthConfigauthprotected booleanautoAcceptHeaderprivate org.apache.http.client.HttpClientclientprotected ContentEncodingRegistrycontentEncodingHandlerprotected java.lang.ObjectdefaultContentTypeprotected java.lang.ObjectdefaultRequestContentTypeprotected java.util.Map<java.lang.Object,java.lang.Object>defaultRequestHeadersprotected java.util.Map<java.lang.Object,groovy.lang.Closure>defaultResponseHandlersprotected URIBuilderdefaultURIprotected EncoderRegistryencodersprotected org.apache.commons.logging.Loglogprotected ParserRegistryparsers
-
Constructor Summary
Constructors Constructor Description HTTPBuilder()Creates a new instance with anulldefault URI.HTTPBuilder(java.lang.Object defaultURI)Give a default URI to be used for all request methods that don't explicitly take a URI parameter.HTTPBuilder(java.lang.Object defaultURI, java.lang.Object defaultContentType)Give a default URI to be used for all request methods that don't explicitly take a URI parameter, and a default content-type to be used for request encoding and response parsing.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<java.lang.Object,groovy.lang.Closure>buildDefaultResponseHandlers()protected org.apache.http.client.HttpClientcreateClient(org.apache.http.params.HttpParams params)Override this method in a subclass to customize creation of the HttpClient instance.protected voiddefaultFailureHandler(HttpResponseDecorator resp)This is the defaultresponse.failurehandler.protected java.lang.ObjectdefaultSuccessHandler(HttpResponseDecorator resp, java.lang.Object parsedData)This is the defaultresponse.successhandler.protected java.lang.ObjectdoRequest(HTTPBuilder.RequestConfigDelegate delegate)Allrequestmethods delegate to this method.protected java.lang.ObjectdoRequest(java.net.URI uri, Method method, java.lang.Object contentType, groovy.lang.Closure configClosure)Create aHTTPBuilder.RequestConfigDelegatefrom the given arguments, execute the config closure, then pass the delegate todoRequest(RequestConfigDelegate), which actually executes the request.java.lang.Objectget(java.util.Map<java.lang.String,?> args)Convenience method to perform an HTTP GET.java.lang.Objectget(java.util.Map<java.lang.String,?> args, groovy.lang.Closure responseClosure)Convenience method to perform an HTTP GET.AuthConfiggetAuth()Used to access theAuthConfighandler used to configure common authentication mechanism.org.apache.http.client.HttpClientgetClient()Return the underlying HTTPClient that is used to handle HTTP requests.java.lang.ObjectgetContentType()EncoderRegistrygetEncoder()Retrieve the map of registered request content-type encoders.java.util.Map<?,groovy.lang.Closure>getHandler()Retrieve the map of response code handlers.java.util.Map<?,?>getHeaders()Get the map of default headers that will be added to all requests.ParserRegistrygetParser()Retrieve the map of registered response content-type parsers.java.lang.ObjectgetUri()Get the default URI used for requests that do not explicitly take auriparam.voidignoreSSLIssues()Ignores certificate issues for SSL connections.booleanisAutoAcceptHeader()Indicates whether or not this client should automatically send anAcceptheader based on thecontentTypeproperty.protected java.lang.ObjectparseResponse(org.apache.http.HttpResponse resp, java.lang.Object contentType)Parse the response data based on the given content-type.java.lang.Objectpost(java.util.Map<java.lang.String,?> args)Convenience method to perform an HTTP POST.java.lang.Objectpost(java.util.Map<java.lang.String,?> args, groovy.lang.Closure responseClosure)Convenience method to perform an HTTP form POST.java.lang.Objectrequest(Method method, groovy.lang.Closure configClosure)Make an HTTP request to the default URI, and parse using the default content-type.java.lang.Objectrequest(Method method, java.lang.Object contentType, groovy.lang.Closure configClosure)Make an HTTP request using the default URI, with the given method, content-type, and configuration.java.lang.Objectrequest(java.lang.Object uri, Method method, java.lang.Object contentType, groovy.lang.Closure configClosure)Make a request for the given HTTP method and content-type, with additional options configured in theconfigClosure.voidsetAuthConfig(AuthConfig ac)Set an alternativeAuthConfigimplementation to handle authorization.voidsetAutoAcceptHeader(boolean shouldSendAcceptHeader)Indicate whether or not this cliernt should send anAcceptheader automatically based on thecontentTypeproperty.voidsetClient(org.apache.http.client.HttpClient client)voidsetContentEncoding(java.lang.Object... encodings)Set acceptable request and response content-encodings.voidsetContentEncodingRegistry(ContentEncodingRegistry cer)Set a custom registry used to handle differentcontent-encodingtypes in responses.voidsetContentType(java.lang.Object ct)Set the default content type that will be used to select the appropriate request encoder and response parser.voidsetEncoderRegistry(EncoderRegistry er)Set a custom registry used to handle different requestcontent-types.voidsetHeaders(java.util.Map<?,?> headers)Set the default headers to add to all requests made by this builder instance.voidsetParserRegistry(ParserRegistry pr)Set a custom registry used to handle different responsecontent-typesvoidsetProxy(java.lang.String host, int port, java.lang.String scheme)Set the default HTTP proxy to be used for all requests.voidsetUri(java.lang.Object uri)Set the default URI used for requests that do not explicitly take auriparam.voidshutdown()Release any system resources held by this instance.
-
-
-
Field Detail
-
client
private org.apache.http.client.HttpClient client
-
defaultURI
protected URIBuilder defaultURI
-
auth
protected AuthConfig auth
-
log
protected final org.apache.commons.logging.Log log
-
defaultContentType
protected java.lang.Object defaultContentType
-
defaultRequestContentType
protected java.lang.Object defaultRequestContentType
-
autoAcceptHeader
protected boolean autoAcceptHeader
-
defaultResponseHandlers
protected final java.util.Map<java.lang.Object,groovy.lang.Closure> defaultResponseHandlers
-
contentEncodingHandler
protected ContentEncodingRegistry contentEncodingHandler
-
defaultRequestHeaders
protected final java.util.Map<java.lang.Object,java.lang.Object> defaultRequestHeaders
-
encoders
protected EncoderRegistry encoders
-
parsers
protected ParserRegistry parsers
-
-
Constructor Detail
-
HTTPBuilder
public HTTPBuilder()
Creates a new instance with anulldefault URI.
-
HTTPBuilder
public HTTPBuilder(java.lang.Object defaultURI) throws java.net.URISyntaxExceptionGive a default URI to be used for all request methods that don't explicitly take a URI parameter.- Parameters:
defaultURI- either aURL,URIor object whosetoString()produces a valid URI string. SeeURIBuilder.convertToURI(Object).- Throws:
java.net.URISyntaxException- if the given argument does not represent a valid URI
-
HTTPBuilder
public HTTPBuilder(java.lang.Object defaultURI, java.lang.Object defaultContentType) throws java.net.URISyntaxExceptionGive a default URI to be used for all request methods that don't explicitly take a URI parameter, and a default content-type to be used for request encoding and response parsing.- Parameters:
defaultURI- either aURL,URIor object whosetoString()produces a valid URI string. SeeURIBuilder.convertToURI(Object).defaultContentType- content-type string. SeeContentTypefor common types.- Throws:
java.net.URISyntaxException- if the uri argument does not represent a valid URI
-
-
Method Detail
-
get
public java.lang.Object get(java.util.Map<java.lang.String,?> args) throws org.apache.http.client.ClientProtocolException, java.io.IOException, java.net.URISyntaxExceptionConvenience method to perform an HTTP GET. It will use the HTTPBuilder's
registered response handlersto handle success or failure status codes. By default, thesuccessresponse handler will attempt to parse the data and simply return the parsed object.Note: If using the
default, be sure to read the caveat regarding streaming response data.successresponse handler- Parameters:
args- seeHTTPBuilder.RequestConfigDelegate.setPropertiesFromMap(Map)- Returns:
- whatever was returned from the response closure.
- Throws:
java.net.URISyntaxException- if a uri argument is given which does not represent a valid URIjava.io.IOExceptionorg.apache.http.client.ClientProtocolException- See Also:
getHandler(),defaultSuccessHandler(HttpResponseDecorator, Object),defaultFailureHandler(HttpResponseDecorator)
-
get
public java.lang.Object get(java.util.Map<java.lang.String,?> args, groovy.lang.Closure responseClosure) throws org.apache.http.client.ClientProtocolException, java.io.IOException, java.net.URISyntaxExceptionConvenience method to perform an HTTP GET. The response closure will be called only on a successful response.
A 'failed' response (i.e. any HTTP status code > 399) will be handled by the registered 'failure' handler. The
default failure handlerthrows anHttpResponseException.- Parameters:
args- seeHTTPBuilder.RequestConfigDelegate.setPropertiesFromMap(Map)responseClosure- code to handle a successful HTTP response- Returns:
- any value returned by the response closure.
- Throws:
org.apache.http.client.ClientProtocolExceptionjava.io.IOExceptionjava.net.URISyntaxException- if a uri argument is given which does not represent a valid URI
-
post
public java.lang.Object post(java.util.Map<java.lang.String,?> args) throws org.apache.http.client.ClientProtocolException, java.net.URISyntaxException, java.io.IOExceptionConvenience method to perform an HTTP POST. It will use the HTTPBuilder's
registered response handlersto handle success or failure status codes. By default, thesuccessresponse handler will attempt to parse the data and simply return the parsed object.Note: If using the
default, be sure to read the caveat regarding streaming response data.successresponse handler- Parameters:
args- seeHTTPBuilder.RequestConfigDelegate.setPropertiesFromMap(Map)- Returns:
- whatever was returned from the response closure.
- Throws:
java.io.IOExceptionjava.net.URISyntaxException- if a uri argument is given which does not represent a valid URIorg.apache.http.client.ClientProtocolException- See Also:
getHandler(),defaultSuccessHandler(HttpResponseDecorator, Object),defaultFailureHandler(HttpResponseDecorator)
-
post
public java.lang.Object post(java.util.Map<java.lang.String,?> args, groovy.lang.Closure responseClosure) throws java.net.URISyntaxException, org.apache.http.client.ClientProtocolException, java.io.IOExceptionConvenience method to perform an HTTP form POST. The response closure will be called only on a successful response.
A 'failed' response (i.e. any HTTP status code > 399) will be handled by the registered 'failure' handler. The
default failure handlerthrows anHttpResponseException.The request body (specified by a
bodynamed parameter) will be converted to a url-encoded form string unless a differentrequestContentTypenamed parameter is passed to this method. (SeeEncoderRegistry.encodeForm(Map).)- Parameters:
args- seeHTTPBuilder.RequestConfigDelegate.setPropertiesFromMap(Map)responseClosure- code to handle a successful HTTP response- Returns:
- any value returned by the response closure.
- Throws:
org.apache.http.client.ClientProtocolExceptionjava.io.IOExceptionjava.net.URISyntaxException- if a uri argument is given which does not represent a valid URI
-
request
public java.lang.Object request(Method method, groovy.lang.Closure configClosure) throws org.apache.http.client.ClientProtocolException, java.io.IOException
Make an HTTP request to the default URI, and parse using the default content-type.- Parameters:
method-HTTP methodconfigClosure- request configuration options- Returns:
- whatever value was returned by the executed response handler.
- Throws:
org.apache.http.client.ClientProtocolExceptionjava.io.IOException- See Also:
request(Object, Method, Object, Closure)
-
request
public java.lang.Object request(Method method, java.lang.Object contentType, groovy.lang.Closure configClosure) throws org.apache.http.client.ClientProtocolException, java.io.IOException
Make an HTTP request using the default URI, with the given method, content-type, and configuration.- Parameters:
method-HTTP methodcontentType- either aContentTypeor valid content-type string.configClosure- request configuration options- Returns:
- whatever value was returned by the executed response handler.
- Throws:
org.apache.http.client.ClientProtocolExceptionjava.io.IOException- See Also:
request(Object, Method, Object, Closure)
-
request
public java.lang.Object request(java.lang.Object uri, Method method, java.lang.Object contentType, groovy.lang.Closure configClosure) throws org.apache.http.client.ClientProtocolException, java.io.IOException, java.net.URISyntaxExceptionMake a request for the given HTTP method and content-type, with additional options configured in theconfigClosure. SeeHTTPBuilder.RequestConfigDelegatefor options.- Parameters:
uri- either aURL,URIor object whosetoString()produces a valid URI string. SeeURIBuilder.convertToURI(Object).method-HTTP methodcontentType- either aContentTypeor valid content-type string.configClosure- closure from which to configure options likeuri.path,request parameters,headers,request bodyandresponse handlers.- Returns:
- whatever value was returned by the executed response handler.
- Throws:
org.apache.http.client.ClientProtocolExceptionjava.io.IOExceptionjava.net.URISyntaxException- if the uri argument does not represent a valid URI
-
doRequest
protected java.lang.Object doRequest(java.net.URI uri, Method method, java.lang.Object contentType, groovy.lang.Closure configClosure) throws org.apache.http.client.ClientProtocolException, java.io.IOExceptionCreate aHTTPBuilder.RequestConfigDelegatefrom the given arguments, execute the config closure, then pass the delegate todoRequest(RequestConfigDelegate), which actually executes the request.- Throws:
org.apache.http.client.ClientProtocolExceptionjava.io.IOException
-
doRequest
protected java.lang.Object doRequest(HTTPBuilder.RequestConfigDelegate delegate) throws org.apache.http.client.ClientProtocolException, java.io.IOException
Allrequestmethods delegate to this method.- Throws:
org.apache.http.client.ClientProtocolExceptionjava.io.IOException
-
parseResponse
protected java.lang.Object parseResponse(org.apache.http.HttpResponse resp, java.lang.Object contentType) throws HttpResponseExceptionParse the response data based on the given content-type. If the given content-type isContentType.ANY, thecontent-typeheader from the response will be used to determine how to parse the response.- Parameters:
resp-contentType-- Returns:
- whatever was returned from the parser retrieved for the given
content-type, or
nullif no parser could be found for this content-type. The parser will also returnnullif the response does not contain any content (e.g. in response to a HEAD request). - Throws:
HttpResponseException- if there is a error parsing the response
-
buildDefaultResponseHandlers
protected java.util.Map<java.lang.Object,groovy.lang.Closure> buildDefaultResponseHandlers()
Creates default response handlers forsuccessandfailurestatus codes. This is used to populate the handler map when a new HTTPBuilder instance is created.- Returns:
- the default response handler map.
- See Also:
defaultSuccessHandler(HttpResponseDecorator, Object),defaultFailureHandler(HttpResponseDecorator)
-
defaultSuccessHandler
protected java.lang.Object defaultSuccessHandler(HttpResponseDecorator resp, java.lang.Object parsedData) throws ResponseParseException
This is the default
response.successhandler. It will be executed if the response is not handled by a status-code-specific handler (i.e.response.'200'= {..}) and no generic 'success' handler is given (i.e.response.success = {..}.) This handler simply returns the parsed data from the response body. In most cases you will probably want to define aresponse.success = {...}handler from the request closure, which will replace the response handler defined by this method.Note for parsers that return streaming content:
For responses parsed as
BINARYorTEXT, the parser will return streaming content -- anInputStreamorReader. In these cases, this handler will buffer the the response content before the network connection is closed.In practice, a user-supplied response handler closure is designed to handle streaming content so it can be read directly from the response stream without buffering, which will be much more efficient. Therefore, it is recommended that request method variants be used which explicitly accept a response handler closure in these cases.
- Parameters:
resp- HTTP responseparsedData- parsed data as resolved from this instance'sParserRegistry- Returns:
- the parsed data object (whatever the parser returns).
- Throws:
ResponseParseException- if there is an error buffering a streaming response.
-
defaultFailureHandler
protected void defaultFailureHandler(HttpResponseDecorator resp) throws HttpResponseException
This is the defaultresponse.failurehandler. It will be executed if no status-code-specific handler is set (i.e.response.'404'= {..}). This default handler will throw aHttpResponseExceptionwhen executed. In most cases you will want to define your ownresponse.failure = {...}handler from the request closure, if you don't want an exception to be thrown for 4xx and 5xx status responses.- Parameters:
resp-- Throws:
HttpResponseException
-
getHandler
public java.util.Map<?,groovy.lang.Closure> getHandler()
Retrieve the map of response code handlers. Each map key is a response code as a string (i.e. '401') or either 'success' or 'failure'. Use this to set default response handlers, e.g.builder.handler.'401' = { resp -> println "${resp.statusLine}" }- Returns:
- See Also:
Status
-
getParser
public ParserRegistry getParser()
Retrieve the map of registered response content-type parsers. Use this to set default response parsers, e.g.builder.parser.'text/javascript' = { resp -> return resp.entity.content // just returns an InputStream }- Returns:
-
getEncoder
public EncoderRegistry getEncoder()
Retrieve the map of registered request content-type encoders. Use this to customize a request encoder for specific content-types, e.g.builder.encoder.'text/javascript' = { body -> def json = body.call( new JsonGroovyBuilder() ) return new StringEntity( json.toString() ) }By default this map is populated by callingEncoderRegistry.buildDefaultEncoderMap(). This method is also used byHTTPBuilder.RequestConfigDelegateto retrieve the proper encoder for building the request content body.- Returns:
- a map of 'encoder' closures, keyed by content-type string.
-
setContentType
public void setContentType(java.lang.Object ct)
Set the default content type that will be used to select the appropriate request encoder and response parser. TheContentTypeenum holds some common content-types that may be used, i.e.import static ContentType.* builder.contentType = XML
Setting the default content-type does three things:- It tells the builder to encode any
request bodyas this content-type. CallingRequestConfigDelegate#setRequestContentType(String)can override this on a per-request basis. - Tells the builder to parse any response as this content-type,
regardless of any
content-typeheader that is sent in the response. - Sets the
Acceptheader to this content-type for all requests (seeContentType.getAcceptHeader()). Note that anyAcceptheader explicitly set either insetHeaders(Map)orHTTPBuilder.RequestConfigDelegate.setHeaders(Map)will override this value.
Additionally, if the content-type is set to
ContentType.ANY, HTTPBuilder will rely on thecontent-typeresponse header to determine how to parse the response data. This allows the user to rely on response headers if they are accurate, or ignore them and forcibly use a certain response parser if so desired.This value is a default and may always be overridden on a per-request basis by using the
builder.request( Method, ContentType, Closure )method or passing acontentTypenamed parameter.- Parameters:
ct- either aContentTypeor string value (i.e."text/xml".)- See Also:
EncoderRegistry,ParserRegistry
- It tells the builder to encode any
-
getContentType
public java.lang.Object getContentType()
- Returns:
- default content type used for request and response.
-
setAutoAcceptHeader
public void setAutoAcceptHeader(boolean shouldSendAcceptHeader)
Indicate whether or not this cliernt should send anAcceptheader automatically based on thecontentTypeproperty.- Parameters:
shouldSendAcceptHeader-trueif the client should automatically insert anAcceptheader, otherwisefalse.
-
isAutoAcceptHeader
public boolean isAutoAcceptHeader()
Indicates whether or not this client should automatically send anAcceptheader based on thecontentTypeproperty. Default istrue.- Returns:
trueif the client should automatically add anAcceptheader to the request; iffalse, no header is added.
-
setContentEncoding
public void setContentEncoding(java.lang.Object... encodings)
Set acceptable request and response content-encodings.- Parameters:
encodings- each Object should be either aContentEncoding.Typevalue, or acontent-encodingstring that is known by theContentEncodingRegistry- See Also:
ContentEncodingRegistry
-
setUri
public void setUri(java.lang.Object uri) throws java.net.URISyntaxExceptionSet the default URI used for requests that do not explicitly take auriparam.- Parameters:
uri- either aURL,URIor object whosetoString()produces a valid URI string. SeeURIBuilder.convertToURI(Object).- Throws:
java.net.URISyntaxException- if the uri argument does not represent a valid URI
-
getUri
public java.lang.Object getUri()
Get the default URI used for requests that do not explicitly take auriparam.- Returns:
- a
URIBuilderinstance. Note that the return type is Object simply so that it matches with its JavaBeansetUri(Object)counterpart.
-
setHeaders
public void setHeaders(java.util.Map<?,?> headers)
Set the default headers to add to all requests made by this builder instance. These values will replace any previously set default headers.- Parameters:
headers- map of header names & values.
-
getHeaders
public java.util.Map<?,?> getHeaders()
Get the map of default headers that will be added to all requests. This is a 'live' collection so it may be used to add or remove default values.- Returns:
- the map of default header names and values.
-
getClient
public org.apache.http.client.HttpClient getClient()
Return the underlying HTTPClient that is used to handle HTTP requests.- Returns:
- the client instance.
-
setClient
public void setClient(org.apache.http.client.HttpClient client)
-
createClient
protected org.apache.http.client.HttpClient createClient(org.apache.http.params.HttpParams params)
Override this method in a subclass to customize creation of the HttpClient instance.- Parameters:
params-- Returns:
-
getAuth
public AuthConfig getAuth()
Used to access theAuthConfighandler used to configure common authentication mechanism. Example:builder.auth.basic( 'myUser', 'somePassword' )
- Returns:
-
setAuthConfig
public void setAuthConfig(AuthConfig ac)
Set an alternativeAuthConfigimplementation to handle authorization.- Parameters:
ac- instance to use.
-
setEncoderRegistry
public void setEncoderRegistry(EncoderRegistry er)
Set a custom registry used to handle different requestcontent-types.- Parameters:
er-
-
setParserRegistry
public void setParserRegistry(ParserRegistry pr)
Set a custom registry used to handle different responsecontent-types- Parameters:
pr-
-
setContentEncodingRegistry
public void setContentEncodingRegistry(ContentEncodingRegistry cer)
Set a custom registry used to handle differentcontent-encodingtypes in responses.- Parameters:
cer-
-
setProxy
public void setProxy(java.lang.String host, int port, java.lang.String scheme)Set the default HTTP proxy to be used for all requests.- Parameters:
host- host name or IPport- port, or -1 for the default portscheme- usually "http" or "https," ornullfor the default- See Also:
HttpHost(String, int, String)
-
ignoreSSLIssues
public void ignoreSSLIssues() throws java.security.KeyManagementException, java.security.UnrecoverableKeyException, java.security.NoSuchAlgorithmException, java.security.KeyStoreExceptionIgnores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers.- Throws:
java.security.KeyStoreExceptionjava.security.NoSuchAlgorithmExceptionjava.security.UnrecoverableKeyExceptionjava.security.KeyManagementException
-
shutdown
public void shutdown()
Release any system resources held by this instance.- See Also:
ClientConnectionManager.shutdown()
-
-