本文整理了Java中org.restlet.routing.Router.setDefaultMatchingMode
方法的一些代码示例,展示了Router.setDefaultMatchingMode
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Router.setDefaultMatchingMode
方法的具体详情如下:
包路径:org.restlet.routing.Router
类名称:Router
方法名:setDefaultMatchingMode
[英]Sets the default matching mode to use when selecting routes based on URIs. By default it is set to Template#MODE_EQUALS.
[中]设置基于URI选择路由时使用的默认匹配模式。默认情况下,它设置为模板#模式_EQUALS。
代码示例来源:origin: uber/chaperone
@Override
public Restlet createInboundRoot() {
final Router router = new Router(getContext());
router.setDefaultMatchingMode(Template.MODE_EQUALS);
// Topic Servlet
router.attach("/topics", TopicManagementRestletResource.class);
router.attach("/topics/", TopicManagementRestletResource.class);
router.attach("/topics/{topicName}", TopicManagementRestletResource.class);
router.attach("/topics/{topicName}/", TopicManagementRestletResource.class);
// Health Check Servlet
router.attach("/health", HealthCheckRestletResource.class);
router.attach("/health/", HealthCheckRestletResource.class);
// Validation Servlet
router.attach("/validation", ValidationRestletResource.class);
router.attach("/validation/", ValidationRestletResource.class);
router.attach("/validation/{option}", ValidationRestletResource.class);
router.attach("/validation/{option}/", ValidationRestletResource.class);
// Admin Servlet
router.attach("/admin", AdminRestletResource.class);
router.attach("/admin/{opt}", AdminRestletResource.class);
return router;
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
"defaultMatchingMode");
if (item != null) {
router.setDefaultMatchingMode(getInt(item, getComponent()
.getInternalRouter().getDefaultMatchingMode()));
代码示例来源:origin: uber/uReplicator
@Override
public Restlet createInboundRoot() {
final Router router = new Router(getContext());
router.setDefaultMatchingMode(Template.MODE_EQUALS);
// Topic Servlet
router.attach("/topics", TopicManagementRestletResource.class);
router.attach("/topics/", TopicManagementRestletResource.class);
router.attach("/topics/{topicName}", TopicManagementRestletResource.class);
router.attach("/topics/{topicName}/", TopicManagementRestletResource.class);
// Admin Servlet
router.attach("/admin", AdminRestletResource.class);
router.attach("/admin/{opt}", AdminRestletResource.class);
// Health Check Servlet
router.attach("/health", HealthCheckRestletResource.class);
router.attach("/health/", HealthCheckRestletResource.class);
return router;
}
}
代码示例来源:origin: ontopia/ontopia
@Override
public Restlet createInboundRoot() {
// encoding service that allows disabling
setEncoderService(new OntopiaEncoderService());
Router versions = new Router(getContext());
versions.setDefaultMatchingMode(Template.MODE_STARTS_WITH);
versions.setRoutingMode(Router.MODE_BEST_MATCH);
versions.setName("Ontopia API root router");
versions.attach("/", APIInfoResource.class);
for (APIVersions version : APIVersions.values()) {
if (isEnabled(version)) {
logger.info("Exposing API {}", version.getName());
versions.attach("/" + version.getName(), new OntopiaAPIVersionFilter(getContext(), version.createChain(this), version));
}
}
return versions;
}
代码示例来源:origin: uber/uReplicator
@Override
public Restlet createInboundRoot() {
final Router router = new Router(getContext());
router.setDefaultMatchingMode(Template.MODE_EQUALS);
代码示例来源:origin: apache/helix
@Override
public Restlet createInboundRoot() {
Router router = new Router(getContext());
router.setDefaultMatchingMode(Template.MODE_EQUALS);
router.attach("/clusters", ClustersResource.class);
router.attach("/clusters/{clusterName}", ClusterResource.class);
内容来源于网络,如有侵权,请联系作者删除!