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 
24 #include <decaf/io/InputStream.h>
25 #include <string>
26 
27 namespace decaf {
28 namespace net {
29 
30  class URI;
31  class URLImpl;
32  class URLStreamHandler;
33  class URLStreamHandlerFactory;
34  class URLConnection;
35  class Proxy;
36 
118  class DECAF_API URL {
119  private:
120 
121  URLImpl* impl;
122 
123  public:
124 
136  URL(const decaf::lang::String& url);
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 
290  decaf::lang::String getAuthority() const;
291 
299  int getDefaultPort() const;
300 
308  decaf::lang::String getFile() const;
309 
317  decaf::lang::String getHost() const;
318 
324  decaf::lang::String getPath() const;
325 
331  decaf::lang::String getUserInfo() const;
332 
338  int getPort() const;
339 
345  decaf::lang::String getProtocol() const;
346 
352  decaf::lang::String getQuery() const;
353 
359  decaf::lang::String getRef() const;
360 
369  int hashCode() const;
370 
388  URLConnection* openConnection();
389 
404  URLConnection* openConnection(const Proxy* proxy);
405 
414  decaf::io::InputStream* openStream();
415 
422  bool sameFile(const URL& other) const;
423 
430  decaf::lang::String toExternalForm() const;
431 
437  std::string toString() const;
438 
444  URI toURI() const;
445 
446  public:
447 
460  static void setURLStreamHandlerFactory(URLStreamHandlerFactory* factory);
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_*/
The abstract class URLStreamHandler is the common superclass for all stream protocol handlers...
Definition: URLStreamHandler.h:45
Concrete implementations of the abstract.
Definition: URLConnection.h:41
A base class that must be implemented by all classes wishing to provide a class that reads in a strea...
Definition: InputStream.h:39
This class represents an instance of a URI as defined by RFC 2396.
Definition: URI.h:37
Definition: Proxy.h:29
Defines a factory which creates an URLStreamHandler for a specified protocol.
Definition: URLStreamHandlerFactory.h:36
An immutable sequence of characters.
Definition: String.h:57
#define DECAF_API
Definition: Config.h:29
Class URL represents a Uniform Resource Locator, a pointer to a "resource" on the World Wide Web...
Definition: URL.h:118