org.restlet.routing.Router.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(233)

本文整理了Java中org.restlet.routing.Router.<init>方法的一些代码示例,展示了Router.<init>的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Router.<init>方法的具体详情如下:
包路径:org.restlet.routing.Router
类名称:Router
方法名:<init>

Router.<init>介绍

[英]Constructor. Note that usage of this constructor is not recommended as the Router won't have a proper context set. In general you will prefer to use the other constructor and pass it the parent application's context or eventually the parent component's context if you don't use applications.
[中]建造师。请注意,不建议使用此构造函数,因为路由器没有正确的上下文集。通常,如果不使用应用程序,您更愿意使用另一个构造函数并将其传递给父应用程序的上下文,或者最终传递给父组件的上下文。

代码示例

代码示例来源:origin: stackoverflow.com

require([
  "app",
  "router",
],

function(app, Router) {
  app.router = new Router();
  Backbone.history.start({ pushState: true, root: app.root });
});

代码示例来源:origin: stackoverflow.com

function Router() {
  var _foo = "bar";

  this.foobar = function () {
     return _foo;
  }
}

var r = new Router();
r.foo // Not accessible

代码示例来源:origin: stackoverflow.com

function Router() {
 if (!(this instanceof Router))
  return new Router();

 // ...
}

代码示例来源:origin: org.restlet.osgi/org.restlet.ext.osgi

/**
 * 
 * @param the
 *            restlet application context
 * @return the newly created router instance
 */
protected Router createRouter(Context context) {
  return new Router(context);
}

代码示例来源:origin: stackoverflow.com

define(arrayOfModulePaths, function () { 

  return {
    listen: function(module) {
      var Router = Backbone.Router.Extend(arguments[module]);
      var router = new Router();
      Backbone.history.start();
    }
  }
})

代码示例来源: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.jse/org.restlet.example

/**
 * Creates a root Router to dispatch call to server resources.
 */
@Override
public Restlet createInboundRoot() {
  return new Router(getContext());
}

代码示例来源: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: 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: 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

/**
 * Creates a root Restlet that will receive all incoming calls.
 */
@Override
public Restlet createInboundRoot() {
  // Create a router Restlet that routes each call to a
  // new instance of HelloWorldResource.
  Router router = new Router(getContext());
  // Defines only one route
  router.attachDefault(HelloWorldResource.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: 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}/", AccountServerResource.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

@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: 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("/", RootServerResource.class);
  router.attach("/accounts/", AccountsServerResource.class);
  router.attach("/accounts/{accountId}", AccountServerResource.class);
  return router;
}

相关文章