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


Java PageExpiredException类代码示例

本文整理汇总了Java中org.apache.wicket.protocol.http.PageExpiredException的典型用法代码示例。如果您正苦于以下问题:Java PageExpiredException类的具体用法?Java PageExpiredException怎么用?Java PageExpiredException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PageExpiredException类属于org.apache.wicket.protocol.http包,在下文中一共展示了PageExpiredException类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: internalMap

import org.apache.wicket.protocol.http.PageExpiredException; //导入依赖的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

示例2: onException

import org.apache.wicket.protocol.http.PageExpiredException; //导入依赖的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));
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:25,代码来源:NextServerApplication.java

示例3: configure

import org.apache.wicket.protocol.http.PageExpiredException; //导入依赖的package包/类
@Override
protected void configure() {
	super.configure();
	
	bind(WicketServlet.class).to(DefaultWicketServlet.class);
	bind(WicketFilter.class).to(DefaultWicketFilter.class);
	bind(WebSocketPolicy.class).toInstance(WebSocketPolicy.newServerPolicy());
	bind(EditSupportRegistry.class).to(DefaultEditSupportRegistry.class);
	bind(WebSocketManager.class).to(DefaultWebSocketManager.class);

	contribute(CommitMessageTransformer.class, PatternCommitMessageTransformer.class);
	
	contributeFromPackage(EditSupport.class, EditSupport.class);
	
	bind(WebApplication.class).to(GitPlexWebApplication.class);
	bind(Application.class).to(GitPlexWebApplication.class);
	bind(AvatarManager.class).to(DefaultAvatarManager.class);
	bind(WebSocketManager.class).to(DefaultWebSocketManager.class);
	
	contributeFromPackage(EditSupport.class, EditSupportLocator.class);
	
	bind(CommitIndexedBroadcaster.class);
	
	contributeFromPackage(DiffRenderer.class, DiffRenderer.class);
	contributeFromPackage(BlobRendererContribution.class, BlobRendererContribution.class);

	contribute(Extension.class, new EmojiExtension());
	contribute(Extension.class, new SourcePositionTrackExtension());
	contribute(HtmlTransformer.class, new MentionTransformer());
	contribute(HtmlTransformer.class, new PullRequestTransformer());

	contribute(ResourcePackScopeContribution.class, new ResourcePackScopeContribution() {
		
		@Override
		public Collection<Class<?>> getResourcePackScopes() {
			return Lists.newArrayList(WebModule.class);
		}
		
	});
	contribute(ExpectedExceptionContribution.class, new ExpectedExceptionContribution() {
		
		@SuppressWarnings("unchecked")
		@Override
		public Collection<Class<? extends Exception>> getExpectedExceptionClasses() {
			return Sets.newHashSet(ConstraintViolationException.class, EntityNotFoundException.class, 
					ObjectNotFoundException.class, StaleStateException.class, UnauthorizedException.class, 
					GitException.class, PageExpiredException.class, StalePageException.class);
		}
		
	});

	bind(UrlManager.class).to(DefaultUrlManager.class);
	bind(CodeCommentChangeBroadcaster.class);
	bind(PullRequestChangeBroadcaster.class);
	bind(TaskChangeBroadcaster.class);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:57,代码来源:WebModule.java

示例4: onException

import org.apache.wicket.protocol.http.PageExpiredException; //导入依赖的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)));
    }
}
 
开发者ID:opensingular,项目名称:singular-server,代码行数:13,代码来源:SingularServerContextListener.java

示例5: onException

