source: XMLIO_V2/external/include/Poco/Net/HTTPServerParams.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: 5.2 KB
Line 
1//
2// HTTPServerParams.h
3//
4// $Id: //poco/1.3/Net/include/Poco/Net/HTTPServerParams.h#2 $
5//
6// Library: Net
7// Package: HTTPServer
8// Module:  HTTPServerParams
9//
10// Definition of the HTTPServerParams 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_HTTPServerParams_INCLUDED
40#define Net_HTTPServerParams_INCLUDED
41
42
43#include "Poco/Net/Net.h"
44#include "Poco/Net/TCPServerParams.h"
45
46
47namespace Poco {
48namespace Net {
49
50
51class Net_API HTTPServerParams: public TCPServerParams
52        /// This class is used to specify parameters to both the
53        /// HTTPServer, as well as to HTTPRequestHandler objects.
54        ///
55        /// Subclasses may add new parameters to the class.
56{
57public:
58        typedef Poco::AutoPtr<HTTPServerParams> Ptr;
59       
60        HTTPServerParams();
61                /// Creates the HTTPServerParams.
62                ///
63                /// Sets the following default values:
64                ///   - timeout:              60 seconds
65                ///   - keepAlive:            true
66                ///   - maxKeepAliveRequests: 0
67                ///   - keepAliveTimeout:     10 seconds
68               
69        void setServerName(const std::string& serverName);
70                /// Sets the name and port (name:port) that the server uses to identify itself.
71                ///
72                /// If this is not set to valid DNS name for your host, server-generated
73                /// redirections will not work.
74               
75        const std::string& getServerName() const;
76                /// Returns the name and port (name:port) that the server uses to identify itself.
77
78        void setSoftwareVersion(const std::string& softwareVersion);
79                /// Sets the server software name and version that the server uses to identify
80                /// itself. If this is set to a non-empty string, the server will
81                /// automatically include a Server header field with the value given
82                /// here in every response it sends.
83                ///
84                /// The format of the softwareVersion string should be name/version
85                /// (e.g. MyHTTPServer/1.0).
86
87        const std::string& getSoftwareVersion() const;
88                /// Returns the server software name and version that the server uses to
89                /// identify itself.
90
91        void setTimeout(const Poco::Timespan& timeout);
92                /// Sets the connection timeout for HTTP connections.
93               
94        const Poco::Timespan& getTimeout() const;
95                /// Returns the connection timeout for HTTP connections.
96               
97        void setKeepAlive(bool keepAlive);
98                /// Enables (keepAlive == true) or disables (keepAlive == false)
99                /// persistent connections.
100               
101        bool getKeepAlive() const;
102                /// Returns true iff persistent connections are enabled.
103               
104        void setKeepAliveTimeout(const Poco::Timespan& timeout);
105                /// Sets the connection timeout for HTTP connections.
106               
107        const Poco::Timespan& getKeepAliveTimeout() const;
108                /// Returns the connection timeout for HTTP connections.
109       
110        void setMaxKeepAliveRequests(int maxKeepAliveRequests);
111                /// Specifies the maximun number of requests allowed
112                /// during a persistent connection. 0 means unlimited
113                /// connections.
114               
115        int getMaxKeepAliveRequests() const;
116                /// Returns the maximum number of requests allowed
117                /// during a persistent connection, or 0 if
118                /// unlimited connections are allowed.
119
120protected:
121        virtual ~HTTPServerParams();
122                /// Destroys the HTTPServerParams.
123
124private:
125        std::string    _serverName;
126        std::string    _softwareVersion;
127        Poco::Timespan _timeout;
128        bool           _keepAlive;
129        int            _maxKeepAliveRequests;
130        Poco::Timespan _keepAliveTimeout;
131};
132
133
134//
135// inlines
136//
137inline const std::string& HTTPServerParams::getServerName() const
138{
139        return _serverName;
140}
141
142
143inline const std::string& HTTPServerParams::getSoftwareVersion() const
144{
145        return _softwareVersion;
146}
147
148
149inline const Poco::Timespan& HTTPServerParams::getTimeout() const
150{
151        return _timeout;
152}
153
154
155inline bool HTTPServerParams::getKeepAlive() const
156{
157        return _keepAlive;
158}
159
160
161inline int HTTPServerParams::getMaxKeepAliveRequests() const
162{
163        return _maxKeepAliveRequests;
164}
165
166
167inline const Poco::Timespan& HTTPServerParams::getKeepAliveTimeout() const
168{
169        return _keepAliveTimeout;
170}
171
172
173} } // namespace Poco::Net
174
175
176#endif // Net_HTTPServerParams_INCLUDED
Note: See TracBrowser for help on using the repository browser.