http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Release Info

Installation
Download
Build

FAQs
Samples
API Docs

DOM C++ Binding
Programming
Migration Guide

Feedback
Bug-Reporting
PDF Document

CVS Repository
Mail Archive

API Docs for SAX and DOM
 

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

XMLNetAccessor.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2000,2004 The Apache Software Foundation.
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 /*
00018  * $Id: XMLNetAccessor.hpp,v 1.8 2004/09/08 13:56:24 peiyongz Exp $
00019  */
00020 
00021 #if !defined(XMLNETACCESSOR_HPP)
00022 #define XMLNETACCESSOR_HPP
00023 
00024 #include <xercesc/util/XMLURL.hpp>
00025 #include <xercesc/util/XMLException.hpp>
00026 
00027 XERCES_CPP_NAMESPACE_BEGIN
00028 
00029 class BinInputStream;
00030 
00031 //  This class holds advanced informations about the HTTP connection
00032 class  XMLNetHTTPInfo
00033 {
00034 public:
00035     XMLNetHTTPInfo();
00036 
00037     typedef enum {
00038         GET,
00039         PUT,
00040         POST
00041     } HTTPMethod;
00042 
00043     // -----------------------------------------------------------------------
00044     //  Data members
00045     //
00046     //  fHTTPMethod
00047     //      The type of the HTTP request
00048     //
00049     //  fHeaders
00050     //      The extra headers that will be sent as part of the request; the format is
00051     //      Header1: Value\r\nHeader2: Value\r\n
00052     //
00053     //  fHeadersLen
00054     //      The length of the string pointed by fHeaders, in bytes
00055     //
00056     //  fPayload
00057     //      The extra data that will be sent after the headers; in the case of a PUT
00058     //      operation, this is the content of the resource being posted. It can be binary data
00059     //
00060     //  fPayloadLen
00061     //      The length of the binary buffer pointed by fPayload, in bytes
00062     //
00063     HTTPMethod      fHTTPMethod;
00064     const char*     fHeaders;
00065     int             fHeadersLen;
00066     const char*     fPayload;
00067     int             fPayloadLen;
00068 };
00069 
00070 inline XMLNetHTTPInfo::XMLNetHTTPInfo()
00071 :fHTTPMethod(XMLNetHTTPInfo::GET),
00072  fHeaders(0),
00073  fHeadersLen(0),
00074  fPayload(0),
00075  fPayloadLen(0)
00076 {
00077 }
00078 
00079 
00080 //
00081 //  This class is an abstract interface via which the URL class accesses
00082 //  net access services. When any source URL is not in effect a local file
00083 //  path, then the URL class is used to look at it. Then the URL class can
00084 //  be asked to make a binary input stream via which the referenced resource
00085 //  can be read in.
00086 //
00087 //  The URL class will use an object derived from this class to create a
00088 //  binary stream for the URL to return. The object it uses is provided by
00089 //  the platform utils, and is actually provided by the per-platform init
00090 //  code so each platform can decide what actual implementation it wants to
00091 //  use.
00092 //
00093 class  XMLNetAccessor : public XMemory
00094 {
00095 public :
00096     // -----------------------------------------------------------------------
00097     //  Virtual destructor
00098     // -----------------------------------------------------------------------
00099     virtual ~XMLNetAccessor()
00100     {
00101     }
00102 
00103 
00104     // -----------------------------------------------------------------------
00105     //  The virtual net accessor interface
00106     // -----------------------------------------------------------------------
00107     virtual const XMLCh* getId() const = 0;
00108 
00109     virtual BinInputStream* makeNew
00110     (
00111         const   XMLURL&                 urlSrc,
00112         const   XMLNetHTTPInfo*         httpInfo=0
00113     ) = 0;
00114 
00115 
00116 protected :
00117     // -----------------------------------------------------------------------
00118     //  Hidden constructors
00119     // -----------------------------------------------------------------------
00120     XMLNetAccessor()
00121     {
00122     }
00123 
00124 
00125 private :
00126     // -----------------------------------------------------------------------
00127     //  Unimplemented constructors and operators
00128     // -----------------------------------------------------------------------
00129     XMLNetAccessor(const XMLNetAccessor&);
00130     XMLNetAccessor& operator=(const XMLNetAccessor&);
00131 };
00132 
00133 MakeXMLException(NetAccessorException, )
00134 
00135 XERCES_CPP_NAMESPACE_END
00136 
00137 #endif


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