activemq-cpp-3.9.5
URL.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _DECAF_NET_URL_H_
19#define _DECAF_NET_URL_H_
20
21#include <decaf/util/Config.h>
22#include <decaf/lang/String.h>
23
25#include <string>
26
27namespace decaf {
28namespace net {
29
30 class URI;
31 class URLImpl;
32 class URLStreamHandler;
34 class URLConnection;
35 class Proxy;
36
119 private:
120
121 URLImpl* impl;
122
123 public:
124
137
177 URL(const URL& context, const decaf::lang::String& spec);
178
203 URL(const decaf::lang::String& protocol, const decaf::lang::String& host, int port,
204 const decaf::lang::String& file, URLStreamHandler* handler);
205
223 URL(const decaf::lang::String& protocol, const decaf::lang::String& host, const decaf::lang::String& file);
224
243 URL(const decaf::lang::String& protocol, const decaf::lang::String& host, int port, const decaf::lang::String& file);
244
262 URL(const URL& context, const decaf::lang::String& spec, URLStreamHandler* handler);
263
264 virtual ~URL();
265
266 public:
267
283 bool equals(const URL& other) const;
284
291
299 int getDefaultPort() const;
300
309
318
325
332
338 int getPort() const;
339
346
353
360
369 int hashCode() const;
370
389
405
415
422 bool sameFile(const URL& other) const;
423
431
437 std::string toString() const;
438
444 URI toURI() const;
445
446 public:
447
461
462 private:
463
480 void set(const decaf::lang::String& protocol, const decaf::lang::String& host, int port,
481 const decaf::lang::String& file, const decaf::lang::String& ref);
482
505 void set(const decaf::lang::String& protocol, const decaf::lang::String& host, int port,
506 const decaf::lang::String& authority, const decaf::lang::String& userInfo,
507 const decaf::lang::String& path, const decaf::lang::String& query,
508 const decaf::lang::String& ref);
509
514 URLStreamHandler* getURLStreamHandler() const;
515
516 private:
517
518 void initialize(const URL* context, const decaf::lang::String& theSpec, URLStreamHandler* handler);
519 void initialize(const decaf::lang::String& protocol, const decaf::lang::String& host, int port,
520 const decaf::lang::String& file, URLStreamHandler* handler);
521
522
523 friend class URLStreamHandler;
524
525 };
526
527}}
528
529#endif /*_DECAF_NET_URL_H_*/
A base class that must be implemented by all classes wishing to provide a class that reads in a strea...
Definition InputStream.h:39
An immutable sequence of characters.
Definition String.h:57
Definition Proxy.h:29
This class represents an instance of a URI as defined by RFC 2396.
Definition URI.h:37
Concrete implementations of the abstract URLConnection class provide a communication link to a URL fo...
Definition URLConnection.h:41
decaf::lang::String getProtocol() const
Gets the protocol of this URL.
decaf::lang::String getUserInfo() const
Gets the user Info part of this URL.
URLConnection * openConnection(const Proxy *proxy)
Same basic functionality as openConnection() is provided here, except that the connection will be mad...
decaf::lang::String getPath() const
Gets the path part of this URL.
int getDefaultPort() const
Gets the default port number of the protocol associated with this URL.
URI toURI() const
Returns a URI instance that is the equivalent of this URL.
int hashCode() const
Creates an integer hash code for this URL which is used in hash based collections.
decaf::lang::String getQuery() const
Gets the query part of this URL.
URL(const decaf::lang::String &protocol, const decaf::lang::String &host, int port, const decaf::lang::String &file, URLStreamHandler *handler)
Creates a URL object from the specified protocol, host, port number, file, and handler.
decaf::lang::String getFile() const
Gets the file name of this URL.
decaf::lang::String getRef() const
Gets the anchor or "reference" portion of this URL.
virtual ~URL()
bool equals(const URL &other) const
Compares this URL for equality with another URL.
decaf::lang::String toExternalForm() const
Constructs a string representation of this URL, by calling the toExternalForm method of the stream pr...
decaf::io::InputStream * openStream()
Shortcut method to opens a connection to this URL and fetch an InputStream for reading from that conn...
int getPort() const
Gets the port of this URL.
static void setURLStreamHandlerFactory(URLStreamHandlerFactory *factory)
Sets an application's URLStreamHandlerFactory.
URL(const decaf::lang::String &protocol, const decaf::lang::String &host, int port, const decaf::lang::String &file)
Creates a new URL instance using the given arguments.
URL(const decaf::lang::String &protocol, const decaf::lang::String &host, const decaf::lang::String &file)
Creates a URL from the specified protocol name, host name, and file name.
URL(const URL &context, const decaf::lang::String &spec, URLStreamHandler *handler)
Creates a URL by parsing the given spec with the specified handler within a specified context.
bool sameFile(const URL &other) const
Compares this URL to the other ignoring the fragment portion to determine if both reference the same ...
URL(const URL &context, const decaf::lang::String &spec)
Creates a URL by parsing the given spec within a specified context.
decaf::lang::String getHost() const
Gets the host name of this URL, if applicable.
friend class URLStreamHandler
Definition URL.h:523
URL(const decaf::lang::String &url)
Creates a URL object from the String representation.
std::string toString() const
Calls toExternalForm to create a string representation of this URL.
URLConnection * openConnection()
Returns a URLConnection object that represents a connection to the remote object referred to by the U...
decaf::lang::String getAuthority() const
Gets the authority part of this URL.
Defines a factory which creates an URLStreamHandler for a specified protocol.
Definition URLStreamHandlerFactory.h:36
The abstract class URLStreamHandler is the common superclass for all stream protocol handlers.
Definition URLStreamHandler.h:45
#define DECAF_API
Definition Config.h:29
Definition URLStreamHandlerManager.h:26
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25