当前位置: 首页>>代码示例>>Java>>正文


Java IRequestHandler类代码示例

本文整理汇总了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);
					}
				}
				
			};
		}
		
	};
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:24,代码来源:GitPlexWebApplication.java

示例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);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:19,代码来源:LoggingRequestCycleListener.java

示例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);
}
 
开发者ID:shawnmckinney,项目名称:fortress-saml-demo,代码行数:25,代码来源:WicketApplication.java

示例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);
}
 
开发者ID:citlab,项目名称:Intercloud,代码行数:23,代码来源:BodyFrame.java

示例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);
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:22,代码来源:CoreDefaultExceptionMapper.java

示例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);
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:17,代码来源:ArtifactoryRequestCycleListener.java

示例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 );
}
 
开发者ID:apache,项目名称:directory-fortress-commander,代码行数:18,代码来源:ApplicationContext.java

示例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);
}
 
开发者ID:shawnmckinney,项目名称:role-engineering-sample,代码行数:24,代码来源:WicketApplication.java

示例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);
	}
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:17,代码来源:UQasarExceptionRequestCycleListener.java

示例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;
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:23,代码来源:OrientDefaultExceptionsHandlingListener.java

示例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);
}
 
开发者ID:shawnmckinney,项目名称:fortressdemo2,代码行数:23,代码来源:WicketApplication.java

示例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);
    }
}
 
开发者ID:flex-oss,项目名称:flex-ui,代码行数:19,代码来源:AbstractExceptionMapper.java

示例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);
}
 
开发者ID:flex-oss,项目名称:flex-ui,代码行数:27,代码来源:AbstractExceptionMapper.java

示例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);
    }
}
 
开发者ID:flex-oss,项目名称:flex-ui,代码行数:17,代码来源:AbstractExceptionMapper.java

示例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;
    }
}
 
开发者ID:flex-oss,项目名称:flex-ui,代码行数:25,代码来源:DefaultExceptionMapper.java


注:本文中的org.apache.wicket.request.IRequestHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。