Class FormDataToMetadata
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.metadata.FormDataToMetadata
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,Service
,StateManagedComponent
@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
Takes a application/x-www-url-form-encoded payload and extracts it as 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.
contentTypeKey
will be checked to see if the content-type is in factapplication/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.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_CONTENT_TYPE_KEY
static java.lang.String
DEFAULT_CONTENT_TYPE_VALUE
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description FormDataToMetadata()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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)
-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId, start, stop
-
-
-
-
Field Detail
-
DEFAULT_CONTENT_TYPE_KEY
public static final java.lang.String DEFAULT_CONTENT_TYPE_KEY
- See Also:
- Constant Field Values
-
DEFAULT_CONTENT_TYPE_VALUE
public static final java.lang.String DEFAULT_CONTENT_TYPE_VALUE
- See Also:
- Constant Field Values
-
-
Method Detail
-
prepare
public void prepare() throws CoreException
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Throws:
CoreException
-
initService
protected void initService() throws CoreException
- Specified by:
initService
in classServiceImp
- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeService
in classServiceImp
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
Description copied from interface:Service
Apply the service to the message.
- Parameters:
msg
- theAdaptrisMessage
to process- Throws:
ServiceException
- wrapping any underlyingException
s
-
getContentTypeKey
public java.lang.String getContentTypeKey()
-
setContentTypeKey
public void setContentTypeKey(java.lang.String s)
Set the metadata key for finding out the content-type.- Parameters:
s
- the metadata key.
-
getMetadataPrefix
public java.lang.String getMetadataPrefix()
-
setMetadataPrefix
public void setMetadataPrefix(java.lang.String metadataPrefix)
-
withMetadataPrefix
public FormDataToMetadata withMetadataPrefix(java.lang.String s)
-
withContentTypeKey
public FormDataToMetadata withContentTypeKey(java.lang.String s)
-
-