Package net.oauth.http
Class HttpMessage
- java.lang.Object
-
- net.oauth.http.HttpMessage
-
- Direct Known Subclasses:
HttpResponseMessage
public class HttpMessage extends Object
An HTTP request or response.- Author:
- John Kristian
-
-
Field Summary
Fields Modifier and Type Field Description static StringACCEPT_ENCODINGprotected InputStreambodystatic StringCONTENT_ENCODINGstatic StringCONTENT_LENGTHstatic StringCONTENT_TYPEstatic StringDEFAULT_CHARSETList<Map.Entry<String,String>>headersStringmethodstatic StringREQUESTThe name of a dump entry whose value is the HTTP request.static StringRESPONSEThe name of a dump entry whose value is the HTTP response.static StringSTATUS_CODEThe name of a dump entry whose value is the HTTP status code.URLurl
-
Constructor Summary
Constructors Constructor Description HttpMessage()HttpMessage(String method, URL url)HttpMessage(String method, URL url, InputStream body)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddump(Map<String,Object> into)Put a description of this message and its origins into the given Map.InputStreamgetBody()StringgetContentCharset()StringgetHeader(String name)Get the value of the last header of the given name.static HttpMessagenewRequest(OAuthMessage from, ParameterStyle style)Construct an HTTP request from this OAuth message.protected InputStreamopenBody()StringremoveHeaders(String name)Remove all headers of the given name.
-
-
-
Field Detail
-
method
public String method
-
url
public URL url
-
body
protected InputStream body
-
REQUEST
public static final String REQUEST
The name of a dump entry whose value is the HTTP request.- See Also:
- Constant Field Values
-
RESPONSE
public static final String RESPONSE
The name of a dump entry whose value is the HTTP response.- See Also:
- Constant Field Values
-
STATUS_CODE
public static final 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 String ACCEPT_ENCODING
- See Also:
- Constant Field Values
-
CONTENT_ENCODING
public static final String CONTENT_ENCODING
- See Also:
- Constant Field Values
-
CONTENT_LENGTH
public static final String CONTENT_LENGTH
- See Also:
- Constant Field Values
-
CONTENT_TYPE
public static final String CONTENT_TYPE
- See Also:
- Constant Field Values
-
DEFAULT_CHARSET
public static final String DEFAULT_CHARSET
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HttpMessage
public HttpMessage()
-
HttpMessage
public HttpMessage(String method, URL url, InputStream body)
-
-
Method Detail
-
getHeader
public final String getHeader(String name)
Get the value of the last header of the given name. The name is case-insensitive.
-
removeHeaders
public String removeHeaders(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 String getContentCharset()
-
getBody
public final InputStream getBody() throws IOException
- Throws:
IOException
-
openBody
protected InputStream openBody() throws IOException
- Throws:
IOException
-
dump
public void dump(Map<String,Object> into) throws IOException
Put a description of this message and its origins into the given Map.- Throws:
IOException
-
newRequest
public static HttpMessage newRequest(OAuthMessage from, ParameterStyle style) throws IOException
Construct an HTTP request from this OAuth message.- Parameters:
style- where to put the OAuth parameters, within the HTTP request- Throws:
IOException
-
-