While working with classes derived from HTTPRequestHandler, I constantly find myself having to pass around request/response references. To avoid having many functions taking same arguments, I cache them in member variables (pointers) in handleRequest :
void MyHandler::handleRequest(request, response)
_pRequest = &request;
_pResponse = &response;
and later retrieve references using
and MyRequestHandler::response() in similar fashion. I also do something like that with MyRequestHandler::form() - the only difference is that form() uses lazy creation like this:
_pForm = new HTMLForm(request(), request().stream());
My proposal is to push this functionality up the hierarchy into HTTPRequestHandler by adding:
From my own experience, this simplifies developer's life when writing handlers. If this is implemented, handleRequest() does not need arguments any more, but it does not hurt to keep it as is in oder not to break the existing code.
I'm aso posting this in forum, since the formatting capabilities of this facility are dismal.