Xerces-C++  3.1.4
XMLNetAccessor.hpp
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 /*
19  * $Id: XMLNetAccessor.hpp 673960 2008-07-04 08:50:12Z borisk $
20  */
21 
22 #if !defined(XERCESC_INCLUDE_GUARD_XMLNETACCESSOR_HPP)
23 #define XERCESC_INCLUDE_GUARD_XMLNETACCESSOR_HPP
24 
26 #include <xercesc/util/XMLURL.hpp>
28 
30 
31 class BinInputStream;
32 
33 // This class holds advanced informations about the HTTP connection
35 {
36 public:
38 
39  typedef enum {
40  GET,
41  PUT,
42  POST
43  } HTTPMethod;
44 
45  // -----------------------------------------------------------------------
46  // Data members
47  //
48  // fHTTPMethod
49  // The type of the HTTP request
50  //
51  // fHeaders
52  // The extra headers that will be sent as part of the request; the format is
53  // Header1: Value\r\nHeader2: Value\r\n
54  //
55  // fHeadersLen
56  // The length of the string pointed by fHeaders, in bytes
57  //
58  // fPayload
59  // The extra data that will be sent after the headers; in the case of a PUT
60  // operation, this is the content of the resource being posted. It can be binary data
61  //
62  // fPayloadLen
63  // The length of the binary buffer pointed by fPayload, in bytes
64  //
66  const char* fHeaders;
68  const char* fPayload;
70 };
71 
73 :fHTTPMethod(XMLNetHTTPInfo::GET),
74  fHeaders(0),
75  fHeadersLen(0),
76  fPayload(0),
77  fPayloadLen(0)
78 {
79 }
80 
81 
82 //
83 // This class is an abstract interface via which the URL class accesses
84 // net access services. When any source URL is not in effect a local file
85 // path, then the URL class is used to look at it. Then the URL class can
86 // be asked to make a binary input stream via which the referenced resource
87 // can be read in.
88 //
89 // The URL class will use an object derived from this class to create a
90 // binary stream for the URL to return. The object it uses is provided by
91 // the platform utils, and is actually provided by the per-platform init
92 // code so each platform can decide what actual implementation it wants to
93 // use.
94 //
96 {
97 public :
98  // -----------------------------------------------------------------------
99  // Virtual destructor
100  // -----------------------------------------------------------------------
101  virtual ~XMLNetAccessor()
102  {
103  }
104 
105 
106  // -----------------------------------------------------------------------
107  // The virtual net accessor interface
108  // -----------------------------------------------------------------------
109  virtual const XMLCh* getId() const = 0;
110 
111  virtual BinInputStream* makeNew
112  (
113  const XMLURL& urlSrc,
114  const XMLNetHTTPInfo* httpInfo=0
115  ) = 0;
116 
117 
118 protected :
119  // -----------------------------------------------------------------------
120  // Hidden constructors
121  // -----------------------------------------------------------------------
123  {
124  }
125 
126 
127 private :
128  // -----------------------------------------------------------------------
129  // Unimplemented constructors and operators
130  // -----------------------------------------------------------------------
132  XMLNetAccessor& operator=(const XMLNetAccessor&);
133 };
134 
135 MakeXMLException(NetAccessorException, XMLUTIL_EXPORT)
136 
138 
139 #endif
This class makes it possible to override the C++ memory management by adding new/delete operators to ...
Definition: XMemory.hpp:40
Definition: XMLURL.hpp:35
XMLNetAccessor()
Definition: XMLNetAccessor.hpp:122
Definition: XMLNetAccessor.hpp:40
#define MakeXMLException(theType, expKeyword)
Definition: XMLException.hpp:178
Definition: XMLNetAccessor.hpp:95
SIZE_T XMLSize_t
Definition: Xerces_autoconf_config.borland.hpp:86
XMLNetHTTPInfo()
Definition: XMLNetAccessor.hpp:72
#define XERCES_CPP_NAMESPACE_BEGIN
Definition: XercesDefs.hpp:112
wchar_t XMLCh
Definition: Xerces_autoconf_config.borland.hpp:92
#define XMLUTIL_EXPORT
Definition: XercesDefs.hpp:162
#define XERCES_CPP_NAMESPACE_END
Definition: XercesDefs.hpp:113
Definition: XMLNetAccessor.hpp:34
HTTPMethod fHTTPMethod
Definition: XMLNetAccessor.hpp:65
XMLSize_t fHeadersLen
Definition: XMLNetAccessor.hpp:67
Definition: BinInputStream.hpp:29
const char * fPayload
Definition: XMLNetAccessor.hpp:68
virtual ~XMLNetAccessor()
Definition: XMLNetAccessor.hpp:101
HTTPMethod
Definition: XMLNetAccessor.hpp:39
Definition: XMLNetAccessor.hpp:41
const char * fHeaders
Definition: XMLNetAccessor.hpp:66
XMLSize_t fPayloadLen
Definition: XMLNetAccessor.hpp:69