Hi Christy,

Let's look at the code of this static getRequest() method:

    public static HttpServletRequest getRequest(Request request) {
        HttpServletRequest result = null;

        if (request instanceof HttpRequest) {
            final HttpCall httpCall = ((HttpRequest) request).getHttpCall();

            if (httpCall instanceof ServletCall) {
                result = ((ServletCall) httpCall).getRequest();
            }
        }

        return result;
    }

You see that we are looking for a HttpRequest instance (your case), then we 
extract the "httpCall" property from it. In your case,
it is probably not an instance of ServletCall?

If so, I would need to understand why. What is your architecture and the way to 
integrate Restlet and Spring. Are you relying on
ServerServlet adapter?

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-----Message d'origine-----
De : blackh...@collab.net [mailto:blackh...@collab.net] 
Envoye : lundi 2 fevrier 2009 12:12
A : discuss@restlet.tigris.org; Jerome Louvel
Objet : RE: from the org.restlet.data.Request, get the HttpServletRequest

Thanks Jerome for coming back so quickly.

The full name of the "request" variable that I pass to the getRequest() static 
method is com.noelios.restlet.http.HttpRequest.

I've also attached the stack trace below for the NPE.

Christy.

java.lang.NullPointerException
        at 
com.vennetics.jbox.backend.servlets.resources.TestResource.init(TestResource.java:77)
        at 
org.restlet.ext.spring.SpringFinder.createTarget(SpringFinder.java:133)
        at 
org.restlet.ext.spring.SpringFinder.createTarget(SpringFinder.java:68)
        at org.restlet.Finder.findTarget(Finder.java:240)
        at org.restlet.Finder.handle(Finder.java:329)
        at org.restlet.Filter.doHandle(Filter.java:150)
        at org.restlet.Filter.handle(Filter.java:195)
        at org.restlet.Router.handle(Router.java:504)
        at org.restlet.Filter.doHandle(Filter.java:150)
        at org.restlet.Filter.handle(Filter.java:195)
        at org.restlet.Filter.doHandle(Filter.java:150)
        at org.restlet.Filter.handle(Filter.java:195)
        at org.restlet.Filter.doHandle(Filter.java:150)
        at com.noelios.restlet.StatusFilter.doHandle(StatusFilter.java:130)
        at org.restlet.Filter.handle(Filter.java:195)
        at org.restlet.Filter.doHandle(Filter.java:150)
        at org.restlet.Filter.handle(Filter.java:195)
        at com.noelios.restlet.ChainHelper.handle(ChainHelper.java:124)
        at 
com.noelios.restlet.application.ApplicationHelper.handle(ApplicationHelper.java:112)
        at org.restlet.Application.handle(Application.java:341)
        at org.restlet.Filter.doHandle(Filter.java:150)
        at org.restlet.Filter.handle(Filter.java:195)
        at org.restlet.Router.handle(Router.java:504)
        at org.restlet.Filter.doHandle(Filter.java:150)
        at org.restlet.Filter.handle(Filter.java:195)
        at org.restlet.Router.handle(Router.java:504)
        at org.restlet.Filter.doHandle(Filter.java:150)
        at com.noelios.restlet.StatusFilter.doHandle(StatusFilter.java:130)
        at org.restlet.Filter.handle(Filter.java:195)
        at org.restlet.Filter.doHandle(Filter.java:150)
        at org.restlet.Filter.handle(Filter.java:195)
        at com.noelios.restlet.ChainHelper.handle(ChainHelper.java:124)
        at org.restlet.Component.handle(Component.java:673)
        at org.restlet.Server.handle(Server.java:331)
        at com.noelios.restlet.ServerHelper.handle(ServerHelper.java:68)
        at 
com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:147)
        at 
com.noelios.restlet.http.StreamServerHelper$ConnectionHandler.run(StreamServerHelper.java:86)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
        at java.util.concurrent.FutureTask.run(FutureTask.java:123)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:613)

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

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

Reply via email to