ch.mimo.netty.handler.codec.icap
Interface IcapMessage

All Known Subinterfaces:
IcapRequest, IcapResponse
All Known Implementing Classes:
AbstractIcapMessage, DefaultIcapRequest, DefaultIcapResponse

public interface IcapMessage

An ICAP message that contains common operations for @see IcapRequest and @see IcapResponse.

Author:
Michael Mimo Moratti (mimo@mimo.ch)

Method Summary
 IcapMessage addHeader(String name, Object value)
          Adds a new header with the specified name and value.
 IcapMessage clearHeaders()
          Removes all headers from this message.
 boolean containsHeader(String name)
           
 boolean containsHttpRequest()
           
 boolean containsHttpResponse()
           
 IcapMessageElementEnum getBodyType()
           
 Encapsulated getEncapsulatedHeader()
           
 String getHeader(String name)
          Returns the header value with the specified header name.
 Set<String> getHeaderNames()
           
 Set<Map.Entry<String,String>> getHeaders()
          Returns the all header names and values that this message contains.
 Set<String> getHeaders(String name)
          Returns the header values with the specified header name.
 org.jboss.netty.handler.codec.http.HttpRequest getHttpRequest()
           
 org.jboss.netty.handler.codec.http.HttpResponse getHttpResponse()
           
 int getPreviewAmount()
           
 IcapVersion getProtocolVersion()
           
 boolean isPreviewMessage()
           
 IcapMessage removeHeader(String name)
          Removes the header with the specified name.
 IcapMessage setBody(IcapMessageElementEnum body)
          Sets the indication that this icap message contains a body of some kind.
 IcapMessage setEncapsulatedHeader(Encapsulated encapsulated)
          Sets the @see Encapsulated Encapsulation header for this message
 IcapMessage setHeader(String name, Iterable<?> values)
          Sets a new header with the specified name and values.
 IcapMessage setHeader(String name, Object value)
          Sets a new header with the specified name and value.
 IcapMessage setHttpRequest(org.jboss.netty.handler.codec.http.HttpRequest httpRequest)
           
 IcapMessage setHttpResponse(org.jboss.netty.handler.codec.http.HttpResponse response)
          Adds a @see HttpResponse to the Icap message.
 IcapMessage setProtocolVersion(IcapVersion version)
          Sets the protocol version of this message.
 

Method Detail

getHeader

String getHeader(String name)
Returns the header value with the specified header name. If there are more than one header value for the specified header name, the first value is returned.

Returns:
the header value or null if there is no such header

getHeaders

Set<String> getHeaders(String name)
Returns the header values with the specified header name.

Returns:
the List of header values. An empty list if there is no such header.

getHeaders

Set<Map.Entry<String,String>> getHeaders()
Returns the all header names and values that this message contains.

Returns:
the List of the header name-value pairs. An empty list if there is no header in this message.

containsHeader

boolean containsHeader(String name)
Parameters:
name - header name
Returns:
true if and only if there is a header with the specified header name.

getHeaderNames

Set<String> getHeaderNames()
Returns:
Set of all header names that this message contains.

addHeader

IcapMessage addHeader(String name,
                      Object value)
Adds a new header with the specified name and value.

Parameters:
name - header name
value - for the given name
Returns:
self in order to chain the method calls

setHeader

IcapMessage setHeader(String name,
                      Object value)
Sets a new header with the specified name and value. If there is an existing header with the same name, the existing header is removed.

Parameters:
name - header name
value - for the given name
Returns:
self in order to chain the method calls

setHeader

IcapMessage setHeader(String name,
                      Iterable<?> values)
Sets a new header with the specified name and values. If there is an existing header with the same name, the existing header is removed.

Parameters:
name - header name
values - for the given name
Returns:
self in order to chain the method calls

removeHeader

IcapMessage removeHeader(String name)
Removes the header with the specified name.

Returns:
self in order to chain the method calls

getPreviewAmount

int getPreviewAmount()
Returns:
the @see Integer preview header value.

clearHeaders

IcapMessage clearHeaders()
Removes all headers from this message.

Returns:
self in order to chain the method calls

getProtocolVersion

IcapVersion getProtocolVersion()
Returns:
the protocol version of this message.

setProtocolVersion

IcapMessage setProtocolVersion(IcapVersion version)
Sets the protocol version of this message.

Parameters:
version - @see IcapVersion
Returns:
self in order to chain the method calls

isPreviewMessage

boolean isPreviewMessage()
Returns:
whether this message is a preview of the actual message.

containsHttpRequest

boolean containsHttpRequest()
Returns:
true if a http request was delivered.

getHttpRequest

org.jboss.netty.handler.codec.http.HttpRequest getHttpRequest()
Returns:
the actual http request instance @see HttpRequest

setHttpRequest

IcapMessage setHttpRequest(org.jboss.netty.handler.codec.http.HttpRequest httpRequest)
Parameters:
httpRequest -
Returns:
self in order to chain the method calls

containsHttpResponse

boolean containsHttpResponse()
Returns:
true if a http response was delivered.

getHttpResponse

org.jboss.netty.handler.codec.http.HttpResponse getHttpResponse()
Returns:
the actual http response instance @see HttpResponse

setHttpResponse

IcapMessage setHttpResponse(org.jboss.netty.handler.codec.http.HttpResponse response)
Adds a @see HttpResponse to the Icap message.

Parameters:
response - the @see HttpResponse
Returns:
self in order to chain the method calls

setEncapsulatedHeader

IcapMessage setEncapsulatedHeader(Encapsulated encapsulated)
Sets the @see Encapsulated Encapsulation header for this message

Parameters:
encapsulated - @see Encapsulated instance
Returns:
self in order to chain the method calls

getEncapsulatedHeader

Encapsulated getEncapsulatedHeader()
Returns:
@see Encapsulated Encapsulated header value

setBody

IcapMessage setBody(IcapMessageElementEnum body)
Sets the indication that this icap message contains a body of some kind.

Parameters:
body - @see IcapMessageElementEnum
Returns:
self in order to chain the method calls

getBodyType

IcapMessageElementEnum getBodyType()
Returns:
@see IcapMessageElementEnum message body indicator.


Copyright © 2011. All Rights Reserved.