Iterable<org.apache.http.Header>
public final class HttpResponseDecorator.HeadersDecorator extends Object implements Iterable<org.apache.http.Header>
HttpResponseDecorator.getHeaders()
.
It provides three "Groovy" ways to access headers:
resp.headers['Content-Type']
returns the Header
instanceresp.headers.'Content-Type'
returns the header value
resp.headers.each { println "${it.name} : ${it.value}" }
Constructor | Description |
---|---|
HeadersDecorator() |
Modifier and Type | Method | Description |
---|---|---|
org.apache.http.Header |
getAt(String name) |
Access the named header value, using bracket form.
|
Iterator |
iterator() |
Used to allow Groovy iteration methods over the response headers.
|
protected String |
propertyMissing(String name) |
Allow property-style access to header values.
|
public org.apache.http.Header getAt(String name)
response.headers['Content-Encoding']
name
- header name, e.g. Content-Type
Header
, or null
if it does not exist
in this responseHttpMessage.getFirstHeader(String)
protected String propertyMissing(String name)
getAt(String)
, except it simply returns the header's String
value, instead of the Header object.name
- header name, e.g. Content-Type
Header
, or null
if it does not exist
in this responseCopyright © 2008–2019. All rights reserved.