net.oauth.http
Class HttpMessage

java.lang.Object
  extended by net.oauth.http.HttpMessage
Direct Known Subclasses:
HttpResponseMessage

public class HttpMessage
extends java.lang.Object

An HTTP request or response.

Author:
John Kristian

Field Summary
static java.lang.String ACCEPT_ENCODING
           
protected  java.io.InputStream body
           
static java.lang.String CONTENT_ENCODING
           
static java.lang.String CONTENT_LENGTH
           
static java.lang.String CONTENT_TYPE
           
static java.lang.String DEFAULT_CHARSET
           
 java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> headers
           
 java.lang.String method
           
static java.lang.String REQUEST
          The name of a dump entry whose value is the HTTP request.
static java.lang.String RESPONSE
          The name of a dump entry whose value is the HTTP response.
static java.lang.String STATUS_CODE
          The name of a dump entry whose value is the HTTP status code.
 java.net.URL url
           
 
Constructor Summary
HttpMessage()
           
HttpMessage(java.lang.String method, java.net.URL url)
           
HttpMessage(java.lang.String method, java.net.URL url, java.io.InputStream body)
           
 
Method Summary
 void dump(java.util.Map<java.lang.String,java.lang.Object> into)
          Put a description of this message and its origins into the given Map.
 java.io.InputStream getBody()
           
 java.lang.String getContentCharset()
           
 java.lang.String getHeader(java.lang.String name)
          Get the value of the last header of the given name.
static HttpMessage newRequest(OAuthMessage from, ParameterStyle style)
          Construct an HTTP request from this OAuth message.
protected  java.io.InputStream openBody()
           
 java.lang.String removeHeaders(java.lang.String name)
          Remove all headers of the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

method

public java.lang.String method

url

public java.net.URL url

headers

public final java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> headers

body

protected java.io.InputStream body

REQUEST

public static final java.lang.String REQUEST
The name of a dump entry whose value is the HTTP request.

See Also:
Constant Field Values

RESPONSE

public static final java.lang.String RESPONSE
The name of a dump entry whose value is the HTTP response.

See Also:
Constant Field Values

STATUS_CODE

public static final java.lang.String STATUS_CODE
The name of a dump entry whose value is the HTTP status code.

See Also:
Constant Field Values

ACCEPT_ENCODING

public static final java.lang.String ACCEPT_ENCODING
See Also:
Constant Field Values

CONTENT_ENCODING

public static final java.lang.String CONTENT_ENCODING
See Also:
Constant Field Values

CONTENT_LENGTH

public static final java.lang.String CONTENT_LENGTH
See Also:
Constant Field Values

CONTENT_TYPE

public static final java.lang.String CONTENT_TYPE
See Also:
Constant Field Values

DEFAULT_CHARSET

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

HttpMessage

public HttpMessage()

HttpMessage

public HttpMessage(java.lang.String method,
                   java.net.URL url)

HttpMessage

public HttpMessage(java.lang.String method,
                   java.net.URL url,
                   java.io.InputStream body)
Method Detail

getHeader

public final java.lang.String getHeader(java.lang.String name)
Get the value of the last header of the given name. The name is case-insensitive.


removeHeaders

public java.lang.String removeHeaders(java.lang.String name)
Remove all headers of the given name. The name is case insensitive.

Returns:
the value of the last header with that name, or null to indicate there was no such header

getContentCharset

public final java.lang.String getContentCharset()

getBody

public final java.io.InputStream getBody()
                                  throws java.io.IOException
Throws:
java.io.IOException

openBody

protected java.io.InputStream openBody()
                                throws java.io.IOException
Throws:
java.io.IOException

dump

public void dump(java.util.Map<java.lang.String,java.lang.Object> into)
          throws java.io.IOException
Put a description of this message and its origins into the given Map.

Throws:
java.io.IOException

newRequest

public static HttpMessage newRequest(OAuthMessage from,
                                     ParameterStyle style)
                              throws java.io.IOException
Construct an HTTP request from this OAuth message.

Parameters:
style - where to put the OAuth parameters, within the HTTP request
Throws:
java.io.IOException


Copyright © 2009. All Rights Reserved.