Thanks james/ron, I finally gathered some courage to look at the source code :) Ok I just want to check for the presence of the User object in the session in my ClassAnnotationEnhancementWorker. I basically need a InjectStateFlag kind of functionality in my Worker (not the page) where i can check if the 'user' object is already present in the session. Then i want to throw PageRedirect to Login page...usual stuff. Am not actually *enhancing* the Page as in ..am not doing any nifty byte code generation stuff.
Since I cannot use @InjectState within my Worker? , I need to figure it out myself by querying hivemind.xml? - so basically my Worker needs to be aware of say the "user" configured in hivemodule.xml How can I query the hivemind and ask if the hivemind container contains an instance of "user" in "session" scope already. I dont want it to instantiate "user" though. Or the only way to throw a PageRedirect is to dynamically enhance the Page by making it implement PageValidateListener? Sorry for such basic questions. thanks Karthik On 12/23/06, James Carman <[EMAIL PROTECTED]> wrote:
The tapestry-acegi library does exactly this. When it sees an Acegi @Secured annotation on a class/method, it uses a worker to enhance the class. So, you can either use what I've already created or refer to the source to see how to do what you want. If you have any questions about the code, don't hesitate to ask. Hope that helps. On 12/22/06, RonPiterman <[EMAIL PROTECTED]> wrote: > yes, workers are part of 4.0.2 - and the code is very clear, and one can > learn alot from it - howard has a *very* nice programming style, so its > worth taking a look. > > I would look at the wiki, but I don't know if there are any > tutorials/docu around for this. It is quite advanced staff, but its not > that hard. > > Cheers, > Ron > > > > karthik G wrote: > > thanks Ron. Currently am with going the way (subclassing a securedpage) as > > suggested by Dennis. Its simple and works. > > But am interested in the workers that you mention. Is looking at the source > > code the only option at this point to write some workers?. Are there any > > docs somewhere? > > Btw are workers part of 4.0.2 > > > > thanks, > > Karthik > > > > > > On 12/21/06, Ron Piterman <[EMAIL PROTECTED]> wrote: > >> > >> yes, there is a configurable annotation workers, so you can > >> create/extend/override page methods when tapestry is preparing the > >> page/component class. > >> > >> You can create your own class worker which will add the needed logic to > >> the mentioned attach event. > >> > >> Take a look at the annotations module code and hivemind configuration. > >> > >> Cheers, > >> Ron > >> > >> > >> > >> karthik G wrote: > >> > I just want to add an annotation on the page and then take some action > >> when > >> > the page is being bound to a request from the page pool. > >> > > >> > @SecuredPage > >> > abstract class MyPage extends BasePage{ > >> > > >> > } > >> > > >> > Is there anyways i can hook into T4's page creation process and then > >> > depending upon the annotation take some action? For e.g in the above > >> > case, I > >> > just want to be able to check for a user object in the session and > >> redirect > >> > to login page. > >> > > >> > I looked at PageAttachListener and it looks nice. But I dont want to > >> > implement that in my page but would like to attach a listener to T4 > >> itself. > >> > > >> > thanks, > >> > Karthik > >> > > >> > >> > >> --------------------------------------------------------------------- > >> 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]