activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject git commit: https://issues.apache.org/jira/browse/AMQCPP-511
Date Tue, 22 Oct 2013 22:41:02 GMT
Updated Branches:
  refs/heads/trunk c5a9f4521 -> 204deea62


https://issues.apache.org/jira/browse/AMQCPP-511

More implementation of http

Project: http://git-wip-us.apache.org/repos/asf/activemq-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-cpp/commit/204deea6
Tree: http://git-wip-us.apache.org/repos/asf/activemq-cpp/tree/204deea6
Diff: http://git-wip-us.apache.org/repos/asf/activemq-cpp/diff/204deea6

Branch: refs/heads/trunk
Commit: 204deea62b1507333ffc536e8cbb68ce0b44e368
Parents: c5a9f45
Author: Timothy Bish <tabish121@gmai.com>
Authored: Tue Oct 22 18:40:58 2013 -0400
Committer: Timothy Bish <tabish121@gmai.com>
Committed: Tue Oct 22 18:40:58 2013 -0400

----------------------------------------------------------------------
 activemq-cpp/src/main/Makefile.am               |   6 +
 .../main/decaf/net/ContentHandlerFactory.cpp    |  26 ++
 .../src/main/decaf/net/ContentHandlerFactory.h  |  55 +++
 activemq-cpp/src/main/decaf/net/FileNameMap.cpp |  25 ++
 activemq-cpp/src/main/decaf/net/FileNameMap.h   |  53 +++
 .../src/main/decaf/net/HttpURLConnection.cpp    | 171 ++++++++
 .../src/main/decaf/net/HttpURLConnection.h      | 415 +++++++++++++++++++
 activemq-cpp/src/main/decaf/net/URL.cpp         |   5 +
 activemq-cpp/src/main/decaf/net/URL.h           |   2 +
 .../src/main/decaf/net/URLConnection.cpp        | 164 +++++++-
 activemq-cpp/src/main/decaf/net/URLConnection.h | 415 ++++++++++++++++++-
 11 files changed, 1335 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/204deea6/activemq-cpp/src/main/Makefile.am
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/Makefile.am b/activemq-cpp/src/main/Makefile.am
index dc13f85..77cf0b6 100644
--- a/activemq-cpp/src/main/Makefile.am
+++ b/activemq-cpp/src/main/Makefile.am
@@ -478,8 +478,11 @@ cc_sources = \
     decaf/lang/exceptions/UnsupportedOperationException.cpp \
     decaf/net/BindException.cpp \
     decaf/net/ConnectException.cpp \
+    decaf/net/ContentHandlerFactory.cpp \
     decaf/net/DatagramPacket.cpp \
+    decaf/net/FileNameMap.cpp \
     decaf/net/HttpRetryException.cpp \
+    decaf/net/HttpURLConnection.cpp \
     decaf/net/Inet4Address.cpp \
     decaf/net/Inet6Address.cpp \
     decaf/net/InetAddress.cpp \
@@ -1152,8 +1155,11 @@ h_sources = \
     decaf/lang/exceptions/UnsupportedOperationException.h \
     decaf/net/BindException.h \
     decaf/net/ConnectException.h \
+    decaf/net/ContentHandlerFactory.h \
     decaf/net/DatagramPacket.h \
+    decaf/net/FileNameMap.h \
     decaf/net/HttpRetryException.h \
