You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by chrome1235 <ke...@gmail.com> on 2012/06/01 18:52:41 UTC

Batch process message to user

Hi,
My Application has some batch processes, therefore I want to response to
users a message like "server is busy now".
I mean, all user request will forward to single page. And I want to do it in
Application class, not pages.

Can I solve this problem?


Best regards,
kemal.

 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Batch-process-message-to-user-tp4649662.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Batch process message to user

Posted by chrome1235 <ke...@gmail.com>.
Hi Dan,
Thanks for your reply.
I found a solution with your help. 

public class MyRequestMapper implements IRequestMapper {
	PageProvider pageProvider;
	final IRequestMapper rootRequestMapper; // original RootMapper
	final WicketApplication wicketApplication;
	public MyRequestMapper(final IRequestMapper rootRequestMapper,
WicketApplication wicketApplication) {
		this.rootRequestMapper= rootRequestMapper;
		this.wicketApplication=wicketApplication;
		pageProvider= new PageProvider(BusyPage.class);
	}
	public int getCompatibilityScore(Request request) {
		return 0;
	}
	public Url mapHandler(IRequestHandler iRequestHandler) {
		return rootRequestMapper.mapHandler(iRequestHandler);
	}
	public IRequestHandler mapRequest(Request request) {
		if (wicketApplication.isBusy()) {
			return new RenderPageRequestHandler(pageProvider);
		} 
	        return rootRequestMapper.mapRequest(request);
	}
}

public class WicketApplication extends WebApplication {
	public void init()
	{
		super.init();
                mountPage("/Home", HomePage.class);
                mountPage("/busy", BusyPage.class);
		setRootRequestMapper(new MyRequestMapper(getRootRequestMapper(), this));
	}
....
}





--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Batch-process-message-to-user-tp4649662p4649674.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Batch process message to user

Posted by Dan Retzlaff <dr...@gmail.com>.
Hi Kemal,

You could register your own root IRequestMapper. See the last paragraph
under "The new way in Wicket 1.5":
https://cwiki.apache.org/WICKET/request-mapping.html

Dan

On Fri, Jun 1, 2012 at 9:52 AM, chrome1235 <ke...@gmail.com> wrote:

> Hi,
> My Application has some batch processes, therefore I want to response to
> users a message like "server is busy now".
> I mean, all user request will forward to single page. And I want to do it
> in
> Application class, not pages.
>
> Can I solve this problem?
>
>
> Best regards,
> kemal.
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Batch-process-message-to-user-tp4649662.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>