IBM WebSphere Application ServerTM
Release 7

com.ibm.websphere.http.data.util
Class HTTPBindingUtil

java.lang.Object
  extended by com.ibm.websphere.http.data.util.HTTPBindingUtil

public class HTTPBindingUtil
extends java.lang.Object

An utility class to help in interacting with HTTP Data Binding APIs.


Field Summary
static java.lang.String COPYRIGHT
           
 
Constructor Summary
HTTPBindingUtil()
           
 
Method Summary
static boolean containsHeader(java.lang.String name, HTTPHeaders headers)
          Returns a boolean indicating whether the named http header has already been set.
static java.lang.String getHeader(java.lang.String name, HTTPHeaders headers)
          Returns the value of the specified http header as a String.
static void removeHeader(java.lang.String name, HTTPHeaders headers)
          Removes all headers with the specified name(case-insensitive).
static void setHeader(java.lang.String name, java.lang.String value, HTTPHeaders headers)
          Sets a http header with the given name and value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values
Constructor Detail

HTTPBindingUtil

public HTTPBindingUtil()
Method Detail

containsHeader

public static boolean containsHeader(java.lang.String name,
                                     HTTPHeaders headers)
Returns a boolean indicating whether the named http header has already been set.

Parameters:
name - the name of http header (case-insensitive)
headers - the header container
Returns:
true if the named http header has already been set; false otherwise
Throws:
java.lang.IllegalArgumentException - if name or headers is null

setHeader

public static void setHeader(java.lang.String name,
                             java.lang.String value,
                             HTTPHeaders headers)
Sets a http header with the given name and value. If the header had been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.

Parameters:
name - the name of the header (case-insensitive)
value - the header value
headers - the header container.
Throws:
java.lang.IllegalArgumentException - if header name or headers is null.

getHeader

public static java.lang.String getHeader(java.lang.String name,
                                         HTTPHeaders headers)
Returns the value of the specified http header as a String. If the request did not include a header of the specified name, this method returns null. If there are multiple headers with the same name, this method returns the first header value. The header name is case insensitive.

Parameters:
name - the http header name (case-insensitive)
headers - http header container
Returns:
String header value
Throws:
java.lang.IllegalArgumentException - if name or headers are null

removeHeader

public static void removeHeader(java.lang.String name,
                                HTTPHeaders headers)
Removes all headers with the specified name(case-insensitive).

Parameters:
name - http header name (case-insensitive)
headers - http header container
Throws:
java.lang.IllegalArgumentException - if name or headers is null

IBM WebSphere Application ServerTM
Release 7