+    decaf/net/HttpURLConnection.h \
     decaf/net/Inet4Address.h \
     decaf/net/Inet6Address.h \
     decaf/net/InetAddress.h \

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/204deea6/activemq-cpp/src/main/decaf/net/ContentHandlerFactory.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/net/ContentHandlerFactory.cpp b/activemq-cpp/src/main/decaf/net/ContentHandlerFactory.cpp
new file mode 100644
index 0000000..e9a2fa2
--- /dev/null
+++ b/activemq-cpp/src/main/decaf/net/ContentHandlerFactory.cpp
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <decaf/net/ContentHandlerFactory.h>
+
+using namespace decaf;
+using namespace decaf::net;
+
+////////////////////////////////////////////////////////////////////////////////
+ContentHandlerFactory::~ContentHandlerFactory() {
+}
+

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/204deea6/activemq-cpp/src/main/decaf/net/ContentHandlerFactory.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/net/ContentHandlerFactory.h b/activemq-cpp/src/main/decaf/net/ContentHandlerFactory.h
new file mode 100644
index 0000000..ade4f49
--- /dev/null
+++ b/activemq-cpp/src/main/decaf/net/ContentHandlerFactory.h
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _DECAF_NET_CONTENTHANDLERFACTORY_H_
+#define _DECAF_NET_CONTENTHANDLERFACTORY_H_
+
+#include <decaf/util/Config.h>
+
+#include <string>
+
+namespace decaf {
+namespace net {
+
+    class ContentHandler;
+
+    /**
+     * Defines a factory interface for content handlers. An implementation of this interface
+     * must map a MIME type into an instance of ContentHandler.
+     *
+     * @since 1.0
+     */
+    class DECAF_API ContentHandlerFactory {
+    public:
+
+        virtual ~ContentHandlerFactory();
+
+        /**
+         * Creates a content handler to handle contentType.
+         *
+         * @param contentType
+         *      specifies the content type which is handled by the returned ContentHandler.
+         *
+         * @return content handler object for a specific content type.
+         */
+        virtual ContentHandler* createContentHandler(const std::string& contentType) = 0;
+
+    };
+
+}}
+
+#endif /* _DECAF_NET_CONTENTHANDLERFACTORY_H_ */

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/204deea6/activemq-cpp/src/main/decaf/net/FileNameMap.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/net/FileNameMap.cpp b/activemq-cpp/src/main/decaf/net/FileNameMap.cpp
new file mode 100644
index 0000000..968777c
--- /dev/null
+++ b/activemq-cpp/src/main/decaf/net/FileNameMap.cpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <decaf/net/FileNameMap.h>
+
+using namespace decaf;
+using namespace decaf::net;
+
+////////////////////////////////////////////////////////////////////////////////
+FileNameMap::~FileNameMap() {
+}

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/204deea6/activemq-cpp/src/main/decaf/net/FileNameMap.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/net/FileNameMap.h b/activemq-cpp/src/main/decaf/net/FileNameMap.h
new file mode 100644
index 0000000..e04a6a4
--- /dev/null
+++ b/activemq-cpp/src/main/decaf/net/FileNameMap.h
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _DECAF_NET_FILENAMEMAP_H_
+#define _DECAF_NET_FILENAMEMAP_H_
+
+#include <decaf/util/Config.h>
+
+#include <string>
+
+namespace decaf {
+namespace net {
+
+    /**
+     * Defines a scheme for mapping a filename type to a MIME content type. Mainly used
+     * by URLStreamHandler for determining the right content handler to handle the resource.
+     *
+     * @since 1.0
+     */
+    class DECAF_API FileNameMap {
+    public:
+
+        virtual ~FileNameMap();
+
+        /**
+         * Determines the MIME type for a file {@code fileName} of a URL.
+         *
+         * @param filename
+         *      the name of the file to consider.
+         *
+         * @return the appropriate MIME type of the given file.
+         */
+        virtual std::string getContentTypeFor(const std::string& filename) = 0;
+
+    };
+
+}}
+
+#endif /* _DECAF_NET_FILENAMEMAP_H_ */

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/204deea6/activemq-cpp/src/main/decaf/net/HttpURLConnection.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/net/HttpURLConnection.cpp b/activemq-cpp/src/main/decaf/net/HttpURLConnection.cpp
new file mode 100644
index 0000000..6c31b57
--- /dev/null
+++ b/activemq-cpp/src/main/decaf/net/HttpURLConnection.cpp
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <decaf/net/HttpURLConnection.h>
+
+#include <decaf/lang/Integer.h>
+#include <decaf/lang/exceptions/IllegalStateException.h>
+#include <decaf/net/ProtocolException.h>
+
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+using namespace decaf::net;
+
+////////////////////////////////////////////////////////////////////////////////
+bool HttpURLConnection::followRedirects = true;
+const int HttpURLConnection::DEFAULT_CHUNK_LENGTH = 1024;
+
+const int HttpURLConnection::HTTP_ACCEPTED = 202;
+const int HttpURLConnection::HTTP_BAD_GATEWAY = 502;
+const int HttpURLConnection::HTTP_BAD_METHOD = 405;
+const int HttpURLConnection::HTTP_BAD_REQUEST = 400;
+const int HttpURLConnection::HTTP_CLIENT_TIMEOUT = 408;
+const int HttpURLConnection::HTTP_CONFLICT = 409;
+const int HttpURLConnection::HTTP_CREATED = 201;
+const int HttpURLConnection::HTTP_ENTITY_TOO_LARGE = 413;
+const int HttpURLConnection::HTTP_FORBIDDEN = 403;
+const int HttpURLConnection::HTTP_GATEWAY_TIMEOUT = 504;
+const int HttpURLConnection::HTTP_GONE = 410;
+const int HttpURLConnection::HTTP_INTERNAL_ERROR = 500;
+const int HttpURLConnection::HTTP_LENGTH_REQUIRED = 411;
+const int HttpURLConnection::HTTP_MOVED_PERM = 301;
+const int HttpURLConnection::HTTP_MOVED_TEMP = 302;
+const int HttpURLConnection::HTTP_MULT_CHOICE = 300;
+const int HttpURLConnection::HTTP_NO_CONTENT = 204;
+const int HttpURLConnection::HTTP_NOT_ACCEPTABLE = 406;
+const int HttpURLConnection::HTTP_NOT_AUTHORITATIVE = 203;
+const int HttpURLConnection::HTTP_NOT_FOUND = 404;
+const int HttpURLConnection::HTTP_NOT_IMPLEMENTED = 501;
+const int HttpURLConnection::HTTP_NOT_MODIFIED = 304;
+const int HttpURLConnection::HTTP_OK = 200;
+const int HttpURLConnection::HTTP_PARTIAL = 206;
+const int HttpURLConnection::HTTP_PAYMENT_REQUIRED = 402;
+const int HttpURLConnection::HTTP_PRECON_FAILED = 412;
+const int HttpURLConnection::HTTP_PROXY_AUTH = 407;
+const int HttpURLConnection::HTTP_REQ_TOO_LONG = 414;
+const int HttpURLConnection::HTTP_RESET = 205;
+const int HttpURLConnection::HTTP_SEE_OTHER = 303;
+const int HttpURLConnection::HTTP_USE_PROXY = 305;
+const int HttpURLConnection::HTTP_UNAUTHORIZED = 401;
+const int HttpURLConnection::HTTP_UNSUPPORTED_TYPE = 415;
+const int HttpURLConnection::HTTP_UNAVAILABLE = 503;
+const int HttpURLConnection::HTTP_VERSION = 505;
+
+////////////////////////////////////////////////////////////////////////////////
+HttpURLConnection::HttpURLConnection(const URL& url) : URLConnection(url),
+                                                       method("GET"),
+                                                       responseCode(-1),
+                                                       responseMessage(),
+                                                       instanceFollowRedirects(true),
+                                                       chunkLength(-1),
+                                                       fixedContentLength(-1) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+HttpURLConnection::~HttpURLConnection() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int HttpURLConnection::getResponseCode() {
+    // Call getInputStream() first since getHeaderField() doesn't return exceptions
+    getInputStream();
+    std::string response = getHeaderField(0);
+    if (response == "") {
+        return -1;
+    }
+
+    // TODO response = response.trim();
+    std::size_t mark = response.find_first_of(" ") + 1;
+    if (mark == std::string::npos) {
+        return -1;
+    }
+
+    std::size_t last = mark + 3;
+    if (last > response.length()) {
+        last = response.length();
+    }
+
+    responseCode = Integer::parseInt(response.substr(mark, mark + last));
+    if (last + 1 <= response.length()) {
+        responseMessage = response.substr(last + 1);
+    }
+    return responseCode;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string HttpURLConnection::getResponseMessage() {
+    if (responseMessage != "") {
+        return responseMessage;
+    }
+    getResponseCode();
+    return responseMessage;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void HttpURLConnection::setRequestMethod(const std::string& method) {
+    if (connected) {
+        throw ProtocolException(__FILE__, __LINE__, "Connection already established");
+    }
+
+    // TODO
+//    for (int i = 0; i < methodTokens.length; i++) {
+//        if (methodTokens[i].equals(method)) {
+//            // if there is a supported method that matches the desired
+//            // method, then set the current method and return
+//            this.method = methodTokens[i];
+//            return;
+//        }
+//    }
+
+    // if none matches, then throw ProtocolException
+    throw new ProtocolException();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void HttpURLConnection::setFixedLengthStreamingMode(int contentLength) {
+    if (connected) {
+        throw IllegalStateException(__FILE__, __LINE__, "Already connected");
+    }
+
+    if (0 < chunkLength) {
+        throw IllegalStateException(__FILE__, __LINE__, "different mode already set");
+    }
+
+    if (0 > contentLength) {
+        throw IllegalArgumentException(__FILE__, __LINE__, "scale value < than zero");
+    }
+
+    fixedContentLength = contentLength;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void HttpURLConnection::setChunkedStreamingMode(int chunklen) {
+    if (connected) {
+        throw IllegalStateException(__FILE__, __LINE__, "Already connected");
+    }
+
+    if (0 <= fixedContentLength) {
+        throw IllegalStateException(__FILE__, __LINE__, "different mode already set");
+    }
+
+    if (0 >= chunklen) {
+        chunkLength = DEFAULT_CHUNK_LENGTH;
+    } else {
+        chunkLength = chunklen;
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/204deea6/activemq-cpp/src/main/decaf/net/HttpURLConnection.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/net/HttpURLConnection.h b/activemq-cpp/src/main/decaf/net/HttpURLConnection.h
new file mode 100644
index 0000000..fe98021
--- /dev/null
+++ b/activemq-cpp/src/main/decaf/net/HttpURLConnection.h
@@ -0,0 +1,415 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _DECAF_NET_HTTPURLCONNECTION_H_
+#define _DECAF_NET_HTTPURLCONNECTION_H_
+
+#include <decaf/util/Config.h>
+
+#include <decaf/io/InputStream.h>
+#include <decaf/io/OutputStream.h>
+#include <decaf/net/URLConnection.h>
+
+namespace decaf {
+namespace net {
+
+    /**
+     * This abstract subclass of URLConnection defines methods for managing HTTP connection
+     * according to the description given by RFC 2068.
+     *
+     * @see ContentHandler
+     * @see URL
+     * @see URLConnection
+     * @see URLStreamHandler
+     *
+     * @since 1.0
+     */
+    class DECAF_API HttpURLConnection : public URLConnection {
+    protected:
+
+        /**
+         * The HTTP request method of this HttpURLConnection.  The default value is "GET".
+         */
+        std::string method;
+
+        /**
+         * The status code of the response obtained from the HTTP request. The
+         * default value is {@code -1}.
+         * <p>
+         * <li>1xx: Informational</li>
+         * <li>2xx: Success</li>
+         * <li>3xx: Relocation/Redirection</li>
+         * <li>4xx: Client Error</li>
+         * <li>5xx: Server Error</li>
+         */
+        int responseCode;
+
+        /**
+         * The HTTP response message which corresponds to the response code.
+         */
+        std::string responseMessage;
+
+        /**
+         * Flag to define whether the protocol will automatically follow redirects
+         * or not. The default value is {@code true}.
+         */
+        bool instanceFollowRedirects;
+
+        /**
+         * If the HTTP chunked encoding is enabled this parameter defines the
+         * chunk-length. Default value is {@code -1} that means the chunked encoding
+         * mode is disabled.
+         */
+        int chunkLength;
+
+        /**
+         * If using HTTP fixed-length streaming mode this parameter defines the
+         * fixed length of content. Default value is {@code -1} that means the
+         * fixed-length streaming mode is disabled.
+         */
+        int fixedContentLength;
+
+    public:
+
+        /**
+         * Numeric status code, 202: Accepted
+         */
+        static const int HTTP_ACCEPTED;
+
+        /**
+         * Numeric status code, 502: Bad Gateway
+         */
+        static const int HTTP_BAD_GATEWAY;
+
+        /**
+         * Numeric status code, 405: Bad Method
+         */
+        static const int HTTP_BAD_METHOD;
+
+        /**
+         * Numeric status code, 400: Bad Request
+         */
+        static const int HTTP_BAD_REQUEST;
+
+        /**
+         * Numeric status code, 408: Client Timeout
+         */
+        static const int HTTP_CLIENT_TIMEOUT;
+
+        /**
+         * Numeric status code, 409: Conflict
+         */
+        static const int HTTP_CONFLICT;
+
+        /**
+         * Numeric status code, 201: Created
+         */
+        static const int HTTP_CREATED;
+
+        /**
+         * Numeric status code, 413: Entity too large
+         */
+        static const int HTTP_ENTITY_TOO_LARGE;
+
+        /**
+         * Numeric status code, 403: Forbidden
+         */
+        static const int HTTP_FORBIDDEN;
+
+        /**
+         * Numeric status code, 504: Gateway timeout
+         */
+        static const int HTTP_GATEWAY_TIMEOUT;
+
+        /**
+         * Numeric status code, 410: Gone
+         */
+        static const int HTTP_GONE;
+
+        /**
+         * Numeric status code, 500: Internal error
+         */
+        static const int HTTP_INTERNAL_ERROR;
+
+        /**
+         * Numeric status code, 411: Length required
+         */
+        static const int HTTP_LENGTH_REQUIRED;
+
+        /**
+         * Numeric status code, 301 Moved permanently
+         */
+        static const int HTTP_MOVED_PERM;
+
+        /**
+         * Numeric status code, 302: Moved temporarily
+         */
+        static const int HTTP_MOVED_TEMP;
+
+        /**
+         * Numeric status code, 300: Multiple choices
+         */
+        static const int HTTP_MULT_CHOICE;
+
+        /**
+         * Numeric status code, 204: No content
+         */
+        static const int HTTP_NO_CONTENT;
+
+        /**
+         * Numeric status code, 406: Not acceptable
+         */
+        static const int HTTP_NOT_ACCEPTABLE;
+
+        /**
+         * Numeric status code, 203: Not authoritative
+         */
+        static const int HTTP_NOT_AUTHORITATIVE;
+
+        /**
+         * Numeric status code, 404: Not found
+         */
+        static const int HTTP_NOT_FOUND;
+
+        /**
+         * Numeric status code, 501: Not implemented
+         */
+        static const int HTTP_NOT_IMPLEMENTED;
+
+        /**
+         * Numeric status code, 304: Not modified
+         */
+        static const int HTTP_NOT_MODIFIED;
+
+        /**
+         * Numeric status code, 200: OK
+         */
+        static const int HTTP_OK;
+
+        /**
+         * Numeric status code, 206: Partial
+         */
+        static const int HTTP_PARTIAL;
+
+        /**
+         * Numeric status code, 402: Payment required
+         */
+        static const int HTTP_PAYMENT_REQUIRED;
+
+        /**
+         * Numeric status code, 412: Precondition failed
+         */
+        static const int HTTP_PRECON_FAILED;
+
+        /**
+         * Numeric status code, 407: Proxy authentication required
+         */
+        static const int HTTP_PROXY_AUTH;
+
+        /**
+         * Numeric status code, 414: Request too long
+         */
+        static const int HTTP_REQ_TOO_LONG;
+
+        /**
+         * Numeric status code, 205: Reset
+         */
+        static const int HTTP_RESET;
+
+        /**
+         * Numeric status code, 303: See other
+         */
+        static const int HTTP_SEE_OTHER;
+
+        /**
+         * Numeric status code, 305: Use proxy
+         */
+        static const int HTTP_USE_PROXY;
+
+        /**
+         * Numeric status code, 401: Unauthorized
+         */
+        static const int HTTP_UNAUTHORIZED;
+
+        /**
+         * Numeric status code, 415: Unsupported type
+         */
+        static const int HTTP_UNSUPPORTED_TYPE;
+
+        /**
+         * Numeric status code, 503: Unavailable
+         */
+        static const int HTTP_UNAVAILABLE;
+
+        /**
+         * Numeric status code, 505: Version not supported
+         */
+        static const int HTTP_VERSION;
+
+    private:
+
+        static bool followRedirects;
+
+        static const int DEFAULT_CHUNK_LENGTH;
+
+    private:
+
+        HttpURLConnection(const HttpURLConnection&);
+        HttpURLConnection& operator= (const HttpURLConnection&);
+
+    protected:
+
+        HttpURLConnection(const URL& url);
+
+    public:
+
+        virtual ~HttpURLConnection();
+
+        /**
+         * Closes the connection to the HTTP server.
+         *
+         * @see URLConnection#connect()
+         * @see URLConnection#connected
+         */
+        virtual void disconnect() = 0;
+
+        /**
+         * 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.
+         *
+         * @return the error input stream returned by the server.
+         */
+        virtual decaf::io::InputStream* getErrorStream() const {
+            return NULL;
+        }
+
+        /**
+         * 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.
+         *
+         * @return the request method string.
+         */
+        std::string getRequestMethod() const {
+            return method;
+        }
+
+        /**
+         * Returns the response code returned by the remote HTTP server.
+         *
+         * @return the response code, -1 if no valid response code.
+         *
+         * @throws IOException if there is an IO error during the retrieval.
+         */
+        int getResponseCode();
+
+        /**
+         * Returns the response message returned by the remote HTTP server.
+         *
+         * @return the response message. empty string if no such response exists.
+         *
+         * @throws IOException if there is an error during the retrieval.
+         */
+        std::string getResponseMessage();
+
+        /**
+         * Sets the request command which will be sent to the remote HTTP server.
+         * This method can only be called before the connection is made.
+         *
+         * @param method
+         *      the string representing the method to be used.
+         *
+         * @throws ProtocolException
+         *      if this is called after connected, or the method is not
+         *      supported by this HTTP implementation.
+         */
+        void setRequestMethod(const std::string& method);
+
+        /**
+         * Returns whether this connection follows redirects.
+         *
+         * @return if this connection follows redirects, false otherwise.
+         */
+        bool getInstanceFollowRedirects() const {
+            return instanceFollowRedirects;
+        }
+
+        /**
+         * Sets whether this connection follows redirects.
+         *
+         * @param followRedirects
+         *      if this connection will follows redirects, false otherwise.
+         */
+        void setInstanceFollowRedirects(bool followRedirects) {
+            instanceFollowRedirects = followRedirects;
+        }
+
+        /**
+         * 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.
+         *
+         * @param contentLength
+         *      the fixed length of the HTTP request body.
+         *
+         * @throws IllegalStateException if already connected or an other mode already set.
+         * @throws IllegalArgumentException if contentLength is less than zero.
+        */
+        void setFixedLengthStreamingMode(int contentLength);
+
+        /**
+         * 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.
+         *
+         * @param chunklen
+         *      the length of a chunk.
+         *
+         * @throws IllegalStateException if already connected or an other mode already set.
+         */
+        void setChunkedStreamingMode(int chunklen);
+
+    public:
+
+        /**
+         * Returns the value of followRedirects which indicates if this connection follows
+         * a different URL redirected by the server. It is enabled by default.
+         *
+         * @return the value of the flag.
+         */
+        static bool getFollowRedirects() {
+            return followRedirects;
+        }
+
+        /**
+         * Sets the flag of whether this connection will follow redirects returned
+         * by the remote server.
+         *
+         * @param follow
+         *      the value to enable or disable this option.
+         */
+        static void setFollowRedirects(bool follow) {
+            followRedirects = follow;
+        }
+
+    };
+
+}}
+
+#endif /* _DECAF_NET_HTTPURLCONNECTION_H_ */

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/204deea6/activemq-cpp/src/main/decaf/net/URL.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/net/URL.cpp b/activemq-cpp/src/main/decaf/net/URL.cpp
index 3db4021..8e505b2 100644
--- a/activemq-cpp/src/main/decaf/net/URL.cpp
+++ b/activemq-cpp/src/main/decaf/net/URL.cpp
@@ -28,3 +28,8 @@ URL::URL() {
 ////////////////////////////////////////////////////////////////////////////////
 URL::URL( const std::string& url DECAF_UNUSED ) {
 }
+
+////////////////////////////////////////////////////////////////////////////////
+std::string URL::toString() const {
+    return "";
+}

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/204deea6/activemq-cpp/src/main/decaf/net/URL.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/net/URL.h b/activemq-cpp/src/main/decaf/net/URL.h
index 2958388..237ee02 100644
--- a/activemq-cpp/src/main/decaf/net/URL.h
+++ b/activemq-cpp/src/main/decaf/net/URL.h
@@ -110,6 +110,8 @@ namespace net{
         URL( const std::string& url );
         virtual ~URL() {}
 
+        virtual std::string toString() const;
+
     };
 
 }}

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/204deea6/activemq-cpp/src/main/decaf/net/URLConnection.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/net/URLConnection.cpp b/activemq-cpp/src/main/decaf/net/URLConnection.cpp
index 6bea771..d56f8cc 100644
--- a/activemq-cpp/src/main/decaf/net/URLConnection.cpp
+++ b/activemq-cpp/src/main/decaf/net/URLConnection.cpp
@@ -17,13 +17,175 @@
 
 #include <decaf/net/URLConnection.h>
 
+#include <decaf/io/IOException.h>
+#include <decaf/lang/Integer.h>
+#include <decaf/lang/exceptions/NullPointerException.h>
+#include <decaf/lang/exceptions/NumberFormatException.h>
+#include <decaf/lang/exceptions/UnsupportedOperationException.h>
+#include <decaf/lang/exceptions/IllegalStateException.h>
+
 using namespace decaf;
 using namespace decaf::net;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+bool URLConnection::defaultAllowUserInteraction;
+bool URLConnection::defaultUseCaches = true;
+
+////////////////////////////////////////////////////////////////////////////////
+namespace decaf {
+namespace net {
+
+    class URLConnectionImpl {
+    public:
+
+        std::string contentType;
+
+//        static bool defaultAllowUserInteraction;
+//        static bool defaultUseCaches = true;
+//        ContentHandler defaultHandler = new DefaultContentHandler();
+
+        long long lastModified;
+        int readTimeout;
+        int connectTimeout;
+
+    public:
+
+        URLConnectionImpl() : contentType(),
+                              lastModified(-1),
+                              readTimeout(0),
+                              connectTimeout(0) {}
+
+    };
+
+}}
 
 ////////////////////////////////////////////////////////////////////////////////
-URLConnection::URLConnection(const URL& url) : url(url) {
+URLConnection::URLConnection(const URL& url) : impl(new URLConnectionImpl),
+                                               url(url),
+                                               ifModifiedSince(),
+                                               useCaches(),
+                                               connected(),
+                                               doOutput(),
+                                               doInput(true),
+                                               allowUserInteraction() {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 URLConnection::~URLConnection() {
+    try {
+        delete this->impl;
+    }
+    DECAF_CATCHALL_NOTHROW()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int URLConnection::getConnectTimeout() const {
+    return impl->connectTimeout;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int URLConnection::getReadTimeout() const {
+    return impl->readTimeout;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+long long URLConnection::getHeaderFieldDate(const std::string& field, long long defaultValue) const {
+    std::string date = getHeaderField(field);
+    if (date == "") {
+        return defaultValue;
+    }
+
+    throw UnsupportedOperationException(__FILE__, __LINE__, "Not yet implemented");
+
+    try {
+        // TODO
+        return -1; // Date::parse(date);
+    } catch (Exception& e) {
+        return defaultValue;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int URLConnection::getHeaderFieldInt(const std::string& field, int defaultValue) const {
+    try {
+        return Integer::parseInt(getHeaderField(field));
+    } catch (NumberFormatException& e) {
+        return defaultValue;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void URLConnection::setAllowUserInteraction(bool newValue) {
+    if (connected) {
+        throw IllegalStateException(__FILE__, __LINE__, "Connection already established");
+    }
+
+    allowUserInteraction = newValue;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void URLConnection::setDefaultUseCaches(bool newValue) {
+    if (connected) {
+        throw IllegalStateException(__FILE__, __LINE__, "Connection already established");
+    }
+    defaultUseCaches = newValue;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void URLConnection::setDoInput(bool newValue) {
+    if (connected) {
+        throw IllegalStateException(__FILE__, __LINE__, "Connection already established");
+    }
+    doInput = newValue;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void URLConnection::setDoOutput(bool newValue) {
+    if (connected) {
+        throw IllegalStateException(__FILE__, __LINE__, "Connection already established");
+    }
+    doOutput = newValue;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void URLConnection::setUseCaches(bool newValue) {
+    if (connected) {
+        throw IllegalStateException(__FILE__, __LINE__, "Connection already established");
+    }
+    useCaches = newValue;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void URLConnection::setConnectTimeout(int timeout) {
+    if (0 > timeout) {
+        throw IllegalStateException(__FILE__, __LINE__, "Invalid negative timeout");
+    }
+    impl->connectTimeout = timeout;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void URLConnection::setReadTimeout(int timeout) {
+    if (0 > timeout) {
+        throw IllegalStateException(__FILE__, __LINE__, "Invalid negative timeout");
+    }
+    impl->readTimeout = timeout;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+long long URLConnection::getLastModified() const {
+    if (impl->lastModified != -1) {
+        return impl->lastModified;
+    }
+
+    return impl->lastModified = getHeaderFieldDate("Last-Modified", 0);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void URLConnection::setIfModifiedSince(long long newValue) {
+    if (connected) {
+        throw IllegalStateException(__FILE__, __LINE__, "Connection already established");
+    }
+    ifModifiedSince = newValue;
 }

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/204deea6/activemq-cpp/src/main/decaf/net/URLConnection.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/decaf/net/URLConnection.h b/activemq-cpp/src/main/decaf/net/URLConnection.h
index b148e81..20cc03c 100644
--- a/activemq-cpp/src/main/decaf/net/URLConnection.h
+++ b/activemq-cpp/src/main/decaf/net/URLConnection.h
@@ -20,11 +20,16 @@
 
 #include <decaf/util/Config.h>
 
+#include <decaf/io/InputStream.h>
+#include <decaf/io/OutputStream.h>
 #include <decaf/net/URL.h>
+#include <decaf/net/UnknownServiceException.h>
 
 namespace decaf {
 namespace net {
 
+    class URLConnectionImpl;
+
     /**
      * Concrete implementations of the abstract {@code URLConnection} class provide
      * a communication link to a URL for exchanging data with a specific protocol
@@ -34,21 +39,429 @@ namespace net {
      * @since 1.0
      */
     class DECAF_API URLConnection {
+    private:
+
+        URLConnectionImpl* impl;
+
+        static bool defaultAllowUserInteraction;
+
+        static bool defaultUseCaches;
+
     protected:
 
         URL url;
 
+        /**
+         * The data must be modified more recently than this time in milliseconds
+         * since January 1, 1970, GMT to be transmitted.
+         */
+        long long ifModifiedSince;
+
+        /**
+         * Specifies whether the using of caches is enabled or the data has to be
+         * recent for every request.
+         */
+        bool useCaches;
+
+        /**
+         * Specifies whether this {@code URLConnection} is already connected to the
+         * remote resource. If this field is set to {@code true} the flags for
+         * setting up the connection are not changeable anymore.
+         */
+        bool connected;
+
+        /**
+         * Specifies whether this {@code URLConnection} allows sending data.
+         */
+        bool doOutput;
+
+        /**
+         * Specifies whether this {@code URLConnection} allows receiving data.
+         */
+        bool doInput;
+
+        /**
+         * Specifies whether this {@code URLConnection} allows user interaction as
+         * it is needed for authentication purposes.
+         */
+        bool allowUserInteraction;
+
     private:
 
         URLConnection(const URLConnection&);
         URLConnection& operator= (const URLConnection&);
 
-    public:
+    protected:
 
         URLConnection(const URL& url);
 
+    public:
+
         virtual ~URLConnection();
 
+        /**
+         * Establishes the connection to the earlier configured resource. The
+         * connection can only be set up before this method has been called.
+         *
+         * @throws IOException if an error occurs while connecting to the resource.
+         */
+        virtual void connect() = 0;
+
+    public:
+
+        /**
+         * Gets the option value which indicates whether user interaction is allowed
+         * on this URLConnection.
+         *
+         * @return the value of the option allowUserInteraction.
+         */
+        bool getAllowUserInteraction() const {
+            return allowUserInteraction;
+        }
+
+        /**
+         * Sets the flag indicating whether this connection allows user interaction
+         * or not. This method can only be called prior to the connection
+         * establishment.
+         *
+         * @param newValue
+         *      the value of the flag to be set.
+         * @throws IllegalStateException
+         *      if this method attempts to change the flag after the connection has been established.
+         */
+        void setAllowUserInteraction(bool newValue);
+
+        /**
+         * Gets the content encoding type specified by the response header field
+         * content-encoding or empty string if this field is not set.
+         *
+         * @return the value of the response header field 'content-encoding'.
+         */
+        std::string getContentEncoding() const {
+            return getHeaderField("Content-Encoding");
+        }
+
+        /**
+         * Gets the content length in bytes specified by the response header field
+         * 'content-length' or '-1' if this field is not set.
+         *
+         * @return the value of the response header field 'content-length'.
+         */
+        int getContentLength() const {
+            return getHeaderFieldInt("Content-Length", -1);
+        }
+
+        /**
+         * Gets the MIME-type of the content specified by the response header field
+         * 'content-type' or empty string if type is unknown.
+         *
+         * @return the value of the response header field 'content-type'.
+         */
+        std::string getContentType() const {
+            return getHeaderField("Content-Type");
+        }
+
+        /**
+         * 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.
+         *
+         * @return the sending timestamp of the current response.
+         */
+        long long getDate() const {
+            return getHeaderFieldDate("Date", 0);
+        }
+
+        /**
+         * Gets the default setting whether this connection allows using caches.
+         *
+         * @return the value of the default setting defaultUseCaches.
+         */
+        bool getDefaultUseCaches() const {
+            return defaultUseCaches;
+        }
+
+        /**
+         * Sets the default value for the flag indicating whether this connection
+         * allows to use caches. Existing URLConnections are unaffected.
+         *
+         * @param newValue
+         *      the default value of the flag to be used for new connections.
+         */
+        void setDefaultUseCaches(bool newValue);
+
+        /**
+         * Gets the value of the option {@code doInput} which specifies whether this
+         * connection allows to receive data.
+         *
+         * @return true if this connection allows input, false otherwise.
+         */
+        bool getDoInput() const {
+            return doInput;
+        }
+
+        /**
+         * Sets the flag indicating whether this URLConnection allows input.
+         * It cannot be set after the connection is established.
+         *
+         * @param newValue
+         *      the new value for the flag to be set.
+         * @throws IllegalAccessError
+         *      if this method attempts to change the value after the
+         *      connection has been already established.
+         */
+        void setDoInput(bool newValue);
+
+        /**
+         * Gets the value of the option doOutput which specifies whether
+         * this connection allows to send data.
+         *
+         * @return true if this connection allows output, false otherwise.
+         */
+        bool getDoOutput() const {
+            return doOutput;
+        }
+
+        /**
+         * Sets the flag indicating whether this URLConnection allows
+         * output. It cannot be set after the connection is established.
+         *
+         * @param newValue
+         *      the new value for the flag to be set.
+         * @throws IllegalAccessError
+         *      if this method attempts to change the value after the
+         *      connection has been already established.
+         */
+        void setDoOutput(bool newValue);
+
+        /**
+         * Gets the timestamp when this response will be expired in milliseconds
+         * since January 1, 1970 GMT or 0 if this timestamp is unknown.
+         *
+         * @return the value of the response header field expires.
+         */
+        long getExpiration() const {
+            return getHeaderFieldDate("Expires", 0);
+        }
+
+        /**
+         * Gets the URL represented by this URLConnection.
+         *
+         * @return the URL of this connection.
+         */
+        URL getURL() const {
+            return url;
+        }
+
+        /**
+         * Gets the value of the flag which specifies whether this URLConnection
+         * allows to use caches.
+         *
+         * @return true if using caches is allowed, false otherwise.
+         */
+        bool getUseCaches() const {
+            return useCaches;
+        }
+
+        /**
+         * Sets the flag indicating whether this connection allows to use caches or
+         * not. This method can only be called prior to the connection
+         * establishment.
+         *
+         * @param newValue
+         *      the value of the flag to be set.
+         * @throws IllegalStateException
+         *      if this method attempts to change the flag after the connection has been established.
+         */
+        void setUseCaches(bool newValue);
+
+        /**
+         * Gets the configured connecting timeout.
+         *
+         * @return the connecting timeout value in milliseconds.
+         */
+        int getConnectTimeout() const;
+
+        /**
+         * 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.
+         *
+         * @param timeout
+         *      the connecting timeout in milliseconds.
+         * @throws IllegalArgumentException
+         *      if the parameter timeout is less than zero.
+         */
+        void setConnectTimeout(int timeout);
+
+        /**
+         * Gets the configured timeout for reading from the input stream of an
+         * established connection to the resource.
+         *
+         * @return the reading timeout value in milliseconds.
+         */
+        int getReadTimeout() const;
+
+        /**
+         * 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.
+         *
+         * @param timeout
+         *      the reading timeout in milliseconds.
+         * @throws IllegalArgumentException
+         *      if the parameter timeout is less than zero.
+         */
+        void setReadTimeout(int timeout);
+
+        /**
+         * Returns the string representation containing the name of this class and
+         * the URL.
+         *
+         * @return the string representation of this URLConnection instance.
+         */
+        virtual std::string toString() const {
+            return "URLConnection:" + url.toString();
+        }
+
+        /**
+         * 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.
+         *
+         * @param pos
+         *      the field position of the response header.
+         *
+         * @return the value of the field at position pos.
+         */
+        virtual std::string getHeaderField(int pos DECAF_UNUSED) const {
+            return "";
+        }
+
+        /**
+         * 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.
+         *
+         * @param key
+         *      the name of the header field.
+         *
+         * @return the value of the header field.
+         */
+        virtual std::string getHeaderField(const std::string& key DECAF_UNUSED) const {
+            return "";
+        }
+
+        /**
+         * 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.
+         *
+         * @param field
+         *      the header field name whose value is needed.
+         * @param defaultValue
+         *      the default value if no field has been found.
+         *
+         * @return the value of the specified header field as a date in milliseconds.
+         */
+        long long getHeaderFieldDate(const std::string& field, long long 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.
+         *
+         * @param field
+         *      the header field name whose value is needed.
+         * @param defaultValue
+         *      the default value if no field has been found.
+         *
+         * @return the value of the specified header field as a number.
+         */
+        int getHeaderFieldInt(const std::string& field, int defaultValue) const;
+
+        /**
+         * Gets the value of the response header field 'last-modified' or zero if
+         * this value is not set.
+         *
+         * @return the value of the 'last-modified' header field.
+         */
+        long long getLastModified() const;
+
+        /**
+         * 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.
+         *
+         * @return the InputStream to read data from.
+         *
+         * @throws IOException if no InputStream could be created.
+         */
+        virtual decaf::io::InputStream* getInputStream() {
+            throw UnknownServiceException(
+                __FILE__, __LINE__, "Does not support writing to the input stream");
+        }
+
+        /**
+         * Gets an OutputStream for writing data to this URLConnection. It throws an
+         * UnknownServiceException by default. This method must be overridden by its
+         * subclasses.
+         *
+         * @return the OutputStream to write data.
+         *
+         * @throws IOException if no OutputStream could be created.
+         */
+        virtual decaf::io::OutputStream* getOutputStream() {
+            throw UnknownServiceException(
+                __FILE__, __LINE__, "Does not support writing to the output stream");
+        }
+
+        /**
+         * 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.
+         *
+         * @return the time in milliseconds since January 1, 1970 GMT.
+         */
+        long long getIfModifiedSince() const {
+            return ifModifiedSince;
+        }
+
+        /**
+         * 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.
+         *
+         * @param newValue
+         *      the time in milliseconds since January 1, 1970 GMT.
+         * @throws IllegalStateException
+         *      if this URLConnection has already been connected.
+         */
+        void setIfModifiedSince(long long newValue);
+
+    public:
+
+        /**
+         * Gets the default setting whether this connection allows user interaction.
+         *
+         * @return the value of the default setting defaultAllowUserInteraction.
+         */
+        static bool getDefaultAllowUserInteraction() {
+            return defaultAllowUserInteraction;
+        }
+
+        /**
+         * Sets the default value for the flag indicating whether this connection
+         * allows user interaction or not. Existing URLConnections are unaffected.
+         *
+         * @param allows
+         *      the default value of the flag to be used for new connections.
+         */
+        static void setDefaultAllowUserInteraction(bool allows) {
+            defaultAllowUserInteraction = allows;
+        }
+
     };
 
 }}


Mime
View raw message