Package com.boomi.common.rest
Class RestOperationConnection
- java.lang.Object
-
- com.boomi.connector.util.BaseConnection<C>
-
- com.boomi.common.rest.RestConnection<OperationContext>
-
- com.boomi.common.rest.RestOperationConnection
-
- Direct Known Subclasses:
OpenAPIOperationConnection
public class RestOperationConnection extends RestConnection<OperationContext>
-
-
Field Summary
-
Fields inherited from class com.boomi.common.rest.RestConnection
DEFAULT_CONNECT_TIMEOUT, DEFAULT_READ_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description RestOperationConnection(OperationContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addCookiesToStore(BasicCookieStore cookieStore)
protected RequestConfig
buildRequestConfig(AuthenticationType authType)
Method to populate the RequestConfig to be used in the HttpContext at the time of the request.protected void
configureCookieScope(HttpClientBuilder builder)
Enables or disables cookie management of the givenHttpClientBuilder
instance based on the value of "Cookie Scope" connection property.protected boolean
doPreemptiveAuthentication(AuthenticationType type)
Returns true / false based off of theAuthenticationType
if we want to pre-emptively send authentication information to a service.protected Credentials
getAuthenticationCredentials(AuthenticationType authenticationType)
Creates the authentication credentials for the request based off ofAuthenticationType
and connection property values.protected Lookup<AuthSchemeProvider>
getAuthSchemeProviders()
Creates a Default Lookup for Authentication Scheme Providers.RestClient
getClient()
Creates a RestClient for operation executionContentType
getEntityContentType()
Returns the expected content type for outbound request data.CloseableHttpClient
getHttpClient()
Returns an instance ofCloseableHttpClient
usingHttpClientBuilder
for operation execution.HttpContext
getHttpContext()
Creates a HttpContext, if the targetAuthenticationType
needs credentials, then a credentials provider will be setup for this context.protected RedirectStrategy
getRedirectStrategy()
ReturnsRedirectStrategy
based on the chosen Follow Redirects operation field.protected HttpRequestRetryHandler
getRetryHandler()
Returns aHttpRequestRetryHandler
for thegetHttpClient()
protected boolean
useSystemProperties()
Always returns true for Rest Connector to enable using system properties by default.-
Methods inherited from class com.boomi.common.rest.RestConnection
getAPIAuthenticationType, getAuthenticationType, getAWSAccessKey, getAWSRegion, getAWSSecretKey, getAWSService, getConnectionProperty, getConnectTimeout, getCookieScope, getCustomAuthCredentials, getDomain, getHttpMethod, getOAuthContext, getPassword, getPreemptive, getPrivateKeyStore, getPublicKeyStore, getReadTimeout, getUrl, getUsername, getWorkstation, isConnectionPoolingEnabled
-
Methods inherited from class com.boomi.connector.util.BaseConnection
generateConnectionInfo, generateConnectionInfo, getConnector, getContext, getOperationContext
-
-
-
-
Constructor Detail
-
RestOperationConnection
public RestOperationConnection(OperationContext context)
-
-
Method Detail
-
getClient
public RestClient getClient()
Creates a RestClient for operation execution- Returns:
- the RestClient
-
getHttpClient
public CloseableHttpClient getHttpClient()
Returns an instance ofCloseableHttpClient
usingHttpClientBuilder
for operation execution. This will configure proxy based off ofAtomProxyConfig
, account/ connection certificates, redirects based off ofgetRedirectStrategy()
}, cookie scope based off ofRestConnection.getCookieScope()
and authentication based registry.- Returns:
CloseableHttpClient
-
getAuthSchemeProviders
protected Lookup<AuthSchemeProvider> getAuthSchemeProviders()
Creates a Default Lookup for Authentication Scheme Providers.- Returns:
- the AuthSchemeProvider Lookup
-
getRedirectStrategy
protected RedirectStrategy getRedirectStrategy()
ReturnsRedirectStrategy
based on the chosen Follow Redirects operation field. If none or null redirect is specified on the operation, then theRedirectStrategy
is null. if "LAX" is chosen on the operation, thenLaxRedirectStrategy
will be used. If "STRICT" is chosen on the operation, then the default apache clientDefaultRedirectStrategy
is used.- Returns:
- the RedirectStrategy
-
configureCookieScope
protected void configureCookieScope(HttpClientBuilder builder) throws IllegalArgumentException
Enables or disables cookie management of the givenHttpClientBuilder
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.- Throws:
IllegalArgumentException
- if the Cookie Scope property is set with an invalid value.
-
addCookiesToStore
protected void addCookiesToStore(BasicCookieStore cookieStore)
-
getHttpContext
public HttpContext getHttpContext()
Creates a HttpContext, if the targetAuthenticationType
needs credentials, then a credentials provider will be setup for this context. In addition, only the selectedAuthenticationType
scheme will be available during authentication negotiation. If theAuthenticationType
allows pre-emptively sending the credentials, then an AuthCache will be created for the context.- Returns:
- the Http Client Context
-
doPreemptiveAuthentication
protected boolean doPreemptiveAuthentication(AuthenticationType type)
Returns true / false based off of theAuthenticationType
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.- Parameters:
type
-- Returns:
- true when PreemptivelyAuthenticate false otherwise.
-
getAuthenticationCredentials
protected Credentials getAuthenticationCredentials(AuthenticationType authenticationType)
Creates the authentication credentials for the request based off ofAuthenticationType
and connection property values.- Returns:
- the authentication Credentials
-
getEntityContentType
public ContentType getEntityContentType()
Returns the expected content type for outbound request data.- Returns:
- the ContentType
-
getRetryHandler
protected HttpRequestRetryHandler getRetryHandler()
Returns aHttpRequestRetryHandler
for thegetHttpClient()
- Returns:
- the HttpRequestRetryHandler
-
useSystemProperties
protected boolean useSystemProperties()
Always returns true for Rest Connector to enable using system properties by default. System properties will be taken into account when configuring the default implementations withinHttpClientBuilder
class.
-
buildRequestConfig
protected RequestConfig buildRequestConfig(AuthenticationType authType)
Method to populate the RequestConfig to be used in the HttpContext at the time of the request. Will set both Connect and Read timeouts if available.- Parameters:
authType
- The authenticationType that is used for the request- Returns:
- The RequestConfig with Auth schemes and timeouts set
-
-