public class ResponseHeadersAsMetadata extends MetadataResponseHeaderImpl
ResponseHeaderHandler
which adds all the HTTP headers from the
response as metadata to the AdaptrisMessage
.
Because HttpURLConnection
exposes headers as a List<String>
; #setMetadataSeparator(String)
is
used
as a separator between multiple items in the list to flatten the list into a single metadata value. The default value is the
tab character ("\t").
This will include header fields where the key is null
; this will end up as the string "null"
. HttpURLConnection
exposes the HTTP status line (e.g. 200 HTTP/1.1 OK
as a header field with no key so this will
generally be what is associated with "null"
.
In the adapter configuration file this class is aliased as http-response-headers-as-metadata which is the preferred alternative to the fully qualified classname when building your configuration.
log
Constructor and Description |
---|
ResponseHeadersAsMetadata() |
ResponseHeadersAsMetadata(java.lang.String prefix) |
ResponseHeadersAsMetadata(java.lang.String prefix,
java.lang.String separator) |
Modifier and Type | Method and Description |
---|---|
protected void |
addMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers,
AdaptrisMessage reply) |
java.lang.String |
getMetadataSeparator() |
void |
setMetadataSeparator(java.lang.String s)
Set the separator to be used when multiple headers should be associated with the same key.
|
generateKey, getMetadataPrefix, handle, setMetadataPrefix
public ResponseHeadersAsMetadata()
public ResponseHeadersAsMetadata(java.lang.String prefix)
public ResponseHeadersAsMetadata(java.lang.String prefix, java.lang.String separator)
protected void addMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, AdaptrisMessage reply)
addMetadata
in class MetadataResponseHeaderImpl
public java.lang.String getMetadataSeparator()
public void setMetadataSeparator(java.lang.String s)
Because HttpURLConnection
exposes headers as a List<String>
; #setMetadataSeparator(String)
is
used as a separator between multiple items in the list to flatten the list into a single metadata value. The default value is
the tab character ("\t").
s
- the separator (default if not specified is "\t");