List of usage examples for org.apache.wicket.request.resource IResource IResource
IResource
From source file:org.wicketstuff.jeeweb.ajax.JEEWebGlobalAjaxHandler.java
License:Apache License
/** * Receives ajax events and delegates them to the page which where rendered previously. *//* w w w .java2 s. c o m*/ @Override public IResource getResource() { return new IResource() { private static final long serialVersionUID = 3070290312369930992L; @Override public void respond(Attributes attributes) { try { PageParameters parameters = attributes.getParameters(); int pageId = parameters.get("pageId").toInt(); Page page = (Page) WebSession.get().getPageManager().getPage(pageId); AjaxRequestTarget newAjaxRequestTarget = ((WebApplication) Application.get()) .newAjaxRequestTarget(page); RequestCycle.get().scheduleRequestHandlerAfterCurrent(newAjaxRequestTarget); page.send(page, Broadcast.BREADTH, new JEEWebGlobalAjaxEvent(newAjaxRequestTarget, parameters, RequestCycle.get().getRequest().getPostParameters())); } catch (Exception e) { LOGGER.error("Error while processing the ajax request", e); } } }; }