|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.buglabs.util.simplerestclient.HTTPResponse
public class HTTPResponse
Class for wrapping the response connection. This is returned when calling get/post/put/delete/head on an HttpRequest object Use this object to check status code and get data from request
| Field Summary | |
|---|---|
static int |
HTTP_CODE_BAD_REQUEST
400 general error |
static int |
HTTP_CODE_CREATED
201 resource created |
static int |
HTTP_CODE_INTERNAL_ERROR
500 internal/application error |
static int |
HTTP_CODE_NOT_AUTHORIZED
401 not authorized |
static int |
HTTP_CODE_NOT_FOUND
404 not found |
static int |
HTTP_CODE_OK
200 general success |
static int |
HTTP_CODE_UNSUPPORTED_TYPE
415 unsupported media type |
| Constructor Summary | |
|---|---|
HTTPResponse(java.net.HttpURLConnection connection)
constructor must take in an HttpURLConnection |
|
| Method Summary | |
|---|---|
void |
checkStatus()
Check the response status in http header throw error if an error status is returned |
java.lang.String |
getErrorMessage()
Get error message out of connection |
java.lang.String |
getHeaderField(java.lang.String key)
Gets a header value from the http response |
int |
getResponseCode()
get response code from request |
java.io.InputStream |
getStream()
Get an input stream from the connection |
java.lang.String |
getString()
Get a string from the connection |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int HTTP_CODE_OK
public static final int HTTP_CODE_CREATED
public static final int HTTP_CODE_BAD_REQUEST
public static final int HTTP_CODE_NOT_AUTHORIZED
public static final int HTTP_CODE_NOT_FOUND
public static final int HTTP_CODE_UNSUPPORTED_TYPE
public static final int HTTP_CODE_INTERNAL_ERROR
| Constructor Detail |
|---|
public HTTPResponse(java.net.HttpURLConnection connection)
| Method Detail |
|---|
public void checkStatus()
throws java.io.IOException,
HTTPException
java.io.IOException
HTTPException
public java.io.InputStream getStream()
throws java.io.IOException,
HTTPException
connection -
BugnetException
java.io.IOException
HTTPException
public java.lang.String getString()
throws java.io.IOException,
HTTPException
connection -
java.io.IOException
HTTPExceptionpublic int getResponseCode()
connection -
public java.lang.String getHeaderField(java.lang.String key)
key -
public java.lang.String getErrorMessage()
throws java.io.IOException
connection -
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||