public final class HttpResponseDecorator.HeadersDecorator extends Object implements Iterable<Object>
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 and Description |
---|
HeadersDecorator() |
Modifier and Type | Method and Description |
---|---|
org.apache.http.Header |
getAt(String name)
Access the named header value, using bracket form.
|
Iterator<Object> |
iterator()
Used to allow Groovy iteration methods over the response headers.
|
protected String |
propertyMissing(String name)
Allow property-style access to header values.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
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 © 2010–2023. All rights reserved.