public class HTTPRequest extends HttpURLConnection
java.net.HttpURLConnection
; see the documentation on that class
for more information.Modifier and Type | Field and Description |
---|---|
private static String |
CRLF |
private boolean |
gotHeaders |
private Vector |
headers |
private Vector |
keyList |
private Hashtable |
keys |
private static char |
keySeparator |
private Socket |
socket |
chunkLength, fixedContentLength, fixedContentLengthLong, HTTP_ACCEPTED, HTTP_BAD_GATEWAY, HTTP_BAD_METHOD, HTTP_BAD_REQUEST, HTTP_CLIENT_TIMEOUT, HTTP_CONFLICT, HTTP_CREATED, HTTP_ENTITY_TOO_LARGE, HTTP_FORBIDDEN, HTTP_GATEWAY_TIMEOUT, HTTP_GONE, HTTP_INTERNAL_ERROR, HTTP_LENGTH_REQUIRED, HTTP_MOVED_PERM, HTTP_MOVED_TEMP, HTTP_MULT_CHOICE, HTTP_NO_CONTENT, HTTP_NOT_ACCEPTABLE, HTTP_NOT_AUTHORITATIVE, HTTP_NOT_FOUND, HTTP_NOT_IMPLEMENTED, HTTP_NOT_MODIFIED, HTTP_OK, HTTP_PARTIAL, HTTP_PAYMENT_REQUIRED, HTTP_PRECON_FAILED, HTTP_PROXY_AUTH, HTTP_REQ_TOO_LONG, HTTP_RESET, HTTP_SEE_OTHER, HTTP_SERVER_ERROR, HTTP_UNAUTHORIZED, HTTP_UNAVAILABLE, HTTP_UNSUPPORTED_TYPE, HTTP_USE_PROXY, HTTP_VERSION, instanceFollowRedirects, method, responseCode, responseMessage
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
Constructor and Description |
---|
HTTPRequest(URL url)
Construct a new
HTTPRequest for the given URL. |
Modifier and Type | Method and Description |
---|---|
void |
connect()
Connect to the HTTP server.
|
void |
disconnect()
Disconnect from the HTTP server.
|
String |
getHeaderField(String key)
Get the header field value for the specified key.
|
String |
getHeaderFieldKey(int n)
Get the header field key for the specified position.
|
void |
getHeaders()
Retrieve header key/value pairs.
|
InputStream |
getInputStream()
Get the input stream associated with the request.
|
OutputStream |
getOutputStream()
Get the output stream associated with the request.
|
private String |
recv(InputStream in) |
private void |
send(OutputStream out,
String s) |
boolean |
usingProxy()
Determine if this implementation uses a proxy.
|
getErrorStream, getFollowRedirects, getHeaderField, getHeaderFieldDate, getInstanceFollowRedirects, getPermission, getRequestMethod, getResponseCode, getResponseMessage, setChunkedStreamingMode, setFixedLengthStreamingMode, setFixedLengthStreamingMode, setFollowRedirects, setInstanceFollowRedirects, setRequestMethod
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentLengthLong, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderFieldInt, getHeaderFieldLong, getHeaderFields, getIfModifiedSince, getLastModified, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString
private static final char keySeparator
private boolean gotHeaders
private static final String CRLF
public HTTPRequest(URL url)
HTTPRequest
for the given URL.url
- The URL identifying the destination of the transaction.public void connect() throws IOException
connect
in class URLConnection
IOException
- If the connection failed.public void disconnect()
disconnect
in class HttpURLConnection
public boolean usingProxy()
usingProxy
in class HttpURLConnection
false
.public InputStream getInputStream() throws IOException
getInputStream
in class URLConnection
IOException
public OutputStream getOutputStream() throws IOException
getOutputStream
in class URLConnection
IOException
public String getHeaderField(String key)
getHeaderField
in class URLConnection
key
- The key.public String getHeaderFieldKey(int n)
getHeaderFieldKey
in class HttpURLConnection
n
- The position.private void send(OutputStream out, String s) throws IOException
IOException
private String recv(InputStream in) throws IOException
IOException
public void getHeaders()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses