Found something that seems to work by reading carefully through
TapestryModule.java, see code below. To me, it seems strange that I have to
do this. Do any of you guys see anything wrong with this?

  public void
contributeHttpServletRequestHandler(OrderedConfiguration<HttpServletRequestFilter>
configuration, @Inject @Symbol(SymbolConstants.CHARSET) final String
applicationCharset, @Primary final SessionPersistedObjectAnalyzer analyzer,
final RequestGlobals requestGlobals) {

    HttpServletRequestFilter storeRequestResponse = new
HttpServletRequestFilter() {

      public boolean service(HttpServletRequest servletRequest,
HttpServletResponse servletResponse, HttpServletRequestHandler handler)
throws IOException {
        Request request = new RequestImpl(servletRequest,
applicationCharset, analyzer);
        Response response = new ResponseImpl(servletResponse);
        requestGlobals.storeRequestResponse(request, response);
        return handler.service(servletRequest, servletResponse);
      }
    };

    configuration.add("StoreRequestResponse", storeRequestResponse,
"before:*");
  }


On Mon, Dec 7, 2009 at 2:35 PM, Inge Solvoll <inge.tapes...@gmail.com>wrote:

> Thanks!
>
> Didn't work though. Tried running
> requestGlobals.storeServletRequestResponse before asm.get(...), still same
> error because requestGlobals.getRequest() is still null after storing
> httprequest.
>
> I discovered that requestGlobals.getHTTPServletRequest() returns a live and
> working request, while requestGlobals.getRequest() returns null. I also put
> a breakpoint in TapestryModule "StoreIntoGlobals", and it is run before my
> code.
>
> So, the Request and Response properties of requestGlobals aren't populated
> when using the Registry from another servlet i think. Am I right? Is there
> any way to make this work?
>
>
>
>
> On Mon, Dec 7, 2009 at 1:16 PM, Thiago H. de Paula Figueiredo <
> thiag...@gmail.com> wrote:
>
>> Em Mon, 07 Dec 2009 08:31:44 -0200, Inge Solvoll <inge.tapes...@gmail.com>
>> escreveu:
>>
>>  Hi!
>>>
>>
>> Hi!
>>
>>
>>
>>> Caused by: java.lang.NullPointerException
>>>        at $Request_12568a717d3.getSession($Request_12568a717d3.java)
>>>        at $Request_12568a717a6.getSession($Request_12568a717a6.java)
>>>        at
>>> org.apache.tapestry5.internal.services.SessionApplicationStatePersistenceStrategy.getSession(SessionApplicationStatePersistenceStrategy.java:38)
>>>
>>
>> It looks like the Request wasnt. Try getting the RequestGlobals service
>> and invoking the storeServletRequestResponse() method before you use the
>> ApplicationStateManager.
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
>> and instructor
>> Owner, software architect and developer, Ars Machina Tecnologia da
>> Informação Ltda.
>> http://www.arsmachina.com.br
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>

Reply via email to