Project

General

Profile

Accessing base HTTP Request object

Added by David Hubbard almost 13 years ago

Hi

I am wanting to integrate Wt with another library which needs to do something at start and end of each request and it expects to see the HTTP Request object.

I see that I can override WApplication::notify() to allow me the necessary places to plug my code in, but is there a way to get access to the underlying HTTP Request object?

Thanks

Dave


Replies (3)

RE: Accessing base HTTP Request object - Added by Koen Deforche almost 13 years ago

Hey Dave,

I believe such a feature makes sense, but currently, no we don't give access to the naked request/response object.

We preferred to keep this API private, and the request/response might not be real (for example in case of a WebSocket we produce 'fake' requests and responses which actually simply reflect messages over the WebSocket connection).

Still, we should probably open up this API (making it also visible whether they are HTTP messages or WebSocket messages), so I would be happy to see a feature request for this.

Regards,

koen

RE: Accessing base HTTP Request object - Added by David Hubbard almost 13 years ago

Koen, Hi

Thanks for the quick response. The answer was rather what I was expecting - which at least proves I wasn't misreading the docs.

Confession time - I'm actually trying to do this in JWt (Forum is a little quieter over there and I thought this was a generic type question, apologies If I have strayed to far). What I have done in Java is used the WtServlet subclass and over-ridden the doGet() and doPost() functions (perhaps not clean, but a work around at present). I notice that this option doesn't look to be available in C version.

I'll see how I get on with this and respond back with an update or feature request.

Cheers

Dave

RE: Accessing base HTTP Request object - Added by Koen Deforche almost 13 years ago

Hey,

In Java the availability of a well standardized servlet API indeed makes this more straight forward, and I can't see anything wrong with your approach.

Regards,

koen

    (1-3/3)