| Alex Vakulenko | 039da31 | 2015-02-03 08:58:55 -0800 | [diff] [blame] | 1 | // Copyright 2014 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef WEBSERVER_LIBWEBSERV_REQUEST_HANDLER_INTERFACE_H_ |
| 6 | #define WEBSERVER_LIBWEBSERV_REQUEST_HANDLER_INTERFACE_H_ |
| 7 | |
| 8 | #include <base/memory/scoped_ptr.h> |
| 9 | #include <libwebserv/request.h> |
| 10 | #include <libwebserv/response.h> |
| 11 | |
| 12 | namespace libwebserv { |
| 13 | |
| 14 | // The base interface for HTTP request handlers. When registering a handler, |
| 15 | // the RequestHandlerInterface is provided, and when a request comes in, |
| 16 | // RequestHandlerInterface::HandleRequest() is called to process the data and |
| 17 | // send response. |
| 18 | class RequestHandlerInterface { |
| 19 | public: |
| 20 | using HandlerSignature = void(scoped_ptr<Request>, scoped_ptr<Response>); |
| 21 | |
| 22 | virtual void HandleRequest(scoped_ptr<Request> request, |
| 23 | scoped_ptr<Response> response) = 0; |
| 24 | }; |
| 25 | |
| 26 | } // namespace libwebserv |
| 27 | |
| 28 | #endif // WEBSERVER_LIBWEBSERV_REQUEST_HANDLER_INTERFACE_H_ |