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


Java HttpAction.ok方法代码示例

本文整理汇总了Java中org.pac4j.core.exception.HttpAction.ok方法的典型用法代码示例。如果您正苦于以下问题:Java HttpAction.ok方法的具体用法?Java HttpAction.ok怎么用?Java HttpAction.ok使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pac4j.core.exception.HttpAction的用法示例。


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

示例1: perform

import org.pac4j.core.exception.HttpAction; //导入方法依赖的package包/类
/**
 * Perform a {@link RedirectAction} on the web context.
 *
 * @param context the web context
 * @return the performed {@link HttpAction}
 */
public HttpAction perform(final WebContext context) {
    if (type == RedirectType.REDIRECT) {
        return HttpAction.redirect("redirection via 302", context, location);
    } else {
        return HttpAction.ok("redirection via 200", context, content);
    }
}
 
开发者ID:millross,项目名称:pac4j-async,代码行数:14,代码来源:RedirectAction.java

示例2: testExtractionHttpActionOnSuccess

import org.pac4j.core.exception.HttpAction; //导入方法依赖的package包/类
@Test(timeout = 1000)
public void testExtractionHttpActionOnSuccess(final TestContext testContext) {

    final Async async = testContext.async();
    final AsyncWebContext asyncWebContext = MockAsyncWebContextBuilder.from(rule.vertx(), asynchronousComputationAdapter).build();
    final HttpAction okAction = HttpAction.ok("No op", asyncWebContext);
    final CompletableFuture<HttpAction> okFuture = delayedResult(() -> okAction)
            .handle(softenBiFunction(AsyncExceptionHandler::extractAsyncHttpAction));
    okFuture.thenAccept(a -> {
        assertThat(a.getCode(), is(200));
        async.complete();
    });
}
 
开发者ID:millross,项目名称:pac4j-async,代码行数:14,代码来源:AsyncExceptionHandlerTest.java

示例3: perform

import org.pac4j.core.exception.HttpAction; //导入方法依赖的package包/类
@Override
public R perform(final C context, final Config config, final HttpActionAdapter<R, C> httpActionAdapter,
                   final String defaultUrl, final String inputLogoutUrlPattern) {

    logger.debug("=== APP LOGOUT ===");

    // default value
    final String logoutUrlPattern;
    if (inputLogoutUrlPattern == null) {
        logoutUrlPattern = Pac4jConstants.DEFAULT_LOGOUT_URL_PATTERN_VALUE;
    } else {
        logoutUrlPattern = inputLogoutUrlPattern;
    }

    // checks
    assertNotNull("context", context);
    assertNotNull("config", config);
    assertNotNull("httpActionAdapter", httpActionAdapter);
    assertNotBlank(Pac4jConstants.LOGOUT_URL_PATTERN, logoutUrlPattern);

    // logic
    final ProfileManager manager = getProfileManager(context);
    manager.logout();
    postLogout(context);

    final String url = context.getRequestParameter(Pac4jConstants.URL);
    String redirectUrl = defaultUrl;
    if (url != null && Pattern.matches(logoutUrlPattern, url)) {
        redirectUrl = url;
    }
    logger.debug("redirectUrl: {}", redirectUrl);
    final HttpAction action;
    if (redirectUrl != null) {
        action = HttpAction.redirect("redirect", context, redirectUrl);
    } else {
        action = HttpAction.ok("ok", context);
    }

    return httpActionAdapter.adapt(action.getCode(), context);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:41,代码来源:DefaultApplicationLogoutLogic.java

示例4: redirect

import org.pac4j.core.exception.HttpAction; //导入方法依赖的package包/类
@Override
public final HttpAction redirect(final WebContext context) throws HttpAction {
    final RedirectAction action = getRedirectAction(context);
    if (action.getType() == RedirectType.REDIRECT) {
        return HttpAction.redirect("redirection via 302", context, action.getLocation());
    } else {
        return HttpAction.ok("redirection via 200", context, action.getContent());
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:10,代码来源:IndirectClient.java


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