activemq-cpp-3.9.0
decaf::net::URLConnection Class Referenceabstract

Concrete implementations of the abstract. More...

#include <src/main/decaf/net/URLConnection.h>

Inheritance diagram for decaf::net::URLConnection:

Public Member Functions

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::InputStreamgetInputStream ()
 Gets an InputStream for reading data from the resource pointed by this URLConnection. More...
 
virtual decaf::io::OutputStreamgetOutputStream ()
 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 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...
 

Protected Member Functions

 URLConnection (const URL &url)
 

Protected Attributes

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...
 

Detailed Description

Concrete implementations of the abstract.

URLConnection

class provide a communication link to a URL for exchanging data with a specific protocol type. A

URLConnection

can only be set up after the instantiation but before connecting to the remote resource.

Since
1.0

Constructor & Destructor Documentation

decaf::net::URLConnection::URLConnection ( const URL url)
protected
virtual decaf::net::URLConnection::~URLConnection ( )
virtual

Member Function Documentation

virtual void decaf::net::URLConnection::connect ( )
pure virtual

Establishes the connection to the earlier configured resource.

The connection can only be set up before this method has been called.

Exceptions
IOExceptionif an error occurs while connecting to the resource.
bool decaf::net::URLConnection::getAllowUserInteraction ( ) const
inline

Gets the option value which indicates whether user interaction is allowed on this URLConnection.

Returns
the value of the option allowUserInteraction.
int decaf::net::URLConnection::getConnectTimeout ( ) const

Gets the configured connecting timeout.

Returns
the connecting timeout value in milliseconds.
std::string decaf::net::URLConnection::getContentEncoding ( ) const
inline

Gets the content encoding type specified by the response header field content-encoding or empty string if this field is not set.

Returns
the value of the response header field 'content-encoding'.
int decaf::net::URLConnection::getContentLength ( ) const
inline

Gets the content length in bytes specified by the response header field 'content-length' or '-1' if this field is not set.

Returns
the value of the response header field 'content-length'.
std::string decaf::net::URLConnection::getContentType ( ) const
inline

Gets the MIME-type of the content specified by the response header field 'content-type' or empty string if type is unknown.

Returns
the value of the response header field 'content-type'.
long long decaf::net::URLConnection::getDate ( ) const
inline

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.

Returns
the sending timestamp of the current response.
static bool decaf::net::URLConnection::getDefaultAllowUserInteraction ( )
inlinestatic

Gets the default setting whether this connection allows user interaction.

Returns
the value of the default setting defaultAllowUserInteraction.
bool decaf::net::URLConnection::getDefaultUseCaches ( ) const
inline

Gets the default setting whether this connection allows using caches.

Returns
the value of the default setting defaultUseCaches.
bool decaf::net::URLConnection::getDoInput ( ) const
inline

Gets the value of the option.

which specifies whether this connection allows to receive data.

Returns
true if this connection allows input, false otherwise.
bool decaf::net::URLConnection::getDoOutput ( ) const
inline

Gets the value of the option doOutput which specifies whether this connection allows to send data.

Returns
true if this connection allows output, false otherwise.
long decaf::net::URLConnection::getExpiration ( ) const
inline

Gets the timestamp when this response will be expired in milliseconds since January 1, 1970 GMT or 0 if this timestamp is unknown.

Returns
the value of the response header field expires.
virtual std::string decaf::net::URLConnection::getHeaderField ( int pos  DECAF_UNUSED) const
inlinevirtual

Gets the header value at the field position pos or empty string if the header has fewer than pos fields.

The current implementation of this method returns always empty string.

Parameters
posthe field position of the response header.
Returns
the value of the field at position pos.
virtual std::string decaf::net::URLConnection::getHeaderField ( const std::string &key  DECAF_UNUSED) const
inlinevirtual

Gets the value of the header field specified by key or empty string if there is no field with this name.

The current implementation of this method returns always empty string.

Parameters
keythe name of the header field.
Returns
the value of the header field.
long long decaf::net::URLConnection::getHeaderFieldDate ( const std::string &  field,
long long  defaultValue 
) const

Gets the specified header value as a date in milliseconds since January 1, 1970 GMT.

Returns the defaultValue if no such header field could be found.

Parameters
fieldthe header field name whose value is needed.
defaultValuethe default value if no field has been found.
Returns
the value of the specified header field as a date in milliseconds.
int decaf::net::URLConnection::getHeaderFieldInt ( const std::string &  field,
int  defaultValue 
) const

Gets the specified header value as a number.

Returns the defaultValue} if no such header field could be found or the value could not be parsed as an Integer.

Parameters
fieldthe header field name whose value is needed.
defaultValuethe default value if no field has been found.
Returns
the value of the specified header field as a number.
long long decaf::net::URLConnection::getIfModifiedSince ( ) const
inline

Gets the point of time since when the data must be modified to be transmitted.

Some protocols transmit data only if it has been modified more recently than a particular time.

Returns
the time in milliseconds since January 1, 1970 GMT.
virtual decaf::io::InputStream* decaf::net::URLConnection::getInputStream ( )
inlinevirtual

Gets an InputStream for reading data from the resource pointed by this URLConnection.

It throws an UnknownServiceException by default. This method must be overridden by its subclasses.

