public class RestOperationConnection extends RestConnection<OperationContext>
DEFAULT_CONNECT_TIMEOUT, DEFAULT_READ_TIMEOUT
Constructor and Description |
---|
RestOperationConnection(OperationContext context) |
Modifier and Type | Method and Description |
---|---|
protected void |
addCookiesToStore(org.apache.http.impl.client.BasicCookieStore cookieStore) |
protected org.apache.http.client.config.RequestConfig |
buildRequestConfig(AuthenticationType authType)
Method to populate the RequestConfig to be used in the HttpContext at the time of the request.
|
protected void |
configureCookieScope(org.apache.http.impl.client.HttpClientBuilder builder)
Enables or disables cookie management of the given
HttpClientBuilder instance based on the value of "Cookie Scope" connection
property. |
protected boolean |
doPreemptiveAuthentication(AuthenticationType type)
Returns true / false based off of the
AuthenticationType if we want to pre-emptively send
authentication information to a service. |
protected org.apache.http.auth.Credentials |
getAuthenticationCredentials(AuthenticationType authenticationType)
Creates the authentication credentials for the request based off of
AuthenticationType and
connection property values. |
protected org.apache.http.config.Lookup<org.apache.http.auth.AuthSchemeProvider> |
getAuthSchemeProviders()
Creates a Default Lookup for Authentication Scheme Providers.
|
RestClient |
getClient()
Creates a RestClient for operation execution
|
org.apache.http.entity.ContentType |
getEntityContentType()
Returns the expected content type for outbound request data.
|
org.apache.http.impl.client.CloseableHttpClient |
getHttpClient()
Returns an instance of
CloseableHttpClient using HttpClientBuilder for operation execution. |
org.apache.http.protocol.HttpContext |
getHttpContext()
Creates a HttpContext, if the target
AuthenticationType needs credentials, then a credentials provider
will be setup for this context. |
protected org.apache.http.client.RedirectStrategy |
getRedirectStrategy()
Returns
RedirectStrategy based on the chosen Follow Redirects operation field. |
protected org.apache.http.client.HttpRequestRetryHandler |
getRetryHandler()
Returns a
HttpRequestRetryHandler for the getHttpClient() |
protected boolean |
useSystemProperties()
Always returns true for Rest Connector to enable using system properties by default.
|
getAPIAuthenticationType, getAuthenticationType, getAWSAccessKey, getAWSRegion, getAWSSecretKey, getAWSService, getConnectionProperty, getConnectTimeout, getCookieScope, getCustomAuthCredentials, getDomain, getHttpMethod, getOAuthContext, getPassword, getPreemptive, getPrivateKeyStore, getPublicKeyStore, getReadTimeout, getUrl, getUsername, getWorkstation, isConnectionPoolingEnabled
generateConnectionInfo, generateConnectionInfo, getConnector, getContext, getOperationContext
public RestOperationConnection(OperationContext context)
public RestClient getClient()
public org.apache.http.impl.client.CloseableHttpClient getHttpClient()
CloseableHttpClient
using HttpClientBuilder
for operation execution.
This will configure proxy based off of AtomProxyConfig
, account/ connection certificates,
redirects based off of getRedirectStrategy()
}, cookie scope based off of RestConnection.getCookieScope()
and
authentication based registry.CloseableHttpClient
protected org.apache.http.config.Lookup<org.apache.http.auth.AuthSchemeProvider> getAuthSchemeProviders()
protected org.apache.http.client.RedirectStrategy getRedirectStrategy()
RedirectStrategy
based on the chosen Follow Redirects operation field.
If none or null redirect is specified on the operation, then the RedirectStrategy
is null.
if "LAX" is chosen on the operation, then LaxRedirectStrategy
will be used.
If "STRICT" is chosen on the operation, then the default apache client DefaultRedirectStrategy
is used.protected void configureCookieScope(org.apache.http.impl.client.HttpClientBuilder builder) throws IllegalArgumentException
HttpClientBuilder
instance based on the value of "Cookie Scope" connection
property. Global cookie store is used when the "Cookie Scope" connection property is set to GLOBAL. In this case, cookies are shared
across all the processes. Http Client's default cookie store is used and cookies are isolated to respective connector execution when
the "Cookie Scope" connection property is null or missing or set to CONNECTOR_SHAPE. Cookies are disabled when the "Cookie Scope"
connection property is set to IGNORED.IllegalArgumentException
- if the Cookie Scope property is set with an invalid value.protected void addCookiesToStore(org.apache.http.impl.client.BasicCookieStore cookieStore)
public org.apache.http.protocol.HttpContext getHttpContext()
AuthenticationType
needs credentials, then a credentials provider
will be setup for this context. In addition, only the selected AuthenticationType
scheme
will be available during authentication negotiation. If the AuthenticationType
allows pre-emptively
sending the credentials, then an AuthCache will be created for the context.protected boolean doPreemptiveAuthentication(AuthenticationType type)
AuthenticationType
if we want to pre-emptively send
authentication information to a service. BASIC and OAUTH2 is user defined, where as AWS and CUSTOM will always
pre-emptively send authentication info. DIGEST will always be false, since it will need service side authentication
information before providing the credentials.type
- protected org.apache.http.auth.Credentials getAuthenticationCredentials(AuthenticationType authenticationType)
AuthenticationType
and
connection property values.public org.apache.http.entity.ContentType getEntityContentType()
protected org.apache.http.client.HttpRequestRetryHandler getRetryHandler()
HttpRequestRetryHandler
for the getHttpClient()
protected boolean useSystemProperties()
HttpClientBuilder
class.protected org.apache.http.client.config.RequestConfig buildRequestConfig(AuthenticationType authType)
authType
- The authenticationType that is used for the request