@ComponentProfile(summary="Turn HTTP Request parameters (from a HTTP POST) into metadata", tag="service,metadata,http,https") public class RequestParameterConverterService extends ServiceImp
Implementation of Service
which parses the incoming HTTP Request parameters and converts all request parameters into
Metadata.
If the client is sending data to the adapter, it is possible that the client will send data as though it were a standard Html Form post. In situations like that, then the payload is a number of URLEncoded key value pairs. This service can be used to convert all the Request parameters into metadata.
If the parameterForPayload
field is configured and present in the request parameters, then this will become the
message payload, otherwise the payload remains unchanged.
In all cases, the metadata value associated with contentTypeKey
will be matched against the configured
contentTypeValue
If the values match, then the payload is converted, otherwise no action is performed on the
payload. If there is a charset parameter supplied with the content type metadata, then this charset will be used to decode the
parameters, and used as the CharEncoding on the AdaptriMessage
In the adapter configuration file this class is aliased as http-request-parameter-converter-service which is the preferred alternative to the fully qualified classname when building your configuration.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_CONTENT_TYPE_KEY |
static java.lang.String |
DEFAULT_CONTENT_TYPE_VALUE |
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
RequestParameterConverterService()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
closeService() |
void |
doService(AdaptrisMessage msg)
*
|
java.lang.String |
getContentTypeKey() |
java.lang.String |
getContentTypeValue() |
java.lang.String |
getParameterForPayload() |
protected void |
initService() |
void |
prepare()
Prepare for initialisation.
|
void |
setContentTypeKey(java.lang.String s)
Set the metadata key for finding out the content-type.
|
void |
setContentTypeValue(java.lang.String s)
Set the value that the content-type must match.
|
void |
setParameterForPayload(java.lang.String s)
Set the request parameter the value of which will become the Payload of the
Adaptris Message
|
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsConfirmation, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isConfirmation, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, rethrowServiceException, retrieveComponentState, setContinueOnFail, setIsConfirmation, setIsTrackingEndpoint, setLookupName, setUniqueId, start, stop
public static final java.lang.String DEFAULT_CONTENT_TYPE_KEY
public static final java.lang.String DEFAULT_CONTENT_TYPE_VALUE
public RequestParameterConverterService()
Creates a new instance.
public void prepare() throws CoreException
ComponentLifecycleExtension
CoreException
public void doService(AdaptrisMessage msg) throws ServiceException
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
s(com.adaptris.core.AdaptrisMessage)
protected void initService() throws CoreException
initService
in class ServiceImp
CoreException
protected void closeService()
closeService
in class ServiceImp
public java.lang.String getParameterForPayload()
public void setParameterForPayload(java.lang.String s)
s
- public java.lang.String getContentTypeKey()
public void setContentTypeKey(java.lang.String s)
s
- the metadata key.public java.lang.String getContentTypeValue()
public void setContentTypeValue(java.lang.String s)
s
- the value.