00001 /*00002 * Licensed to the Apache Software Foundation (ASF) under one or more00003 * contributor license agreements. See the NOTICE file distributed with00004 * this work for additional information regarding copyright ownership.00005 * The ASF licenses this file to You under the Apache License, Version 2.000006 * (the "License"); you may not use this file except in compliance with00007 * the License. You may obtain a copy of the License at00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.000010 * 00011 * Unless required by applicable law or agreed to in writing, software00012 * distributed under the License is distributed on an "AS IS" BASIS,00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.00014 * See the License for the specific language governing permissions and00015 * limitations under the License.00016 */00017
00018 /*00019 * $Id: XMLNetAccessor.hpp 568078 2007-08-21 11:43:25Z amassari $00020 */00021
00022 #if !defined(XMLNETACCESSOR_HPP)00023#define XMLNETACCESSOR_HPP00024
00025 #include <xercesc/util/XMLURL.hpp>00026 #include <xercesc/util/XMLException.hpp>00027
00028 XERCES_CPP_NAMESPACE_BEGIN00029
00030 class BinInputStream;
00031
00032 // This class holds advanced informations about the HTTP connection00033class XMLNetHTTPInfo00034 {
00035 public:
00036 XMLNetHTTPInfo();
00037
00038typedefenum {
00039 GET,
00040 PUT,
00041 POST
00042 } HTTPMethod;
00043
00044 // -----------------------------------------------------------------------00045 // Data members00046 //00047 // fHTTPMethod00048 // The type of the HTTP request00049 //00050 // fHeaders00051 // The extra headers that will be sent as part of the request; the format is00052 // Header1: Value\r\nHeader2: Value\r\n00053 //00054 // fHeadersLen00055 // The length of the string pointed by fHeaders, in bytes00056 //00057 // fPayload00058 // The extra data that will be sent after the headers; in the case of a PUT00059 // operation, this is the content of the resource being posted. It can be binary data00060 //00061 // fPayloadLen00062 // The length of the binary buffer pointed by fPayload, in bytes00063 //00064HTTPMethod fHTTPMethod;
00065constchar* fHeaders;
00066int fHeadersLen;
00067constchar* fPayload;
00068int fPayloadLen;
00069 };
00070
00071inlineXMLNetHTTPInfo::XMLNetHTTPInfo()
00072 :fHTTPMethod(XMLNetHTTPInfo::GET),
00073 fHeaders(0),
00074 fHeadersLen(0),
00075 fPayload(0),
00076 fPayloadLen(0)
00077 {
00078 }
00079
00080
00081 //00082 // This class is an abstract interface via which the URL class accesses00083 // net access services. When any source URL is not in effect a local file00084 // path, then the URL class is used to look at it. Then the URL class can00085 // be asked to make a binary input stream via which the referenced resource00086 // can be read in.00087 //00088 // The URL class will use an object derived from this class to create a00089 // binary stream for the URL to return. The object it uses is provided by00090 // the platform utils, and is actually provided by the per-platform init00091 // code so each platform can decide what actual implementation it wants to00092 // use.00093 //00094class XMLNetAccessor : publicXMemory00095 {
00096 public :
00097 // -----------------------------------------------------------------------00098 // Virtual destructor00099 // -----------------------------------------------------------------------00100virtual ~XMLNetAccessor()
00101 {
00102 }
00103
00104
00105 // -----------------------------------------------------------------------00106 // The virtual net accessor interface00107 // -----------------------------------------------------------------------00108 virtualconst XMLCh* getId() const = 0;
00109
00110 virtualBinInputStream* makeNew
00111 (
00112 constXMLURL& urlSrc,
00113 constXMLNetHTTPInfo* httpInfo=0
00114 ) = 0;
00115
00116
00117 protected :
00118 // -----------------------------------------------------------------------00119 // Hidden constructors00120 // -----------------------------------------------------------------------00121XMLNetAccessor()
00122 {
00123 }
00124
00125
00126 private :
00127 // -----------------------------------------------------------------------00128 // Unimplemented constructors and operators00129 // -----------------------------------------------------------------------00130 XMLNetAccessor(constXMLNetAccessor&);
00131 XMLNetAccessor& operator=(constXMLNetAccessor&);
00132 };
00133
00134 MakeXMLException(NetAccessorException, )
00135
00136 XERCES_CPP_NAMESPACE_END00137
00138 #endif