Package net.officefloor.server.http.impl
Class ProcessAwareHttpResponseHeaders
- java.lang.Object
-
- net.officefloor.server.http.impl.ProcessAwareHttpResponseHeaders
-
- All Implemented Interfaces:
java.lang.Iterable<HttpHeader>,HttpResponseHeaders
public class ProcessAwareHttpResponseHeaders extends java.lang.Object implements HttpResponseHeaders
ProcessStateawareHttpResponseHeaders.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description ProcessAwareHttpResponseHeaders(ManagedObjectContext context)Instantiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpHeaderaddHeader(java.lang.String name, java.lang.String value)Adds aHttpHeaderfor the response.HttpHeaderaddHeader(java.lang.String name, HttpHeaderValue value)Adds aHttpHeader.HttpHeaderaddHeader(HttpHeaderName name, java.lang.String value)Adds aHttpHeader.HttpHeaderaddHeader(HttpHeaderName name, HttpHeaderValue value)Adds aHttpHeader.HttpHeadergetHeader(java.lang.String name)Obtains the firstHttpHeaderby the name.java.lang.Iterable<HttpHeader>getHeaders(java.lang.String name)Obtains all theHttpHeaderinstances by the name.WritableHttpHeadergetWritableHttpHeaders()Obtains the headWritableHttpHeaderto the linked list ofWritableHttpHeaderinstances for theHttpResponseWriter.java.util.Iterator<HttpHeader>iterator()booleanremoveHeader(HttpHeader header)Removes the particularHttpHeaderfrom the response.booleanremoveHeaders(java.lang.String name)Removes allHttpHeaderinstances by the name.
-
-
-
Constructor Detail
-
ProcessAwareHttpResponseHeaders
public ProcessAwareHttpResponseHeaders(ManagedObjectContext context)
Instantiate.- Parameters:
context-ManagedObjectContext.
-
-
Method Detail
-
getWritableHttpHeaders
public WritableHttpHeader getWritableHttpHeaders()
Obtains the headWritableHttpHeaderto the linked list ofWritableHttpHeaderinstances for theHttpResponseWriter.- Returns:
- Head
WritableHttpHeaderto the linked list ofWritableHttpHeaderinstances for theHttpResponseWriter. May benull.
-
iterator
public java.util.Iterator<HttpHeader> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<HttpHeader>
-
addHeader
public HttpHeader addHeader(java.lang.String name, java.lang.String value) throws java.lang.IllegalArgumentException
Description copied from interface:HttpResponseHeadersAdds a
HttpHeaderfor the response.HttpHeaderinstances are provided on the response in the order they are added.- Specified by:
addHeaderin interfaceHttpResponseHeaders- Parameters:
name- Name ofHttpHeader.value- Value ofHttpHeader.- Returns:
- Added
HttpHeader. - Throws:
java.lang.IllegalArgumentException- Should theHttpHeaderbe managed by theHttpResponse.
-
addHeader
public HttpHeader addHeader(HttpHeaderName name, java.lang.String value) throws java.lang.IllegalArgumentException
Description copied from interface:HttpResponseHeadersAdds aHttpHeader.- Specified by:
addHeaderin interfaceHttpResponseHeaders- Parameters:
name-HttpHeaderName.value- Value ofHttpHeader.- Returns:
- Added
HttpHeader - Throws:
java.lang.IllegalArgumentException- Should theHttpHeaderbe managed by theHttpResponse.
-
addHeader
public HttpHeader addHeader(java.lang.String name, HttpHeaderValue value) throws java.lang.IllegalArgumentException
Description copied from interface:HttpResponseHeadersAdds aHttpHeader.- Specified by:
addHeaderin interfaceHttpResponseHeaders- Parameters:
name- Name ofHttpHeader.value-HttpHeaderValue.- Returns:
- Added
HttpHeader. - Throws:
java.lang.IllegalArgumentException- Should theHttpHeaderbe managed by theHttpResponse.
-
addHeader
public HttpHeader addHeader(HttpHeaderName name, HttpHeaderValue value) throws java.lang.IllegalArgumentException
Description copied from interface:HttpResponseHeadersAdds aHttpHeader.- Specified by:
addHeaderin interfaceHttpResponseHeaders- Parameters:
name-HttpHeaderName.value-HttpHeaderValue.- Returns:
- Added
HttpHeader. - Throws:
java.lang.IllegalArgumentException- Should theHttpHeaderbe managed by theHttpResponse.
-
removeHeader
public boolean removeHeader(HttpHeader header)
Description copied from interface:HttpResponseHeadersRemoves the particularHttpHeaderfrom the response.- Specified by:
removeHeaderin interfaceHttpResponseHeaders- Parameters:
header-HttpHeaderto be removed from the response.- Returns:
trueif theHttpHeaderwas removed.
-
removeHeaders
public boolean removeHeaders(java.lang.String name)
Description copied from interface:HttpResponseHeadersRemoves all
HttpHeaderinstances by the name.This method compliments
HttpResponseHeaders.addHeader(String, String)to allow adding a new singleHttpHeaderinstance by name.- Specified by:
removeHeadersin interfaceHttpResponseHeaders- Parameters:
name- Name of theHttpHeaderinstances to remove.- Returns:
trueifHttpHeaderinstances were removed by the name.
-
getHeader
public HttpHeader getHeader(java.lang.String name)
Description copied from interface:HttpResponseHeadersObtains the firstHttpHeaderby the name.- Specified by:
getHeaderin interfaceHttpResponseHeaders- Parameters:
name- Name of theHttpHeader.- Returns:
- First
HttpHeaderornullif notHttpHeader.
-
getHeaders
public java.lang.Iterable<HttpHeader> getHeaders(java.lang.String name)
Description copied from interface:HttpResponseHeadersObtains all theHttpHeaderinstances by the name.- Specified by:
getHeadersin interfaceHttpResponseHeaders- Parameters:
name- Name of theHttpHeaderinstances.- Returns:
- All
HttpHeaderinstances by the name.
-
-