xp-framework/xp-framework — pull request #142 by mihaighigea (2012-03-29 12:56:27+00:00)
Title: Inject HttpRequestAdapter/HttpResponseAdapter into webmethods

Hi,

As a short introduction, the bindings list of routing processor contains two object instances (`webservices.rest.server.transport.HttpRequestAdapter` and `webservices.rest.server.transport.HttpRequestAdapter`) and the `payload` which contain a serialised object.

This fix solve two problems:
1. The actual implementation does not allow you to inject the request/response adapter into webmethod. The simple use case could be when a request headers are needed into a webmethod. Think to the situation when the your Rest API needs an authentication to a back-end, and the Authorisation header is needed.

#[@webmethod(verb= 'GET', path= "/lists", inject= array('webservices.rest.server.transport.HttpRequestAdapter'))]
public function handleSaveIncidents($request) {
return $request->getHeader('Authorisation');
}

2. If you try to inject the request/response adapter into webmethod, you will get an `ClassCastException` because the existing instance cannot be casted to `lang.Object`.

What do you say?

Cheers,
Mihai