Hello Carl, Richard,

from what I understand, the main aim of the JaxRs extension is to be able
to host a JaxRs based application inside a Restlet based application.
Which, quickly said, allows you to serve your classic JaxRs annotated
resources using the available server connectors such as the internal one,
the one based on Jetty or Simple library, or a servlet container, etc.
In this use case, the "classic JaxRs annotated resources" are considered to
be plain old Java objects, it does not address the special case of Restlet
ServerResource. That's my current understanding.

You can still get the current request as follow :
org.restlet.Request restletReq = org.restlet.Request.getCurrent();

Having said that I have one general recommandation. When using Restlet
ServerResource, it's fine to get the current Request because this is
completely part of the Restlet API. But accessing the HttpServletRequest
ties your application with the special case of an application hosted by a
servlet container and will prevent you to host your application using the
Simple extension, for example.

I guess that we can enhance the current behaviour and take into account the
case of JaxRs annotated instances of ServerResource. I've entered an issue :
https://github.com/restlet/restlet-framework-java/issues/610

Best regards,
Thierry Boileau


On my resource:
> public class UserActsServerResource extends ServerResource implements
> UserActsResource {...
>
> I am able to use:
> public final Representation represent() {
> ...
>  User user = UserHelpers.getCurrentUser(this.getRequest(),
> this.getResponse());
>
> and this.getRequest() returns a useful value.  But I have no idea why this
> is not working for you.  I am using the GAE Edition.  Perhaps the problem
> is in some other location of your code/configuration??
>
> RB
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2972100
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2972185

Reply via email to