Returns
the InputStream to read data from.
Exceptions
IOExceptionif no InputStream could be created.
long long decaf::net::URLConnection::getLastModified ( ) const

Gets the value of the response header field 'last-modified' or zero if this value is not set.

Returns
the value of the 'last-modified' header field.
virtual decaf::io::OutputStream* decaf::net::URLConnection::getOutputStream ( )
inlinevirtual

Gets an OutputStream for writing data to this URLConnection.

It throws an UnknownServiceException by default. This method must be overridden by its subclasses.

Returns
the OutputStream to write data.
Exceptions
IOExceptionif no OutputStream could be created.
int decaf::net::URLConnection::getReadTimeout ( ) const

Gets the configured timeout for reading from the input stream of an established connection to the resource.

Returns
the reading timeout value in milliseconds.
URL decaf::net::URLConnection::getURL ( ) const
inline

Gets the URL represented by this URLConnection.

Returns
the URL of this connection.
bool decaf::net::URLConnection::getUseCaches ( ) const
inline

Gets the value of the flag which specifies whether this URLConnection allows to use caches.

Returns
true if using caches is allowed, false otherwise.
void decaf::net::URLConnection::setAllowUserInteraction ( bool  newValue)

Sets the flag indicating whether this connection allows user interaction or not.

This method can only be called prior to the connection establishment.

Parameters
newValuethe value of the flag to be set.
Exceptions
IllegalStateExceptionif this method attempts to change the flag after the connection has been established.
void decaf::net::URLConnection::setConnectTimeout ( int  timeout)

Sets the timeout value in milliseconds for establishing the connection to the resource pointed by this URLConnection instance.

A SocketTimeoutException is thrown if the connection could not be established in this time. Default is 0 which stands for an infinite timeout.

Parameters
timeoutthe connecting timeout in milliseconds.
Exceptions
IllegalArgumentExceptionif the parameter timeout is less than zero.
static void decaf::net::URLConnection::setDefaultAllowUserInteraction ( bool  allows)
inlinestatic

Sets the default value for the flag indicating whether this connection allows user interaction or not.

Existing URLConnections are unaffected.

Parameters
allowsthe default value of the flag to be used for new connections.
void decaf::net::URLConnection::setDefaultUseCaches ( bool  newValue)

Sets the default value for the flag indicating whether this connection allows to use caches.

Existing URLConnections are unaffected.

Parameters
newValuethe default value of the flag to be used for new connections.
void decaf::net::URLConnection::setDoInput ( bool  newValue)

Sets the flag indicating whether this URLConnection allows input.

It cannot be set after the connection is established.

Parameters
newValuethe new value for the flag to be set.
Exceptions
IllegalAccessErrorif this method attempts to change the value after the connection has been already established.
void decaf::net::URLConnection::setDoOutput ( bool  newValue)

Sets the flag indicating whether this URLConnection allows output.

It cannot be set after the connection is established.

Parameters
newValuethe new value for the flag to be set.
Exceptions
IllegalAccessErrorif this method attempts to change the value after the connection has been already established.
void decaf::net::URLConnection::setIfModifiedSince ( long long  newValue)

Sets the point of time since when the data must be modified to be transmitted.

Some protocols transmit data only if it has been modified more recently than a particular time. The data will be transmitted regardless of its timestamp if this option is set to 0.

Parameters
newValuethe time in milliseconds since January 1, 1970 GMT.
Exceptions
IllegalStateExceptionif this URLConnection has already been connected.
void decaf::net::URLConnection::setReadTimeout ( int  timeout)

Sets the timeout value in milliseconds for reading from the input stream of an established connection to the resource.

A SocketTimeoutException is thrown if the connection could not be established in this time. Default is code 0 which stands for an infinite timeout.

Parameters
timeoutthe reading timeout in milliseconds.
Exceptions
IllegalArgumentExceptionif the parameter timeout is less than zero.
void decaf::net::URLConnection::setUseCaches ( bool  newValue)

Sets the flag indicating whether this connection allows to use caches or not.

This method can only be called prior to the connection establishment.

Parameters
newValuethe value of the flag to be set.
Exceptions
IllegalStateExceptionif this method attempts to change the flag after the connection has been established.
virtual std::string decaf::net::URLConnection::toString ( ) const
inlinevirtual

Returns the string representation containing the name of this class and the URL.

Returns
the string representation of this URLConnection instance.

Field Documentation

bool decaf::net::URLConnection::allowUserInteraction
protected

Specifies whether this.

URLConnection

allows user interaction as it is needed for authentication purposes.

bool decaf::net::URLConnection::connected
protected

Specifies whether this.

URLConnection

is already connected to the remote resource. If this field is set to

true

the flags for setting up the connection are not changeable anymore.

bool decaf::net::URLConnection::doInput
protected

Specifies whether this.

URLConnection

allows receiving data.

bool decaf::net::URLConnection::doOutput
protected

Specifies whether this.

URLConnection

allows sending data.

long long decaf::net::URLConnection::ifModifiedSince
protected

The data must be modified more recently than this time in milliseconds since January 1, 1970, GMT to be transmitted.

URL decaf::net::URLConnection::url
protected
bool decaf::net::URLConnection::useCaches
protected

Specifies whether the using of caches is enabled or the data has to be recent for every request.


The documentation for this class was generated from the following file: