Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef ACE_HTTP_REQUEST_H
00010 #define ACE_HTTP_REQUEST_H
00011
00012 #include "ace/pre.h"
00013
00014 #include "ace/config-all.h"
00015
00016 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00017 # pragma once
00018 #endif
00019
00020 #include "ace/Array.h"
00021 #include "ace/INet/INet_Export.h"
00022 #include "ace/INet/Request.h"
00023 #include "ace/INet/HTTP_Header.h"
00024
00025 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00026
00027 namespace ACE
00028 {
00029 namespace HTTP
00030 {
00031 class ACE_INET_Export Request
00032 : public ACE::INet::Request, public Header
00033 {
00034 public:
00035
00036 Request();
00037
00038
00039 Request(const ACE_CString& version);
00040
00041
00042 Request(const ACE_CString& method, const ACE_CString& uri);
00043
00044
00045 Request(const ACE_CString& method, const ACE_CString& uri, const ACE_CString& version);
00046
00047
00048 virtual ~Request();
00049
00050
00051 void reset ();
00052
00053 void reset (const ACE_CString& version);
00054
00055 void reset (const ACE_CString& method, const ACE_CString& uri);
00056
00057 void reset (const ACE_CString& method, const ACE_CString& uri, const ACE_CString& version);
00058
00059
00060 void set_method(const ACE_CString& method);
00061
00062
00063 const ACE_CString& get_method() const;
00064
00065
00066 void set_URI(const ACE_CString& uri);
00067
00068
00069 const ACE_CString& get_URI() const;
00070
00071
00072 void set_host(const ACE_CString& host);
00073
00074 void set_host(const ACE_CString& host, u_short port);
00075
00076
00077 bool has_host () const;
00078
00079
00080 ACE_CString get_host() const;
00081
00082
00083 void add_cookie(const ACE_CString & cookie);
00084
00085
00086 void get_cookies(ACE_Array<ACE_CString> & cookies) const;
00087
00088
00089
00090 bool has_credentials() const;
00091
00092
00093 void get_credentials(ACE_CString& scheme, ACE_CString& auth_info) const;
00094
00095
00096 void set_credentials(const ACE_CString& scheme, const ACE_CString& auth_info);
00097
00098
00099 void write(std::ostream& str) const;
00100
00101
00102
00103 bool read(std::istream& str);
00104
00105 static const ACE_CString HTTP_GET;
00106 static const ACE_CString HTTP_HEAD;
00107 static const ACE_CString HTTP_PUT;
00108 static const ACE_CString HTTP_POST;
00109 static const ACE_CString HTTP_OPTIONS;
00110 static const ACE_CString HTTP_DELETE;
00111 static const ACE_CString HTTP_TRACE;
00112 static const ACE_CString HTTP_CONNECT;
00113
00114 static const ACE_CString HOST;
00115 static const ACE_CString COOKIE;
00116 static const ACE_CString AUTHORIZATION;
00117
00118 private:
00119 enum Limits
00120 {
00121 MAX_METHOD_LENGTH = 32,
00122 MAX_URI_LENGTH = 4096,
00123 MAX_VERSION_LENGTH = 8
00124 };
00125
00126 ACE_CString method_;
00127 ACE_CString uri_;
00128 };
00129 }
00130 }
00131
00132 ACE_END_VERSIONED_NAMESPACE_DECL
00133
00134 #if defined (__ACE_INLINE__)
00135 #include "ace/INet/HTTP_Request.inl"
00136 #endif
00137
00138 #include "ace/post.h"
00139 #endif