本文整理了Java中org.restlet.routing.Router.attach
方法的一些代码示例,展示了Router.attach
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Router.attach
方法的具体详情如下:
包路径:org.restlet.routing.Router
类名称:Router
方法名:attach
[英]Attaches a target Resource class to this router based on a given URI pattern. A new route using the matching mode returned by #getMatchingMode(Restlet) will be added routing to the target when calls with a URI matching the pattern will be received.
[中]基于给定的URI模式将目标资源类附加到此路由器。当接收到URI与模式匹配的调用时,将向目标添加使用#getMatchingMode(Restlet)返回的匹配模式的新路由。
代码示例来源: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: stackoverflow.com
public class ContactsApplication extends Application {
public Restlet createInboundRoot() {
Router router = new Router(getContext());
router.attach("/contacts/", ContactsServerResource.class);
router.attach("/contacts/{contactId}", ContactServerResource.class);
return router;
}
}
代码示例来源:origin: stackoverflow.com
public class SampleApplication extends Application {
@Override
public Restlet createInboundRoot() {
Router router = new Router(getContext());
router.attach("/download/", DownloadResourceImpl.class);
return router;
}
}
代码示例来源:origin: stackoverflow.com
@Override
public Restlet createInboundRoot() {
Router router = new Router(getContext());
// attaches the resource that represents a video, according to its identifier
router.attach("/videos/{videoid}", VideoServerResource.class);
// ... other instructions
return router;
}
代码示例来源:origin: stackoverflow.com
public Restlet createInboundRoot() {
Router router = new Router(getContext());
router.attach("/test/{id}", MyServerResource.class);
return router;
}
代码示例来源:origin: stackoverflow.com
public synchronized Restlet createInboundRoot()
{
Router router = new Router();
router.attach("/helloworld",HelloWorldResource.class);
router.attach("/hello",HelloWorldResource1.class);
Filter fil1 = filterObj();
fil1.setNext(router);
return fil1;
}
代码示例来源:origin: cdelmas/microservices-comparison
@Override
public Restlet createInboundRoot() {
Router router = newRouter();
router.attach("/cars", CarsResource.class);
router.attach("/cars/{id}", CarResource.class);
return router;
}
}
代码示例来源:origin: com.whizzosoftware.hobson.hub/hobson-hub-auth
@Override
public Restlet createInboundRoot() {
Router router = newRouter();
router.attach("/", new Redirector(getContext(), "/console/index.html", Redirector.MODE_CLIENT_TEMPORARY));
// OIDC related resources
router.attach(AuthorizationResource.PATH, AuthorizationResource.class);
router.attach(JWKSResource.PATH, JWKSResource.class);
router.attach(OIDCConfigurationResource.PATH, OIDCConfigurationResource.class);
router.attach(TokenResource.PATH, TokenResource.class);
return router;
}
}
代码示例来源:origin: org.restlet.jse/org.restlet.example
@Override
public Restlet createInboundRoot() {
// Create a router
Router router = new Router(getContext());
// Attach the resources to the router
router.attach("/users/{user}", UserResource.class);
router.attach("/users/{user}/orders", OrdersResource.class);
router.attach("/users/{user}/orders/{order}", OrderResource.class);
// Return the root router
return router;
}
代码示例来源:origin: stackoverflow.com
public class MyApplication extends Application {
@Override
public Restlet createInboundRoot() {
Router router = new Router();
router.attach("/test", MyServerResource.class);
return router;
}
}
代码示例来源:origin: org.restlet.jse/org.restlet.example
/**
* Creates a root Router to dispatch call to server resources.
*/
@Override
public Restlet createInboundRoot() {
Router router = new Router(getContext());
router.attach("/accounts/{accountId}/mails/{mailId}",
MailServerResource.class);
return router;
}
}
代码示例来源:origin: org.restlet.jse/org.restlet.example
/**
* Creates a root Router to dispatch call to server resources.
*/
@Override
public Restlet createInboundRoot() {
Router router = new Router(getContext());
router.attach("/accounts/{accountId}/mails/{mailId}",
MailServerResource.class);
return router;
}
}
代码示例来源:origin: org.restlet.jse/org.restlet.example
/**
* Creates a root Router to dispatch call to server resources.
*/
@Override
public Restlet createInboundRoot() {
Router router = new Router(getContext());
router.attach("/accounts/{accountId}/mails/{mailId}",
MailServerResource.class);
return router;
}
}
代码示例来源:origin: com.whizzosoftware.hobson.hub/hobson-hub-setup
@Override
public Restlet createInboundRoot() {
Router router = new Router();
router.attach("/", new ClassLoaderOverrideDirectory(getContext(), "clap://class/www/", getClass().getClassLoader()));
return router;
}
代码示例来源:origin: org.restlet.jse/org.restlet.example
/**
* Creates a root Router to dispatch call to server resources.
*/
@Override
public Restlet createInboundRoot() {
Router router = new Router(getContext());
router.attach("/accounts/{accountId}/mails/{mailId}",
MailServerResource.class);
return router;
}
}
代码示例来源:origin: paulnguyen/cmpe202
@Override
public Restlet createInboundRoot() {
Router router = new Router(getContext()) ;
router.attach( "/cart", OrderResource.class ) ;
return router;
}
代码示例来源:origin: org.restlet.jse/org.restlet.example
@Override
public Restlet createInboundRoot() {
Router router = new Router(getContext());
// Serve static files (images, etc.)
String rootUri = "file:///" + System.getProperty("user.home");
Directory directory = new Directory(getContext(), rootUri);
directory.setListingAllowed(true);
router.attach("/home", directory);
// Attach the hello web service
router.attach("/hello", HelloServerResource.class);
return router;
}
}
代码示例来源:origin: stackoverflow.com
Component serverComponent = new Component();
serverComponent.getServers().add(Protocol.HTTP, 8080);
final Router router = new Router(serverComponent.getContext().createChildContext());
router.attach("/myrestendpoint", MyServerResource.class);
serverComponent.getDefaultHost().attach(router);
serverComponent.start();
代码示例来源:origin: org.restlet.osgi/org.restlet
@Override
public TemplateRoute attach(Restlet target) {
if (target.getContext() == null) {
target.setContext(getContext().createChildContext());
}
return super.attach(target);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
@Override
public TemplateRoute attach(String uriPattern, Restlet target) {
if (target.getContext() == null) {
target.setContext(getContext().createChildContext());
}
return super.attach(uriPattern, target);
}
内容来源于网络,如有侵权,请联系作者删除!