Xerces-C++ 3.2.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$
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_XMLNETACCESSOR_HPP)
23#define XERCESC_INCLUDE_GUARD_XMLNETACCESSOR_HPP
24
25#include <xercesc/util/XercesDefs.hpp>
26#include <xercesc/util/XMLURL.hpp>
27#include <xercesc/util/XMLException.hpp>
28
29 XERCES_CPP_NAMESPACE_BEGIN
30
31 class BinInputStream;
32
33// This class holds advanced informations about the HTTP connection
34 class XMLUTIL_EXPORT XMLNetHTTPInfo
35{
36 public:
37 XMLNetHTTPInfo();
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 //
65 HTTPMethod fHTTPMethod;
66 const char* fHeaders;
67 XMLSize_t fHeadersLen;
68 const char* fPayload;
69 XMLSize_t fPayloadLen;
70};
71
72 inline XMLNetHTTPInfo::XMLNetHTTPInfo()
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//
95 class XMLUTIL_EXPORT XMLNetAccessor : public XMemory
96{
97public :
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
118protected :
119 // -----------------------------------------------------------------------
120 // Hidden constructors
121 // -----------------------------------------------------------------------
122 XMLNetAccessor()
123 {
124 }
125
126
127private :
128 // -----------------------------------------------------------------------
129 // Unimplemented constructors and operators
130 // -----------------------------------------------------------------------
131 XMLNetAccessor(const XMLNetAccessor&);
132 XMLNetAccessor& operator=(const XMLNetAccessor&);
133};
134
135 MakeXMLException(NetAccessorException, XMLUTIL_EXPORT)
136
137 XERCES_CPP_NAMESPACE_END
138
139#endif
MakeXMLException
MakeXMLException(XMLPlatformUtilsException, XMLUTIL_EXPORT) inline XMLSize_t XMLPlatformUtils
Definition: PlatformUtils.hpp:774
XMLException.hpp
XMLURL.hpp
XercesDefs.hpp
XERCES_CPP_NAMESPACE_BEGIN
#define XERCES_CPP_NAMESPACE_BEGIN
Definition: XercesDefs.hpp:112
XMLUTIL_EXPORT
#define XMLUTIL_EXPORT
Definition: XercesDefs.hpp:162
XERCES_CPP_NAMESPACE_END
#define XERCES_CPP_NAMESPACE_END
Definition: XercesDefs.hpp:113
XMLCh
uint16_t XMLCh
Definition: Xerces_autoconf_config.hpp:120
XMLSize_t
size_t XMLSize_t
Definition: Xerces_autoconf_config.hpp:112
BinInputStream
Definition: BinInputStream.hpp:30
XMLNetAccessor
Definition: XMLNetAccessor.hpp:96
XMLNetAccessor::~XMLNetAccessor
virtual ~XMLNetAccessor()
Definition: XMLNetAccessor.hpp:101
XMLNetAccessor::makeNew
virtual BinInputStream * makeNew(const XMLURL &urlSrc, const XMLNetHTTPInfo *httpInfo=0)=0
XMLNetAccessor::XMLNetAccessor
XMLNetAccessor()
Definition: XMLNetAccessor.hpp:122
XMLNetAccessor::getId
virtual const XMLCh * getId() const =0
XMLNetHTTPInfo
Definition: XMLNetAccessor.hpp:35
XMLNetHTTPInfo::fHeaders
const char * fHeaders
Definition: XMLNetAccessor.hpp:66
XMLNetHTTPInfo::XMLNetHTTPInfo
XMLNetHTTPInfo()
Definition: XMLNetAccessor.hpp:72
XMLNetHTTPInfo::fHeadersLen
XMLSize_t fHeadersLen
Definition: XMLNetAccessor.hpp:67
XMLNetHTTPInfo::fPayloadLen
XMLSize_t fPayloadLen
Definition: XMLNetAccessor.hpp:69
XMLNetHTTPInfo::fHTTPMethod
HTTPMethod fHTTPMethod
Definition: XMLNetAccessor.hpp:65
XMLNetHTTPInfo::fPayload
const char * fPayload
Definition: XMLNetAccessor.hpp:68
XMLNetHTTPInfo::HTTPMethod
HTTPMethod
Definition: XMLNetAccessor.hpp:39
XMLNetHTTPInfo::GET
@ GET
Definition: XMLNetAccessor.hpp:40
XMLNetHTTPInfo::PUT
@ PUT
Definition: XMLNetAccessor.hpp:41
XMLURL
Definition: XMLURL.hpp:36
XMemory
This class makes it possible to override the C++ memory management by adding new/delete operators to ...
Definition: XMemory.hpp:41