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;
119 return allowUserInteraction;
141 return getHeaderField(
"Content-Encoding");
151 return getHeaderFieldInt(
"Content-Length", -1);
161 return getHeaderField(
"Content-Type");
172 return getHeaderFieldDate(
"Date", 0);
181 return defaultUseCaches;
244 return getHeaderFieldDate(
"Expires", 0);
326 return std::string(
"URLConnection:") + url.
toString();
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;
451 return defaultAllowUserInteraction;
462 defaultAllowUserInteraction = allows;
Base interface for any class that wants to represent an output stream of bytes.
Definition: OutputStream.h:39
Concrete implementations of the abstract URLConnection class provide a communication link to a URL fo...
Definition: URLConnection.h:41
bool doOutput
Specifies whether this URLConnection allows sending data.
Definition: URLConnection.h:76
bool allowUserInteraction
Specifies whether this URLConnection allows user interaction as it is needed for authentication purpo...
Definition: URLConnection.h:87
void setConnectTimeout(int timeout)
Sets the timeout value in milliseconds for establishing the connection to the resource pointed by thi...
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.
long getExpiration() const
Gets the timestamp when this response will be expired in milliseconds since January 1,...
Definition: URLConnection.h:243
bool getUseCaches() const
Gets the value of the flag which specifies whether this URLConnection allows to use caches.
Definition: URLConnection.h:262
int getHeaderFieldInt(const std::string &field, int defaultValue) const
Gets the specified header value as a number.
virtual std::string toString() const
Returns the string representation containing the name of this class and the URL.
Definition: URLConnection.h:325
virtual decaf::io::OutputStream * getOutputStream()
Gets an OutputStream for writing data to this URLConnection.
Definition: URLConnection.h:414
virtual void connect()=0
Establishes the connection to the earlier configured resource.
void setDoOutput(bool newValue)
Sets the flag indicating whether this URLConnection allows output.
void setDoInput(bool newValue)
Sets the flag indicating whether this URLConnection allows input.
URL getURL() const
Gets the URL represented by this URLConnection.
Definition: URLConnection.h:252
virtual decaf::io::InputStream * getInputStream()
Gets an InputStream for reading data from the resource pointed by this URLConnection.
Definition: URLConnection.h:400
bool getDefaultUseCaches() const
Gets the default setting whether this connection allows using caches.
Definition: URLConnection.h:180
long long ifModifiedSince
The data must be modified more recently than this time in milliseconds since January 1,...
Definition: URLConnection.h:58
bool getDoInput() const
Gets the value of the option doInput which specifies whether this connection allows to receive data.
Definition: URLConnection.h:199
bool connected
Specifies whether this URLConnection is already connected to the remote resource.
Definition: URLConnection.h:71
int getConnectTimeout() const
Gets the configured connecting timeout.
void setUseCaches(bool newValue)
Sets the flag indicating whether this connection allows to use caches or not.
void setAllowUserInteraction(bool newValue)
Sets the flag indicating whether this connection allows user interaction or not.
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
bool doInput
Specifies whether this URLConnection allows receiving data.
Definition: URLConnection.h:81
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
static bool getDefaultAllowUserInteraction()
Gets the default setting whether this connection allows user interaction.
Definition: URLConnection.h:450
bool getAllowUserInteraction() const
Gets the option value which indicates whether user interaction is allowed on this URLConnection.
Definition: URLConnection.h:118
long long getLastModified() const
Gets the value of the response header field 'last-modified' or zero if this value is not set.
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 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
void setIfModifiedSince(long long newValue)
Sets the point of time since when the data must be modified to be transmitted.
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
URLConnection(const URL &url)
void setDefaultUseCaches(bool newValue)
Sets the default value for the flag indicating whether this connection allows to use caches.
long long getIfModifiedSince() const
Gets the point of time since when the data must be modified to be transmitted.
Definition: URLConnection.h:426
bool getDoOutput() const
Gets the value of the option doOutput which specifies whether this connection allows to send data.
Definition: URLConnection.h:221
std::string getContentEncoding() const
Gets the content encoding type specified by the response header field content-encoding or empty strin...
Definition: URLConnection.h:140
void setReadTimeout(int timeout)
Sets the timeout value in milliseconds for reading from the input stream of an established connection...
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
URL url
Definition: URLConnection.h:52
int getReadTimeout() const
Gets the configured timeout for reading from the input stream of an established connection to the res...
bool useCaches
Specifies whether the using of caches is enabled or the data has to be recent for every request.
Definition: URLConnection.h:64
Class URL represents a Uniform Resource Locator, a pointer to a "resource" on the World Wide Web.
Definition: URL.h:118
std::string toString() const
Calls toExternalForm to create a string representation of this URL.
Definition: UnknownServiceException.h:27
#define DECAF_API
Definition: Config.h:29
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition: AprPool.h:25