Class NetStorageSender
- All Implemented Interfaces:
CanUseSharedResource<HttpSession>
,FrankElement
,HasApplicationContext
,HasName
,HasPhysicalDestination
,IConfigurable
,IScopeProvider
,ISender
,ISenderWithParameters
,IWithParameters
,NameAware
,HasKeystore
,HasTruststore
,ConfigurableLifecycle
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
,org.springframework.context.Lifecycle
,org.springframework.context.Phased
,org.springframework.context.SmartLifecycle
See AbstractHttpSender
for more arguments and parameters!
AuthAlias:
If you do not want to specify the nonce and the access token used to authenticate with Akamai, you can use the authalias property. The username represents the nonce and the password the access token.
- Since:
- 7.0-B4
- Author:
- Niels Meijer
- Parameters
- Some actions require specific parameters to be set. Optional parameters for the
UPLOAD
action are: md5, sha1, sha256 and mtime.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.frankframework.http.AbstractHttpSender
AbstractHttpSender.HttpMethod
Nested classes/interfaces inherited from class org.frankframework.http.AbstractHttpSession
AbstractHttpSession.OauthAuthenticationMethod
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
Fields inherited from class org.frankframework.http.AbstractHttpSender
CORRELATION_ID_HEADER, headerParamsSet, MESSAGE_ID_HEADER, parametersToSkipWhenEmptySet, paramList, requestOrBodyParamsSet, staticUri, urlParameter
Fields inherited from class org.frankframework.http.AbstractHttpSession
AUTHENTICATION_METHOD_KEY, log
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Configure this component.extractResult
(HttpResponseHandler responseHandler, PipeLineSession session) Custom implementation to extract the response and format it to a String result.org.apache.http.client.methods.HttpRequestBase
getMethod
(URI uri, Message message, ParameterValueList parameters, PipeLineSession session) Custom implementation to create aHttpRequest
object.getResponseBodyAsString
(HttpResponseHandler responseHandler, boolean throwIOExceptionWhenParsingResponse) When an exception occurs and the response cannot be parsed, we do not want to throw a 'missing response' exception.protected URI
Builds the URI with the rootDirectory, optional CpCode and makes sure the path never ends with a slash '/'.sendMessage
(Message message, PipeLineSession session) Send a message to some destination (as configured in the Sender object).void
setAccessToken
(String accessToken) Login is done via a Nonce and AccessTokenvoid
setAction
(NetStorageSender.Action action) NetStorage action to be usedvoid
setActionVersion
(int actionVersion) At the time of writing, NetStorage only supports version 1void
setAuthAlias
(String authAlias) Alias used to obtain credentials for nonce (username) and accesstoken (password)void
NetStorage CP Code of the storage groupvoid
setHashAlgorithm
(HashAlgorithm hashAlgorithm) Only works in combination with the UPLOAD action.void
Login is done via a Nonce and AccessTokenvoid
setRootDir
(String rootDir) Root directory (appended to the url + cpCode)void
setSignVersion
(int signVersion) Version to validate queries made to NetStorage backend.void
The destination URL for the Akamai NetStorage.Methods inherited from class org.frankframework.http.AbstractHttpSender
addParameter, appendParameters, getLogPrefix, getObjectType, getParameterList, setCharSet, setContentType, setHeadersParams, setMethodType, setParametersToSkipWhenEmpty, setResultStatusCodeSessionKey, setStyleSheetName, setUrlParam, setXhtml, start, stop, validateResponseCode
Methods inherited from class org.frankframework.http.AbstractHttpSession
areCookiesDisabled, execute, getCredentials, getSSLConnectionSocketFactory, isRunning, setAllowSelfSignedCertificates, setAuthDomain, setAuthenticatedTokenRequest, setClientAlias, setClientId, setClientSecret, setConnectionIdleTimeout, setConnectionTimeToLive, setDisableCookies, setFollowRedirects, setHttpClient, setHttpContext, setIgnoreCertificateExpiredException, setIgnoreRedirects, setKeyManagerAlgorithm, setKeystore, setKeystoreAlias, setKeystoreAliasAuthAlias, setKeystoreAliasPassword, setKeystoreAuthAlias, setKeystorePassword, setKeystoreType, setMaxConnections, setMaxExecuteRetries, setOauthAuthenticationMethod, setPassword, setPrefillProxyAuthCache, setProtocol, setProxyAuthAlias, setProxyHost, setProxyPassword, setProxyPort, setProxyRealm, setProxyUsername, setSamlAssertionExpiry, setSamlAudience, setSamlIssuer, setSamlNameId, setScope, setStaleChecking, setStaleTimeout, setSupportedCipherSuites, setTimeout, setTokenEndpoint, setTokenExpiry, setTrustManagerAlgorithm, setTruststore, setTruststoreAuthAlias, setTruststorePassword, setTruststoreType, setUsername, setVerifyHostname
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContext
Methods inherited from interface org.frankframework.core.CanUseSharedResource
getSharedResource, setSharedResourceRef
Methods inherited from interface org.frankframework.lifecycle.ConfigurableLifecycle
getPhase, isAutoStartup
Methods inherited from interface org.frankframework.core.HasApplicationContext
getApplicationContext, getConfigurationClassLoader
Methods inherited from interface org.frankframework.encryption.HasKeystore
getKeyManagerAlgorithm, getKeystore, getKeystoreAlias, getKeystoreAliasAuthAlias, getKeystoreAliasPassword, getKeystoreAuthAlias, getKeystorePassword, getKeystoreType
Methods inherited from interface org.frankframework.core.HasPhysicalDestination
getDomain
Methods inherited from interface org.frankframework.encryption.HasTruststore
getTrustManagerAlgorithm, getTruststore, getTruststoreAuthAlias, getTruststorePassword, getTruststoreType, isAllowSelfSignedCertificates, isIgnoreCertificateExpiredException, isVerifyHostname
Methods inherited from interface org.frankframework.core.ISender
isSynchronous, sendMessageOrThrow
Methods inherited from interface org.frankframework.core.ISenderWithParameters
consumesSessionVariable
Methods inherited from interface org.springframework.context.Lifecycle
isRunning
Methods inherited from interface org.springframework.context.SmartLifecycle
stop
-
Field Details
-
DESTINATION_PARAM_KEY
- See Also:
-
FILE_PARAM_KEY
- See Also:
-
MTIME_PARAM_KEY
- See Also:
-
HASHVALUE_PARAM_KEY
- See Also:
-
-
Constructor Details
-
NetStorageSender
public NetStorageSender()
-
-
Method Details
-
configure
Description copied from interface:IConfigurable
Configure this component.configure()
is called once at startup of the framework in the configure method of the owner of thisIConfigurable
. Purpose of this method is to check whether the static configuration of the object is correct. As much as possible class-instantiating should take place in theconfigure()
, to improve performance.In the case of a container, this will propagate the configure signal to all components that apply.
- Specified by:
configure
in interfaceIConfigurable
- Overrides:
configure
in classAbstractHttpSender
- Throws:
ConfigurationException
- in case it was not able to configure the component.
-
getURI
Builds the URI with the rootDirectory, optional CpCode and makes sure the path never ends with a slash '/'.- Overrides:
getURI
in classAbstractHttpSession
- Parameters:
path
- to append to the root- Returns:
- full path to use as endpoint
- Throws:
URISyntaxException
-
sendMessage
@Nonnull public SenderResult sendMessage(@Nonnull Message message, @Nonnull PipeLineSession session) throws SenderException, TimeoutException Description copied from interface:ISender
Send a message to some destination (as configured in the Sender object). This method may only be called after theconfigure()
method is called.The following table shows the difference between synchronous and a-synchronous senders:
synchronous a-synchronous ISender.isSynchronous()
returnstrue
false
return value of sendMessage()
isthe reply-message the messageId of the message sent the correlationID specified with sendMessage()
may be ignored is sent with the message a {link TimeOutException} may be thrown if a timeout occurs waiting for a reply should not be expected Multiple objects may try to call this method at the same time, from different threads. Implementations of this method should therefore be thread-safe, or
synchronized
.- Specified by:
sendMessage
in interfaceISender
- Overrides:
sendMessage
in classAbstractHttpSender
- Throws:
SenderException
TimeoutException
-
getMethod
public org.apache.http.client.methods.HttpRequestBase getMethod(URI uri, Message message, @Nonnull ParameterValueList parameters, PipeLineSession session) throws SenderException Description copied from class:AbstractHttpSender
Custom implementation to create aHttpRequest
object.- Specified by:
getMethod
in classAbstractHttpSender
- Parameters:
uri
- endpoint to send the message tomessage
- to be sentparameters
- ParameterValueList that contains all the senders parameterssession
- PipeLineSession to retrieve or store data from, or NULL when not set- Returns:
- a
HttpRequest
object - Throws:
SenderException
-
extractResult
public Message extractResult(HttpResponseHandler responseHandler, PipeLineSession session) throws SenderException, IOException Description copied from class:AbstractHttpSender
Custom implementation to extract the response and format it to a String result.
It is important that theresponse
will be read or will beclosed
.- Specified by:
extractResult
in classAbstractHttpSender
- Parameters:
responseHandler
-HttpResponseHandler
that contains the response informationsession
-PipeLineSession
which may be null- Returns:
- a string that will be passed to the pipeline
- Throws:
SenderException
IOException
-
getResponseBodyAsString
public String getResponseBodyAsString(HttpResponseHandler responseHandler, boolean throwIOExceptionWhenParsingResponse) throws IOException When an exception occurs and the response cannot be parsed, we do not want to throw a 'missing response' exception. Since this method is used when handling exceptions, silently return null, to avoid NPE's and IOExceptions- Throws:
IOException
-
setHashAlgorithm
Only works in combination with the UPLOAD action. If set, and not specified as parameter, the sender will sign the file to be uploaded. -
setAction
NetStorage action to be used -
setActionVersion
public void setActionVersion(int actionVersion) At the time of writing, NetStorage only supports version 1- Default value
- 1
-
setCpCode
NetStorage CP Code of the storage group -
setUrl
The destination URL for the Akamai NetStorage. (Only the hostname, without CpCode; eq. xyz-nsu.akamaihd.net)- Overrides:
setUrl
in classAbstractHttpSender
-
setNonce
Login is done via a Nonce and AccessToken- Parameters:
nonce
- to use when logging in
-
setSignVersion
public void setSignVersion(int signVersion) Version to validate queries made to NetStorage backend.- Parameters:
signVersion
- supports 3 types; 3:MD5, 4:SHA1, 5: SHA256- Default value
- 5
-
getSignType
-
setAccessToken
Login is done via a Nonce and AccessToken- Parameters:
accessToken
- to use when logging in
-
getPhysicalDestinationName
- Specified by:
getPhysicalDestinationName
in interfaceHasPhysicalDestination
- Overrides:
getPhysicalDestinationName
in classAbstractHttpSender
-
setRootDir
Root directory (appended to the url + cpCode) -
setAuthAlias
Alias used to obtain credentials for nonce (username) and accesstoken (password)- Overrides:
setAuthAlias
in classAbstractHttpSession
-