本文整理匯總了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);
}