00001 /***************************************************************************** 00002 * Copyright (C) 2011 by Benjamin Hadorn (b_hadorn@bluewin.ch) 00003 ***************************************************************************** 00004 * Project : Zeus Base Library 00005 * Module : HTTPRequest 00006 * Package : Zeus.ZeusBase.Net.Protocols 00007 * Author : Benjamin Hadorn 00008 * Date : 27.12.2011 00009 * System : Zeus-Framework 00010 ***************************************************************************** 00011 * Licence: * 00012 * This library is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU Lesser General Public License as * 00014 * published by the Free Software Foundation; either version * 00015 * 2.1 of the License, or (at your option) any later version. * 00016 * * 00017 * This library is distributed in the hope that it will be useful, * 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00020 * GNU Lesser General Public License for more details. * 00021 * * 00022 * You should have received a copy of the GNU Lesser General Public * 00023 * License along with this library; if not, write to the Free Software * 00024 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA * 00025 *****************************************************************************/ 00026 00027 /***************************************************************************** 00028 * Changes: 00029 * 27.12.2011 bha: created zeus 2.0 00030 *****************************************************************************/ 00031 00032 00033 #ifndef HTTPRequestH 00034 #define HTTPRequestH 00035 00036 #include <zeusbase/Net/Protocols/AbstractHTTPData.h> 00037 00038 BEGIN_NAMESPACE_Zeus 00039 00040 /***************************************************************************/ 00044 /***************************************************************************/ 00045 zeusbase_class THTTPRequest : public TAbstractHTTPData 00046 { 00047 public: 00048 /***********************************************************************/ 00051 /***********************************************************************/ 00052 enum ERequestProperty 00053 { 00054 /*HTTP 1.0*/ 00055 etAuthorization = 0, 00056 etFrom = 1, 00057 etIfModifiedSince = 2, 00058 etReferer = 3, 00059 etUserAgent = 4, 00060 00061 //additional HTTP 1.0 00062 etAccept = 5, 00063 etAcceptCharset = 6, 00064 etAcceptEncoding = 7, 00065 etAcceptLanguage = 8 00066 }; 00067 00068 THTTPRequest(THTTProtocol::EHTTPVersion eVersion = THTTProtocol::etVersion_1_0); 00069 00070 virtual void reset(); 00071 virtual Retval setRequestProperty(ERequestProperty eType, const IString& rValue); 00072 virtual void setData(const IString& rData, bool bAddContentProperties = false); 00073 00074 THTTProtocol::ERequestMethod getMethod() const; 00075 TString getRessource() const; 00076 void setMethod(THTTProtocol::ERequestMethod eMethod); 00077 void setRessource(const IString& rRessource); 00078 TString toString() const; 00079 00080 static Retval parse(const IString& rIn, THTTPRequest*& rpRequest); 00081 00082 protected: 00083 virtual ~THTTPRequest(); 00084 00085 private: 00087 THTTProtocol::ERequestMethod m_eMethod; 00089 TString m_strRessourceURI; 00090 00091 }; 00092 00093 00094 //Inline methods 00095 /***************************************************************************/ 00098 /***************************************************************************/ 00099 inline THTTProtocol::ERequestMethod THTTPRequest::getMethod() const 00100 { return m_eMethod; } 00101 00102 /***************************************************************************/ 00105 /***************************************************************************/ 00106 inline TString THTTPRequest::getRessource() const 00107 { return m_strRessourceURI; } 00108 00109 /***************************************************************************/ 00112 /***************************************************************************/ 00113 inline void THTTPRequest::setData(const IString& rData, bool bAddContentProperties/* = false*/) 00114 { 00115 TAbstractHTTPData::setData(rData,bAddContentProperties); 00116 } 00117 00118 END_NAMESPACE_Zeus 00119 00120 #endif