本文整理汇总了Java中org.takes.facets.fallback.RqFallback类的典型用法代码示例。如果您正苦于以下问题:Java RqFallback类的具体用法?Java RqFallback怎么用?Java RqFallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RqFallback类属于org.takes.facets.fallback包,在下文中一共展示了RqFallback类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: route
import org.takes.facets.fallback.RqFallback; //导入依赖的package包/类
@Override
public final Opt<Response> route(final RqFallback req) throws IOException {
return new Opt.Single<>(
new RsWithStatus(
new RsHtml(
new RsVelocity(
TkApp.class.getResource("error.html.vm"),
new RsVelocity.Pair(
"err",
new TextOf(req.throwable()).asString()
),
new RsVelocity.Pair(
"rev",
Manifests.read("Rehttp-Revision")
)
)
),
HttpURLConnection.HTTP_INTERNAL_ERROR
)
);
}
开发者ID:yegor256,项目名称:rehttp,代码行数:22,代码来源:TkFatal.java
示例2: fatal
import org.takes.facets.fallback.RqFallback; //导入依赖的package包/类
/**
* Make fatal error page.
* @param req Request
* @return Response
* @throws IOException If fails
*/
private static Response fatal(final RqFallback req) throws IOException {
return new RsWithStatus(
new RsHtml(
new RsVelocity(
TkApp.class.getResource("error.html.vm"),
new RsVelocity.Pair(
"err",
new TextOf(req.throwable()).asString()
),
new RsVelocity.Pair("rev", TkApp.REV)
)
),
HttpURLConnection.HTTP_INTERNAL_ERROR
);
}
开发者ID:yegor256,项目名称:threecopies,代码行数:22,代码来源:TkApp.java
示例3: fatal
import org.takes.facets.fallback.RqFallback; //导入依赖的package包/类
/**
* Make fatal error page.
* @param req Request
* @return Response
* @throws IOException If fails
*/
private static Response fatal(final RqFallback req) throws IOException {
return new RsWithStatus(
new RsWithType(
new RsVelocity(
TkAppFallback.class.getResource("error.html.vm"),
new RsVelocity.Pair(
"err",
ExceptionUtils.getStackTrace(req.throwable())
),
new RsVelocity.Pair("rev", TkAppFallback.REV)
),
"text/html"
),
HttpURLConnection.HTTP_INTERNAL_ERROR
);
}
开发者ID:yegor256,项目名称:jare,代码行数:23,代码来源:TkAppFallback.java
示例4: fatal
import org.takes.facets.fallback.RqFallback; //导入依赖的package包/类
/**
* Make fatal error page.
* @param req Request
* @return Response
* @throws IOException If fails
*/
private static Response fatal(final RqFallback req) throws IOException {
return new RsWithStatus(
new RsWithType(
new RsVelocity(
TkAppFallback.class.getResource("error.html.vm"),
new RsVelocity.Pair(
"err",
ExceptionUtils.getStackTrace(req.throwable())
),
new RsVelocity.Pair("rev", TkAppFallback.REV),
new RsVelocity.Pair("version", TkAppFallback.VERSION)
),
"text/html"
),
HttpURLConnection.HTTP_INTERNAL_ERROR
);
}
开发者ID:yegor256,项目名称:wring,代码行数:24,代码来源:TkAppFallback.java
示例5: FbError
import org.takes.facets.fallback.RqFallback; //导入依赖的package包/类
/**
* Ctor.
*/
public FbError() {
super(
new Fallback() {
@Override
public Opt<Response> route(final RqFallback req) {
final String exc = ExceptionUtils.getStackTrace(
req.throwable()
);
return new Opt.Single<Response>(
new RsWithStatus(
new RsText(
String.format(
"oops, something went wrong!\n%s",
exc
)
),
req.code()
)
);
}
}
);
}
开发者ID:libreio,项目名称:libre,代码行数:27,代码来源:FbError.java
示例6: displaysErrorMsg
import org.takes.facets.fallback.RqFallback; //导入依赖的package包/类
/**
* FbError can display error message.
* @throws IOException If unsuccessful.
*/
@Test
public void displaysErrorMsg() throws IOException {
final String msg = "errormsg";
final Opt<Response> opt = new FbError().route(
new RqFallback.Fake(500, new IOException(msg))
);
MatcherAssert.assertThat(opt.has(), Matchers.equalTo(true));
MatcherAssert.assertThat(
IOUtils.toString(opt.get().body()),
Matchers.allOf(
Matchers.containsString("oops, something "),
Matchers.containsString("IOException"),
Matchers.containsString(msg)
)
);
}
开发者ID:libreio,项目名称:libre,代码行数:21,代码来源:FbErrorTest.java
示例7: fatal
import org.takes.facets.fallback.RqFallback; //导入依赖的package包/类
/**
* Make a fatal response.
* @param req Request
* @return Response
* @throws IOException If fails
*/
private static Response fatal(final RqFallback req) throws IOException {
final String err = ExceptionUtils.getStackTrace(
req.throwable()
);
Logger.error(TkAppFallback.class, "%[exception]s", req.throwable());
return new RsWithStatus(
new RsWithType(
new RsVelocity(
TkAppFallback.class.getResource("error.html.vm"),
new RsVelocity.Pair("error", err),
new RsVelocity.Pair("version", TkAppFallback.VERSION)
),
"text/html"
),
HttpURLConnection.HTTP_INTERNAL_ERROR
);
}
开发者ID:yegor256,项目名称:thindeck,代码行数:24,代码来源:TkAppFallback.java
示例8: fatal
import org.takes.facets.fallback.RqFallback; //导入依赖的package包/类
private static Response fatal(final RqFallback req) {
return new RsWithStatus(
new RsText(ExceptionUtils.getStackTrace(req.throwable())),
HttpURLConnection.HTTP_INTERNAL_ERROR
);
}
开发者ID:yaroska,项目名称:true_oop,代码行数:7,代码来源:TkAppFallback.java
注:本文中的org.takes.facets.fallback.RqFallback类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论