Ale,
   Related to what you have mentioned. I render mails with some
mockHTTPrequest and mockeHTTPResponse, etc. But, I need to render mails in a
different thread than wicket's one. I have another servlet that runs Blazeds
(Flex) where I also need to render some mails, but  I got  "There is no
application
attached to current thread...". According to what you mentioned, could I
solve this issue?

thanks in advance.

On Fri, Jul 30, 2010 at 5:46 AM, Alex Objelean <alex.objel...@gmail.com>wrote:

>
> There was a long discussion about this. One of the proposal was to use
> InheritableThreadLocal which would solve this problem, but there was a lot
> of concerns about this approach.
>
> The solution I have found was this:
> If you create the thread with ExecutorService, you could do the following:
>
>    final ExecutorService service = new ScheduledThreadPoolExecutor(1) {
>      @Override
>      protected void beforeExecute(final Thread t, final Runnable r) {
>        Application.set(app);
>      };
>      @Override
>      protected void afterExecute(final Runnable r, final Throwable t) {
>        Application.unset();
>      }
>    };
>
> and execute you thread like this:
> service.submit(new Runnable() {
>            @Override
>            public void run() {
>              //do stuff
>            }
>          });
>
> This will ensure that Application is accessible from within newly created
> thread.
>
> Alex
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Localizer-in-a-new-Thread-tp2307306p2307732.html
> Sent from the Wicket - User 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
>
>


-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus

Reply via email to