org.glassfish.jersey.message.internal
Class HeadersFactory

java.lang.Object
  extended by org.glassfish.jersey.message.internal.HeadersFactory

public final class HeadersFactory
extends java.lang.Object

Utility class supporting the processing of message headers.

Author:
Marek Potociar (marek.potociar at oracle.com), Michal Gajdos (michal.gajdos at oracle.com)

Method Summary
static AbstractMultivaluedMap<java.lang.String,java.lang.String> createInbound()
          Create an empty inbound message headers container.
static AbstractMultivaluedMap<java.lang.String,java.lang.String> createInbound(java.util.Map<java.lang.String,java.util.List<java.lang.String>> initial)
          Create an inbound message headers container.
static AbstractMultivaluedMap<java.lang.String,java.lang.String> createInbound(MultivaluedMap<java.lang.String,java.lang.String> initial)
          Create an inbound message headers container.
static AbstractMultivaluedMap<java.lang.String,java.lang.Object> createOutbound()
          Create an empty outbound message headers container.
static AbstractMultivaluedMap<java.lang.String,java.lang.Object> createOutbound(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> initial)
          Create an outbound message headers container.
static
<V> MultivaluedMap<java.lang.String,V>
empty()
          Get immutable empty message headers container.
static java.util.List<java.lang.String> toString(java.util.List<java.lang.Object> headerValues, RuntimeDelegate rd)
           
static MultivaluedMap<java.lang.String,java.lang.String> toString(MultivaluedMap<java.lang.String,java.lang.Object> headers, RuntimeDelegate rd)
           
static java.lang.String toString(java.lang.Object headerValue, RuntimeDelegate rd)
          Convert a message header value, represented as a general object, to it's string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createInbound

public static AbstractMultivaluedMap<java.lang.String,java.lang.String> createInbound()
Create an empty inbound message headers container. Created container is mutable.

Returns:
a new empty mutable container for storing inbound message headers.

createInbound

public static AbstractMultivaluedMap<java.lang.String,java.lang.String> createInbound(MultivaluedMap<java.lang.String,java.lang.String> initial)
Create an inbound message headers container. Created container is mutable and is initialized with the supplied initial collection of headers.

Parameters:
initial - initial collection of headers to be used to initialize the created message headers container.
Returns:
a new mutable container for storing inbound message headers initialized with the supplied initial collection of headers.

createInbound

public static AbstractMultivaluedMap<java.lang.String,java.lang.String> createInbound(java.util.Map<java.lang.String,java.util.List<java.lang.String>> initial)
Create an inbound message headers container. Created container is mutable and is initialized with the supplied initial collection of headers supplied as a Map of String keys and List<String> values.

Parameters:
initial - initial collection of headers to be used to initialize the created message headers container.
Returns:
a new mutable container for storing inbound message headers initialized with the supplied initial collection of headers.

empty

public static <V> MultivaluedMap<java.lang.String,V> empty()
Get immutable empty message headers container. The factory method can be used to for both message header container types  –  inbound as well as outbound.

Type Parameters:
V - header value type. Typically Object in case of the outbound headers and String in case of the inbound headers.
Returns:
an immutable empty message headers container.

createOutbound

public static AbstractMultivaluedMap<java.lang.String,java.lang.Object> createOutbound()
Create an empty outbound message headers container. Created container is mutable.

Returns:
a new empty mutable container for storing outbound message headers.

createOutbound

public static AbstractMultivaluedMap<java.lang.String,java.lang.Object> createOutbound(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> initial)
Create an outbound message headers container. Created container is mutable and is initialized with the supplied initial collection of headers supplied as a Map of String keys and List<String> values.

Parameters:
initial - initial collection of headers to be used to initialize the created message headers container.
Returns:
a new mutable container for storing outbound message headers initialized with the supplied initial collection of headers.

toString

public static java.lang.String toString(java.lang.Object headerValue,
                                        RuntimeDelegate rd)
Convert a message header value, represented as a general object, to it's string representation.

This method defers to RuntimeDelegate.createHeaderDelegate(java.lang.Class) to obtain a RuntimeDelegate.HeaderDelegate to convert the value to a String. If a RuntimeDelegate.HeaderDelegate is not found then the toString() method on the header object is utilized.

Parameters:
headerValue - the header value represented as an object.
rd - runtime delegate instance to be used for header delegate retrieval. If null, a default RuntimeDelegate instance will be obtained and used.
Returns:
the string representation of the supplied header value.

toString

public static java.util.List<java.lang.String> toString(java.util.List<java.lang.Object> headerValues,
                                                        RuntimeDelegate rd)

toString

public static MultivaluedMap<java.lang.String,java.lang.String> toString(MultivaluedMap<java.lang.String,java.lang.Object> headers,
                                                                         RuntimeDelegate rd)


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.