• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FbChain类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: make

import org.takes.facets.fallback.FbChain; //导入依赖的package包/类
private static Take make(final Take take) {
    return new TkFallback(
            take,
            new FbChain(
                    new FbStatus(
                            HttpURLConnection.HTTP_NOT_FOUND,
                            new RsWithStatus(
                                    new RsText("endpoint with this path not found"),
                                    HttpURLConnection.HTTP_NOT_FOUND
                            )
                    ),
                    new FbStatus(
                            HttpURLConnection.HTTP_BAD_REQUEST,
                            new RsWithStatus(
                                    new RsText("bad request"),
                                    HttpURLConnection.HTTP_BAD_REQUEST
                            )
                    ),
                    req -> new Opt.Empty<>(),
                    req -> new Opt.Single<>(fatal(req))
            )
    );
}
 
开发者ID:yaroska,项目名称:true_oop,代码行数:24,代码来源:TkAppFallback.java


示例2: TkSafe

import org.takes.facets.fallback.FbChain; //导入依赖的package包/类
/**
 * Ctor.
 * @param take Original take
 */
public TkSafe(final Take take) {
    this.take = new TkFallback(
        take,
        new FbChain(
            new FbStatus(
                HttpURLConnection.HTTP_NOT_FOUND,
                new RsWithStatus(
                    new RsText("Page not found"),
                    HttpURLConnection.HTTP_NOT_FOUND
                )
            ),
            new FbStatus(
                HttpURLConnection.HTTP_BAD_REQUEST,
                new RsWithStatus(
                    new RsText("Bad request"),
                    HttpURLConnection.HTTP_BAD_REQUEST
                )
            ),
            req -> {
                Sentry.capture(req.throwable());
                return new Opt.Empty<>();
            },
            req -> new TkFatal().route(req)
        )
    );
}
 
开发者ID:yegor256,项目名称:rehttp,代码行数:31,代码来源:TkSafe.java


示例3: safe

import org.takes.facets.fallback.FbChain; //导入依赖的package包/类
/**
 * With fallback.
 * @param take Takes
 * @return Safe takes
 */
private static Take safe(final Take take) {
    return new TkFallback(
        take,
        new FbChain(
            new FbStatus(
                HttpURLConnection.HTTP_NOT_FOUND,
                (Fallback) req -> new Opt.Single<>(
                    new RsWithStatus(
                        new RsText(req.throwable().getLocalizedMessage()),
                        HttpURLConnection.HTTP_NOT_FOUND
                    )
                )
            ),
            new FbStatus(
                HttpURLConnection.HTTP_BAD_REQUEST,
                (Fallback) req -> new Opt.Single<>(
                    new RsWithStatus(
                        new RsText(req.throwable().getLocalizedMessage()),
                        HttpURLConnection.HTTP_BAD_REQUEST
                    )
                )
            ),
            req -> {
                Sentry.capture(req.throwable());
                return new Opt.Empty<>();
            },
            req -> new Opt.Single<>(TkApp.fatal(req))
        )
    );
}
 
开发者ID:yegor256,项目名称:threecopies,代码行数:36,代码来源:TkApp.java


示例4: make

import org.takes.facets.fallback.FbChain; //导入依赖的package包/类
/**
 * Authenticated.
 * @param take Takes
 * @return Authenticated takes
 */
private static Take make(final Take take) {
    return new TkFallback(
        take,
        new FbChain(
            new FbStatus(
                HttpURLConnection.HTTP_NOT_FOUND,
                new RsWithStatus(
                    new RsText("Page not found"),
                    HttpURLConnection.HTTP_NOT_FOUND
                )
            ),
            new FbStatus(
                HttpURLConnection.HTTP_BAD_REQUEST,
                new RsWithStatus(
                    new RsText("Bad request"),
                    HttpURLConnection.HTTP_BAD_REQUEST
                )
            ),
            req -> {
                Sentry.capture(req.throwable());
                return new Opt.Empty<>();
            },
            req -> new Opt.Single<>(TkAppFallback.fatal(req))
        )
    );
}
 
