本文整理汇总了Java中org.takes.tk.TkWithType类的典型用法代码示例。如果您正苦于以下问题:Java TkWithType类的具体用法?Java TkWithType怎么用?Java TkWithType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TkWithType类属于org.takes.tk包,在下文中一共展示了TkWithType类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: app
import org.takes.tk.TkWithType; //导入依赖的package包/类
/**
* Ctor.
* @param base Base
* @return App
* @throws IOException If fails
*/
private static Take app(final Base base) throws IOException {
return new TkWithHeaders(
new TkVersioned(
new TkMeasured(
new TkFlash(
TkApp.auth(
TkApp.safe(
new TkForward(
new TkGzip(
new TkFork(
new FkRegex("/robots.txt", ""),
new FkRegex(
"/org/takes/.+\\.xsl",
new TkClasspath()
),
new FkRegex(
"/xsl/[a-z\\-]+\\.xsl",
new TkWithType(
TkApp.refresh("./src/main/xsl"),
"text/xsl"
)
),
new FkRegex(
"/css/[a-z]+\\.css",
new TkWithType(
TkApp.refresh("./src/main/scss"),
"text/css"
)
),
new FkRegex(
"/images/[a-z]+\\.svg",
new TkWithType(
TkApp.refresh("./src/main/resources"),
"image/svg+xml"
)
),
new FkRegex(
"/images/[a-z]+\\.png",
new TkWithType(
TkApp.refresh("./src/main/resources"),
"image/png"
)
),
new FkRegex("/", new TkIndex()),
new FkRegex("/scripts", new TkScripts(base)),
new FkRegex("/script", new TkScript(base)),
new FkRegex("/save", new TkSave(base)),
new FkRegex("/delete", new TkDelete(base)),
new FkRegex("/flush", new TkFlush(base)),
new FkRegex("/pay", new TkPay(base)),
new FkRegex("/delete-log", new TkDeleteLog(base)),
new FkRegex("/logs", new TkLogs(base)),
new FkRegex("/log", new TkLog()),
new FkRegex("/log-link", new TkLogLink(base))
)
)
)
)
)
)
)
),
new Sprintf("X-ThreeCopies-Revision: %s", TkApp.REV).toString(),
"Vary: Cookie"
);
}
开发者ID:yegor256,项目名称:threecopies,代码行数:73,代码来源:TkApp.java
示例2: make
import org.takes.tk.TkWithType; //导入依赖的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
示例3: regex
import org.takes.tk.TkWithType; //导入依赖的package包/类
/**
* Regex takes.
* @param base Base
* @return Takes
* @throws IOException If fails
*/
private static Take regex(final Base base) throws IOException {
return new TkFork(
new FkRegex("/robots.txt", ""),
new FkRegex(
"/org/takes/.+\\.xsl",
new TkClasspath()
),
new FkRegex(
"/xsl/[a-z\\-]+\\.xsl",
new TkWithType(
TkApp.refresh("./src/main/xsl"),
"text/xsl"
)
),
new FkRegex(
"/css/[a-z]+\\.css",
new TkWithType(
TkApp.refresh("./src/main/scss"),
"text/css"
)
),
new FkRegex(
"/images/[a-z]+\\.svg",
new TkWithType(
TkApp.refresh("./src/main/resources"),
"image/svg+xml"
)
),
new FkRegex(
"/images/[a-z]+\\.png",
new TkWithType(
TkApp.refresh("./src/main/resources"),
"image/png"
)
),
new FkAnonymous(
new TkFork(
new FkRegex("/", new TkIndex(base))
)
),
new FkAuthenticated(
new TkSecure(
new TkFork(
new FkRegex("/", new TkEvents(base)),
new FkRegex("/favicon", new TkFavicon(base)),
new FkRegex("/pipes", new TkPipes(base)),
new FkRegex("/pipe-add", new TkPipeAdd(base)),
new FkRegex("/pipe-delete", new TkPipeDelete(base)),
new FkRegex("/event-delete", new TkEventDelete(base)),
new FkRegex("/event-down", new TkEventDown(base))
)
)
)
);
}
开发者ID:yegor256,项目名称:wring,代码行数:62,代码来源:TkApp.java
示例4: regex
import org.takes.tk.TkWithType; //导入依赖的package包/类
/**
* Regex takes.
* @param base Base
* @return Take
* @throws IOException If fails
*/
private static Take regex(final Base base) throws IOException {
return new TkFork(
new FkParams(
PsByFlag.class.getSimpleName(),
Pattern.compile(".+"),
new TkRedirect()
),
new FkRegex("/robots.txt", ""),
new FkRegex(
"/xsl/[a-z\\-]+\\.xsl",
new TkWithType(
TkApp.refresh("./src/main/xsl"),
"text/xsl"
)
),
new FkRegex(
"/js/[a-z]+\\.js",
new TkWithType(
TkApp.refresh("./src/main/js"),
"text/javascript"
)
),
new FkRegex(
"/css/[a-z]+\\.css",
new TkWithType(
TkApp.refresh("./src/main/scss"),
"text/css"
)
),
new FkAnonymous(
new TkFork(
new FkRegex("/", new TkIndex(base))
)
),
new FkAuthenticated(
new TkFork(
new FkRegex("/", new TkDecks(base)),
new FkRegex("/acc", new TkAccount(base)),
new FkRegex("/add", new TkAddDeck(base)),
new FkRegex("/d/.*", new TkDeck(base))
)
)
);
}
开发者ID:yegor256,项目名称:thindeck,代码行数:51,代码来源:TkApp.java
注:本文中的org.takes.tk.TkWithType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论