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
UPLOADaction are: md5, sha1, sha256 and mtime.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.frankframework.http.AbstractHttpSender
AbstractHttpSender.HttpMethodNested classes/interfaces inherited from class org.frankframework.http.AbstractHttpSession
AbstractHttpSession.OauthAuthenticationMethod -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class org.frankframework.http.AbstractHttpSender
CORRELATION_ID_HEADER, headerParamsSet, MESSAGE_ID_HEADER, parametersToSkipWhenEmptySet, paramList, requestOrBodyParamsSet, staticUri, urlParameterFields inherited from class org.frankframework.http.AbstractHttpSession
AUTHENTICATION_METHOD_KEY, logFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidConfigure this component.protected booleandetectedTimeDrift(String dateString, int allowedDrift) Validate Server-Time driftextractResult(HttpResponseHandler responseHandler, PipeLineSession session) Custom implementation to extract the response and format it to a String result.org.apache.http.client.methods.HttpRequestBasegetMethod(URI uri, Message message, ParameterValueList parameters, PipeLineSession session) Custom implementation to create aHttpRequestobject.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 URIBuilds 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).voidsetAccessToken(String accessToken) Login is done via a Nonce and AccessTokenvoidsetAction(NetStorageSender.Action action) NetStorage action to be usedvoidsetActionVersion(int actionVersion) At the time of writing, NetStorage only supports version 1voidsetAuthAlias(String authAlias) Alias used to obtain credentials for nonce (username) and accesstoken (password)voidNetStorage CP Code of the storage groupvoidsetHashAlgorithm(HashAlgorithm hashAlgorithm) Only works in combination with the UPLOAD action.voidLogin is done via a Nonce and AccessTokenvoidsetRootDir(String rootDir) Root directory (appended to the url + cpCode)voidsetSignVersion(int signVersion) Version to validate queries made to NetStorage backend.voidThe destination URL for the Akamai NetStorage.Methods inherited from class org.frankframework.http.AbstractHttpSender
addParameter, appendParameters, getCredentials, getLogPrefix, getOauthAuthenticationMethod, getObjectType, getParameterList, getTokenEndpoint, setCharSet, setContentType, setHeadersParams, setMethodType, setParametersToSkipWhenEmpty, setResultStatusCodeSessionKey, setStyleSheetName, setUrlParam, setXhtml, start, stop, validateResponseCodeMethods inherited from class org.frankframework.http.AbstractHttpSession
areCookiesDisabled, execute, getDomainAwareCredentials, 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, setVerifyHostnameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContextMethods inherited from interface org.frankframework.core.CanUseSharedResource
getSharedResource, setSharedResourceRefMethods inherited from interface org.frankframework.lifecycle.ConfigurableLifecycle
getPhase, isAutoStartup, isConfiguredMethods inherited from interface org.frankframework.core.FrankElement
addConfigWarningMethods inherited from interface org.frankframework.core.HasApplicationContext
getApplicationContext, getConfigurationClassLoaderMethods inherited from interface org.frankframework.encryption.HasKeystore
getKeyManagerAlgorithm, getKeystore, getKeystoreAlias, getKeystoreAliasAuthAlias, getKeystoreAliasPassword, getKeystoreAuthAlias, getKeystorePassword, getKeystoreTypeMethods inherited from interface org.frankframework.encryption.HasTruststore
getTrustManagerAlgorithm, getTruststore, getTruststoreAuthAlias, getTruststorePassword, getTruststoreType, isAllowSelfSignedCertificates, isIgnoreCertificateExpiredException, isVerifyHostnameMethods inherited from interface org.frankframework.core.ISender
isSynchronous, sendMessageOrThrowMethods inherited from interface org.frankframework.core.ISenderWithParameters
consumesSessionVariableMethods inherited from interface org.springframework.context.Lifecycle
isRunningMethods 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:IConfigurableConfigure 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:
configurein interfaceIConfigurable- Overrides:
configurein 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:
getURIin 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:ISenderSend 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()returnstruefalsereturn 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:
sendMessagein interfaceISender- Overrides:
sendMessagein classAbstractHttpSender- Throws:
SenderExceptionTimeoutException
-
getMethod
public org.apache.http.client.methods.HttpRequestBase getMethod(URI uri, Message message, @Nonnull ParameterValueList parameters, PipeLineSession session) throws SenderException Description copied from class:AbstractHttpSenderCustom implementation to create aHttpRequestobject.- Specified by:
getMethodin 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
HttpRequestobject - Throws:
SenderException
-
extractResult
public Message extractResult(HttpResponseHandler responseHandler, PipeLineSession session) throws SenderException, IOException Description copied from class:AbstractHttpSenderCustom implementation to extract the response and format it to a String result.
It is important that theresponsewill be read or will beclosed.- Specified by:
extractResultin classAbstractHttpSender- Parameters:
responseHandler-HttpResponseHandlerthat contains the response informationsession-PipeLineSessionwhich may be null- Returns:
- a string that will be passed to the pipeline
- Throws:
SenderExceptionIOException
-
detectedTimeDrift
Validate Server-Time drift- Parameters:
dateString- HTTP date header, if empty assume no driftallowedDrift- Allowed time offset in milliseconds
-
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:
setUrlin 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:
getPhysicalDestinationNamein interfaceHasPhysicalDestination- Overrides:
getPhysicalDestinationNamein classAbstractHttpSender
-
setRootDir
Root directory (appended to the url + cpCode) -
setAuthAlias
Alias used to obtain credentials for nonce (username) and accesstoken (password)- Overrides:
setAuthAliasin classAbstractHttpSession
-