>From the thread you can't request anything to the application server, since
the original request that initiates the threads is already gone, what you
can do is actually create an abstract behavior with a timer that checks the
server (lets say every 5 seconds) for an status and  force a redirection
from there (javascript tricks). Obviously your thread need to update this
status somewhere.



On Thu, Oct 28, 2010 at 5:36 AM, lsm_7 [via Apache Wicket] <
ml-node+3016823-1352866555-65...@n4.nabble.com<ml-node%2b3016823-1352866555-65...@n4.nabble.com>
> wrote:

> Hello everybody,
>
> I have a form, then when all the fields are filled and I clicked the accept
> button, there's an AJAX event that shows a progress bar in flash and then
> executes onSubmit(). In this event I create a thread to execute other
> internal actions.
>
> What I want is when the thread finishes, redirect to another WebPage. But
> it seems that I can not interact with redirections from the thread.
>
> If somebody has any suggestion it would be great!
>
> The most important part of the code is:
>
> .....
>
>  button.add(new AjaxEventBehavior("onclick"){
>
>                         @Override
>                         protected void onEvent(AjaxRequestTarget target) {
>                                 iframe.setVisible(true);
>                                 target.addComponent(iframe);
>
>                                 onSubmit();
>
>                                 t = new ThreadXen();
>                                 t.start();
>                         }
>                 });
>         }
>
>         public void onSubmit() {
>                 int mem = Integer.parseInt(memory.getValue());
>                 int swap;
>
>                 if (mem < 1024)
>                         swap = mem*2;
>                 else
>                         swap = 2048;
>
>                 machine = new VirtualMachine();
>                 machine.setHostname(name.getValue());
>                 machine.setMemory(mem);
>                 machine.setDisk(Integer.parseInt(disk.getValue()));
>                 machine.setSwap(swap);
>                 machine.setOs(os.getModelObject());
>                 machine.setPwd(password.getValue());
>                 machine.setArch(arch.getValue());
>                 List<String> users = assigned.getUsers();
>                 machine.setAssigned(users);
>         }
>
>         public class ThreadXen extends Thread implements Serializable{
>
>                 private static final long serialVersionUID =
> 6117927184239433259L;
>
>             public void run() {
>             XenManager.newMachine(machine);
>             setResponsePage(ListMachines.class);
>             }
>         }
>
> .....
>
>
> Thanks in advance
>
>
> ------------------------------
>  View message @
> http://apache-wicket.1842946.n4.nabble.com/Problem-with-setResponsePage-from-a-thread-tp3016823p3016823.html
> To start a new topic under Apache Wicket, email
> ml-node+1842946-398011874-65...@n4.nabble.com<ml-node%2b1842946-398011874-65...@n4.nabble.com>
> To unsubscribe from Apache Wicket, click 
> here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=>.
>
>
>


-- 
Sincerely,
JC (http://www.linkedin.com/in/jcgarciam)
Work smarter, not harder!.

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-with-setResponsePage-from-a-thread-tp3016823p3017124.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

Reply via email to