activemq-cpp-3.9.0
|
This abstract subclass of URLConnection defines methods for managing HTTP connection according to the description given by RFC 2068. More...
#include <src/main/decaf/net/HttpURLConnection.h>
Public Member Functions | |
virtual | ~HttpURLConnection () |
virtual void | disconnect ()=0 |
Closes the connection to the HTTP server. More... | |
virtual decaf::io::InputStream * | getErrorStream () const |
Returns an input stream from the server in the case of an error such as the requested file has not been found on the remote server. More... | |
std::string | getRequestMethod () const |
Returns the request method which will be used to make the request to the remote HTTP server. More... | |
int | getResponseCode () |
Returns the response code returned by the remote HTTP server. More... | |
std::string | getResponseMessage () |
Returns the response message returned by the remote HTTP server. More... | |
void | setRequestMethod (const std::string &method) |
Sets the request command which will be sent to the remote HTTP server. More... | |
bool | getInstanceFollowRedirects () const |
Returns whether this connection follows redirects. More... | |
void | setInstanceFollowRedirects (bool followRedirects) |
Sets whether this connection follows redirects. More... | |
void | setFixedLengthStreamingMode (int contentLength) |
If the length of a HTTP request body is known ahead, sets fixed length to enable streaming without buffering. More... | |
void | setChunkedStreamingMode (int chunklen) |
If the length of a HTTP request body is NOT known ahead, enable chunked transfer encoding to enable streaming with buffering. More... | |
![]() | |
virtual | ~URLConnection () |
virtual void | connect ()=0 |
Establishes the connection to the earlier configured resource. More... | |
bool | getAllowUserInteraction () const |
Gets the option value which indicates whether user interaction is allowed on this URLConnection. More... | |
void | setAllowUserInteraction (bool newValue) |
Sets the flag indicating whether this connection allows user interaction or not. More... | |
std::string | getContentEncoding () const |
Gets the content encoding type specified by the response header field content-encoding or empty string if this field is not set. More... | |
int | getContentLength () const |
Gets the content length in bytes specified by the response header field 'content-length' or '-1' if this field is not set. More... | |
std::string | getContentType () const |
Gets the MIME-type of the content specified by the response header field 'content-type' or empty string if type is unknown. More... | |
long long | getDate () const |
Gets the timestamp when this response has been sent as a date in milliseconds since January 1, 1970 GMT or '0' if this timestamp is unknown. More... | |
bool | getDefaultUseCaches () const |
Gets the default setting whether this connection allows using caches. More... | |
void | setDefaultUseCaches (bool newValue) |
Sets the default value for the flag indicating whether this connection allows to use caches. More... | |
bool | getDoInput () const |
Gets the value of the option. More... | |
void | setDoInput (bool newValue) |
Sets the flag indicating whether this URLConnection allows input. More... | |
bool | getDoOutput () const |
Gets the value of the option doOutput which specifies whether this connection allows to send data. More... | |
void | setDoOutput (bool newValue) |
Sets the flag indicating whether this URLConnection allows output. More... | |
long | getExpiration () const |
Gets the timestamp when this response will be expired in milliseconds since January 1, 1970 GMT or 0 if this timestamp is unknown. More... | |
URL | getURL () const |
Gets the URL represented by this URLConnection. More... | |
bool | getUseCaches () const |
Gets the value of the flag which specifies whether this URLConnection allows to use caches. More... | |
void | setUseCaches (bool newValue) |
Sets the flag indicating whether this connection allows to use caches or not. More... | |
int | getConnectTimeout () const |
Gets the configured connecting timeout. More... | |
void | setConnectTimeout (int timeout) |
Sets the timeout value in milliseconds for establishing the connection to the resource pointed by this URLConnection instance. More... | |
int | getReadTimeout () const |
Gets the configured timeout for reading from the input stream of an established connection to the resource. More... | |
void | setReadTimeout (int timeout) |
Sets the timeout value in milliseconds for reading from the input stream of an established connection to the resource. More... | |
virtual std::string | toString () const |
Returns the string representation containing the name of this class and the URL. More... | |
virtual std::string | getHeaderField (int pos DECAF_UNUSED) const |
Gets the header value at the field position pos or empty string if the header has fewer than pos fields. More... | |
virtual std::string | getHeaderField (const std::string &key DECAF_UNUSED) const |
Gets the value of the header field specified by key or empty string if there is no field with this name. More... | |
long long | getHeaderFieldDate (const std::string &field, long long defaultValue) const |
Gets the specified header value as a date in milliseconds since January 1, 1970 GMT. More... | |
int | getHeaderFieldInt (const std::string &field, int defaultValue) const |
Gets the specified header value as a number. More... | |
long long | getLastModified () const |
Gets the value of the response header field 'last-modified' or zero if this value is not set. More... | |
virtual decaf::io::InputStream * | getInputStream () |
Gets an InputStream for reading data from the resource pointed by this URLConnection. More... | |
virtual decaf::io::OutputStream * | getOutputStream () |
Gets an OutputStream for writing data to this URLConnection. More... | |
long long | getIfModifiedSince () const |
Gets the point of time since when the data must be modified to be transmitted. More... | |
void | setIfModifiedSince (long long newValue) |
Sets the point of time since when the data must be modified to be transmitted. More... | |
Static Public Member Functions | |
static bool | getFollowRedirects () |
Returns the value of followRedirects which indicates if this connection follows a different URL redirected by the server. More... | |
static void | setFollowRedirects (bool follow) |
Sets the flag of whether this connection will follow redirects returned by the remote server. More... | |
![]() | |
static bool | getDefaultAllowUserInteraction () |
Gets the default setting whether this connection allows user interaction. More... | |
static void | setDefaultAllowUserInteraction (bool allows) |
Sets the default value for the flag indicating whether this connection allows user interaction or not. More... | |
Static Public Attributes | |
static const int | HTTP_ACCEPTED |
Numeric status code, 202: Accepted. More... | |
static const int | HTTP_BAD_GATEWAY |
Numeric status code, 502: Bad Gateway. More... | |
static const int | HTTP_BAD_METHOD |
Numeric status code, 405: Bad Method. More... | |
static const int | HTTP_BAD_REQUEST |
Numeric status code, 400: Bad Request. More... | |
static const int | HTTP_CLIENT_TIMEOUT |
Numeric status code, 408: Client Timeout. More... | |
static const int | HTTP_CONFLICT |
Numeric status code, 409: Conflict. More... | |
static const int | HTTP_CREATED |
Numeric status code, 201: Created. More... | |
static const int | HTTP_ENTITY_TOO_LARGE |
Numeric status code, 413: Entity too large. More... | |
static const int | HTTP_FORBIDDEN |
Numeric status code, 403: Forbidden. More... | |
static const int | HTTP_GATEWAY_TIMEOUT |
Numeric status code, 504: Gateway timeout. More... | |
static const int | HTTP_GONE |
Numeric status code, 410: Gone. More... | |
static const int | HTTP_INTERNAL_ERROR |
Numeric status code, 500: Internal error. More... | |
static const int | HTTP_LENGTH_REQUIRED |
Numeric status code, 411: Length required. More... | |
static const int | HTTP_MOVED_PERM |
Numeric status code, 301 Moved permanently. More... | |
static const int | HTTP_MOVED_TEMP |
Numeric status code, 302: Moved temporarily. More... | |
static const int | HTTP_MULT_CHOICE |
Numeric status code, 300: Multiple choices. More... | |
static const int | HTTP_NO_CONTENT |
Numeric status code, 204: No content. More... | |
static const int | HTTP_NOT_ACCEPTABLE |
Numeric status code, 406: Not acceptable. More... | |
static const int | HTTP_NOT_AUTHORITATIVE |
Numeric status code, 203: Not authoritative. More... | |
static const int | HTTP_NOT_FOUND |
Numeric status code, 404: Not found. More... | |
static const int | HTTP_NOT_IMPLEMENTED |
Numeric status code, 501: Not implemented. More... | |
static const int | HTTP_NOT_MODIFIED |
Numeric status code, 304: Not modified. More... | |
static const int | HTTP_OK |
Numeric status code, 200: OK. More... | |
static const int | HTTP_PARTIAL |
Numeric status code, 206: Partial. More... | |
static const int | HTTP_PAYMENT_REQUIRED |
Numeric status code, 402: Payment required. More... | |
static const int | HTTP_PRECON_FAILED |
Numeric status code, 412: Precondition failed. More... | |
static const int | HTTP_PROXY_AUTH |
Numeric status code, 407: Proxy authentication required. More... | |
static const int | HTTP_REQ_TOO_LONG |
Numeric status code, 414: Request too long. More... | |
static const int | HTTP_RESET |
Numeric status code, 205: Reset. More... | |
static const int | HTTP_SEE_OTHER |
Numeric status code, 303: See other. More... | |
static const int | HTTP_USE_PROXY |
Numeric status code, 305: Use proxy. More... | |
static const int | HTTP_UNAUTHORIZED |
Numeric status code, 401: Unauthorized. More... | |
static const int | HTTP_UNSUPPORTED_TYPE |
Numeric status code, 415: Unsupported type. More... | |
static const int | HTTP_UNAVAILABLE |
Numeric status code, 503: Unavailable. More... | |
static const int | HTTP_VERSION |
Numeric status code, 505: Version not supported. More... | |
Protected Member Functions | |
HttpURLConnection (const URL &url) | |
![]() | |
URLConnection (const URL &url) | |
Protected Attributes | |
std::string | method |
The HTTP request method of this HttpURLConnection. More... | |
int | responseCode |
The status code of the response obtained from the HTTP request. More... | |
std::string | responseMessage |
The HTTP response message which corresponds to the response code. More... | |
bool | instanceFollowRedirects |
Flag to define whether the protocol will automatically follow redirects or not. More... | |
int | chunkLength |
If the HTTP chunked encoding is enabled this parameter defines the chunk-length. More... | |
int | fixedContentLength |
If using HTTP fixed-length streaming mode this parameter defines the fixed length of content. More... | |
![]() | |
URL | url |
long long | ifModifiedSince |
The data must be modified more recently than this time in milliseconds since January 1, 1970, GMT to be transmitted. More... | |
bool | useCaches |
Specifies whether the using of caches is enabled or the data has to be recent for every request. More... | |
bool | connected |
Specifies whether this. More... | |
bool | doOutput |
Specifies whether this. More... | |
bool | doInput |
Specifies whether this. More... | |
bool | allowUserInteraction |
Specifies whether this. More... | |
This abstract subclass of URLConnection defines methods for managing HTTP connection according to the description given by RFC 2068.
|
virtual |
|
pure virtual |
Closes the connection to the HTTP server.
|
inlinevirtual |
Returns an input stream from the server in the case of an error such as the requested file has not been found on the remote server.
This stream can be used to read the data the server will send back.
References NULL.
|
inlinestatic |
Returns the value of followRedirects which indicates if this connection follows a different URL redirected by the server.
It is enabled by default.
|
inline |
Returns whether this connection follows redirects.
|
inline |
Returns the request method which will be used to make the request to the remote HTTP server.
All possible methods of this HTTP implementation is listed in the class definition.
int decaf::net::HttpURLConnection::getResponseCode | ( | ) |
Returns the response code returned by the remote HTTP server.
IOException | if there is an IO error during the retrieval. |
std::string decaf::net::HttpURLConnection::getResponseMessage | ( | ) |
Returns the response message returned by the remote HTTP server.
IOException | if there is an error during the retrieval. |
void decaf::net::HttpURLConnection::setChunkedStreamingMode | ( | int | chunklen | ) |
If the length of a HTTP request body is NOT known ahead, enable chunked transfer encoding to enable streaming with buffering.
Notice that not all http servers support this mode. Sets after connection will cause an exception.
chunklen | the length of a chunk. |
IllegalStateException | if already connected or an other mode already set. |
void decaf::net::HttpURLConnection::setFixedLengthStreamingMode | ( | int | contentLength | ) |
If the length of a HTTP request body is known ahead, sets fixed length to enable streaming without buffering.
Sets after connection will cause an exception.
contentLength | the fixed length of the HTTP request body. |
IllegalStateException | if already connected or an other mode already set. |
IllegalArgumentException | if contentLength is less than zero. |
|
inlinestatic |
Sets the flag of whether this connection will follow redirects returned by the remote server.
follow | the value to enable or disable this option. |
|
inline |
Sets whether this connection follows redirects.
followRedirects | if this connection will follows redirects, false otherwise. |
void decaf::net::HttpURLConnection::setRequestMethod | ( | const std::string & | method | ) |
Sets the request command which will be sent to the remote HTTP server.
This method can only be called before the connection is made.
method | the string representing the method to be used. |
ProtocolException | if this is called after connected, or the method is not supported by this HTTP implementation. |
|
protected |
If the HTTP chunked encoding is enabled this parameter defines the chunk-length.
Default value is
that means the chunked encoding mode is disabled.
|
protected |
If using HTTP fixed-length streaming mode this parameter defines the fixed length of content.
Default value is
that means the fixed-length streaming mode is disabled.
|
static |
Numeric status code, 202: Accepted.
|
static |
Numeric status code, 502: Bad Gateway.
|
static |
Numeric status code, 405: Bad Method.
|
static |
Numeric status code, 400: Bad Request.
|
static |
Numeric status code, 408: Client Timeout.
|
static |
Numeric status code, 409: Conflict.
|
static |
Numeric status code, 201: Created.
|
static |
Numeric status code, 413: Entity too large.
|
static |
Numeric status code, 403: Forbidden.
|
static |
Numeric status code, 504: Gateway timeout.
|
static |
Numeric status code, 410: Gone.
|
static |
Numeric status code, 500: Internal error.
|
static |
Numeric status code, 411: Length required.
|
static |
Numeric status code, 301 Moved permanently.
|
static |
Numeric status code, 302: Moved temporarily.
|
static |
Numeric status code, 300: Multiple choices.
|
static |
Numeric status code, 204: No content.
|
static |
Numeric status code, 406: Not acceptable.
|
static |
Numeric status code, 203: Not authoritative.
|
static |
Numeric status code, 404: Not found.
|
static |
Numeric status code, 501: Not implemented.
|
static |
Numeric status code, 304: Not modified.
|
static |
Numeric status code, 200: OK.
|
static |
Numeric status code, 206: Partial.
|
static |
Numeric status code, 402: Payment required.
|
static |
Numeric status code, 412: Precondition failed.
|
static |
Numeric status code, 407: Proxy authentication required.
|
static |
Numeric status code, 414: Request too long.
|
static |
Numeric status code, 205: Reset.
|
static |
Numeric status code, 303: See other.
|
static |
Numeric status code, 401: Unauthorized.
|
static |
Numeric status code, 503: Unavailable.
|
static |
Numeric status code, 415: Unsupported type.
|
static |
Numeric status code, 305: Use proxy.
|
static |
Numeric status code, 505: Version not supported.
|
protected |
Flag to define whether the protocol will automatically follow redirects or not.
The default value is
.
|
protected |
The HTTP request method of this HttpURLConnection.
The default value is "GET".
|
protected |
The status code of the response obtained from the HTTP request.
The default value is
.
1xx: Informational 2xx: Success 3xx: Relocation/Redirection 4xx: Client Error 5xx: Server Error
|
protected |
The HTTP response message which corresponds to the response code.