本文整理汇总了Java中org.apache.wicket.core.request.handler.RenderPageRequestHandler类的典型用法代码示例。如果您正苦于以下问题:Java RenderPageRequestHandler类的具体用法?Java RenderPageRequestHandler怎么用?Java RenderPageRequestHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RenderPageRequestHandler类属于org.apache.wicket.core.request.handler包,在下文中一共展示了RenderPageRequestHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newWebRequest
import org.apache.wicket.core.request.handler.RenderPageRequestHandler; //导入依赖的package包/类
@Override
public WebRequest newWebRequest(HttpServletRequest servletRequest, String filterPath) {
return new ServletWebRequest(servletRequest, filterPath) {
@Override
public boolean shouldPreserveClientUrl() {
if (RequestCycle.get().getActiveRequestHandler() instanceof RenderPageRequestHandler) {
RenderPageRequestHandler requestHandler =
(RenderPageRequestHandler) RequestCycle.get().getActiveRequestHandler();
/*
* Add this to make sure that the page url does not change upon errors, so that
* user can know which page is actually causing the error. This behavior is common
* for main stream applications.
*/
if (requestHandler.getPage() instanceof BaseErrorPage)
return true;
}
return super.shouldPreserveClientUrl();
}
};
}
示例2: onRequestHandlerScheduled
import org.apache.wicket.core.request.handler.RenderPageRequestHandler; //导入依赖的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.core.request.handler.RenderPageRequestHandler; //导入依赖的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.core.request.handler.RenderPageRequestHandler; //导入依赖的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: init
import org.apache.wicket.core.request.handler.RenderPageRequestHandler; //导入依赖的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 );
}
示例6: init
import org.apache.wicket.core.request.handler.RenderPageRequestHandler; //导入依赖的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);
}
示例7: createPageRequestHandler
import org.apache.wicket.core.request.handler.RenderPageRequestHandler; //导入依赖的package包/类
private RenderPageRequestHandler createPageRequestHandler(PageProvider pageProvider) {
RequestCycle requestCycle = RequestCycle.get();
if (requestCycle == null) {
throw new IllegalStateException("there is no current request cycle attached to this thread");
}
/*
* Use NEVER_REDIRECT policy to preserve the original page's URL for
* non-Ajax requests and always redirect for ajax requests
*/
RenderPageRequestHandler.RedirectPolicy redirect = RenderPageRequestHandler.RedirectPolicy.NEVER_REDIRECT;
if (isProcessingAjaxRequest()) {
redirect = RenderPageRequestHandler.RedirectPolicy.AUTO_REDIRECT;
}
return new RenderPageRequestHandler(pageProvider, redirect);
}
示例8: init
import org.apache.wicket.core.request.handler.RenderPageRequestHandler; //导入依赖的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);
}
示例9: createPageRequestHandler
import org.apache.wicket.core.request.handler.RenderPageRequestHandler; //导入依赖的package包/类
private RenderPageRequestHandler createPageRequestHandler(PageProvider pageProvider) {
RequestCycle requestCycle = RequestCycle.get();
if (requestCycle == null) {
throw new IllegalStateException("there is no current request cycle attached to this thread");
}
/*
* Use NEVER_REDIRECT policy to preserve the original page's URL for
* non-Ajax requests and always redirect for ajax requests
*/
RenderPageRequestHandler.RedirectPolicy redirect = RenderPageRequestHandler.RedirectPolicy.NEVER_REDIRECT;
if (isProcessingAjaxRequest()) {
redirect = RenderPageRequestHandler.RedirectPolicy.AUTO_REDIRECT;
}
return new RenderPageRequestHandler(pageProvider, redirect);
}
示例10: internalMap
import org.apache.wicket.core.request.handler.RenderPageRequestHandler; //导入依赖的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);
}
示例11: onException
import org.apache.wicket.core.request.handler.RenderPageRequestHandler; //导入依赖的package包/类
@Override
public IRequestHandler onException(RequestCycle cycle, Exception e) {
if (e instanceof PageExpiredException) {
LOG.error("Page expired", e); // !?
return null; // see
// getApplicationSettings().setPageExpiredErrorPage
}
if (e instanceof MaintenanceException) {
return new RenderPageRequestHandler(new PageProvider(MaintenancePage.class));
}
if (e instanceof StalePageException) {
return null;
}
String errorCode = String.valueOf(System.currentTimeMillis());
LOG.error("Error with code " + errorCode, e);
PageParameters parameters = new PageParameters();
parameters.add("errorCode", errorCode);
parameters.add("errorMessage", UrlEncoder.QUERY_INSTANCE.encode(e.getMessage(), HTTP.ISO_8859_1));
return new RenderPageRequestHandler(new PageProvider(ErrorPage.class, parameters));
}
示例12: onException
import org.apache.wicket.core.request.handler.RenderPageRequestHandler; //导入依赖的package包/类
@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);
}
LoggingUtils.logUnexpectedException(LOGGER, "Error occurred during page rendering", ex);
return new RenderPageRequestHandler(new PageProvider(new PageError(ex)));
}
示例13: debugHandler
import org.apache.wicket.core.request.handler.RenderPageRequestHandler; //导入依赖的package包/类
public static String debugHandler(IRequestHandler handler) {
if (handler == null) {
return null;
}
if (handler instanceof RenderPageRequestHandler) {
return "RenderPageRequestHandler(" + ((RenderPageRequestHandler) handler).getPageClass().getName()
+ ")";
} else {
return handler.toString();
}
}
示例14: onException
import org.apache.wicket.core.request.handler.RenderPageRequestHandler; //导入依赖的package包/类
@Override
public IRequestHandler onException(RequestCycle cycle, Exception ex) {
SingularException singularException = getFirstSingularException(ex);
if (singularException instanceof SingularServerException
&& ((WebRequest) RequestCycle.get().getRequest()).isAjax()) {
return new AjaxErrorRequestHandler(singularException);
} else if (ex instanceof PageExpiredException) {
return new RenderPageRequestHandler(new PageProvider(new Page410()));
} else {
return new RenderPageRequestHandler(new PageProvider(new Page500(ex)));
}
}
示例15: processHybrid
import org.apache.wicket.core.request.handler.RenderPageRequestHandler; //导入依赖的package包/类
@Override
protected IRequestHandler processHybrid(PageInfo pageInfo, Class<? extends IRequestablePage> pageClass,
PageParameters pageParameters, Integer renderCount) {
IRequestHandler handler = super.processHybrid(pageInfo, pageClass, pageParameters, renderCount);
if (handler instanceof RenderPageRequestHandler) {
// in the current implementation (wicket 1.5.6) super.processHybrid
// returns a RenderPageRequestHandler
RenderPageRequestHandler renderPageHandler = (RenderPageRequestHandler) handler;
if (renderPageHandler.getPageProvider() instanceof PageProvider) {
PageProvider provider = (PageProvider) renderPageHandler.getPageProvider();
// This check is necessary to prevent a
// RestartResponseAtInterceptPageException at the wrong time in
// request cycle
if (provider.hasPageInstance()) {
PageParameters newPageParameters = renderPageHandler.getPageParameters();
PageParameters oldPageParameters = renderPageHandler.getPageProvider().getPageInstance()
.getPageParameters();
// if we recognize a change between the page parameter of
// the loaded
// page and the page parameter of the current request, we
// redirect
// to a fresh bookmarkable instance of that page.
if (!PageParameters.equals(oldPageParameters, newPageParameters)) {
handler = processBookmarkable(pageClass, newPageParameters);
}
}
}
}
return handler;
}