import org.apache.wicket.protocol.http.PageExpiredException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public IRequestHandler onException(final RequestCycle cycle,
        final Exception e) {

    LOG.error("Exception found", e);

    final Page errorPage;
    PageParameters errorParameters = new PageParameters();
    errorParameters.add("errorTitle",
            new StringResourceModel("alert", null).getString());

    if (e instanceof UnauthorizedInstantiationException) {
        errorParameters.add("errorMessage", new StringResourceModel(
                "unauthorizedInstantiationException", null).getString());

        errorPage = new ErrorPage(errorParameters);
    } else if (e instanceof HttpClientErrorException) {
        errorParameters.add("errorMessage",
                new StringResourceModel("httpClientException", null).
                getString());

        errorPage = new ErrorPage(errorParameters);
    } else if (e instanceof PageExpiredException
            || !(SyncopeSession.get()).isAuthenticated()) {

        errorParameters.add("errorMessage",
                new StringResourceModel("pageExpiredException", null).
                getString());

        errorPage = new ErrorPage(errorParameters);
    } else if (e.getCause() != null && e.getCause().getCause() != null
            && e.getCause().getCause() instanceof RestClientException) {

        errorParameters.add("errorMessage",
                new StringResourceModel("restClientException", null).
                getString());

        errorPage = new ErrorPage(errorParameters);
    } else {
        // redirect to default Wicket error page
        errorPage = new ExceptionErrorPage(e, null);
    }

    return new ComponentRenderingRequestHandler(errorPage);
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:49,代码来源:SyncopeRequestCycleListener.java

示例6: onRuntimeException

import org.apache.wicket.protocol.http.PageExpiredException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Page onRuntimeException(Page page, RuntimeException e) {
  
  Map<String,TopicMap> tms = topicmaps.get();
  if (tms != null && !tms.isEmpty()) {
    Iterator<TopicMap> iter = tms.values().iterator();
    while (iter.hasNext()) {
      TopicMap topicmap = iter.next();
      TopicMapIF tm = topicmap.getTopicMapIF();
      TopicMapStoreIF store = tm.getStore();
      try {
        store.abort();
      } catch (Exception ex) {
        log.error("Problems occured while aborting transaction", ex);
      } finally {
        store.close();
      }
    }
  }
  if (tms != null) {
    tms.clear();
  }
  
  Throwable cause = e;
  if (cause instanceof WicketRuntimeException) 
  cause = cause.getCause(); 
  if (cause instanceof InvocationTargetException) 
  cause = cause.getCause();
  if (e instanceof PageExpiredException) {

    String referer = ((WebRequest)this.getRequest()).getHttpServletRequest().getHeader("Referer");
    if (referer != null) {
      Pattern pattern = Pattern.compile("ontopoly.pages.\\w*");
      Matcher matcher = pattern.matcher(referer);
      String pageName = "";
      if (matcher.find())
        pageName = matcher.group();
      
      pattern = Pattern.compile("&([^&]*)=([^&]*)");
      matcher = pattern.matcher(referer);
      
      Map<String,String> pageParametersMap = new HashMap<String,String>();
      while (matcher.find())
        pageParametersMap.put(matcher.group(1), matcher.group(2));
      
      Class<? extends Page> classObjectForPage = null;
      try {
        classObjectForPage = (Class<? extends Page>)Class.forName(pageName);
      }
      catch(ClassNotFoundException cnfe) {
        //! System.out.println("Couldn't find a class with the name: "+pageName);
      }        
      return new PageExpiredErrorPage(classObjectForPage, new PageParameters(pageParametersMap));
    }
  }
  if (cause instanceof Exception) {
    return new InternalErrorPageWithException(page, e);
  }
  return super.onRuntimeException(page, e);
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:62,代码来源:OntopolyRequestCycle.java

示例7: onException

import org.apache.wicket.protocol.http.PageExpiredException; //导入依赖的package包/类
@Override
public IRequestHandler onException(final RequestCycle cycle, final Exception e) {
    LOG.error("Exception found", e);

    PageParameters errorParameters = new PageParameters();

    IRequestablePage errorPage = null;
    if (instanceOf(e, UnauthorizedInstantiationException.class) != null) {
        errorParameters.add("errorMessage", MISSING_AUTHORIZATION);
        errorPage = new Login(errorParameters);
    } else if (instanceOf(e, AccessControlException.class) != null) {
        if (instanceOf(e, AccessControlException.class).getMessage().contains("expired")) {
            errorParameters.add("errorMessage", PAGE_EXPIRED);
        } else {
            errorParameters.add("errorMessage", MISSING_AUTHORIZATION_CORE);
        }
        errorPage = new Login(errorParameters);
    } else if (instanceOf(e, PageExpiredException.class) != null || !SyncopeConsoleSession.get().isSignedIn()) {
        errorParameters.add("errorMessage", PAGE_EXPIRED);
        errorPage = new Login(errorParameters);
    } else if (instanceOf(e, BadRequestException.class) != null
            || instanceOf(e, WebServiceException.class) != null
            || instanceOf(e, SyncopeClientException.class) != null) {

        errorParameters.add("errorMessage", REST);
        errorPage = new Login(errorParameters);
    } else {
        Throwable cause = instanceOf(e, ForbiddenException.class);
        if (cause == null) {
            // redirect to default Wicket error page
            errorPage = new ExceptionErrorPage(e, null);
        } else {
            errorParameters.add("errorMessage", cause.getMessage());
            errorPage = new Login(errorParameters);
        }
    }

    if (errorPage instanceof Login) {
        try {
            SyncopeConsoleSession.get().cleanup();
            SyncopeConsoleSession.get().invalidateNow();
        } catch (Throwable t) {
            // ignore
            LOG.debug("Unexpected error while forcing logout after error", t);
        }
    }

    return new RenderPageRequestHandler(new PageProvider(errorPage));
}
 
开发者ID:apache,项目名称:syncope,代码行数:50,代码来源:SyncopeConsoleRequestCycleListener.java

示例8: processHybrid

import org.apache.wicket.protocol.http.PageExpiredException; //导入依赖的package包/类
@Override
protected IRequestHandler processHybrid(PageInfo pageInfo, Class< ? extends IRequestablePage> pageClass, PageParameters pageParameters,
    Integer renderCount)
{
  IRequestHandler handler = null;
  try {
    handler = super.processHybrid(pageInfo, pageClass, pageParameters, renderCount);
  } catch (PageExpiredException e) {
    // in case of pageExpiredException at this point, we just redirect to previous bookmarkable resource
    return processBookmarkable(pageClass, pageParameters);
  }
  if (handler != null && 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()) {
        // get page classes
        Class< ? extends IRequestablePage> oldPageClass = renderPageHandler.getPageClass();
        Class< ? extends IRequestablePage> newPageClass = renderPageHandler.getPageProvider().getPageClass();

        // get page parameters
        PageParameters newPageParameters = renderPageHandler.getPageParameters();
        PageParameters oldPageParameters = renderPageHandler.getPageProvider().getPageInstance().getPageParameters();

        if (oldPageClass != null && oldPageClass.equals(newPageClass) == false) {
          return processBookmarkable(newPageClass, newPageParameters);
        }

        // 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)) {
          return processBookmarkable(newPageClass, newPageParameters);
        }
      }
    }
  }
  return handler;
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:43,代码来源:PageParameterAwareMountedMapper.java

