[ 
https://issues.apache.org/jira/browse/WICKET-2538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Igor Vaynberg resolved WICKET-2538.
-----------------------------------

    Resolution: Won't Fix
      Assignee: Igor Vaynberg

you can set the application object yourself (application.set()), passing it to 
your thread. or use wickettester in the other thread to set up the environment.

that said, this is not a recommended way of doing anything. the page and its 
components should only be used within a request, otherwise you can risk running 
into weird problems.

i doubt that creating the components is what takes a long time. it is probably 
some other peripheral processing, assembling the component tree itself is 
cheap. so you should probably move just that peripheral processing out into a 
thread.

> Background application threads
> ------------------------------
>
>                 Key: WICKET-2538
>                 URL: https://issues.apache.org/jira/browse/WICKET-2538
>             Project: Wicket
>          Issue Type: Wish
>            Reporter: Pedro Santos
>            Assignee: Igor Vaynberg
>
> I have a wish for to do wicket component creation on background threads.
> Why?
> I have an project that has an special panel, that create a lot of images to 
> present or not (time consuming) , based on visibility rules, implemented on 
> image components on it.
> That panelWithImages is in an step of an wizard. When the user goes to the 
> wizard, I want to start this panel creation, and when the user go to this 
> step, the panelWithImages will to be instantiated our almost.
> The actual problem: the image components on panel receive one resource 
> reference, set it on localizedImageResource, that call one bind method, that 
> some moment will call Application.get()
> Why can't I separate the time consuming work from the panel construction 
> process?
> Actually I can do that, with an extra work. Then in the panel construction I 
> just wait for the thread that was started when user open the wizard. But is 
> is just a wish. If the application object were set to the background thread 
> on ThreadLocal, it would be easier.
> For example:
> WicketThreadForCreateComponentOnBackground{
>       public WicketThreadForCreateComponentOnBackground()
>       {
>               session = Session.get();
>               application = Application.get();
>       }
>       public final void run()
>       {
>               Application.set(application);
>               Session.set(sessaoGestao);
>               createComponentsOnBackground();
>               Session.unset();
>               Application.unset();
>       }
>       protected abstract void createComponentsOnBackground();
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to