com.ibm.websphere.http.data.util

Class HTTPBindingUtil

  1. java.lang.Object
  2. extended bycom.ibm.websphere.http.data.util.HTTPBindingUtil

  1. public class HTTPBindingUtil
  2. extends java.lang.Object
An utility class to help in interacting with HTTP Data Binding APIs.

Field Summary

Modifier and Type Field and Description
  1. static
  2. java.lang.String
COPYRIGHT

Constructor Summary

Constructor and Description
HTTPBindingUtil()

Method Summary

Modifier and Type Method and Description
  1. static
  2. boolean
containsHeader(java.lang.String name,HTTPHeaders headers)
Returns a boolean indicating whether the named http header has already been set.
  1. static
  2. java.lang.String
getHeader(java.lang.String name,HTTPHeaders headers)
Returns the value of the specified http header as a String.
  1. static
  2. void
removeHeader(java.lang.String name,HTTPHeaders headers)
Removes all headers with the specified name(case-insensitive).
  1. static
  2. 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

  1. public static final java.lang.String COPYRIGHT
See Also:

Constructor Detail

HTTPBindingUtil

  1. public HTTPBindingUtil()

Method Detail

containsHeader

  1. public static boolean containsHeader( java.lang.String name,
  2. 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

  1. public static void setHeader(java.lang.String name,
  2. java.lang.String value,
  3. 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

  1. public static java.lang.String getHeader( java.lang.String name,
  2. 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

  1. public static void removeHeader( java.lang.String name,
  2. 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