Michael,
You might want to look at implementing a WebRequestServicerFilter. This is the
Tapestry equivalent of the ServletFilter but since it is wired into the
Tapestry framework you should be able to inject the services you need into it.
Here is how you would define it in your hivemodule.xml:
<service-point id="MyServicerFilter"
interface="org.apache.tapestry.services.WebRequestServicerFilter">
<invoke-factory>
<construct class="com.acme.MyServicerFilter">
<set-service property="..." service-id="tapestry..."/>
</construct>
</invoke-factory>
</service-point>
<contribution configuration-id="tapestry.request.WebRequestServicerPipeline">
<filter name="MyServicerFilter" object="service:MyServicerFilter" />
</contribution>
Raphael Jean
EntropySoft
> -----Original Message-----
> From: Michael Echerer [mailto:[EMAIL PROTECTED]
> Sent: mercredi 1 mars 2006 23:07
> To: [email protected]
> Subject: T4: How to hook into requestCycle creation?
>
> Hi,
>
> in Tapestry 3.x we had subclassed the BaseEngine and had our own
>
> protected IRequestCycle createRequestCycle(RequestContext context,
> IEngineService service, IMonitor monitor)
>
> method, because we wanted log4j MDC (map diagnostic context) information
> per thread.
>
> Basically we first called the original super implementation and then
> took the ready-to-use cycle to obtain the Visit object from it. Here we
> could also take e.g. our custom User object from in order to also have
> the user name for each log statement available and much more context info.
>
> That why e.g. a workaround like putting a Servlet filter in front of the
> application servlet isn't enough, as we can't easily get to our Tapestry
> objects.
>
> After migrating we saw that in Tapestry 4 there is no BaseEngine.
> Basically the IRequestCycle seems to be created by the
> RequestCycleFactory. Can we hook our own implementation into this? And
> how?
>
> Ideally we'd like to subclass RequestCycleFactoryImpl and call the super
> public IRequestCycle newRequestCycle(IEngine engine) method and go ahead
> as with Tapestry 3.0.x.
>
> However since the RequestCycleFactory is wired via Hivemind's
> META-INF/tapestry.request.xml in the tapestry-4.0.jar we're not sure how
> to do it...
>
> Does this mean we have to unjar, put our own
>
> <service-point id="RequestCycleFactory">
> Creates new IRequestCycle instances.
> <invoke-factory>
> <construct class="com.xyz.Log4jEnabledRequestCycleFactoryImpl">
>
> in it, jar the T4 library as the service point is IHMO already
> configured otherwise?
>
> I guess there should be a smarter way to do this, but no clue how...
>
> Any better ideas or comments?
> Can we hook into somewhere else? Basically we just need the request
> cycle object anywhere early enough before the whole request is processed
> to get a per thread MDC with full Tapesty access.
>
> Cheers
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]