mmhttp.protocol
Class ResponseParser
java.lang.Object
mmhttp.protocol.ResponseParser
public class ResponseParser
- extends java.lang.Object
Used to parse HTTP 1.1 responses.
Constructor Summary |
ResponseParser(java.io.InputStream input)
The Response will be read out of the provided InputStream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ResponseParser
public ResponseParser(java.io.InputStream input)
throws java.lang.Exception
- The Response will be read out of the provided InputStream.
- Parameters:
input
-
- Throws:
java.lang.Exception
getStatus
public int getStatus()
- Returns:
- the status of the response
getBody
public java.lang.String getBody()
- Returns:
- the body of the response
getHeader
public java.lang.String getHeader(java.lang.String key)
- Parameters:
key
-
- Returns:
- the value of the specified header, null if it doesn't exist
hasHeader
public boolean hasHeader(java.lang.String key)
- Parameters:
key
-
- Returns:
- true if the parsed response contains the specified header
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
- Returns:
- a human readable representation of the response.
performHttpRequest
public static ResponseParser performHttpRequest(java.lang.String hostname,
int hostPort,
RequestBuilder builder)
throws java.lang.Exception
- A convenience method that will perform a complete HTTP request, returning a parsed response.
- Parameters:
hostname
- hostPort
- builder
-
- Returns:
- parsed response.
- Throws:
java.lang.Exception
Copyright © 2009 Micah Martin. All Rights Reserved.