本文整理汇总了Java中spark.route.Routes类的典型用法代码示例。如果您正苦于以下问题:Java Routes类的具体用法?Java Routes怎么用?Java Routes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Routes类属于spark.route包,在下文中一共展示了Routes类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: destroy
import spark.route.Routes; //导入依赖的package包/类
@Override
public void destroy() {
//hacky way to reset the state of the routes between tests
//see Service.stop(), (not invoked directly because it spawns a thread)
try {
Method getInstance = Spark.class.getDeclaredMethod("getInstance");
getInstance.setAccessible(true);
Service service = (Service) getInstance.invoke(null);
//Dependent on current version of Spark
//This is likely to fail in case of upgrades
clear(service, "routes", Routes.class);
clear(service, "exceptionMapper", ExceptionMapper.class);
clear(service, "staticFilesConfiguration", StaticFilesConfiguration.class);
ReflectionTestUtils.setField(service, "initialized", false);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例2: create
import spark.route.Routes; //导入依赖的package包/类
@Override
public EmbeddedServer create(Routes routes, StaticFilesConfiguration staticFilesConfiguration, boolean multipleHandlers) {
if (embeddedServer == null) {
embeddedServer = new LambdaEmbeddedServer(routes, staticFilesConfiguration, multipleHandlers);
}
return embeddedServer;
}
示例3: LambdaEmbeddedServer
import spark.route.Routes; //导入依赖的package包/类
LambdaEmbeddedServer(Routes routes, StaticFilesConfiguration filesConfig, boolean multipleHandlers) {
applicationRoutes = routes;
staticFilesConfiguration = filesConfig;
hasMultipleHandler = multipleHandlers;
// try to initialize the filter here.
sparkFilter = new MatcherFilter(applicationRoutes, staticFilesConfiguration, true, hasMultipleHandler);
}