On Mon, Dec 7, 2009 at 7:11 AM, Inge Solvoll <inge.tapes...@gmail.com> wrote: > 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? >
Since it's not a Tapestry-related request, control has passed out of the TapestryFilter and on to other servlets within the web application. Tapestry has already cleaned up the RequestGlobals object, a per-thread service that stores the HttpServletRequest and (Tapestry) Request objects. You want to make sure to invoke the Registry.cleanupThread() method at the end of your request. I've been planning to add a simpler alternative to SessionStateObjects, an annotation that simply says "store this value in the session with this explicit key", to make coordinating a T5 app with a legacy app simpler. > 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 >>> >>> >> > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org