T5 with Spring $ecurity - dynamic roles on pages
Is it possible to use dynamic roles in the @Secured("ROLE_XYZ") page annotation in such a way that a service could be employed to retrieve a list of roles and populate the annotation before the request is intercepted/interrogate by the Spring $ecurity integration? Something equivalent to an expansion to call a method in onBeforeRender method etc? It appears that annotation values are fixed at compile time, or am I missing something obvious? Background is to allow certain pages to have their $ecurity requirements amended through the UI without a restart. Thanks, Jim. -- View this message in context: http://old.nabble.com/T5-with-Spring-%24ecurity---dynamic-roles-on-pages-tp27186104p27186104.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Updating a zone before the Ajax request
On Fri, 15 Jan 2010 15:58:02 -0200, Baptiste Autin - Linkeo RD wrote: Not as much as something like, say: :-) You're right. You can file a JIRA to request this improvement. :) -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Updating a zone before the Ajax request
I think Ajax.Responders.register({ onCreate: function() { ... } )}; is easy enough. :) Not as much as something like, say: :-) (a special attribute on a t:zone, or on a t:beaneditform, I don't know what would be the best...) Your solution also means adding a renderSupport in the Java file... Moreover, it seems that the JS handler is fired for every Ajax request triggered from any component in the page... which is not always desirable. I think I can survive with it anyway :) Baptiste - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Updating a zone before the Ajax request
On Fri, 15 Jan 2010 14:50:07 -0200, Baptiste Autin - Linkeo RD wrote: Thanks a lot guys. It works! :) (... even if I think the solution is rather complicated for a simple need... It would be great if a future release of Tapestry offered a way to call some Javascript just before an Ajax request!) I think Ajax.Responders.register({ onCreate: function() { ... } )}; is easy enough. :) -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Updating a zone before the Ajax request
Thanks a lot guys. It works! (... even if I think the solution is rather complicated for a simple need... It would be great if a future release of Tapestry offered a way to call some Javascript just before an Ajax request!) Joost Schouten (ml) a écrit : An easier solution would be to like Thiago sugested. Here's my code that does the trick. Cheers, Joost .js file: AjaxProgressTracker = { init: function() { Ajax.Responders.register({ onCreate: function() { // ajax request is sent AjaxProgressTracker.ajaxCalled(); }, onComplete: function() { // ajax response is back. AjaxProgressTracker.ajaxEnded(); } }); }, ajaxCalled : function () { $$('body')[0].addClassName('ajaxInProgress'); }, ajaxEnded : function () { $$('body')[0].removeClassName('ajaxInProgress'); } } LayoutComponent.java @SetupRender private void setup() { renderSupport.addScript("AjaxProgressTracker.init();"); } tml: loading css: #ajaxLoadingIndicator{ position: absolute; z-index: 101; width: 5em; height: 1.6em; position: fixed; left: 50%; margin-left: -2.5em; top: 2em; padding: 0.3em 0.3em 0.3em 2.5em; display: none; } .ajaxInProgress #ajaxLoadingIndicator { display: block; } Baptiste Autin - Linkeo RD wrote: Hello, I have a BeanEditForm that updates a Zone through the "zone" attribute. It works fine. Now, I would like to display a kind of loading icon (or invoke a Javascript method) just *before* the Ajax request, but I could find any solution. I could not make ProgressiveDisplay work in such a situation (since the page is already fully loaded when the form is submitted) And the "show"/"update" functions of the Zone component, which could have been a workaround, are triggered only after the HTTP response. Any idea ? Baptiste - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Baptiste Autin Ingénieur de développement LINKEO http://www.linkeo.com/ - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: get component according to ID
On Fri, 15 Jan 2010 13:23:23 -0200, LiborGMC wrote: -Component needs refresh after user click on Action. But only this component should be refreshed, not whole page Use a Zone. -There could be more these components on same page Use some Zones and a MuitiZoneUpdate. More information at http://tapestry.apache.org/tapestry5/guide/ajax.html. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: get component according to ID
Uhh I write faster then I think :-(. Now I finally understand what did you try to suggest me. Sorry for the last post ;-). Thank you for your help Libor -- View this message in context: http://old.nabble.com/get-component-according-to-ID-tp27144243p27178827.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: get component according to ID
Ok it sound me like I hit to limit of Tapestry. Well I'm not able refresh components if there are more of them on same page. Or what strategy shall I use? Could anybody bring in how to implement this scenario: -Component needs refresh after user click on Action. But only this component should be refreshed, not whole page -There could be more these components on same page -- View this message in context: http://old.nabble.com/get-component-according-to-ID-tp27144243p27178781.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Handling session expiry
On Fri, 15 Jan 2010 13:08:50 -0200, Klaus Kopruch wrote: In javax.servlet.http.HttpSession or org.apache.tapestry5.services.Session? Tapestry's Session is just a facade around the HttpSession. Thus, setting some attribute in Session makes it be set in the HttpSession too. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Handling session expiry
Thiago H. de Paula Figueiredo wrote: > > I don't use @SessionState with my HttpSessionBindingListener > implementation. I set it in the Session directly. ;) > In javax.servlet.http.HttpSession or org.apache.tapestry5.services.Session? -- View this message in context: http://old.nabble.com/Handling-session-expiry-tp27177262p27178554.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Handling session expiry
> I don't use @SessionState with my HttpSessionBindingListener > implementation. I set it in the Session directly. ;) Exactly, just set it in your web.xml: com.web.application.SessionListener And then in SessionListener: /** @see HttpSessionListener#sessionCreated(HttpSessionEvent) */ public void sessionCreated(HttpSessionEvent event) { Logger.getLogger(getClass()).info( "Session created with id: " + event.getSession().getId()); } /** @see HttpSessionListener#sessionDestroyed(HttpSessionEvent) */ public void sessionDestroyed(HttpSessionEvent event) { //your logic here } and bobs your uncle! Peter -- If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Please visit http://www.albourne.com/email.html for important additional terms relating to this e-mail. - Original Message - From: "Thiago H. de Paula Figueiredo" To: "Tapestry users" Sent: Friday, 15 January, 2010 16:44:28 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Handling session expiry On Fri, 15 Jan 2010 12:40:24 -0200, Massimo Lusetti wrote: > On Fri, Jan 15, 2010 at 3:34 PM, Thiago H. de Paula Figueiredo > wrote: > >> T5 doesn't, but the Servlet API has. Create an >> HttpSessionBindingListener >> implementation and add it to the Session. Its valueUnbound() method >> will be >> invoked when the session is invalidated. > > Actually HttpSessionBindingListener.valueUnbound() Notifies the object > that it is being unbound from a session and identifies the session, so > due to the way T5 use the session with @SessionState object I would > play carefully with it :) I don't use @SessionState with my HttpSessionBindingListener implementation. I set it in the Session directly. ;) -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Handling session expiry
Massimo Lusetti wrote: > > Implement one of the listeners, for ex HttpSessionListener, then > access the registry from the context and do what you need. > Where do you install HttpSessionListener? What registry and what context do you mean? -- View this message in context: http://old.nabble.com/Handling-session-expiry-tp27177262p27178413.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Updating a zone before the Ajax request
On Fri, 15 Jan 2010 12:46:55 -0200, Baptiste Autin - Linkeo RD wrote: Now, I would like to display a kind of loading icon (or invoke a Javascript method) just *before* the Ajax request, but I could find any solution. I've never tested it, but maybe Prototype's Ajax.Responders object is a solution: http://www.prototypejs.org/api/ajax/responders -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Handling session expiry
Tx, I'll play with it. -- View this message in context: http://old.nabble.com/Handling-session-expiry-tp27177262p27178359.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Updating a zone before the Ajax request
An easier solution would be to like Thiago sugested. Here's my code that does the trick. Cheers, Joost .js file: AjaxProgressTracker = { init: function() { Ajax.Responders.register({ onCreate: function() { // ajax request is sent AjaxProgressTracker.ajaxCalled(); }, onComplete: function() { // ajax response is back. AjaxProgressTracker.ajaxEnded(); } }); }, ajaxCalled : function () { $$('body')[0].addClassName('ajaxInProgress'); }, ajaxEnded : function () { $$('body')[0].removeClassName('ajaxInProgress'); } } LayoutComponent.java @SetupRender private void setup() { renderSupport.addScript("AjaxProgressTracker.init();"); } tml: loading css: #ajaxLoadingIndicator{ position: absolute; z-index: 101; width: 5em; height: 1.6em; position: fixed; left: 50%; margin-left: -2.5em; top: 2em; padding: 0.3em 0.3em 0.3em 2.5em; display: none; } .ajaxInProgress #ajaxLoadingIndicator { display: block; } Baptiste Autin - Linkeo RD wrote: Hello, I have a BeanEditForm that updates a Zone through the "zone" attribute. It works fine. Now, I would like to display a kind of loading icon (or invoke a Javascript method) just *before* the Ajax request, but I could find any solution. I could not make ProgressiveDisplay work in such a situation (since the page is already fully loaded when the form is submitted) And the "show"/"update" functions of the Zone component, which could have been a workaround, are triggered only after the HTTP response. Any idea ? Baptiste - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Updating a zone before the Ajax request
Hello, I have a BeanEditForm that updates a Zone through the "zone" attribute. It works fine. Now, I would like to display a kind of loading icon (or invoke a Javascript method) just *before* the Ajax request, but I could find any solution. I could not make ProgressiveDisplay work in such a situation (since the page is already fully loaded when the form is submitted) And the "show"/"update" functions of the Zone component, which could have been a workaround, are triggered only after the HTTP response. Any idea ? Baptiste - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Handling session expiry
On Fri, 15 Jan 2010 12:40:24 -0200, Massimo Lusetti wrote: On Fri, Jan 15, 2010 at 3:34 PM, Thiago H. de Paula Figueiredo wrote: T5 doesn't, but the Servlet API has. Create an HttpSessionBindingListener implementation and add it to the Session. Its valueUnbound() method will be invoked when the session is invalidated. Actually HttpSessionBindingListener.valueUnbound() Notifies the object that it is being unbound from a session and identifies the session, so due to the way T5 use the session with @SessionState object I would play carefully with it :) I don't use @SessionState with my HttpSessionBindingListener implementation. I set it in the Session directly. ;) -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Handling session expiry
On Fri, Jan 15, 2010 at 3:34 PM, Thiago H. de Paula Figueiredo wrote: > T5 doesn't, but the Servlet API has. Create an HttpSessionBindingListener > implementation and add it to the Session. Its valueUnbound() method will be > invoked when the session is invalidated. Actually HttpSessionBindingListener.valueUnbound() Notifies the object that it is being unbound from a session and identifies the session, so due to the way T5 use the session with @SessionState object I would play carefully with it :) Cheers -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Handling session expiry
On Fri, 15 Jan 2010 12:25:16 -0200, Klaus Kopruch wrote: Hello, Hi! can someone pls give me some hints how to handle user session expirations without writing much boilerplate code? I'd like to send a special session expiry page. Has T5 a mechanism for that? T5 doesn't, but the Servlet API has. Create an HttpSessionBindingListener implementation and add it to the Session. Its valueUnbound() method will be invoked when the session is invalidated. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Handling session expiry
On Fri, Jan 15, 2010 at 3:25 PM, Klaus Kopruch wrote: > can someone pls give me some hints how to handle user session expirations > without writing much boilerplate code? I'd like to send a special session > expiry page. Has T5 a mechanism for that? Implement one of the listeners, for ex HttpSessionListener, then access the registry from the context and do what you need. Cheers -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: get component according to ID
On Fri, 15 Jan 2010 11:55:01 -0200, Jun Tsai wrote: Why use dynamic block id? You can use dynamic zone id,then use static block to update it's content. No component or block id can be dynamic in Tapestry: static structure, dynamic behaviour. As Jun said, you can use another approach for implementing exactly the same logic. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Handling session expiry
Hello, can someone pls give me some hints how to handle user session expirations without writing much boilerplate code? I'd like to send a special session expiry page. Has T5 a mechanism for that? Thx, Klaus -- View this message in context: http://old.nabble.com/Handling-session-expiry-tp27177262p27177262.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: get component according to ID
Why use dynamic block id? You can use dynamic zone id,then use static block to update it's content. I think you should change your strategy. 2010/1/15 LiborGMC > > This quite good but my problem still persist. To have more components on > same > page block ID should be variable as well. But I'm facing to similar > problem, > how to get instance of Block according its ID? If I set block ID as > constant > i.e. "myBlock" then I cannot have more than one component on a same page. > There is really no mechanism how to obtain component in Java class > according > its ID in Tapestry 5? > Regards > > Libor > -- > View this message in context: > http://old.nabble.com/get-component-according-to-ID-tp27144243p27174834.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- regards, Jun Tsai
Re: get component according to ID
This quite good but my problem still persist. To have more components on same page block ID should be variable as well. But I'm facing to similar problem, how to get instance of Block according its ID? If I set block ID as constant i.e. "myBlock" then I cannot have more than one component on a same page. There is really no mechanism how to obtain component in Java class according its ID in Tapestry 5? Regards Libor -- View this message in context: http://old.nabble.com/get-component-according-to-ID-tp27144243p27174834.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: 301 vs 302 redirects due to SEO
Stephan, you can extend the possible return types of the onActivate method by adding a ComponentEventResultProcessor to you configuration. You can define an HttpStatusCode class that returns the code you wish. I don't know if you consider this "clean", but it takes HTTP internals, codes etc. out of you page class and puts it into the HttpStatusCode class or the result processor. See http://old.nabble.com/T5-How-to-tell-T5-to-send-301-%28moved-permanently%29-ts18870223.html Hope this helps, Lutz On Thu, Jan 14, 2010 at 7:28 PM, Stephan Schwab wrote: > > Event handlers in Tapestry, such as onActivate() may return a page object or > page name. That gets translated into a HTTP 302 redirect. > > Now there are situations, e.g. in shopping applications, where one needs to > use 301 (moved permanently) redirects instead. > > One can @Inject the Response object, set the status to 301 and the location > in the HTTP header. That works but it makes you mix framework code with > application code in a page class which feels a bit wrong. > > Is there a cleaner way? > > Stephan > -- altocon GmbH http://www.altocon.de/ Software Development, Consulting Hamburg, Germany - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org