1//
2// HTTPRequestHandlerFactory.h
3//
4// Library: Net
5// Package: HTTPServer
6// Module: HTTPRequestHandlerFactory
7//
8// Definition of the HTTPRequestHandlerFactory class.
9//
10// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
11// and Contributors.
12//
13// SPDX-License-Identifier: BSL-1.0
14//
15
16
17#ifndef Net_HTTPRequestHandlerFactory_INCLUDED
18#define Net_HTTPRequestHandlerFactory_INCLUDED
19
20
21#include "Poco/Net/Net.h"
22#include "Poco/SharedPtr.h"
23#include "Poco/BasicEvent.h"
24
25
26namespace Poco {
27namespace Net {
28
29
30class HTTPServerRequest;
31class HTTPServerResponse;
32class HTTPRequestHandler;
33
34
35class Net_API HTTPRequestHandlerFactory
36 /// A factory for HTTPRequestHandler objects.
37 /// Subclasses must override the createRequestHandler()
38 /// method.
39{
40public:
41 typedef Poco::SharedPtr<HTTPRequestHandlerFactory> Ptr;
42
43 HTTPRequestHandlerFactory();
44 /// Creates the HTTPRequestHandlerFactory.
45
46 virtual ~HTTPRequestHandlerFactory();
47 /// Destroys the HTTPRequestHandlerFactory.
48
49 virtual HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request) = 0;
50 /// Must be overridden by subclasses.
51 ///
52 /// Creates a new request handler for the given HTTP request.
53 ///
54 /// The method should inspect the given HTTPServerRequest object (e.g., method
55 /// and URI) and create an appropriate HTTPRequestHandler object to handle the
56 /// request.
57 ///
58 /// If the request contains a "Expect: 100-continue" header, it's possible
59 /// to prevent the server from sending the default 100 Continue response
60 /// by setting the status of the response object that can be obtained through
61 /// the request object (request.response()) to something other than 200 OK.
62
63protected:
64 Poco::BasicEvent<const bool> serverStopped;
65
66private:
67 HTTPRequestHandlerFactory(const HTTPRequestHandlerFactory&);
68 HTTPRequestHandlerFactory& operator = (const HTTPRequestHandlerFactory&);
69
70 friend class HTTPServer;
71 friend class HTTPServerConnection;
72};
73
74
75} } // namespace Poco::Net
76
77
78#endif // Net_HTTPRequestHandlerFactory_INCLUDED
79