Re: Continue navigating while on submit button process stuff on the background
Yes, you are right. I have realised that if all I want the thread to do is to send emails then all I need to pass is the necessary parameters. There is no need to access wicket components from inside the search. With this exclusions, the functionality is more modular. Cheers, Lucas -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Continue-navigating-while-on-submit-button-process-stuff-on-the-background-tp3473026p3506961.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Continue navigating while on submit button process stuff on the background
@jcgarciam, Thanks for your post. Sorry it took me so long to reply. Yes, I am using component instantiation listener on my wicket app. I think I might have not explained things properly in my last post. For the sake of clarity, I'm posting my web.xml and applicationContext set up: On my WicketApplication class I have the following, also based on the wicket in action book: public class WicketApplication extends WebApplication { @Autowired private ObjectService objects_service; @Override protected void init() { addComponentInstantiationListener(new SpringComponentInjector(this)); } My spring/hibernate set-up is also similar to the wicket in Action book : My web.xml file has the following hibernate session filter (wicket in action book, section 12.3.2): filter filter-nameopensessioninview/filter-name filter-class org.springframework.orm.hibernate3.support.OpenSessionInViewFilter/filter-class /filter filter-mapping filter-nameopensessioninview/filter-name url-pattern/*/url-pattern /filter-mapping context-param param-namecontextConfigLocation/param-name param-value/WEB-INF/applicationContext.xml/param-value /context-param listener listener-classorg.springframework.web.context.ContextLoaderListener/listener-class /listener On the applicationContext.xml file I have the following: tx:annotation-driven / bean id=wicketApplication class=com.myApp.WicketApplication /bean ... I think the whole set up is pretty much standard but if you think I am missing something, then I'd be most grateful if you point it out. Cheers, Lucas -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Continue-navigating-while-on-submit-button-process-stuff-on-the-background-tp3473026p3505262.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Continue navigating while on submit button process stuff on the background
Hi, putting configuration aside of your first question (since i just made a comment, for the sake of best practice). Back to your original question and since you are using Spring, you can just use Spring facilities to Schedule the jobs an pass the appropriate parameters (list of objects) to the appropriate async service http://static.springsource.org/spring/docs/2.5.x/reference/scheduling.html http://static.springsource.org/spring/docs/2.5.x/reference/scheduling.htmlBut keep in mind the following, from a Thread you shouldn't access any wicket component since those are bound the Http Thread, which at the point when the jobs runs the request would be gone. On Sat, May 7, 2011 at 6:26 AM, lucast [via Apache Wicket] ml-node+3505262-1989378023-65...@n4.nabble.com wrote: @jcgarciam, Thanks for your post. Sorry it took me so long to reply. Yes, I am using component instantiation listener on my wicket app. I think I might have not explained things properly in my last post. For the sake of clarity, I'm posting my web.xml and applicationContext set up: On my WicketApplication class I have the following, also based on the wicket in action book: public class WicketApplication extends WebApplication { @Autowired private ObjectService objects_service; @Override protected void init() { addComponentInstantiationListener(new SpringComponentInjector(this)); } My spring/hibernate set-up is also similar to the wicket in Action book : My web.xml file has the following hibernate session filter (wicket in action book, section 12.3.2): filter filter-nameopensessioninview/filter-name filter-class org.springframework.orm.hibernate3.support.OpenSessionInViewFilter/filter-class /filter filter-mapping filter-nameopensessioninview/filter-name url-pattern/*/url-pattern /filter-mapping context-param param-namecontextConfigLocation/param-name param-value/WEB-INF/applicationContext.xml/param-value /context-param listener listener-classorg.springframework.web.context.ContextLoaderListener/listener-class /listener On the applicationContext.xml file I have the following: tx:annotation-driven / bean id=wicketApplication class=com.myApp.WicketApplication /bean ... I think the whole set up is pretty much standard but if you think I am missing something, then I'd be most grateful if you point it out. Cheers, Lucas -- If you reply to this email, your message will be added to the discussion below: http://apache-wicket.1842946.n4.nabble.com/Continue-navigating-while-on-submit-button-process-stuff-on-the-background-tp3473026p3505262.html To start a new topic under Apache Wicket, email ml-node+1842946-398011874-65...@n4.nabble.com To unsubscribe from Apache Wicket, click herehttp://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=1842946code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=. -- JC -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Continue-navigating-while-on-submit-button-process-stuff-on-the-background-tp3473026p3505480.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Continue navigating while on submit button process stuff on the background
Lucast is not good idea to make the Wicket application and spring bean directly (can't remember why, but look for it into the archive), instead the use of the CompenentInstantiaionListener is the recommended with the companion of the wicket @SpringBean annotation. On Thu, Apr 28, 2011 at 8:31 AM, lucast [via Apache Wicket] ml-node+3480723-1382859170-65...@n4.nabble.com wrote: Thank you Mzemeck, I am using Spring and I tried implementing @Async but for some reason when I fired up my wicket app it complained that it couldn't find the beans. I think it must have been because I'm declaring all of my spring managed beans (including my wicketApplication class) on my applicationContext file. Looking at the Task Execution and Schedulinghttp://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/htmlsingle/spring-framework-reference.html#scheduling section of the spring reference manual, I decided to use a TaskExecutorhttp://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/htmlsingle/spring-framework-reference.html#scheduling-task-executor-usage instead of using @Async annotations and it works perfectly with my current spring settings. I am autowiring spring beans on my WicketAppliation class. And I noticed that calling WicketApplication.get() from the taskExecutor kept throwing a WicketRuntimeException: There is no application attached to current thread taskExecutor-1 exception. I realised that I didn't need to call my db services from the taskExecutor since none of those tasks are time consuming, the sending emails is what is time consuming and that's what I limited the functionality of taskExecutor to. Thanks, once more for your help. Lucas -- If you reply to this email, your message will be added to the discussion below: http://apache-wicket.1842946.n4.nabble.com/Continue-navigating-while-on-submit-button-process-stuff-on-the-background-tp3473026p3480723.html To start a new topic under Apache Wicket, email ml-node+1842946-398011874-65...@n4.nabble.com To unsubscribe from Apache Wicket, click herehttp://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=1842946code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=. -- JC -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Continue-navigating-while-on-submit-button-process-stuff-on-the-background-tp3473026p3486071.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Continue navigating while on submit button process stuff on the background
Thank you Mzemeck, I am using Spring and I tried implementing @Async but for some reason when I fired up my wicket app it complained that it couldn't find the beans. I think it must have been because I'm declaring all of my spring managed beans (including my wicketApplication class) on my applicationContext file. Looking at the http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/htmlsingle/spring-framework-reference.html#scheduling Task Execution and Scheduling section of the spring reference manual, I decided to use a http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/htmlsingle/spring-framework-reference.html#scheduling-task-executor-usage TaskExecutor instead of using @Async annotations and it works perfectly with my current spring settings. I am autowiring spring beans on my WicketAppliation class. And I noticed that calling WicketApplication.get() from the taskExecutor kept throwing a WicketRuntimeException: There is no application attached to current thread taskExecutor-1 exception. I realised that I didn't need to call my db services from the taskExecutor since none of those tasks are time consuming, the sending emails is what is time consuming and that's what I limited the functionality of taskExecutor to. Thanks, once more for your help. Lucas -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Continue-navigating-while-on-submit-button-process-stuff-on-the-background-tp3473026p3480723.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Continue navigating while on submit button process stuff on the background
Dear Forum, I have a simple tabbed view object page with a notify button that when the user clicks on the button, it emails a long list of people with information about the concerning the object. Some objects have a list of 100+ email addresses and clicking on submit stops me from continuing visiting other tabbed pages until the email class has finished sending all the emails (40 seconds afterwards). How can implement the notify button so that it emails people on the background AND allows me to continue navigating out of the current view tabbed page into another page? Thanks in advance, Lucas The button i'm implementing is simple: new Button (notifyButton){ @Override public void onSubmit() { EmailServices emailService = new EmailNotificationService(); emailService.notifyMailingList(object); } }; -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Continue-navigating-while-on-submit-button-process-stuff-on-the-background-tp3473026p3473026.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Continue navigating while on submit button process stuff on the background
Send your emails in a batch at a later time, or if you are using Spring you could use the new @Async annotation. From: lucast lucastol...@hotmail.com To: users@wicket.apache.org Date: 04/25/2011 08:32 AM Subject:Continue navigating while on submit button process stuff on the background Dear Forum, I have a simple tabbed view object page with a notify button that when the user clicks on the button, it emails a long list of people with information about the concerning the object. Some objects have a list of 100+ email addresses and clicking on submit stops me from continuing visiting other tabbed pages until the email class has finished sending all the emails (40 seconds afterwards). How can implement the notify button so that it emails people on the background AND allows me to continue navigating out of the current view tabbed page into another page? Thanks in advance, Lucas The button i'm implementing is simple: new Button (notifyButton){ @Override public void onSubmit() { EmailServices emailService = new EmailNotificationService(); emailService.notifyMailingList(object); } }; -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Continue-navigating-while-on-submit-button-process-stuff-on-the-background-tp3473026p3473026.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org Notice: This communication, including any attachments, is intended solely for the use of the individual or entity to which it is addressed. This communication may contain information that is protected from disclosure under State and/or Federal law. Please notify the sender immediately if you have received this communication in error and delete this email from your system. If you are not the intended recipient, you are requested not to disclose, copy, distribute or take any action in reliance on the contents of this information.
Re: Continue navigating while on submit button process stuff on the background
or if you are not using Spring...use Java Futures... http://download.oracle.com/javase/6/docs/api/java/util/concurrent/Future.html From: lucast lucastol...@hotmail.com To: users@wicket.apache.org Date: 04/25/2011 08:32 AM Subject:Continue navigating while on submit button process stuff on the background Dear Forum, I have a simple tabbed view object page with a notify button that when the user clicks on the button, it emails a long list of people with information about the concerning the object. Some objects have a list of 100+ email addresses and clicking on submit stops me from continuing visiting other tabbed pages until the email class has finished sending all the emails (40 seconds afterwards). How can implement the notify button so that it emails people on the background AND allows me to continue navigating out of the current view tabbed page into another page? Thanks in advance, Lucas The button i'm implementing is simple: new Button (notifyButton){ @Override public void onSubmit() { EmailServices emailService = new EmailNotificationService(); emailService.notifyMailingList(object); } }; -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Continue-navigating-while-on-submit-button-process-stuff-on-the-background-tp3473026p3473026.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org Notice: This communication, including any attachments, is intended solely for the use of the individual or entity to which it is addressed. This communication may contain information that is protected from disclosure under State and/or Federal law. Please notify the sender immediately if you have received this communication in error and delete this email from your system. If you are not the intended recipient, you are requested not to disclose, copy, distribute or take any action in reliance on the contents of this information.