| API Docs for SAX and DOM |
| Main Page Classes Files Related Pages # XMLNetAccessor.hpp Go to the documentation of this file.
    00001 /*
    00002  * Licensed to the Apache Software Foundation (ASF) under one or more
    00003  * contributor license agreements.  See the NOTICE file distributed with
    00004  * this work for additional information regarding copyright ownership.
    00005  * The ASF licenses this file to You under the Apache License, Version 2.0
    00006  * (the "License"); you may not use this file except in compliance with
    00007  * the License.  You may obtain a copy of the License at
    00008  *
    00009  *      http://www.apache.org/licenses/LICENSE-2.0
    00010  *
    00011  * Unless required by applicable law or agreed to in writing, software
    00012  * 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 and
    00015  * 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_HPP
    00024
    00025 #include <xercesc/util/XMLURL.hpp>
    00026 #include <xercesc/util/XMLException.hpp>
    00027
    00028 XERCES_CPP_NAMESPACE_BEGIN
    00029
    00030 class BinInputStream;
    00031
    00032 //  This class holds advanced informations about the HTTP connection
    00033 class  XMLNetHTTPInfo
    00034 {
    00035 public:
    00036     XMLNetHTTPInfo();
    00037
    00038     typedef enum {
    00039         GET,
    00040         PUT,
    00041         POST
    00042     } HTTPMethod;
    00043
    00044     // -----------------------------------------------------------------------
    00045     //  Data members
    00046     //
    00047     //  fHTTPMethod
    00048     //      The type of the HTTP request
    00049     //
    00050     //  fHeaders
    00051     //      The extra headers that will be sent as part of the request; the format is
    00052     //      Header1: Value\r\nHeader2: Value\r\n
    00053     //
    00054     //  fHeadersLen
    00055     //      The length of the string pointed by fHeaders, in bytes
    00056     //
    00057     //  fPayload
    00058     //      The extra data that will be sent after the headers; in the case of a PUT
    00059     //      operation, this is the content of the resource being posted. It can be binary data
    00060     //
    00061     //  fPayloadLen
    00062     //      The length of the binary buffer pointed by fPayload, in bytes
    00063     //
    00064     HTTPMethod      fHTTPMethod;
    00065     const char*     fHeaders;
    00066     int             fHeadersLen;
    00067     const char*     fPayload;
    00068     int             fPayloadLen;
    00069 };
    00070
    00071 inline XMLNetHTTPInfo::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 accesses
    00083 //  net access services. When any source URL is not in effect a local file
    00084 //  path, then the URL class is used to look at it. Then the URL class can
    00085 //  be asked to make a binary input stream via which the referenced resource
    00086 //  can be read in.
    00087 //
    00088 //  The URL class will use an object derived from this class to create a
    00089 //  binary stream for the URL to return. The object it uses is provided by
    00090 //  the platform utils, and is actually provided by the per-platform init
    00091 //  code so each platform can decide what actual implementation it wants to
    00092 //  use.
    00093 //
    00094 class  XMLNetAccessor : public XMemory
    00095 {
    00096 public :
    00097     // -----------------------------------------------------------------------
    00098     //  Virtual destructor
    00099     // -----------------------------------------------------------------------
    00100     virtual ~XMLNetAccessor()
    00101     {
    00102     }
    00103
    00104
    00105     // -----------------------------------------------------------------------
    00106     //  The virtual net accessor interface
    00107     // -----------------------------------------------------------------------
    00108     virtual const XMLCh* getId() const = 0;
    00109
    00110     virtual BinInputStream* makeNew
    00111     (
    00112         const   XMLURL&                 urlSrc,
    00113         const   XMLNetHTTPInfo*         httpInfo=0
    00114     ) = 0;
    00115
    00116
    00117 protected :
    00118     // -----------------------------------------------------------------------
    00119     //  Hidden constructors
    00120     // -----------------------------------------------------------------------
    00121     XMLNetAccessor()
    00122     {
    00123     }
    00124
    00125
    00126 private :
    00127     // -----------------------------------------------------------------------
    00128     //  Unimplemented constructors and operators
    00129     // -----------------------------------------------------------------------
    00130     XMLNetAccessor(const XMLNetAccessor&);
    00131     XMLNetAccessor& operator=(const XMLNetAccessor&);
    00132 };
    00133
    00134 MakeXMLException(NetAccessorException, )
    00135
    00136 XERCES_CPP_NAMESPACE_END
    00137
    00138 #endif

Copyright © 1994-2004 The Apache Software Foundation. All Rights Reserved.