source: NonGTP/Xerces/xerces/include/xercesc/util/XMLNetAccessor.hpp @ 358

Revision 358, 4.2 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 1999-2000,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * $Id: XMLNetAccessor.hpp,v 1.8 2004/09/08 13:56:24 peiyongz Exp $
19 */
20
21#if !defined(XMLNETACCESSOR_HPP)
22#define XMLNETACCESSOR_HPP
23
24#include <xercesc/util/XMLURL.hpp>
25#include <xercesc/util/XMLException.hpp>
26
27XERCES_CPP_NAMESPACE_BEGIN
28
29class BinInputStream;
30
31//  This class holds advanced informations about the HTTP connection
32class XMLUTIL_EXPORT XMLNetHTTPInfo
33{
34public:
35    XMLNetHTTPInfo();
36
37    typedef enum {
38        GET,
39        PUT,
40        POST
41    } HTTPMethod;
42
43    // -----------------------------------------------------------------------
44    //  Data members
45    //
46    //  fHTTPMethod
47    //      The type of the HTTP request
48    //
49    //  fHeaders
50    //      The extra headers that will be sent as part of the request; the format is
51    //      Header1: Value\r\nHeader2: Value\r\n
52    //
53    //  fHeadersLen
54    //      The length of the string pointed by fHeaders, in bytes
55    //
56    //  fPayload
57    //      The extra data that will be sent after the headers; in the case of a PUT
58    //      operation, this is the content of the resource being posted. It can be binary data
59    //
60    //  fPayloadLen
61    //      The length of the binary buffer pointed by fPayload, in bytes
62    //
63    HTTPMethod      fHTTPMethod;
64    const char*     fHeaders;
65    int             fHeadersLen;
66    const char*     fPayload;
67    int             fPayloadLen;
68};
69
70inline XMLNetHTTPInfo::XMLNetHTTPInfo()
71:fHTTPMethod(XMLNetHTTPInfo::GET),
72 fHeaders(0),
73 fHeadersLen(0),
74 fPayload(0),
75 fPayloadLen(0)
76{
77}
78
79
80//
81//  This class is an abstract interface via which the URL class accesses
82//  net access services. When any source URL is not in effect a local file
83//  path, then the URL class is used to look at it. Then the URL class can
84//  be asked to make a binary input stream via which the referenced resource
85//  can be read in.
86//
87//  The URL class will use an object derived from this class to create a
88//  binary stream for the URL to return. The object it uses is provided by
89//  the platform utils, and is actually provided by the per-platform init
90//  code so each platform can decide what actual implementation it wants to
91//  use.
92//
93class XMLUTIL_EXPORT XMLNetAccessor : public XMemory
94{
95public :
96    // -----------------------------------------------------------------------
97    //  Virtual destructor
98    // -----------------------------------------------------------------------
99    virtual ~XMLNetAccessor()
100    {
101    }
102
103
104    // -----------------------------------------------------------------------
105    //  The virtual net accessor interface
106    // -----------------------------------------------------------------------
107    virtual const XMLCh* getId() const = 0;
108
109    virtual BinInputStream* makeNew
110    (
111        const   XMLURL&                 urlSrc,
112        const   XMLNetHTTPInfo*         httpInfo=0
113    ) = 0;
114
115
116protected :
117    // -----------------------------------------------------------------------
118    //  Hidden constructors
119    // -----------------------------------------------------------------------
120    XMLNetAccessor()
121    {
122    }
123
124
125private :
126    // -----------------------------------------------------------------------
127    //  Unimplemented constructors and operators
128    // -----------------------------------------------------------------------
129    XMLNetAccessor(const XMLNetAccessor&);
130    XMLNetAccessor& operator=(const XMLNetAccessor&);
131};
132
133MakeXMLException(NetAccessorException, XMLUTIL_EXPORT)
134
135XERCES_CPP_NAMESPACE_END
136
137#endif
Note: See TracBrowser for help on using the repository browser.