RejectedSoftware Forums

Sign up

HTTPServerRequest with Rest interfaces

Hi,

I am looking for a way to retrieve the ip of clients, when they call a rest service.

It seems to be not supported to have a HTTPServerRequest parameter on a rest method.

Maybe I need prefer form interfaces? What are the differences with rest ones?

Re: HTTPServerRequest with Rest interfaces

On Mon, 01 Dec 2014 22:02:08 GMT, Xavier Bigand wrote:

Hi,

I am looking for a way to retrieve the ip of clients, when they call a rest service.

It seems to be not supported to have a HTTPServerRequest parameter on a rest method.

Maybe I need prefer form interfaces? What are the differences with rest ones?

For the differences:
https://github.com/rejectedsoftware/vibe.d/pull/842#issuecomment-56690175

Should I have to do it, I would use @before:
https://github.com/rejectedsoftware/vibe.d/blob/master/examples/rest/source/app.d#L289

Note however that @before has some problems, and it's a workaround which works only for trivial issues (e.g., avoid as much as possible server code / types in @before, as the function referenced has to be visible from the client too).

Re: HTTPServerRequest with Rest interfaces

On Fri, 05 Dec 2014 08:36:42 GMT, Mathias LANG wrote:

On Mon, 01 Dec 2014 22:02:08 GMT, Xavier Bigand wrote:

Hi,

I am looking for a way to retrieve the ip of clients, when they call a rest service.

It seems to be not supported to have a HTTPServerRequest parameter on a rest method.

Maybe I need prefer form interfaces? What are the differences with rest ones?

For the differences:
https://github.com/rejectedsoftware/vibe.d/pull/842#issuecomment-56690175

Should I have to do it, I would use @before:
https://github.com/rejectedsoftware/vibe.d/blob/master/examples/rest/source/app.d#L289

Note however that @before has some problems, and it's a workaround which works only for trivial issues (e.g., avoid as much as possible server code / types in @before, as the function referenced has to be visible from the client too).

Ok thanks for tips.

I don't think to need something else than user ips for rest services that aren't comming from the parameters.