Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:15

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_XMLNETACCESSOR_HPP)
0023 #define XERCESC_INCLUDE_GUARD_XMLNETACCESSOR_HPP
0024 
0025 #include <xercesc/util/XercesDefs.hpp>
0026 #include <xercesc/util/XMLURL.hpp>
0027 #include <xercesc/util/XMLException.hpp>
0028 
0029 XERCES_CPP_NAMESPACE_BEGIN
0030 
0031 class BinInputStream;
0032 
0033 //  This class holds advanced informations about the HTTP connection
0034 class XMLUTIL_EXPORT XMLNetHTTPInfo
0035 {
0036 public:
0037     XMLNetHTTPInfo();
0038 
0039     typedef enum {
0040         GET,
0041         PUT,
0042         POST
0043     } HTTPMethod;
0044 
0045     // -----------------------------------------------------------------------
0046     //  Data members
0047     //
0048     //  fHTTPMethod
0049     //      The type of the HTTP request
0050     //
0051     //  fHeaders
0052     //      The extra headers that will be sent as part of the request; the format is
0053     //      Header1: Value\r\nHeader2: Value\r\n
0054     //
0055     //  fHeadersLen
0056     //      The length of the string pointed by fHeaders, in bytes
0057     //
0058     //  fPayload
0059     //      The extra data that will be sent after the headers; in the case of a PUT
0060     //      operation, this is the content of the resource being posted. It can be binary data
0061     //
0062     //  fPayloadLen
0063     //      The length of the binary buffer pointed by fPayload, in bytes
0064     //
0065     HTTPMethod      fHTTPMethod;
0066     const char*     fHeaders;
0067     XMLSize_t       fHeadersLen;
0068     const char*     fPayload;
0069     XMLSize_t       fPayloadLen;
0070 };
0071 
0072 inline XMLNetHTTPInfo::XMLNetHTTPInfo()
0073 :fHTTPMethod(XMLNetHTTPInfo::GET),
0074  fHeaders(0),
0075  fHeadersLen(0),
0076  fPayload(0),
0077  fPayloadLen(0)
0078 {
0079 }
0080 
0081 
0082 //
0083 //  This class is an abstract interface via which the URL class accesses
0084 //  net access services. When any source URL is not in effect a local file
0085 //  path, then the URL class is used to look at it. Then the URL class can
0086 //  be asked to make a binary input stream via which the referenced resource
0087 //  can be read in.
0088 //
0089 //  The URL class will use an object derived from this class to create a
0090 //  binary stream for the URL to return. The object it uses is provided by
0091 //  the platform utils, and is actually provided by the per-platform init
0092 //  code so each platform can decide what actual implementation it wants to
0093 //  use.
0094 //
0095 class XMLUTIL_EXPORT XMLNetAccessor : public XMemory
0096 {
0097 public :
0098     // -----------------------------------------------------------------------
0099     //  Virtual destructor
0100     // -----------------------------------------------------------------------
0101     virtual ~XMLNetAccessor()
0102     {
0103     }
0104 
0105 
0106     // -----------------------------------------------------------------------
0107     //  The virtual net accessor interface
0108     // -----------------------------------------------------------------------
0109     virtual const XMLCh* getId() const = 0;
0110 
0111     virtual BinInputStream* makeNew
0112     (
0113         const   XMLURL&                 urlSrc,
0114         const   XMLNetHTTPInfo*         httpInfo=0
0115     ) = 0;
0116 
0117 
0118 protected :
0119     // -----------------------------------------------------------------------
0120     //  Hidden constructors
0121     // -----------------------------------------------------------------------
0122     XMLNetAccessor()
0123     {
0124     }
0125 
0126 
0127 private :
0128     // -----------------------------------------------------------------------
0129     //  Unimplemented constructors and operators
0130     // -----------------------------------------------------------------------
0131     XMLNetAccessor(const XMLNetAccessor&);
0132     XMLNetAccessor& operator=(const XMLNetAccessor&);
0133 };
0134 
0135 MakeXMLException(NetAccessorException, XMLUTIL_EXPORT)
0136 
0137 XERCES_CPP_NAMESPACE_END
0138 
0139 #endif