本文整理汇总了Java中org.apache.wicket.request.IRequestHandler类的典型用法代码示例。如果您正苦于以下问题:Java IRequestHandler类的具体用法?Java IRequestHandler怎么用?Java IRequestHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IRequestHandler类属于org.apache.wicket.request包,在下文中一共展示了IRequestHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExceptionMapperProvider
import org.apache.wicket.request.IRequestHandler; //导入依赖的package包/类
@Override
public final IProvider<IExceptionMapper> getExceptionMapperProvider() {
return new IProvider<IExceptionMapper>() {
@Override
public IExceptionMapper get() {
return new DefaultExceptionMapper() {
@Override
protected IRequestHandler mapExpectedExceptions(Exception e, Application application) {
Page errorPage = mapExceptions(e);
if (errorPage != null) {
return createPageRequestHandler(new PageProvider(errorPage));
} else {
return super.mapExpectedExceptions(e, application);
}
}
};
}
};
}
示例2: onRequestHandlerScheduled
import org.apache.wicket.request.IRequestHandler; //导入依赖的package包/类
@Override
public void onRequestHandlerScheduled(RequestCycle cycle, IRequestHandler handler) {
if (handler instanceof RenderPageRequestHandler) {
Class<? extends IRequestablePage> pageClass = ((RenderPageRequestHandler) handler).getPageClass();
if (REQUEST_LOGGER.isTraceEnabled()) {
REQUEST_LOGGER.trace("REQUEST CYCLE: Scheduled redirect to page {}", pageClass);
}
if (PageError.class.isAssignableFrom(pageClass)) {
REQUEST_LOGGER.info("REQUEST CYCLE: Scheduled redirect to error page {}", pageClass);
}
} else {
if (REQUEST_LOGGER.isTraceEnabled()) {
REQUEST_LOGGER.trace("REQUEST CYCLE: Scheduled request handler {}",
WebComponentUtil.debugHandler(handler));
}
}
super.onRequestHandlerScheduled(cycle, handler);
}
示例3: init
import org.apache.wicket.request.IRequestHandler; //导入依赖的package包/类
/**
* @see org.apache.wicket.Application#init()
*/
@Override
public void init()
{
super.init();
// TODO STEP 7b: uncomment to enable injection of fortress spring beans:
getComponentInstantiationListeners().add(new SpringComponentInjector(this));
// Catch runtime exceptions this way:
getRequestCycleListeners().add( new AbstractRequestCycleListener()
{
@Override
public IRequestHandler onException( RequestCycle cycle, Exception e )
{
return new RenderPageRequestHandler( new PageProvider( new ErrorPage( e ) ) );
}
} );
getMarkupSettings().setStripWicketTags(true);
getRequestCycleSettings().setRenderStrategy( RequestCycleSettings.RenderStrategy.ONE_PASS_RENDER);
}
示例4: BodyFrame
import org.apache.wicket.request.IRequestHandler; //导入依赖的package包/类
/**
* Constructor
*/
public BodyFrame() {
frameTarget = new TargetFrame(DefaultPage.class);
leftFrame = new NavigationFrame(this);
getSession().getPageManager().touchPage(leftFrame);
IRequestHandler leftFrameHandler = new RenderPageRequestHandler(new PageProvider(leftFrame));
ExtendedFrame leftFrameTag = new ExtendedFrame("leftFrame", leftFrameHandler);
add(leftFrameTag);
ExtendedFrame rightFrameTag = new ExtendedFrame("rightFrame") {
/** */
private static final long serialVersionUID = 1L;
@Override
protected CharSequence getUrl() {
return frameTarget.getUrl();
}
};
add(rightFrameTag);
}
示例5: map
import org.apache.wicket.request.IRequestHandler; //导入依赖的package包/类
@Override
public IRequestHandler map(Exception e) {
if (e instanceof AuthorizationException) {
/*
* Make Spring Security work for us: it will save the original request for later redirect and redirect
* to the login page
*/
throw new AccessDeniedException("Access denied by Wicket's security layer", e);
}
try {
return DELEGATE.map(e);
} catch (RuntimeException e2) {
if (LOGGER.isDebugEnabled()) {
LOGGER.error("An error occurred while handling a previous error: " + e2.getMessage(), e2);
}
// We were already handling an exception! give up
LOGGER.error("unexpected exception when handling another exception: " + e.getMessage(), e);
return new ErrorCodeRequestHandler(500);
}
}
示例6: onException
import org.apache.wicket.request.IRequestHandler; //导入依赖的package包/类
@Override
public IRequestHandler onException(RequestCycle cycle, Exception e) {
if (e instanceof AuthorizationException) {
StringBuilder builder = new StringBuilder("User ");
try {
AuthorizationService authService = ContextHelper.get().getAuthorizationService();
builder.append(authService.currentUsername());
} catch (Exception e1) {
log.error("Error retrieving Username", e1);
}
builder.append(" accessed unauthorized resource. ");
builder.append(e.getMessage());
log.info(builder.toString());
}
return super.onException(cycle, e);
}
示例7: init
import org.apache.wicket.request.IRequestHandler; //导入依赖的package包/类
@Override
public void init()
{
super.init();
getComponentInstantiationListeners().add( new SpringComponentInjector( this ) );
// Catch runtime exceptions this way:
getRequestCycleListeners().add( new AbstractRequestCycleListener()
{
@Override
public IRequestHandler onException( RequestCycle cycle, Exception e )
{
return new RenderPageRequestHandler( new PageProvider( new ErrorPage( e ) ) );
}
} );
getMarkupSettings().setStripWicketTags( true );
}
示例8: init
import org.apache.wicket.request.IRequestHandler; //导入依赖的package包/类
/**
* @see org.apache.wicket.Application#init()
*/
@Override
public void init()
{
super.init();
// Enable injection of fortress spring beans:
getComponentInstantiationListeners().add(new SpringComponentInjector(this));
// Catch runtime exceptions this way:
getRequestCycleListeners().add( new AbstractRequestCycleListener()
{
@Override
public IRequestHandler onException( RequestCycle cycle, Exception e )
{
return new RenderPageRequestHandler( new PageProvider( new ErrorPage( e ) ) );
}
} );
getMarkupSettings().setStripWicketTags(true);
getRequestCycleSettings().setRenderStrategy( RequestCycleSettings.RenderStrategy.ONE_PASS_RENDER);
}
示例9: onException
import org.apache.wicket.request.IRequestHandler; //导入依赖的package包/类
@Override
public IRequestHandler onException(RequestCycle cycle, Exception ex) {
if (ex instanceof EntityNotFoundException) {
return createPageRequestHandler(new PageProvider(new EntityNotFoundErrorPage((EntityNotFoundException) ex)));
} else if (ex.getCause() instanceof InvocationTargetException) {
Throwable targetException = ((InvocationTargetException) ex.getCause()).getTargetException();
if (targetException instanceof EntityNotFoundException) {
return createPageRequestHandler(new PageProvider(new EntityNotFoundErrorPage((EntityNotFoundException) targetException)));
}
}
if (deploymentMode) {
return createPageRequestHandler(new PageProvider(new ErrorPage(ex)));
} else {
return super.onException(cycle, ex);
}
}
示例10: extractCurrentPage
import org.apache.wicket.request.IRequestHandler; //导入依赖的package包/类
private Page extractCurrentPage(boolean fullSearch)
{
final RequestCycle requestCycle = RequestCycle.get();
IRequestHandler handler = requestCycle.getActiveRequestHandler();
if (handler == null)
{
handler = requestCycle.getRequestHandlerScheduledAfterCurrent();
if(handler==null && fullSearch) {
handler = OrientDbWebApplication.get().getRootRequestMapper().mapRequest(requestCycle.getRequest());
}
}
if (handler instanceof IPageRequestHandler)
{
IPageRequestHandler pageRequestHandler = (IPageRequestHandler)handler;
return (Page)pageRequestHandler.getPage();
}
return null;
}
示例11: init
import org.apache.wicket.request.IRequestHandler; //导入依赖的package包/类
/**
* @see org.apache.wicket.Application#init()
*/
@Override
public void init()
{
super.init();
// add your configuration here
getComponentInstantiationListeners().add(new SpringComponentInjector(this));
// Catch runtime exceptions this way:
getRequestCycleListeners().add( new AbstractRequestCycleListener()
{
@Override
public IRequestHandler onException( RequestCycle cycle, Exception e )
{
return new RenderPageRequestHandler( new PageProvider( new ErrorPage( e ) ) );
}
} );
getMarkupSettings().setStripWicketTags(true);
}
示例12: map
import org.apache.wicket.request.IRequestHandler; //导入依赖的package包/类
@SuppressWarnings("illegalcatch")
@Override
public IRequestHandler map(Exception e) {
try {
// we don't want to cache an exceptional reply in the browser
getWebResponse().ifPresent(WebResponse::disableCaching);
return internalMap(e);
} catch (RuntimeException ie) { // exception thrown while handling the exception
if (LOG.isDebugEnabled()) {
LOG.error("An error occurred while handling a previous error: " + ie.getMessage(), ie);
}
LOG.error("Unexpected exception when handling another exception: " + e.getMessage(), e);
// the mapping process failed, so this is the fallback error handler (nothing more we can really do)
return new ErrorCodeRequestHandler(INTERNAL_SERVER_ERROR);
}
}
示例13: internalMap
import org.apache.wicket.request.IRequestHandler; //导入依赖的package包/类
private IRequestHandler internalMap(Exception e) {
final Application application = Application.get();
// check if we are processing an Ajax request and if we want to invoke the failure handler
if (isAjaxRequest() && shouldInvokeClientSideFailureHandler(application)) {
return new ErrorCodeRequestHandler(INTERNAL_SERVER_ERROR);
}
if (e instanceof StalePageException) {
// If the page was stale, just re-render it (the url should always be updated by an redirect in that case)
return new RenderPageRequestHandler(new PageProvider(((StalePageException) e).getPage()));
} else if (e instanceof PageExpiredException) {
return createPageRequestHandler(application.getApplicationSettings().getPageExpiredErrorPage());
} else if (e instanceof AuthorizationException || e instanceof ListenerInvocationNotAllowedException) {
return createPageRequestHandler(application.getApplicationSettings().getAccessDeniedPage());
} else if (e instanceof ResponseIOException) {
LOG.error("Connection lost, give up responding.", e);
return new EmptyRequestHandler();
} else
if (e instanceof PackageResource.PackageResourceBlockedException && application.usesDeploymentConfig()) {
LOG.debug(e.getMessage(), e);
return new ErrorCodeRequestHandler(NOT_FOUND);
}
return mapUnexpectedException(e);
}
示例14: mapUnexpectedException
import org.apache.wicket.request.IRequestHandler; //导入依赖的package包/类
private IRequestHandler mapUnexpectedException(Exception e) {
LOG.error("{}: An unexpected error occurred", getExceptionId(e), e);
Application application = Application.get();
IExceptionSettings.UnexpectedExceptionDisplay display =
application.getExceptionSettings().getUnexpectedExceptionDisplay();
if (IExceptionSettings.SHOW_EXCEPTION_PAGE.equals(display)) {
return createPageRequestHandler(createExceptionDisplayPageProvider(e));
} else if (IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE.equals(display)) {
return createPageRequestHandler(application.getApplicationSettings().getInternalErrorPage());
} else {
// IExceptionSettings.SHOW_NO_EXCEPTION_PAGE
return new ErrorCodeRequestHandler(INTERNAL_SERVER_ERROR);
}
}
示例15: extractCurrentPage
import org.apache.wicket.request.IRequestHandler; //导入依赖的package包/类
/**
* Returns the page being rendered when the exception was thrown, or {@code null} if it cannot be extracted.
*
* @return a Page
*/
private Page extractCurrentPage() {
RequestCycle requestCycle = RequestCycle.get();
if (requestCycle == null) {
return null;
}
IRequestHandler handler = requestCycle.getActiveRequestHandler();
if (handler == null) {
handler = requestCycle.getRequestHandlerScheduledAfterCurrent();
}
if (handler instanceof IPageRequestHandler) {
return (Page) ((IPageRequestHandler) handler).getPage();
} else {
return null;
}
}