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 ServiceImpTakes 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.
contentTypeKeywill 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.StringDEFAULT_CONTENT_TYPE_KEYstatic java.lang.StringDEFAULT_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 voidcloseService()voiddoService(AdaptrisMessage msg)Apply the service to the message.java.lang.StringgetContentTypeKey()java.lang.StringgetMetadataPrefix()protected voidinitService()voidprepare()Prepare for initialisation.voidsetContentTypeKey(java.lang.String s)Set the metadata key for finding out the content-type.voidsetMetadataPrefix(java.lang.String metadataPrefix)FormDataToMetadatawithContentTypeKey(java.lang.String s)FormDataToMetadatawithMetadataPrefix(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 CoreExceptionDescription copied from interface:ComponentLifecycleExtensionPrepare for initialisation.- Throws:
CoreException
-
initService
protected void initService() throws CoreException- Specified by:
initServicein classServiceImp- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeServicein classServiceImp
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
Description copied from interface:ServiceApply the service to the message.
- Parameters:
msg- theAdaptrisMessageto process- Throws:
ServiceException- wrapping any underlyingExceptions
-
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)
-
-