|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface HttpConnection
This interface defines the necessary methods and constants for an HTTP connection.
HttpConnector
Field Summary | |
---|---|
static java.lang.String |
GET
HTTP Get method. |
static java.lang.String |
HEAD
HTTP Head method. |
static int |
HTTP_BAD_GATEWAY
502: The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request. |
static int |
HTTP_BAD_REQUEST
400: The request could not be understood by the server due to malformed syntax. |
static int |
HTTP_FORBIDDEN
403: The server understood the request, but is refusing to fulfill it. |
static int |
HTTP_INTERNAL_ERROR
500: The server encountered an unexpected condition which prevented it from fulfilling the request. |
static int |
HTTP_NOT_ACCEPTABLE
406: The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request. |
static int |
HTTP_NOT_FOUND
404: The server has not found anything matching the Request-URI. |
static int |
HTTP_NOT_MODIFIED
304: If the client has performed a conditional GET request and access is allowed, but the document has not been modified, the server SHOULD respond with this status code. |
static int |
HTTP_OK
200: The request has succeeded. |
static int |
HTTP_UNAUTHORIZED
401: The request requires user authentication. |
static int |
HTTP_UNAVAILABLE
503: The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. |
static java.lang.String |
POST
HTTP Post method. |
Method Summary | |
---|---|
void |
close()
Close the connection. |
java.lang.String |
getHeaderField(java.lang.String name)
Returns the value of the named header field. |
java.lang.String |
getRequestProperty(java.lang.String key)
Returns the value of the named general request property for this connection. |
int |
getResponseCode()
Returns the HTTP response status code, e.g., 200 (HTTP_OK). |
void |
open(java.lang.String url)
Create and open a Http connection. |
java.io.InputStream |
openInputStream()
Open and return an input stream for a connection. |
java.io.OutputStream |
openOutputStream()
Open and return an output stream for a connection. |
void |
setRequestMethod(java.lang.String method)
Set the method for the URL request, one of: GET, POST or HEAD. |
void |
setRequestProperty(java.lang.String key,
java.lang.String value)
Sets the general request property. |
Field Detail |
---|
static final java.lang.String GET
HTTP Get method.
static final java.lang.String POST
HTTP Post method.
static final java.lang.String HEAD
HTTP Head method.
static final int HTTP_OK
200: The request has succeeded.
static final int HTTP_FORBIDDEN
403: The server understood the request, but is refusing to fulfill it.
static final int HTTP_UNAVAILABLE
503: The server is currently unable to handle the request due to a temporary overloading or maintenance of the server.
static final int HTTP_NOT_MODIFIED
304: If the client has performed a conditional GET request and access is allowed, but the document has not been modified, the server SHOULD respond with this status code.
static final int HTTP_BAD_REQUEST
400: The request could not be understood by the server due to malformed syntax.
static final int HTTP_UNAUTHORIZED
401: The request requires user authentication. The response MUST include a WWW-Authenticate header field containing a challenge applicable to the requested resource.
static final int HTTP_NOT_FOUND
404: The server has not found anything matching the Request-URI.
static final int HTTP_NOT_ACCEPTABLE
406: The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.
static final int HTTP_INTERNAL_ERROR
500: The server encountered an unexpected condition which prevented it from fulfilling the request.
static final int HTTP_BAD_GATEWAY
502: The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.
Method Detail |
---|
void open(java.lang.String url) throws java.io.IOException
Create and open a Http connection.
url
- The URL for the connection.
java.io.IOException
- If an I/O error occurs.void close() throws java.io.IOException
Close the connection.
java.io.IOException
- If an I/O error occurs.int getResponseCode() throws java.io.IOException
Returns the HTTP response status code, e.g., 200 (HTTP_OK).
java.io.IOException
- If an I/O error occurs.java.io.InputStream openInputStream() throws java.io.IOException
Open and return an input stream for a connection.
java.io.IOException
- If an I/O error occurs.java.io.OutputStream openOutputStream() throws java.io.IOException
Open and return an output stream for a connection.
java.io.IOException
- If an I/O error occurs.void setRequestMethod(java.lang.String method) throws java.io.IOException
Set the method for the URL request, one of: GET, POST or HEAD.
method
- The HTTP method.
java.io.IOException
- If an I/O error occurs.void setRequestProperty(java.lang.String key, java.lang.String value) throws java.io.IOException
Sets the general request property. If a property with the key already exists, overwrite its value with the new value.
key
- The keyword by which the request is known (e.g., "accept").value
- the value associated with it.
java.io.IOException
- If an I/O error occurs.java.lang.String getRequestProperty(java.lang.String key) throws java.io.IOException
Returns the value of the named general request property for this connection.
key
- The keyword by which the request property is known
(e.g., "accept").
java.io.IOException
- If an I/O error occurs.java.lang.String getHeaderField(java.lang.String name) throws java.io.IOException
Returns the value of the named header field.
name
- Name of a header field.
java.io.IOException
- If an I/O error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |