I believe the reason the WebRequestServicerFilter was suggested was to avoid that inelegant bit. This worked for me:
<service-point id="WebRequestFilter" interface="org.apache.tapestry.services.WebRequestServicerFilter"> <invoke-factory> <construct class="cview.services.WebRequestFilter"> <set-object property="appStateManager" value="infrastructure:applicationStateManager"/> </construct> </invoke-factory> </service-point> <contribution configuration-id="tapestry.request.WebRequestServicerPipeline"> <filter name="WebRequestFilter" object="service:WebRequestFilter" /> </contribution> public class WebRequestFilter implements WebRequestServicerFilter { private ApplicationStateManager appStateManager; public void setAppStateManager(ApplicationStateManager asm) { appStateManager = asm; } public void service(....) { servicer.service(request, response); System.out.println("visit = " + (Visit) appStateManager.get("visit")); } } Dobrin Ivanov wrote: > Thanks, now it works. My filter is : > ----------------------------------------- > public void service(WebRequest request, WebResponse > response, WebRequestServicer servicer) throws > IOException { > // Request Cycle Begin > servicer.service(request, response); > // Request Cycle End > WebSession webSession = request.getSession(false); > if (webSession!=null) { > String visitKey = "state:" + APP_NAME + ":visit"; > Visit visit = (Visit) > webSession.getAttribute(visitKey); > // use visit > } > } > ----------------------------------------- > > So, we again have this visit-from-session code, but > the only inelegant bit is this visitKey assembling > part may be :) > > --- James Carman <[EMAIL PROTECTED]> wrote: > > >> Sorry. Try >> tapestry.request.WebRequestServicerPipeline. As I >> said, it was >> off the top of my head. Sorry for the typo. >> >> -----Original Message----- >> From: Dobrin Ivanov >> [mailto:[EMAIL PROTECTED] >> Sent: Friday, September 22, 2006 1:45 PM >> To: Tapestry users >> Subject: RE: How to listent for the Request Cycle >> End >> >> 10x >> >> Now i get the error below. Any chance that there are >> some docs for this? >> >> 1547 [main] ERROR >> >> > org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/weprom] > >> - Servlet /weprom threw load() exception >> org.apache.hivemind.ApplicationRuntimeException: >> Error >> at context:/WEB-INF/hivemodule.xml, line 19, column >> 79: Module weprom has contributed to unknown con >> figuration point >> hivemind.request.WebRequestServicerPipeline. The >> contribution has been ignored. >> [context:/WEB-INF/hivemodule.xml, line 19, column >> 79] >> at >> >> > org.apache.hivemind.impl.StrictErrorHandler.error(StrictErrorHandler.java:39 > >> ) >> >> --- James Carman <[EMAIL PROTECTED]> wrote: >> >> >>> You can put it in your WEB-INF folder or in >>> WEB-INF/classes/META-INF. >>> Tapestry (actually HiveMind) will find it in >>> >> either >> >>> case. >>> >>> -----Original Message----- >>> From: Dobrin Ivanov >>> [mailto:[EMAIL PROTECTED] >>> Sent: Friday, September 22, 2006 1:26 PM >>> To: Tapestry users >>> Subject: RE: How to listent for the Request Cycle >>> End >>> >>> And where should be located my hivemodule.xml? >>> >> (I'm >> >>> using just Tapestry, I know it lies above hivemind >>> microkernel...) >>> >>> >>> --- James Carman <[EMAIL PROTECTED]> >>> >> wrote: >> >>>> To plug into the WebRequestServicerPipeline, you >>>> implement the >>>> WebRequestServicerFilter interface: >>>> >>>> public class MyFilter implements >>>> WebRequestServicerFilter >>>> { >>>> } >>>> >>>> Then, in your hivemodule.xml you plug it into >>>> >> the >> >>>> pipeline: >>>> >>>> <contribution >>>> >>>> > configuration-id="hivemind.request.WebRequestServicerPipeline"> > >>>> <filter name="MyFilter" >>>> >>> object="instance:MyFilter" >>> >>>> /> >>>> </contribution> >>>> >>>> That's off the top of my head, but you get the >>>> >>> idea. >>> >>>> This basically acts >>>> like a servlet filter, but you can plug >>>> hivemind-managed filters in (so you >>>> can inject stuff into your implementation >>>> >>> objects). >>> >>>> -----Original Message----- >>>> From: Dobrin Ivanov >>>> [mailto:[EMAIL PROTECTED] >>>> Sent: Wednesday, September 20, 2006 1:30 PM >>>> To: Tapestry users >>>> Subject: Re: How to listent for the Request >>>> >> Cycle >> >>>> End >>>> >>>> I do not know about this custom Engine classes >>>> changes >>>> (frowned)... >>>> is there some information about this topic? >>>> >>>> .. and also the other one with the >>>> >>>> >> pipelines/WebRequestServicerPipeline/interceptors? >> >>>> --- James Carman <[EMAIL PROTECTED]> >>>> >>> wrote: >>> >>>>> You can plugin to the webrequest servicer >>>>> >>>> pipeline. >>>> >>>>>> Ummm... you could do that too. You're >>>>>> >> correct >> >>>>> that it would avoid the >>>>> >>>>>> visit-from-session inelegant bit. It would >>>>>> >> be >> >>>>> conceptually similar to >>>>> >>>>>> the servlet filter approach. The downside >>>>>> >>> would >>> >>>>> be that custom Engine >>>>> >>>>>> classes are frowned upon as Tapestry goes >>>>>> >>>> forward. >>>> >>>>> I'm not sure there >>>>> >>>>>> is an Engine.getVisit() in 4.1. >>>>>> >>>>>> None of the approaches is perfect since >>>>>> >>> Tapestry >>> >>>>> doesn't provide a >>>>> >>>>>> built-in end-of-request hook. Well, there >>>>>> >> is >> >>> a >>> >>>>> call to >>>>> >>>>>> monitor.serviceEnd() that you could use >>>>>> >>> without >>> >>>>> subclassing Engine. >>>>> >>>>>> Dobrin Ivanov wrote: >>>>>> >>>>>>> Hi, >>>>>>> Thanks Bryan, this looks like a hack:) >>>>>>> >>>>>>> What do you think if I override the >>>>>>> >> Engine's >> >>>>> method: >>>>> >>>>>>> public void service(WebRequest request, >>>>>>> >>>>> WebResponse >>>>> >>>>>>> response) throws IOException { >>>>>>> super.service(request, response); >>>>>>> // insert code here >>>>>>> } >>>>>>> >>>>>>> Is this a bad approach? >>>>>>> >>>>>>> >>>>>>> --- Bryan Lewis <[EMAIL PROTECTED]> wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>>> It sounds like a servlet listener method >>>>>>>> >>> could >>> >>>>> work >>>>> >>>>>>>> for you. Or a >>>>>>>> servlet filter as in the previous >>>>>>>> >>> suggestion. >>> >>>>> Both >>>>> >>>>>>>> would give you a >>>>>>>> hook into the end-of-request, and you can >>>>>>>> >>> get >>> >>>> to >>>> >>>>> the >>>>> >>>>>>>> Visit via the >>>>>>>> session. Here's a listener approach. >>>>>>>> >>>>>>>> >>>>>>>> public class EventListener implements >>>>>>>> ServletRequestListener >>>>>>>> { >>>>>>>> public void >>>>>>>> requestInitialized(ServletRequestEvent >>>>>>>> >> sre) >> >>> { >>> >>>>>>>> // This method might not need to >>>>>>>> >> do >> >>>>>>>> anything. >>>>>>>> } >>>>>>>> >>>>>>>> public void >>>>>>>> >>>>> requestDestroyed(ServletRequestEvent >>>>> >>>>>>>> sre) >>>>>>>> { >>>>>>>> // Call a static method in your >>>>>>>> thread-storage class to get your >>>>>>>> data. >>>>>>>> >>>>>>>> // The slightly messy part is >>>>>>>> >>> getting >>> >>>>> the >>>>> >>>>>>>> Visit from the session. >>>>>>>> > === message truncated === > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >