Hi,

I've made a JaxRsApplication Restlet application that works. But I'm
trying to get the HttpServletRequest in a ServerResource via
ServletUtils.getRequest(getRequest()). This fails as getRequest()
returns null, as does getContext(), getInfo(), getResponse() etc.

One of the only UniformResource call that doesn't return null is
getApplication().

My JaxRsApplication is as follows:

public class MyJaxRsApplication extends JaxRsApplication
{
    public MyJaxRsApplication(Context context)
    {
        super(context);
        add(new MyRestletApplication());
    }

    public class MyRestletApplication extends Application
    {
        public Set<Class<?>> getClasses()
        {
            Set<Class<?>> rrcs = new HashSet<Class<?>>();
            rrcs.add(AResource.class);
            return rrcs;
        }
    }
}

and the AResource is:

@Path("/")
public class AResource extends ServerResource
{

    @GET
    @Produces("text/html")
    public String getResult()
    {
        // The next line returns null....
        org.restlet.Request restletReq = getRequest();
        HttpServletRequest req = ServletUtils.getRequest(restletReq);
        return req.getServerName();
    }
}

I'm I missing something? The UniformResource does not appear to get
the request set when it is initialised.

Regards,
Carl

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

Reply via email to