Class ResponseHeadersAsMetadata
- All Implemented Interfaces:
ResponseHeaderHandler<HttpURLConnection>
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.
-
Field Summary
Fields inherited from class com.adaptris.core.http.client.net.MetadataResponseHeaderImpl
log
-
Constructor Summary
ConstructorsConstructorDescriptionResponseHeadersAsMetadata
(String prefix) ResponseHeadersAsMetadata
(String prefix, String separator) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addMetadata
(Map<String, List<String>> headers, AdaptrisMessage reply) void
Set the separator to be used when multiple headers should be associated with the same key.Methods inherited from class com.adaptris.core.http.client.net.MetadataResponseHeaderImpl
generateKey, getMetadataPrefix, handle, setMetadataPrefix
-
Constructor Details
-
ResponseHeadersAsMetadata
public ResponseHeadersAsMetadata() -
ResponseHeadersAsMetadata
-
ResponseHeadersAsMetadata
-
-
Method Details
-
addMetadata
- Specified by:
addMetadata
in classMetadataResponseHeaderImpl
-
getMetadataSeparator
-
setMetadataSeparator
Set the separator to be used when multiple headers should be associated with the same key.Because
HttpURLConnection
exposes headers as aList<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").- Parameters:
s
- the separator (default if not specified is "\t");
-