示例9: ErrorPage

import org.apache.wicket.protocol.http.PageExpiredException; //导入依赖的package包/类
public ErrorPage(final Throwable throwable)
{
  super(null);
  errorMessage = getString("errorpage.unknownError");
  messageNumber = null;
  Throwable rootCause = null;
  showFeedback = true;
  if (throwable != null) {
    rootCause = ExceptionHelper.getRootCause(throwable);
    if (rootCause instanceof ProjectForgeException) {
      errorMessage = getExceptionMessage(this, (ProjectForgeException) rootCause, true);
    } else if (throwable instanceof ServletException) {
      messageNumber = String.valueOf(System.currentTimeMillis());
      log.error("Message #" + messageNumber + ": " + throwable.getMessage(), throwable);
      if (rootCause != null) {
        log.error("Message #" + messageNumber + " rootCause: " + rootCause.getMessage(), rootCause);
      }
      errorMessage = getLocalizedMessage(UserException.I18N_KEY_PLEASE_CONTACT_DEVELOPER_TEAM, messageNumber);
    } else if (throwable instanceof PageExpiredException) {
      log.info("Page expired (session time out).");
      showFeedback = false;
      errorMessage = getString("message.wicket.pageExpired");
      title = getString("message.title");
    } else {
      messageNumber = String.valueOf(System.currentTimeMillis());
      log.error("Message #" + messageNumber + ": " + throwable.getMessage(), throwable);
      errorMessage = getLocalizedMessage(UserException.I18N_KEY_PLEASE_CONTACT_DEVELOPER_TEAM, messageNumber);
    }
  }
  form = new ErrorForm(this);
  final String receiver = Configuration.getInstance().getStringValue(ConfigurationParam.FEEDBACK_E_MAIL);
  form.data.setReceiver(receiver);
  form.data.setMessageNumber(messageNumber);
  form.data.setMessage(throwable != null ? throwable.getMessage() : "");
  form.data.setStackTrace(throwable != null ? ExceptionHelper.printStackTrace(throwable) : "");
  form.data.setSender(PFUserContext.getUser().getFullname());
  final String subject = "ProjectForge-Error #" + form.data.getMessageNumber() + " from " + form.data.getSender();
  form.data.setSubject(subject);
  if (rootCause != null) {
    form.data.setRootCause(rootCause.getMessage());
    form.data.setRootCauseStackTrace(ExceptionHelper.printStackTrace(rootCause));
  }
  final boolean visible = showFeedback == true && messageNumber != null && StringUtils.isNotBlank(receiver);
  body.add(form);
  if (visible == true) {
    form.init();
  }
  form.setVisible(visible);
  final Label errorMessageLabel = new Label("errorMessage", errorMessage);
  body.add(errorMessageLabel.setVisible(errorMessage != null));
  final FeedbackPanel feedbackPanel = new FeedbackPanel("feedback");
  feedbackPanel.setOutputMarkupId(true);
  body.add(feedbackPanel);
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:55,代码来源:ErrorPage.java

示例10: isIgnoredException

import org.apache.wicket.protocol.http.PageExpiredException; //导入依赖的package包/类
/**
 * Those Exceptions are ignored in our Errorhandling. Due to the fact that
 * Applications using DMDWeb may invalidate their Session using their
 * ErrorPage.<br>
 * <br>
 * If you want to change the behavior for your Application, you can
 * overwrite this method.
 * 
 * @param ex
 *            The thrown Exception
 * @return true if the Exception is ignored, else false.
 */
protected boolean isIgnoredException(Exception ex) {
    if (ex instanceof PageExpiredException) {
        return true;
    } else if (ex instanceof ResponseIOException) {
        return true;
    } else if (ex instanceof StalePageException) {
        return true;
    }
    return false;
}
 
开发者ID:Nocket,项目名称:nocket,代码行数:23,代码来源:DMDLoggingRequestCycleListener.java


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