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


Java RestartResponseAtInterceptPageException类代码示例

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


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

示例1: SummonerQueryForwardPage

import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
public SummonerQueryForwardPage(PageParameters parameters) {
    super(parameters, "Summoner Search", null);
    // get summoner name and region sent by the form
    String summonerName = parameters.get("summonerName").toString("");
    String regionName = parameters.get("region").toString("").toUpperCase();

    // insert data to error page
    add(new Label("summoner_name", summonerName));
    add(new Label("region", regionName));

    // check if summoner name and region are valid, if not return to show error page
    if (summonerName == null || summonerName.length() == 0) return;
    if (!EnumUtils.isValidEnum(RiotEndpoint.class, regionName)) return;

    // convert region name to RiotEndpoint object
    RiotEndpoint region = RiotEndpoint.valueOf(regionName);

    // generate the summoners statistic
    Pair<String, SummonerStatisticItem> summonerStatistic = PageDataProvider.generateSummonerStatistic(summonerName, region);
    // if statistic generation failed, return to show error page
    if (summonerStatistic == null) return;

    // forward to single summoner page with region and summoner key name
    throw new RestartResponseAtInterceptPageException(SingleSummonerPage.class, new PageParameters()
            .set(0, regionName).set(1, summonerStatistic.getKey()));
}
 
开发者ID:LogicalOverflow,项目名称:MasterStats,代码行数:27,代码来源:SummonerQueryForwardPage.java

示例2: handleCallback

import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
protected void handleCallback(PageParameters parameters, SessionClientInfo sessionClientInfo) throws Exception
{
    super.handleCallback(parameters, sessionClientInfo);
    try
    {
        CrestClientInfo clientInfo = (CrestClientInfo) sessionClientInfo.getOauthClientInfo();
        getVerifyData(clientInfo);
        CoreController.getController().fireAuthenticatedEvent(clientInfo, AuthEventListener.Type.Authenticated);
    } catch (Exception e)
    {
        LoggerFactory.getLogger(getClass()).info("OAuth authentication phase 2 failed", e);
        throw new RestartResponseAtInterceptPageException(SignOutPage.class);
    }
    throw new RestartResponseAtInterceptPageException(LoginPage.class);
}
 
开发者ID:timpanogos,项目名称:crestj,代码行数:17,代码来源:CrestAuthCallback.java

示例3: isInstantiationAuthorized