开发者ID:yegor256,项目名称:jare,代码行数:32,代码来源:TkAppFallback.java


示例5: make

import org.takes.facets.fallback.FbChain; //导入依赖的package包/类
/**
 * Authenticated.
 * @param take Takes
 * @return Authenticated takes
 */
private static Take make(final Take take) {
    return new TkFallback(
        take,
        new FbChain(
            new FbStatus(
                HttpURLConnection.HTTP_NOT_FOUND,
                new RsWithStatus(
                    new RsText("page not found"),
                    HttpURLConnection.HTTP_NOT_FOUND
                )
            ),
            new FbStatus(
                HttpURLConnection.HTTP_BAD_REQUEST,
                new RsWithStatus(
                    new RsText("bad request"),
                    HttpURLConnection.HTTP_BAD_REQUEST
                )
            ),
            req -> {
                Sentry.capture(req.throwable());
                return new Opt.Empty<>();
            },
            req -> new Opt.Single<>(TkAppFallback.fatal(req))
        )
    );
}
 
开发者ID:yegor256,项目名称:wring,代码行数:32,代码来源:TkAppFallback.java


示例6: fallback

import org.takes.facets.fallback.FbChain; //导入依赖的package包/类
/**
 * Fallback.
 * @param take Original take
 * @return Take with fallback
 */
private static Take fallback(final Take take) {
    return new TkFallback(
        take,
        new FbChain(
            // @checkstyle MagicNumberCheck (1 line)
            new FbStatus(404, new TkFixed(new RsNotFound())),
            new FbError()
        )
    );
}
 
开发者ID:libreio,项目名称:libre,代码行数:16,代码来源:TkApp.java


示例7: make

import org.takes.facets.fallback.FbChain; //导入依赖的package包/类
/**
 * Ctor.
 * @param home Home directory
 * @return The take
 * @throws IOException If fails
 */
private static Take make(final Path home) throws IOException {
    final Futures futures = new Futures(new Reports(home));
    return new TkFallback(
        new TkForward(
            new TkFork(
                new FkRegex("/", new TkIndex()),
                new FkRegex("/robots.txt", new TkText("")),
                new FkRegex("/mistakes", new TkMistakes()),
                new FkRegex(
                    "/flush",
                    (Take) req -> new RsText(
                        String.format("%d flushed", new Results().flush())
                    )
                ),
                new FkRegex("/all", new TkAll()),
                new FkRegex("/queue", new TkQueue(futures)),
                new FkRegex(
                    ".+\\.xsl",
                    new TkWithType(
                        new TkClasspath(),
                        "text/xsl"
                    )
                ),
                new FkRegex(
                    "/jpeek\\.css",
                    new TkWithType(
                        new TkText(
                            new TextOf(
                                new ResourceOf("org/jpeek/jpeek.css")
                            ).asString()
                        ),
                        "text/css"
                    )
                ),
                new FkRegex(
                    "/([^/]+)/([^/]+)(.*)",
                    new TkReport(
                        new AsyncReports(
                            // @checkstyle MagicNumber (1 line)
                            new SolidBiFunc<>(futures, 100)
                        )
                    )
                )
            )
        ),
        new FbChain(
            new FbStatus(
                HttpURLConnection.HTTP_NOT_FOUND,
                (Fallback) req -> new Opt.Single<>(
                    new RsWithStatus(
                        new RsText(req.throwable().getMessage()),
                        req.code()
                    )
                )
            ),
            req -> {
                Sentry.capture(req.throwable());
                return new Opt.Single<>(
                    new RsWithStatus(
                        new RsText(
                            new TextOf(req.throwable()).asString()
                        ),
                        HttpURLConnection.HTTP_INTERNAL_ERROR
                    )
                );
            }
        )
    );
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:76,代码来源:TkApp.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Priv3DES类代码示例发布时间:2022-05-23
下一篇:
Java WrappedRuntimeException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap