This kind of things is best implemented using hivemind / AOP
Interceptors. You can intercept Any hivemind service - its just the
question which one is the best -
RequestCycle is created for each request - also assets aso, so this
might not be the right thing to do -
You could for example intercept the PageService, ExternalService and
DirectService - I think these are the three that are involved in page
serving.
furthermore, you could take another approach and contribute to one of
the pipelines that processes each request -
I would consider this one unclean however. Its just the wrong logical
place to do logging -
Cheers,
Ron
Another approach would be adding an
I would consider: either
Michael Echerer wrote:
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]