Example usage for org.apache.wicket Page send

List of usage examples for org.apache.wicket Page send

Introduction

In this page you can find the example usage for org.apache.wicket Page send.

Prototype

@Override
public final <T> void send(IEventSink sink, Broadcast type, T payload) 

Source Link

Usage

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.
 *///from  w  w w .j  a  v  a  2s .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);
            }
        }
    };
}