Java Code Examples for org.restlet.routing.Router#attachDefault()

The following examples show how to use org.restlet.routing.Router#attachDefault() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApiRestletApplication.java    From geowave with Apache License 2.0 6 votes vote down vote up
@Override
public synchronized Restlet createInboundRoot() {

  // Create a router Restlet and map all the resources
  final Router router = new Router(getContext());

  // set context attributes that resources may need access to here
  getContext().getAttributes().put("availableRoutes", availableRoutes);
  getContext().getAttributes().put("asyncOperationPool", asyncOperationPool);
  getContext().getAttributes().put("asyncOperationStatuses", asyncOperationStatuses);

  // actual mapping here
  router.attachDefault(MainResource.class);
  router.attach("/api", SwaggerResource.class);
  router.attach("/v0/fileupload", FileUploadResource.class);
  router.attach("/v0/operation_status", AsyncOperationStatusResource.class);
  attachApiRoutes(router);
  return router;
}
 
Example 2
Source File: ActRestApplication.java    From Shop-for-JavaWeb with MIT License 5 votes vote down vote up
/**
 * Creates a root Restlet that will receive all incoming calls.
 */
@Override
public synchronized Restlet createInboundRoot() {
	Router router = new Router(getContext());
	router.attachDefault(DefaultResource.class);
	ModelerServicesInit.attachResources(router);
	DiagramServicesInit.attachResources(router);
	JsonpFilter jsonpFilter = new JsonpFilter(getContext());
	jsonpFilter.setNext(router);
	return jsonpFilter;
}
 
Example 3
Source File: VirtualNetworkWebRoutable.java    From floodlight_with_topoguard with Apache License 2.0 5 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/tenants/{tenant}/networks", NetworkResource.class); // GET
    router.attach("/tenants/{tenant}/networks/{network}", NetworkResource.class); // PUT, DELETE
    router.attach("/tenants/{tenant}/networks", NetworkResource.class); // POST
    router.attach("/tenants/{tenant}/networks/{network}/ports/{port}/attachment", HostResource.class);
    router.attachDefault(NoOp.class);
    return router;
}
 
Example 4
Source File: LoadBalancerWebRoutable.java    From floodlight_with_topoguard with Apache License 2.0 5 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/vips/", VipsResource.class); // GET, POST
    router.attach("/vips/{vip}", VipsResource.class); // GET, PUT, DELETE 
    router.attach("/pools/", PoolsResource.class); // GET, POST
    router.attach("/pools/{pool}", PoolsResource.class); // GET, PUT, DELETE
    router.attach("/members/", MembersResource.class); // GET, POST
    router.attach("/members/{member}", MembersResource.class); // GET, PUT, DELETE
    router.attach("/pools/{pool}/members", PoolMemberResource.class); //GET
    router.attach("/health_monitors/", MonitorsResource.class); //GET, POST
    router.attach("/health_monitors/{monitor}", MonitorsResource.class); //GET, PUT, DELETE        
    router.attachDefault(NoOp.class);
    return router;
 }
 
Example 5
Source File: RestletApplication.java    From AGDISTIS with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * 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 GetDisambiguation.
	final Router router = new Router(getContext());

	// Defines only one route
	router.attachDefault(GetDisambiguation.class);
	//System.gc();
	return router;
}
 
Example 6
Source File: RestletApplication.java    From open-rmbt with Apache License 2.0 5 votes vote down vote up
@Override
public Restlet createInboundRoot() {
	
       Router router = new Router(getContext());
       router.attach("/", StatusResource.class);
       router.attach("/info/{type}", InfoResource.class);
       router.attach("/info/", InfoResource.class);
       router.attachDefault(ErrorHandlerResource.class);
       return router;
}