source: XMLIO_V2/external/include/Poco/Net/HTTPServerRequestImpl.h @ 80

Last change on this file since 80 was 80, checked in by ymipsl, 14 years ago

ajout lib externe

  • Property svn:eol-style set to native
File size: 4.0 KB
Line 
1//
2// HTTPServerRequestImpl.h
3//
4// $Id: //poco/1.3/Net/include/Poco/Net/HTTPServerRequestImpl.h#3 $
5//
6// Library: Net
7// Package: HTTPServer
8// Module:  HTTPServerRequestImpl
9//
10// Definition of the HTTPServerRequestImpl class.
11//
12// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
13// and Contributors.
14//
15// Permission is hereby granted, free of charge, to any person or organization
16// obtaining a copy of the software and accompanying documentation covered by
17// this license (the "Software") to use, reproduce, display, distribute,
18// execute, and transmit the Software, and to prepare derivative works of the
19// Software, and to permit third-parties to whom the Software is furnished to
20// do so, all subject to the following:
21//
22// The copyright notices in the Software and this entire statement, including
23// the above license grant, this restriction and the following disclaimer,
24// must be included in all copies of the Software, in whole or in part, and
25// all derivative works of the Software, unless such copies or derivative
26// works are solely in the form of machine-executable object code generated by
27// a source language processor.
28//
29// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
32// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
33// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
34// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
35// DEALINGS IN THE SOFTWARE.
36//
37
38
39#ifndef Net_HTTPServerRequestImpl_INCLUDED
40#define Net_HTTPServerRequestImpl_INCLUDED
41
42
43#include "Poco/Net/Net.h"
44#include "Poco/Net/HTTPServerRequest.h"
45#include "Poco/Net/SocketAddress.h"
46#include "Poco/AutoPtr.h"
47#include <istream>
48
49
50namespace Poco {
51namespace Net {
52
53
54class HTTPServerSession;
55class HTTPServerParams;
56
57
58class Net_API HTTPServerRequestImpl: public HTTPServerRequest
59        /// This subclass of HTTPServerRequest is used for
60        /// representing server-side HTTP requests.
61        ///
62        /// A HTTPServerRequest is passed to the
63        /// handleRequest() method of HTTPRequestHandler.
64{
65public:
66        HTTPServerRequestImpl(HTTPServerResponse& response, HTTPServerSession& session, HTTPServerParams* pParams);
67                /// Creates the HTTPServerRequestImpl, using the
68                /// given HTTPServerSession.
69
70        ~HTTPServerRequestImpl();
71                /// Destroys the HTTPServerRequestImpl.
72               
73        std::istream& stream();
74                /// Returns the input stream for reading
75                /// the request body.
76                ///
77                /// The stream is valid until the HTTPServerRequestImpl
78                /// object is destroyed.
79               
80        bool expectContinue() const;
81                /// Returns true if the client expects a
82                /// 100 Continue response.
83               
84        const SocketAddress& clientAddress() const;
85                /// Returns the client's address.
86
87        const SocketAddress& serverAddress() const;
88                /// Returns the server's address.
89               
90        const HTTPServerParams& serverParams() const;
91                /// Returns a reference to the server parameters.
92
93        HTTPServerResponse& response() const;
94                /// Returns a reference to the associated response.
95
96protected:
97        static const std::string EXPECT;
98       
99private:
100        HTTPServerResponse&             _response;
101        std::istream*                   _pStream;
102        Poco::AutoPtr<HTTPServerParams> _pParams;
103        SocketAddress                   _clientAddress;
104        SocketAddress                   _serverAddress;
105};
106
107
108//
109// inlines
110//
111inline std::istream& HTTPServerRequestImpl::stream()
112{
113        poco_check_ptr (_pStream);
114       
115        return *_pStream;
116}
117
118
119inline const SocketAddress& HTTPServerRequestImpl::clientAddress() const
120{
121        return _clientAddress;
122}
123
124
125inline const SocketAddress& HTTPServerRequestImpl::serverAddress() const
126{
127        return _serverAddress;
128}
129
130
131inline const HTTPServerParams& HTTPServerRequestImpl::serverParams() const
132{
133        return *_pParams;
134}
135
136
137inline HTTPServerResponse& HTTPServerRequestImpl::response() const
138{
139        return _response;
140}
141
142
143} } // namespace Poco::Net
144
145
146#endif // Net_HTTPServerRequestImpl_INCLUDED
Note: See TracBrowser for help on using the repository browser.