import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(Class<T> componentClass) {
	// if it's not a wicket page --> allow
	if (!Page.class.isAssignableFrom(componentClass)) {
		return true;
	}

	// if it's a page that does not require authentication --> allow
	for (Class<? extends WebPage> clazz : PAGES_WO_AUTH_REQ) {
		if (clazz.isAssignableFrom(componentClass)) {
			return true;
		}
	}

	// if it's any other wicket page and user is not logged in -->
	// redirect to login page
	if (!((UQSession) Session.get()).isAuthenticated()) {
		throw new RestartResponseAtInterceptPageException(LoginPage.class);
	}
	return true;
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:22,代码来源:UQasarRedirectWithoutLoginStrategy.java

示例4: newPage

import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
public <C extends IRequestablePage> C newPage(final Class<C> pageClass) {
    LOG.debug("Creating new {} page without parameters", pageClass.getName());

    if (!Application.get().getSecuritySettings().getAuthorizationStrategy().isInstantiationAuthorized(pageClass)) {
        throw new RestartResponseAtInterceptPageException(wicketSettings.getLoginPageClass());
    }

    try {
        final C pageInstance = injector.createChildInjector(new AbstractModule() {

            @Override
            protected void configure() {
                bind(PageParameters.class).toInstance(new PageParameters());
            }

        }).getInstance(pageClass);

        return pageInstance;
    } catch(final ConfigurationException e) {
        LOG.debug("Could not create page {} through Guice, trying manually: {}", pageClass, e.getMessage());

        return createOrThrow(pageClass, null);
    }
}
 
开发者ID:Metrink,项目名称:croquet,代码行数:26,代码来源:GuicePageFactory.java

示例5: isInstantiationAuthorized

import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(
		Class<T> componentClass) {
	if(!Page.class.isAssignableFrom(componentClass)){
		return true;
	}
	
	if(RegisterPage.class.isAssignableFrom(componentClass)){
		return true;
	}
	
	if(LogoutPage.class.isAssignableFrom(componentClass)){
		return true;
	}
	
	if(LoginPage.class.isAssignableFrom(componentClass)){
		return true;
	}
	
	@SuppressWarnings("rawtypes")
	UserSession session = (UserSession)Session.get();
	if(session.getUser().isAnonymous){
		throw new RestartResponseAtInterceptPageException(LoginPage.class);
	}
	return true;
}
 
开发者ID:atomfrede,项目名称:freezing-octo-bear,代码行数:27,代码来源:SimpleUserAuthorizationStrategy.java

示例6: setAuthorizationStrategy

import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
/**
 * Initializes the authorization strategy for the web application. Pages,
 * which implement the {@link AuthenticatedWebPage} interface, are only
 * accessible for authenticated users.
 */
private void setAuthorizationStrategy() {
	this.getSecuritySettings().setAuthorizationStrategy(new IAuthorizationStrategy() {

		@Override
		public boolean isActionAuthorized(final Component component, final Action action) {
			// authorize everything
			return true;
		}

		@Override
		public <T extends IRequestableComponent> boolean isInstantiationAuthorized(final Class<T> componentClass) {
			// Check if the new Page requires authentication
			// (implements the marker interface)
			if (AuthenticatedWebPage.class.isAssignableFrom(componentClass)) {
				// Is user signed in?
				if (((AuthenticatedSession) Session.get()).isSignedIn()) {
					// okay to proceed
					return true;
				}

				// Intercept the request, but remember the target
				// for later.
				// Invoke Component.continueToOriginalDestination()
				// after successful logon to
				// continue with the target remembered.

				throw new RestartResponseAtInterceptPageException(LoginPage.class);
			}

			// okay to proceed
			return true;
		}
	});
}
 
开发者ID:bptlab,项目名称:Unicorn,代码行数:40,代码来源:UNICORNApplication.java

示例7: newRestartResponseAtInterceptPageException

import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
public RestartResponseAtInterceptPageException newRestartResponseAtInterceptPageException() throws LinkParameterValidationRuntimeException {
	Class<? extends Page> pageClass = getValidPageClass();
	PageParameters parameters = getValidatedParameters();
	
	return new RestartResponseAtInterceptPageException(pageClass, parameters);
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:8,代码来源:CorePageLinkDescriptorImpl.java

示例8: onUnauthorizedInstantiation

import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
public void onUnauthorizedInstantiation(final Component component) {
    SyncopeSession.get().invalidate();

    if (component instanceof Page) {
        throw new UnauthorizedInstantiationException(component.getClass());
    }

    throw new RestartResponseAtInterceptPageException(Login.class);
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:11,代码来源:SyncopeApplication.java

示例9: isInstantiationAuthorized

import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(Class<T> componentClass) {
    if (!hasSpringSecuredAnnotation(componentClass)) {
        return true;
    }
    boolean authorized = isAuthorized(componentClass);
    if (Page.class.isAssignableFrom(componentClass) && !authorized) {
        String missingPermissions = ArrayUtils.toString(componentClass.getAnnotation(Secured.class).value());
        Session.get().error("Zugriff verweigert fehlende Berechtigung(en): " + missingPermissions);
        throw new RestartResponseAtInterceptPageException(LoginPage.class);
    }
    return authorized;
}
 
开发者ID:zutherb,项目名称:AppStash,代码行数:14,代码来源:SpringSecurityAuthorizationStrategy.java

示例10: onUnauthorizedInstantiation

import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
public void onUnauthorizedInstantiation(final Component component)
{
  if (MySession.get().isMobileUserAgent() == true) {
    throw new RestartResponseAtInterceptPageException(LoginMobilePage.class);
  } else {
    throw new RestartResponseAtInterceptPageException(LoginPage.class);
  }
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:10,代码来源:MyAuthorizationStrategy.java

示例11: addSecurityAuthorization

import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
protected void addSecurityAuthorization() {
	Class<? extends Page> signInPageClass = LoginPage.class;
	if (CasUtil.isCasUsed()) {
		signInPageClass = CasLoginPage.class;
	}

	IAuthorizationStrategy authStrategy = new SimplePageAuthorizationStrategy(SecurePage.class, signInPageClass) {

		@Override
		protected boolean isAuthorized() {
			boolean b = NextServerSession.get().isSignedIn();
			if (!b) {
				if (CasUtil.isCasUsed()) {
					LOG.debug("Checking if context contains CAS authentication");
					b = NextServerSession.get().checkForSignIn();
					if (!b) {
						String serviceUrl = CasUtil.getServiceProperties().getService();
						String loginUrl = CasUtil.getLoginUrl();
						LOG.debug("cas authentication: service URL: " + serviceUrl);
						String redirectUrl = loginUrl + "?service=" + serviceUrl;
						LOG.debug("attempting to redirect to: " + redirectUrl);
						throw new RestartResponseAtInterceptPageException(new RedirectPage(redirectUrl));
					}
				}
			}

			return b;
		}

	};
	getSecuritySettings().setAuthorizationStrategy(authStrategy);
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:33,代码来源:NextServerApplication.java

示例12: checkReady

import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
private void checkReady() {
	if (!GitPlex.getInstance().isReady() && getClass() != ServerInitPage.class)
		throw new RestartResponseAtInterceptPageException(ServerInitPage.class);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:5,代码来源:BasePage.java

示例13: unauthorized

import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
public void unauthorized() {
	if (getLoginUser() != null) 
		throw new UnauthorizedException("You are not allowed to perform this operation");
	else 
		throw new RestartResponseAtInterceptPageException(LoginPage.class);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:7,代码来源:BasePage.java

示例14: onInitialize

import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
protected void onInitialize() {
    super.onInitialize();

    this.originalUrl = RestartResponseAtInterceptPageException.getOriginalUrl();

    this.form = new Form<>("form");
    this.add(this.form);
    this.loginField = new TextField<>("loginField", new PropertyModel<>(this, "login"));
    this.loginField.setRequired(true);
    this.form.add(this.loginField);
    this.loginFeedback = new TextFeedbackPanel("loginFeedback", this.loginField);
    this.form.add(this.loginFeedback);

    this.passwordField = new PasswordTextField("passwordField", new PropertyModel<>(this, "password"));
    this.passwordField.setRequired(true);
    this.form.add(this.passwordField);
    this.passwordFeedback = new TextFeedbackPanel("passwordFeedback", this.passwordField);
    this.form.add(this.passwordFeedback);

    this.language = "Khmer";
    this.languageField = new DropDownChoice<String>("languageField", new PropertyModel<>(this, "language"), new PropertyModel<>(this, "languages")) {
        @Override
        protected boolean wantOnSelectionChangedNotifications() {
            return true;
        }

        @Override
        protected void onSelectionChanged(String newSelection) {
            if (StringUtils.equalsIgnoreCase("Khmer", newSelection)) {
                this.getSession().setLocale(new Locale("km"));
            } else {
                this.getSession().setLocale(new Locale("en"));
            }
        }
    };
    this.languageField.setRequired(true);
    this.form.add(this.languageField);
    this.languageFeedback = new TextFeedbackPanel("languageFeedback", this.languageField);
    this.form.add(this.languageFeedback);

    this.loginButton = new Button("loginButton");
    this.loginButton.setOnSubmit(this::loginButtonOnSubmit);
    this.form.add(this.loginButton);

    if (AbstractAuthenticatedWebSession.get().isSignedIn()) {
        setResponsePage(getApplication().getHomePage());
    }
}
 
开发者ID:PkayJava,项目名称:MBaaS,代码行数:50,代码来源:LoginPage.java

示例15: newRestartResponseAtInterceptPageException

import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
public RestartResponseAtInterceptPageException newRestartResponseAtInterceptPageException()
		throws LinkInvalidTargetRuntimeException, LinkParameterValidationRuntimeException,
		LinkParameterInjectionRuntimeException {
	throw invalidException();
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:7,代码来源:InvalidLinkGenerator.java


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