|
OpenAPI 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AQWebRequest
The AQWebRequest interface implements an HTTP method. The following methods are supported as of this release:
AQWebClient
which would read response data from the HTTP server and then return it to application
as an AQWebResponse
object.
Field-value pairs can be added to an AQWebRequest by invocation of
addParameter(String name, String value)
or addParameter(String name, String[] values)
.
For get
requests, field-value pairs are encoded as UTF-8 characters and appended to the URL as the query string.
For post
requests, field-value pairs are sent to server along with the request body.
The request represented by an AQWebRequest can be sent to an HTTP server by invoking one of these methods:
Please see AQWebClient
for example of creating an instance of an AQWebClient.
Once a request is successfully processed, a response object is returned to the caller.
Various information can be retrieved from the response object, please see AQWebResponse
for more information.
An instance of the object that implements the AQWebRequest interface can be instantiated via
AQWebClient.newWebRequest(String url)
.
Method Summary | |
---|---|
void |
addParameter(String name,
String value)
Adds a field-value pair to this object. |
void |
addParameter(String name,
String[] values)
Adds a field with multiple values to this object, duplicated values are ignored. |
void |
addRequestHeader(String headerName,
String headerValue)
Adds the specified request header, not overwriting any previous value. |
void |
addUpload(String filename,
byte[] source,
String contentType,
String charset)
Adds the array of bytes to be uploaded to remote server to this object. |
void |
addUpload(String filename,
String sourceFile,
String contentType,
String charset)
Adds the array of bytes to be uploaded to remote server to this object. |
void |
clearUploads()
Removes all of uploads that were added to this request using addUpload(String filename, String sourceFile, String contentType, String charset) and
addUpload(String filename, byte[] source, String contentType, String charset) . |
String |
getAcceptCharsetHeader()
Returns the value of the Accept-Charset request header. |
String |
getAcceptEncodingHeader()
Returns the value of the Accept-Encoding request header. |
String |
getAcceptHeader()
Returns the value of the Accept request header. |
String |
getAcceptLanguageHeader()
Returns the value of the Accept-Language request header. |
String |
getAllowHeader()
Returns the value of the Allow entity header. |
String |
getAuthorizationHeader()
Returns the value of the Authorization request header. |
String |
getCacheControlHeader()
Returns the value of the Cache-Control general header. |
String |
getConnectionHeader()
Returns the value of the Connection general header. |
String |
getContentEncodingHeader()
Returns the value of the Content-Encoding entity header. |
String |
getContentLanguageHeader()
Returns the value of the Content-Language entity header. |
int |
getContentLengthHeader()
Returns the value of the Content-Length entity header. |
String |
getContentLocationHeader()
Returns the value of the Content-Location entity header. |
String |
getContentMD5Header()
Returns the value of the Content-MD5 entity header. |
String |
getContentRangeHeader()
Returns the value of the Content-Range entity header. |
String |
getContentTypeHeader()
Returns the value of the Content-Type entity header. |
String |
getDateHeader()
Returns the value of the Date general header. |
String |
getExpectHeader()
Returns the value of the Expect request header. |
String |
getExpiresHeader()
Returns the value of the Expires entity header. |
String |
getFromHeader()
Returns the value of the From request header. |
String |
getHeaderField(String name)
Returns the header value associated with the given header name. |
List<String> |
getHeaderFields(String name)
Returns the header values associated with the given header name. |
Map<String,List<String>> |
getHeaderMap()
Returns all of headers this request currently has. |
String |
getHostHeader()
Returns the value of the Host request header. |
String |
getIfMatchHeader()
Returns the value of the If-Match request header. |
String |
getIfModifiedSinceHeader()
Returns the value of the If-Modified-Since request header. |
String |
getIfNoneMatchHeader()
Returns the value of the If-None-Match request header. |
String |
getIfRangeHeader()
Returns the value of the If-Range request header. |
String |
getIfUnmodifiedSinceHeader()
Returns the value of the If-Unmodified-Since request header. |
String |
getLastModifiedHeader()
Returns the value of the Last-Modified entity header. |
String |
getMaxForwardsHeader()
Returns the value of the Max-Forwards request header. |
String |
getPragmaHeader()
Returns the value of the Pragma general header. |
String |
getProxyAuthorizationHeader()
Returns the value of the Proxy-Authorization request header. |
String |
getRangeHeader()
Returns the value of the Range request header. |
String |
getRefererHeader()
Returns the value of the Referer request header. |
String |
getTEHeader()
Returns the value of the TE request header. |
String |
getTrailerHeader()
Returns the value of the Trailer general header. |
String |
getTransferEncodingHeader()
Returns the value of the Transfer-Encoding general header. |
String |
getUpgradeHeader()
Returns the value of the Upgrade general header. |
String |
getURL()
Returns the URL string to which this request to be sent. |
String |
getUserAgentHeader()
Returns the value of the User-Agent request header. |
String |
getViaHeader()
Returns the value of the Via general header. |
String |
getWarningHeader()
Returns the value of the Warning general header. |
void |
removeParameter(String name)
Removes a field with all values from this request. |
void |
removeRequestHeader(String headerName)
Remove the request header associated with the given name. |
void |
setUserAgentHeader(String headerValue)
Sets the value of the User-Agent request header. |
String |
toString()
Returns a string representation of this object. |
Method Detail |
---|
void addParameter(String name, String value) throws Exception
name
- the name of the fieldvalue
- the value of the field
Exception
- if name or value is a null object, or name containing spaces onlyvoid addParameter(String name, String[] values) throws Exception
name
- the name of the fieldvalues
- the list of values
Exception
void removeParameter(String name)
name
- the name of the fieldvoid addUpload(String filename, String sourceFile, String contentType, String charset) throws Exception
filename
- the filename to use for the uploaded filesourceFile
- the file to uploadcontentType
- the content type for the file to upload; defaults to application/octet-stream if nullcharset
- the charset encoding for the file to upload; defaults to ISO-8859-1 if null
Exception
void addUpload(String filename, byte[] source, String contentType, String charset) throws Exception
filename
- the filename to use for the uploaded contentsource
- the content to uploadcontentType
- the content type for the source to upload; defaults to application/octet-stream if nullcharset
- the charset encoding for the source to upload; defaults to ISO-8859-1 if null
Exception
void clearUploads()
addUpload(String filename, String sourceFile, String contentType, String charset)
and
addUpload(String filename, byte[] source, String contentType, String charset)
.
String getURL()
void addRequestHeader(String headerName, String headerValue)
headerName
- the header's nameheaderValue
- the header's valuevoid removeRequestHeader(String headerName)
headerName
- the header's nameMap<String,List<String>> getHeaderMap()
List<String> getHeaderFields(String name)
name
- the name of the header
String getHeaderField(String name)
name
- the name of the header
String getCacheControlHeader()
Cache-Control
general header.
Cache-Control
header is not definedString getConnectionHeader()
Connection
general header.
Connection
header is not definedString getDateHeader()
Date
general header.
Date
header is not definedString getPragmaHeader()
Pragma
general header.
Pragma
header is not definedString getTrailerHeader()
Trailer
general header.
Trailer
header is not definedString getTransferEncodingHeader()
Transfer-Encoding
general header.
Transfer-Encoding
header is not definedString getUpgradeHeader()
Upgrade
general header.
Upgrade
header is not definedString getViaHeader()
Via
general header.
Via
header is not definedString getWarningHeader()
Warning
general header.
Warning
header is not definedString getAllowHeader()
Allow
entity header.
Allow
header is not definedString getContentEncodingHeader()
Content-Encoding
entity header.
Content-Encoding
header is not definedString getContentLanguageHeader()
Content-Language
entity header.
Content-Language
header is not definedint getContentLengthHeader()
Content-Length
entity header.
Content-Length
header is not definedString getContentLocationHeader()
Content-Location
entity header.
Content-Location
header is not definedString getContentMD5Header()
Content-MD5
entity header.
Content-MD5
header is not definedString getContentRangeHeader()
Content-Range
entity header.
Content-Range
header is not definedString getContentTypeHeader()
Content-Type
entity header.
Content-Type
header is not definedString getExpiresHeader()
Expires
entity header.
Expires
header is not definedString getLastModifiedHeader()
Last-Modified
entity header.
Last-Modified
header is not definedString getAcceptHeader()
Accept
request header.
Accept
header is not definedString getAcceptCharsetHeader()
Accept-Charset
request header.
Accept-Charset
header is not definedString getAcceptEncodingHeader()
Accept-Encoding
request header.
Accept-Encoding
header is not definedString getAcceptLanguageHeader()
Accept-Language
request header.
Accept-Language
header is not definedString getAuthorizationHeader()
Authorization
request header.
Authorization
header is not definedString getExpectHeader()
Expect
request header.
Expect
header is not definedString getFromHeader()
From
request header.
From
header is not definedString getHostHeader()
Host
request header.
Host
header is not definedString getIfMatchHeader()
If-Match
request header.
If-Match
header is not definedString getIfModifiedSinceHeader()
If-Modified-Since
request header.
If-Modified-Since
header is not definedString getIfNoneMatchHeader()
If-None-Match
request header.
If-None-Match
header is not definedString getIfRangeHeader()
If-Range
request header.
If-Range
header is not definedString getIfUnmodifiedSinceHeader()
If-Unmodified-Since
request header.
If-Unmodified-Since
header is not definedString getMaxForwardsHeader()
Max-Forwards
request header.
Max-Forwards
header is not definedString getProxyAuthorizationHeader()
Proxy-Authorization
request header.
Proxy-Authorization
header is not definedString getRangeHeader()
Range
request header.
Range
header is not definedString getRefererHeader()
Referer
request header.
Referer
header is not definedString getTEHeader()
TE
request header.
TE
header is not definedString getUserAgentHeader()
User-Agent
request header.
User-Agent
header is not definedvoid setUserAgentHeader(String headerValue)
User-Agent
request header.
headerValue
- the header's valueString toString()
toString
in class Object
|
OpenAPI 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |