Example usage for org.apache.wicket.request.cycle RequestCycle getActiveRequestHandler

List of usage examples for org.apache.wicket.request.cycle RequestCycle getActiveRequestHandler

Introduction

In this page you can find the example usage for org.apache.wicket.request.cycle RequestCycle getActiveRequestHandler.

Prototype

public IRequestHandler getActiveRequestHandler() 

Source Link

Usage

From source file:at.molindo.wicketutils.utils.WicketUtils.java

License:Apache License

public static Class<? extends IRequestablePage> getBookmarkablePage(final RequestCycle cycle) {
    if (cycle == null) {
        return null;
    }//  w w w . j a  v  a  2s . c om

    final IRequestHandler handler = cycle.getActiveRequestHandler();
    if (handler instanceof BookmarkablePageRequestHandler) {
        return ((BookmarkablePageRequestHandler) handler).getPageClass();
    }

    return null;
}

From source file:com.evolveum.midpoint.web.security.LoggingRequestCycleListener.java

License:Apache License

@Override
public IRequestHandler onException(RequestCycle cycle, Exception ex) {
    if (REQUEST_LOGGER.isTraceEnabled()) {
        REQUEST_LOGGER.trace("REQUEST CYCLE: Exception: {}, handler {}", ex,
                WebComponentUtil.debugHandler(cycle.getActiveRequestHandler()), ex);
    }// ww w  .j  a v  a  2  s .co m
    LoggingUtils.logUnexpectedException(LOGGER, "Error occurred during page rendering", ex);
    return new RenderPageRequestHandler(new PageProvider(new PageError(ex)));
}

From source file:com.evolveum.midpoint.web.security.LoggingRequestCycleListener.java

License:Apache License

@Override
public void onBeginRequest(RequestCycle cycle) {
    if (REQUEST_LOGGER.isTraceEnabled()) {
        REQUEST_LOGGER.trace("REQUEST CYCLE: Begin request: '{}', handler {}",
                cycle.getRequest().getOriginalUrl(),
                WebComponentUtil.debugHandler(cycle.getActiveRequestHandler()));
    }// w w  w  .j  a v  a2  s. co m
    super.onBeginRequest(cycle);
}

From source file:name.martingeisse.admin.application.wicket.ExceptionMapper.java

License:Open Source License

/**
 * /* w  ww  . jav  a  2s.co  m*/
 */
@SuppressWarnings("unused")
private Page extractCurrentPage() {
    final RequestCycle requestCycle = RequestCycle.get();
    IRequestHandler handler = requestCycle.getActiveRequestHandler();
    if (handler == null) {
        handler = requestCycle.getRequestHandlerScheduledAfterCurrent();
    }
    if (handler instanceof IPageRequestHandler) {
        final IPageRequestHandler pageRequestHandler = (IPageRequestHandler) handler;
        return (Page) pageRequestHandler.getPage();
    }
    return null;
}

From source file:name.martingeisse.trading_game.gui.util.AjaxRequestUtil.java

License:Open Source License

/**
 * Obtains the {@link AjaxRequestTarget} for the current request. Returns
 * null for non-AJAX requests./*from   w w  w  . j  av a2s .co m*/
 *
 * @return the ART
 */
public static AjaxRequestTarget getAjaxRequestTarget() {
    RequestCycle requestCycle = RequestCycle.get();
    IRequestHandler scheduledHandler = requestCycle.getRequestHandlerScheduledAfterCurrent();
    if (scheduledHandler instanceof AjaxRequestTarget) {
        return (AjaxRequestTarget) scheduledHandler;
    }
    IRequestHandler currentHandler = requestCycle.getActiveRequestHandler();
    if (currentHandler instanceof AjaxRequestTarget) {
        return (AjaxRequestTarget) currentHandler;
    }
    return null;
}