Hi Ryan,
If you implement PageRenderRequestFilter and ComponentEventRequestFilter
you should be able to do exactly what you want. The parameters passed to
the handle methods of these interface will let you get access to stuff
like the logical page name, and even the page itself - that way you can
do annotation-based authentication/authorization if you want.
You need to contribute the filters to their respective handlers, that
is, PageRenderRequestHandler and ComponentEventRequestHandler. Those are
ordered configurations, so contribute to them using methods like
contributePageRenderRequestHandler(OrderedConfiguration<PageRenderRequestFilter>
configuration) and
contributeComponentEventRequestHandler(OrderedConfiguration<ComponentEventRequestFilter>
configuration).
To get at the page class from the handle method, use the ComponentSource
service's getPage(String) method with the page name retrieved from the
parameters passed to the handler methods.
And if you want to redirect to another page you can inject the Request
service and use any of its redirect methods to do that instead of
calling the next filter in the pipeline.
Hope this helps.
-Filip
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/services/PageRenderRequestHandler.html
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/services/ComponentEventRequestHandler.html
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/services/PageRenderRequestFilter.html
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/services/ComponentEventRequestFilter.html
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/services/ComponentSource.html
ryanskow skrev:
An event handler method for event "initialize" can be used for this
purpose.
I was able to get the superclass to catch the event by declaring:
@OnEvent (with no arguments)
public void foo()
{
// this is processed before the intended onActionFromThingOne is called -
which is perfect
}
This information is less accesible to the page (things are very
compartmentalized).
So there is no way for a page to know what what event is being applied to
it? I've been searching for some sort of @Environmental or @Inject to help
with that, but haven't found anything.
There's also two request pipelines: ComponentEventRequestHandler and
PageRenderRequestHandler that can be extended (by contributing filters
... see the JavaDoc). These allow you to apply tests and checks
across all pages.
I tried creating a dispatcher and fitting that before the PageRender, but it
didn't appear as though my @ApplicationState of the logged in user was
available there. Plus there was the need to do parsing of the request
string which didn't seem like the 'right' way to do things.
Which JavaDoc are you referring to in regards to contributing a filter?
There doesn't seem to be anything in the PageRendererRequestHandler or
ComponentEvenRequestHandler specifically mentioning the ability to extend
via filters. I have a feeling this is simple, but am having trouble
connecting the dots... Is there a simple example showing how to implement
and configure a custom ComponentEventRequestHandler?
I'll look further into Acegi security, but wanted to see if the tapestry
framework can handle security on its own.
Thank you for your responses!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]