@ComponentProfile(summary="Turn a application/www-url-form-encoded payload into metadata.", tag="service,metadata,http,https", since="3.9.0") public class FormDataToMetadata extends ServiceImp
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.
contentTypeKey
will be checked to see if the content-type is in fact
application/x-www-url-form-encoded
; if it is, then the payload is parsed as into
metadata, note that the payload is always unchanged.
In the adapter configuration file this class is aliased as www-url-form-encoded-payload-to-metadata 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
Constructor and Description |
---|
FormDataToMetadata() |
Modifier and Type | Method and Description |
---|---|
protected void |
closeService() |
void |
doService(AdaptrisMessage msg)
Apply the service to the message.
|
java.lang.String |
getContentTypeKey() |
java.lang.String |
getMetadataPrefix() |
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 |
setMetadataPrefix(java.lang.String metadataPrefix) |
FormDataToMetadata |
withContentTypeKey(java.lang.String s) |
FormDataToMetadata |
withMetadataPrefix(java.lang.String s) |
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId, start, stop
public static final java.lang.String DEFAULT_CONTENT_TYPE_KEY
public static final java.lang.String DEFAULT_CONTENT_TYPE_VALUE
public void prepare() throws CoreException
ComponentLifecycleExtension
CoreException
protected void initService() throws CoreException
initService
in class ServiceImp
CoreException
protected void closeService()
closeService
in class ServiceImp
public void doService(AdaptrisMessage msg) throws ServiceException
Service
Apply the service to the message.
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
spublic java.lang.String getContentTypeKey()
public void setContentTypeKey(java.lang.String s)
s
- the metadata key.public java.lang.String getMetadataPrefix()
public void setMetadataPrefix(java.lang.String metadataPrefix)
public FormDataToMetadata withMetadataPrefix(java.lang.String s)
public FormDataToMetadata withContentTypeKey(java.lang.String s)