18 #ifndef _DECAF_NET_URLCONNECTION_H_
19 #define _DECAF_NET_URLCONNECTION_H_
31 class URLConnectionImpl;
44 URLConnectionImpl* impl;
46 static bool defaultAllowUserInteraction;
48 static bool defaultUseCaches;
108 virtual void connect() = 0;
119 return allowUserInteraction;
132 void setAllowUserInteraction(
bool newValue);
141 return getHeaderField(
"Content-Encoding");
151 return getHeaderFieldInt(
"Content-Length", -1);
161 return getHeaderField(
"Content-Type");
172 return getHeaderFieldDate(
"Date", 0);
181 return defaultUseCaches;
191 void setDefaultUseCaches(
bool newValue);
213 void setDoInput(
bool newValue);
235 void setDoOutput(
bool newValue);
244 return getHeaderFieldDate(
"Expires", 0);
276 void setUseCaches(
bool newValue);
283 int getConnectTimeout()
const;
296 void setConnectTimeout(
int timeout);
304 int getReadTimeout()
const;
317 void setReadTimeout(
int timeout);
326 return std::string(
"URLConnection:") + url.toString();
368 long long getHeaderFieldDate(
const std::string& field,
long long defaultValue)
const;
381 int getHeaderFieldInt(
const std::string& field,
int defaultValue)
const;
389 long long getLastModified()
const;
402 __FILE__, __LINE__,
"Does not support writing to the input stream");
416 __FILE__, __LINE__,
"Does not support writing to the output stream");
427 return ifModifiedSince;
441 void setIfModifiedSince(
long long newValue);
451 return defaultAllowUserInteraction;
462 defaultAllowUserInteraction = allows;
Definition: UnknownServiceException.h:27
bool getAllowUserInteraction() const
Gets the option value which indicates whether user interaction is allowed on this URLConnection...
Definition: URLConnection.h:118
static bool getDefaultAllowUserInteraction()
Gets the default setting whether this connection allows user interaction.
Definition: URLConnection.h:450
static void setDefaultAllowUserInteraction(bool allows)
Sets the default value for the flag indicating whether this connection allows user interaction or not...
Definition: URLConnection.h:461
Concrete implementations of the abstract.
Definition: URLConnection.h:41
bool connected
Specifies whether this.
Definition: URLConnection.h:71
bool getDefaultUseCaches() const
Gets the default setting whether this connection allows using caches.
Definition: URLConnection.h:180
bool useCaches
Specifies whether the using of caches is enabled or the data has to be recent for every request...
Definition: URLConnection.h:64
long getExpiration() const
Gets the timestamp when this response will be expired in milliseconds since January 1...
Definition: URLConnection.h:243
bool getDoOutput() const
Gets the value of the option doOutput which specifies whether this connection allows to send data...
Definition: URLConnection.h:221
bool getDoInput() const
Gets the value of the option.
Definition: URLConnection.h:199
virtual decaf::io::InputStream * getInputStream()
Gets an InputStream for reading data from the resource pointed by this URLConnection.
Definition: URLConnection.h:400
int getContentLength() const
Gets the content length in bytes specified by the response header field 'content-length' or '-1' if t...
Definition: URLConnection.h:150
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 na...
Definition: URLConnection.h:353
bool allowUserInteraction
Specifies whether this.
Definition: URLConnection.h:87
long long ifModifiedSince
The data must be modified more recently than this time in milliseconds since January 1...
Definition: URLConnection.h:58
URL url
Definition: URLConnection.h:52
bool getUseCaches() const
Gets the value of the flag which specifies whether this URLConnection allows to use caches...
Definition: URLConnection.h:262
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 fiel...
Definition: URLConnection.h:339
virtual decaf::io::OutputStream * getOutputStream()
Gets an OutputStream for writing data to this URLConnection.
Definition: URLConnection.h:414
#define DECAF_API
Definition: Config.h:29
long long getDate() const
Gets the timestamp when this response has been sent as a date in milliseconds since January 1...
Definition: URLConnection.h:171
#define DECAF_UNUSED
Definition: Config.h:160
Base interface for any class that wants to represent an output stream of bytes.
Definition: OutputStream.h:39
long long getIfModifiedSince() const
Gets the point of time since when the data must be modified to be transmitted.
Definition: URLConnection.h:426
std::string getContentType() const
Gets the MIME-type of the content specified by the response header field 'content-type' or empty stri...
Definition: URLConnection.h:160
virtual std::string toString() const
Returns the string representation containing the name of this class and the URL.
Definition: URLConnection.h:325
bool doOutput
Specifies whether this.
Definition: URLConnection.h:76
Class URL represents a Uniform Resource Locator, a pointer to a "resource" on the World Wide Web...
Definition: URL.h:118
URL getURL() const
Gets the URL represented by this URLConnection.
Definition: URLConnection.h:252
bool doInput
Specifies whether this.
Definition: URLConnection.h:81
std::string getContentEncoding() const
Gets the content encoding type specified by the response header field content-encoding or empty strin...
Definition: URLConnection.h:140