Home
HTTP module

ServerResponder

Base responder interface for handling one HTTP request on a server connection.

ServerResponder

#include <icy/http/server.h>
class ServerResponder

Defined in src/http/include/icy/http/server.h:145

Base responder interface for handling one HTTP request on a server connection. Derived classes typically override [onRequest()](#onrequest) and optionally the streaming hooks.

List of all members

NameKindOwner
ServerResponderfunctionDeclared here
~ServerResponderfunctionDeclared here
onHeadersfunctionDeclared here
onPayloadfunctionDeclared here
onRequestfunctionDeclared here
onClosefunctionDeclared here
connectionfunctionDeclared here
requestfunctionDeclared here
responsefunctionDeclared here
_connectionvariableDeclared here
ServerResponderfunctionDeclared here
operator=functionDeclared here

Public Methods

ReturnNameDescription
ServerResponder inlineCreates a ServerResponder for the given connection.
voidonHeaders virtual inlineCalled when the incoming request headers have been parsed.
voidonPayload virtual inlineCalled for each chunk of incoming request body data.
voidonRequest virtual inlineCalled when the complete HTTP request has been received. Derived classes should write their response here.
voidonClose virtual inlineCalled when the connection is closed.
ServerConnection &connection inlineReturns the underlying server connection.
Request &request inlineReturns the current HTTP request from the underlying connection.
Response &response inlineReturns the current HTTP response from the underlying connection.

ServerResponder

inline

inline ServerResponder(ServerConnection & connection)

Defined in src/http/include/icy/http/server.h:150

Creates a ServerResponder for the given connection.

Parameters

  • connection The server connection this responder handles.

onHeaders

virtual inline

virtual inline void onHeaders(Request & request)

Defined in src/http/include/icy/http/server.h:159

Called when the incoming request headers have been parsed.

Parameters

  • request The parsed HTTP request with headers populated.

onPayload

virtual inline

virtual inline void onPayload(const MutableBuffer & body)

Defined in src/http/include/icy/http/server.h:163

Called for each chunk of incoming request body data.

Parameters

  • body Buffer containing a chunk of the request body.

onRequest

virtual inline

virtual inline void onRequest(Request & request, Response & response)

Defined in src/http/include/icy/http/server.h:169

Called when the complete HTTP request has been received. Derived classes should write their response here.

Parameters

  • request The fully received HTTP request.

  • response The HTTP response to populate and send.


onClose

virtual inline

virtual inline void onClose()

Defined in src/http/include/icy/http/server.h:176

Called when the connection is closed.


connection

inline

inline ServerConnection & connection()

Defined in src/http/include/icy/http/server.h:179

Returns the underlying server connection.


request

inline

inline Request & request()

Defined in src/http/include/icy/http/server.h:185

Returns the current HTTP request from the underlying connection.


response

inline

inline Response & response()

Defined in src/http/include/icy/http/server.h:191

Returns the current HTTP response from the underlying connection.

Protected Attributes

ReturnNameDescription
ServerConnection &_connection

_connection

ServerConnection & _connection

Defined in src/http/include/icy/http/server.h:197

Private Methods

ReturnNameDescription
ServerResponderDeleted constructor.

ServerResponder

ServerResponder(const ServerResponder &) = delete

Defined in src/http/include/icy/http/server.h:200

Deleted constructor.