source: icXML/icXML-devel/src/xercesc/util/XMLNetAccessor.hpp @ 2722

Last change on this file since 2722 was 2722, checked in by cameron, 6 years ago

Original Xerces files with import mods for icxercesc

File size: 4.3 KB
Line 
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
25#include <xercesc/util/XercesDefs.hpp>
26#include <xercesc/util/XMLURL.hpp>
27#include <xercesc/util/XMLException.hpp>
28
29XERCES_CPP_NAMESPACE_BEGIN
30
31class BinInputStream;
32
33//  This class holds advanced informations about the HTTP connection
34class XMLUTIL_EXPORT XMLNetHTTPInfo
35{
36public:
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
72inline 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//
95class 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
135MakeXMLException(NetAccessorException, XMLUTIL_EXPORT)
136
137XERCES_CPP_NAMESPACE_END
138
139#endif
Note: See TracBrowser for help on using the repository browser.