Java Code Examples for org.restlet.routing.Router

The following are top voted examples for showing how to use org.restlet.routing.Router. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: QoS-floodlight   File: CoreWebRoutable.java   Source Code and License 8 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/module/all/json", ModuleLoaderResource.class);
    router.attach("/module/loaded/json", LoadedModuleLoaderResource.class);
    router.attach("/switch/{switchId}/role/json", SwitchRoleResource.class);
    router.attach("/switch/all/{statType}/json", AllSwitchStatisticsResource.class);
    router.attach("/switch/{switchId}/{statType}/json", SwitchStatisticsResource.class);
    router.attach("/controller/switches/json", ControllerSwitchesResource.class);
    router.attach("/counter/{counterTitle}/json", CounterResource.class);
    router.attach("/counter/{switchId}/{counterName}/json", SwitchCounterResource.class);
    router.attach("/counter/categories/{switchId}/{counterName}/{layer}/json", SwitchCounterCategoriesResource.class);
    router.attach("/memory/json", ControllerMemoryResource.class);
    router.attach("/packettrace/json", PacketTraceResource.class);
    router.attach("/storage/tables/json", StorageSourceTablesResource.class);
    router.attach("/controller/summary/json", ControllerSummaryResource.class);
    router.attach("/role/json", ControllerRoleResource.class);
    router.attach("/health/json", HealthCheckResource.class);
    router.attach("/system/uptime/json", SystemUptimeResource.class);
    return router;
}
 
Example 2
Project: fresco_floodlight   File: RestApiServer.java   Source Code and License 7 votes vote down vote up
@Override
public Restlet createInboundRoot() {
	Router baseRouter = new Router(context);
	baseRouter.setDefaultMatchingMode(Template.MODE_STARTS_WITH);
	for (RestletRoutable rr : restlets) {
		baseRouter.attach(rr.basePath(), rr.getRestlet(context));
	}

	Filter slashFilter = new Filter() {            
		@Override
		protected int beforeHandle(Request request, Response response) {
			Reference ref = request.getResourceRef();
			String originalPath = ref.getPath();
			if (originalPath.contains("//"))
			{
				String newPath = originalPath.replaceAll("/+", "/");
				ref.setPath(newPath);
			}
			return Filter.CONTINUE;
		}

	};
	slashFilter.setNext(baseRouter);

	return slashFilter;
}
 
Example 3
Project: floodlight-hardware   File: CoreWebRoutable.java   Source Code and License 7 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/module/all/json", ModuleLoaderResource.class);
    router.attach("/module/loaded/json", LoadedModuleLoaderResource.class);
    router.attach("/switch/{" + STR_SWITCH_ID + "}/role/json", SwitchRoleResource.class);
    router.attach("/switch/all/{" + STR_STAT_TYPE + "}/json", AllSwitchStatisticsResource.class);
    router.attach("/switch/{" + STR_SWITCH_ID + "}/{" + STR_STAT_TYPE + "}/json", SwitchStatisticsResource.class);
    router.attach("/controller/switches/json", ControllerSwitchesResource.class);
    router.attach("/counter/{" + STR_CTR_MODULE + "}/{" + STR_CTR_TITLE + "}/json", CounterResource.class);
    router.attach("/memory/json", ControllerMemoryResource.class);
    router.attach("/packettrace/json", PacketTraceResource.class);
    router.attach("/storage/tables/json", StorageSourceTablesResource.class);
    router.attach("/controller/summary/json", ControllerSummaryResource.class);
    router.attach("/role/json", ControllerRoleResource.class);
    router.attach("/health/json", HealthCheckResource.class);
    router.attach("/system/uptime/json", SystemUptimeResource.class);
    return router;
}
 
Example 4
Project: ACAMPController   File: RestApiServer.java   Source Code and License 6 votes vote down vote up
@Override
public Restlet createInboundRoot() {
	Router baseRouter = new Router(context);
	baseRouter.setDefaultMatchingMode(Template.MODE_STARTS_WITH);
	for (RestletRoutable rr : restlets) {
		baseRouter.attach(rr.basePath(), rr.getRestlet(context));
	}

	Filter slashFilter = new Filter() {            
		@Override
		protected int beforeHandle(Request request, Response response) {
			Reference ref = request.getResourceRef();
			String originalPath = ref.getPath();
			if (originalPath.contains("//"))
			{
				String newPath = originalPath.replaceAll("/+", "/");
				ref.setPath(newPath);
			}
			return Filter.CONTINUE;
		}

	};
	slashFilter.setNext(baseRouter);

	return slashFilter;
}
 
Example 5
Project: sync-android-p2p   File: Application.java   Source Code and License 6 votes vote down vote up
public static void main(String[] args) throws Exception {
	
	final int port = 8182;

    createDevelopmentDatabase();

    // Set up a Restlet service
    final Router router = new Router();
    router.attachDefault(HttpListener.class);

    org.restlet.Application myApp = new org.restlet.Application() {
        @Override
        public org.restlet.Restlet createInboundRoot() {
        	Context ctx = getContext();
ctx.getParameters().add("databaseDir", databaseDir);
ctx.getParameters().add("port", Integer.toString(port));
router.setContext(ctx);
            return router;
        };
    };
    Component component = new Component();
    component.getDefaultHost().attach("/", myApp);

    new Server(Protocol.HTTP, port, component).start();
}
 
Example 6
Project: floodlight1.2-delay   File: RestApiServer.java   Source Code and License 6 votes vote down vote up
@Override
public Restlet createInboundRoot() {
	Router baseRouter = new Router(context);
	baseRouter.setDefaultMatchingMode(Template.MODE_STARTS_WITH);
	for (RestletRoutable rr : restlets) {
		baseRouter.attach(rr.basePath(), rr.getRestlet(context));
	}

	Filter slashFilter = new Filter() {            
		@Override
		protected int beforeHandle(Request request, Response response) {
			Reference ref = request.getResourceRef();
			String originalPath = ref.getPath();
			if (originalPath.contains("//"))
			{
				String newPath = originalPath.replaceAll("/+", "/");
				ref.setPath(newPath);
			}
			return Filter.CONTINUE;
		}

	};
	slashFilter.setNext(baseRouter);

	return slashFilter;
}
 
Example 7
Project: floodlight1.2-delay   File: CoreWebRoutable.java   Source Code and License 6 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/module/all/json", ModuleLoaderResource.class);
    router.attach("/module/loaded/json", LoadedModuleLoaderResource.class);
    router.attach("/switch/{" + STR_SWITCH_ID + "}/role/json", SwitchRoleResource.class);
    router.attach("/switch/all/{" + STR_STAT_TYPE + "}/json", AllSwitchStatisticsResource.class);
    router.attach("/switch/{" + STR_SWITCH_ID + "}/{" + STR_STAT_TYPE + "}/json", SwitchStatisticsResource.class);
    router.attach("/controller/switches/json", ControllerSwitchesResource.class);
    router.attach("/counter/{" + STR_CTR_MODULE + "}/{" + STR_CTR_TITLE + "}/json", CounterResource.class);
    router.attach("/memory/json", ControllerMemoryResource.class);
    router.attach("/packettrace/json", PacketTraceResource.class);
    router.attach("/storage/tables/json", StorageSourceTablesResource.class);
    router.attach("/controller/summary/json", ControllerSummaryResource.class);
    router.attach("/role/json", ControllerRoleResource.class);
    router.attach("/health/json", HealthCheckResource.class);
    router.attach("/system/uptime/json", SystemUptimeResource.class);
    return router;
}
 
Example 8
Project: ACAMPController   File: CoreWebRoutable.java   Source Code and License 6 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/module/all/json", ModuleLoaderResource.class);
    router.attach("/module/loaded/json", LoadedModuleLoaderResource.class);
    router.attach("/switch/{" + STR_SWITCH_ID + "}/role/json", SwitchRoleResource.class);
    router.attach("/switch/all/{" + STR_STAT_TYPE + "}/json", AllSwitchStatisticsResource.class);
    router.attach("/switch/{" + STR_SWITCH_ID + "}/{" + STR_STAT_TYPE + "}/json", SwitchStatisticsResource.class);
    router.attach("/controller/switches/json", ControllerSwitchesResource.class);
    router.attach("/counter/{" + STR_CTR_MODULE + "}/{" + STR_CTR_TITLE + "}/json", CounterResource.class);
    router.attach("/memory/json", ControllerMemoryResource.class);
    router.attach("/packettrace/json", PacketTraceResource.class);
    router.attach("/storage/tables/json", StorageSourceTablesResource.class);
    router.attach("/controller/summary/json", ControllerSummaryResource.class);
    router.attach("/role/json", ControllerRoleResource.class);
    router.attach("/health/json", HealthCheckResource.class);
    router.attach("/system/uptime/json", SystemUptimeResource.class);
    return router;
}
 
Example 9
Project: floodlight-simple-multicast   File: MulticastWebRoutable.java   Source Code and License 5 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
	Router router = new Router(context);
	router.attach("/controller/summary/json", ControllerSummaryResource.class);
	router.attach("/module/loaded/json", LoadedModuleLoaderResource.class);
	router.attach("/controller/switches/json", ControllerSwitchesResource.class);
	router.attach("/groups_info/json", GroupsInfoResource.class);
	router.attach("/group_info/json", GroupInfoResource.class);
	router.attach("/group_create/json", GroupCreateResource.class);
	return router;
}
 
Example 10
Project: open-kilda   File: SwitchManagerWebRoutable.java   Source Code and License 5 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/flow", FlowResource.class);
    router.attach("/flows/switch_id/{switch_id}", FlowsResource.class);
    router.attach("/meters/switch_id/{switch_id}", MetersResource.class);
    return router;
}
 
Example 11
Project: FFS-Api   File: ApiV1.java   Source Code and License 5 votes vote down vote up
@Override
protected void configurePublicRouter(Router router) {
	router.attach("/account/login", LoginResource.class);
	router.attach("/events", EventsResource.class);
	router.attach("/event/current", EventCurrentResource.class);
	router.attach("/event/{EVENT_ID}", EventResource.class);
	router.attach("/event/{EVENT_ID}/users", EventUsersResource.class);
	router.attach("/event/{EVENT_ID}/user/{USER_ID}", EventUserResource.class);
	router.attach("/event/{EVENT_ID}/rounds", EventRoundsResource.class);
	router.attach("/event/{EVENT_ID}/round/{ROUND_ID}", EventRoundResource.class);
}
 
Example 12
Project: FFS-Api   File: ApiV1.java   Source Code and License 5 votes vote down vote up
@Override
protected void configureRouter(int group, Router router) {
	switch (group) {
	case AWAITING_FOR_ACTIVATION:
		router.attachDefault(AwaitingForActivationResource.class);
		router.attach("/me", MeResource.class);
		router.attach("/me/events", MeEventsResource.class);
		break;
	case BANNED:
		router.attachDefault(BannedResource.class);
		break;
	case USER:
		router.attach("/event/{EVENT_ID}/register", EventRegisterResource.class);
		break;
	case MODERATOR:
		router.attach("/event/{EVENT_ID}/round/{ROUND_ID}/score/{USER_ID}", EventRoundUserScoreResource.class);
		break;
	case ADMIN:
		break;
	case SUPERADMIN:
		break;
	}
}
 
Example 13
Project: open-rmbt   File: RestletApplication.java   Source Code and License 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;
}
 
Example 14
Project: open-rmbt   File: MapServer.java   Source Code and License 5 votes vote down vote up
@Override
public Restlet createInboundRoot()
{
    final Router router = new Router(getContext());
    
    router.attach("/version", VersionResource.class);
    
    final PointTiles pointTiles = new PointTiles();
    router.attach("/tiles/points/{zoom}/{x}/{y}.png", pointTiles);
    router.attach("/tiles/points", pointTiles);
    
    final HeatmapTiles heatmapTiles = new HeatmapTiles();
    router.attach("/tiles/heatmap/{zoom}/{x}/{y}.png", heatmapTiles);
    router.attach("/tiles/heatmap", heatmapTiles);
    
    final ShapeTiles shapeTiles = new ShapeTiles();
    router.attach("/tiles/shapes/{zoom}/{x}/{y}.png", shapeTiles);
    router.attach("/tiles/shapes", shapeTiles);
    
    router.attach("/tiles/markers", MarkerResource.class);
    
    router.attach("/tiles/info", InfoResource.class);
    router.attach("/v2/tiles/info", at.rtr.rmbt.mapServer.v2.InfoResource.class);
    
    return router;
}
 
Example 15
Project: fresco_floodlight   File: PerfWebRoutable.java   Source Code and License 5 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/data/json", PerfMonDataResource.class);
    router.attach("/{perfmonstate}/json", PerfMonToggleResource.class); // enable, disable, or reset
    return router;
}
 
Example 16
Project: fresco_floodlight   File: DeviceRoutable.java   Source Code and License 5 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/all/json", DeviceResource.class);
    router.attach("/", DeviceResource.class);
    router.attach("/debug", DeviceEntityResource.class);
    return router;
}
 
Example 17
Project: fresco_floodlight   File: VirtualNetworkWebRoutable.java   Source Code and License 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 18
Project: fresco_floodlight   File: LinkDiscoveryWebRoutable.java   Source Code and License 5 votes vote down vote up
/**
 * Create the Restlet router and bind to the proper resources.
 */
@Override
public Router getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/autoportfast/{state}/json", AutoPortFast.class); // enable/true or disable/false
    return router;
}
 
Example 19
Project: fresco_floodlight   File: LoadBalancerWebRoutable.java   Source Code and License 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 20
Project: fresco_floodlight   File: StaticWebRoutable.java   Source Code and License 5 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
       Router router = new Router(context);
       router.attach("", new Directory(context, "clap://classloader/web/"));
       context.setClientDispatcher(new Client(context, Protocol.CLAP));
       return router;
}
 
Example 21
Project: fresco_floodlight   File: ACLWebRoutable.java   Source Code and License 5 votes vote down vote up
/**
    * Create the Restlet router and bind to the proper resources.
    */
@Override
public Restlet getRestlet(Context context) {
       Router router = new Router(context);
       router.attach("/rules/json", ACLRuleResource.class);
       router.attach("/clear/json", ClearACRulesResource.class);
       return router;
}
 
Example 22
Project: fresco_floodlight   File: StaticFlowEntryWebRoutable.java   Source Code and License 5 votes vote down vote up
/**
 * Create the Restlet router and bind to the proper resources.
 */
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/json", StaticFlowEntryPusherResource.class);
    router.attach("/json/store", StaticFlowEntryPusherResource.class);
    router.attach("/json/delete", StaticFlowEntryDeleteResource.class);
    router.attach("/clear/{switch}/json", ClearStaticFlowEntriesResource.class);
    router.attach("/list/{switch}/json", ListStaticFlowEntriesResource.class);
    return router;
}
 
Example 23
Project: fresco_floodlight   File: TopologyWebRoutable.java   Source Code and License 5 votes vote down vote up
/**
 * Create the Restlet router and bind to the proper resources.
 */
@Override
public Router getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/links/json", LinksResource.class);
    router.attach("/directed-links/json", DirectedLinksResource.class);
    router.attach("/external-links/json", ExternalLinksResource.class);
    router.attach("/tunnellinks/json", TunnelLinksResource.class);
    router.attach("/switchclusters/json", SwitchClustersResource.class);
    router.attach("/broadcastdomainports/json", BroadcastDomainPortsResource.class);
    router.attach("/enabledports/json", EnabledPortsResource.class);
    router.attach("/blockedports/json", BlockedPortsResource.class);
    router.attach("/route/{src-dpid}/{src-port}/{dst-dpid}/{dst-port}/json", RouteResource.class);
    return router;
}
 
Example 24
Project: fresco_floodlight   File: SwitchStatisticsWebRoutable.java   Source Code and License 5 votes vote down vote up
@Override
public Router getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/bandwidth/{" + DPID_STR + "}/{" + PORT_STR + "}/json", BandwidthResource.class);
    router.attach("/config/enable/json", ConfigResource.class);
    router.attach("/config/disable/json", ConfigResource.class);
    return router;
}
 
Example 25
Project: fresco_floodlight   File: FirewallWebRoutable.java   Source Code and License 5 votes vote down vote up
/**
 * Create the Restlet router and bind to the proper resources.
 */
@Override
public Router getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/module/status/json",       FirewallStatusResource.class);
    router.attach("/module/enable/json",       FirewallEnableResource.class);
    router.attach("/module/disable/json",      FirewallDisableResource.class);
    router.attach("/module/subnet-mask/json",  FirewallSubnetMaskResource.class);
    router.attach("/module/storageRules/json", FirewallStorageRulesResource.class);

    router.attach("/rules/json",               FirewallRulesResource.class);

    return router;
}
 
Example 26
Project: fresco_floodlight   File: CoreWebRoutable.java   Source Code and License 5 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/module/all/json", ModuleLoaderResource.class);
    router.attach("/module/loaded/json", LoadedModuleLoaderResource.class);
    router.attach("/switch/{" + STR_SWITCH_ID + "}/role/json", SwitchRoleResource.class);
    router.attach("/switch/all/{" + STR_STAT_TYPE + "}/json", AllSwitchStatisticsResource.class);
    router.attach("/switch/{" + STR_SWITCH_ID + "}/{" + STR_STAT_TYPE + "}/json", SwitchStatisticsResource.class);
    router.attach("/controller/switches/json", ControllerSwitchesResource.class);
    router.attach("/counter/{" + STR_CTR_MODULE + "}/{" + STR_CTR_TITLE + "}/json", CounterResource.class);
    router.attach("/memory/json", ControllerMemoryResource.class);
    router.attach("/packettrace/json", PacketTraceResource.class);
    router.attach("/storage/tables/json", StorageSourceTablesResource.class);
    router.attach("/controller/summary/json", ControllerSummaryResource.class);
    router.attach("/role/json", ControllerRoleResource.class);
    router.attach("/health/json", HealthCheckResource.class);
    router.attach("/system/uptime/json", SystemUptimeResource.class);
    return router;
}
 
Example 27
Project: iTAP-controller   File: ObfuscationRestApiWebRoutable.java   Source Code and License 5 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/masks/json", ObfuscationRestApiResourceMasks.class);
    router.attach("/links/json", ObfuscationRestApiResourceLinks.class);
    //router.attach("/tm/json", ObfuscationRestApiResourceTrafficMatrix.class);
    return router;
}
 
Example 28
Project: iTAP-controller   File: PerfWebRoutable.java   Source Code and License 5 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/data/json", PerfMonDataResource.class);
    router.attach("/{perfmonstate}/json", PerfMonToggleResource.class); // enable, disable, or reset
    return router;
}
 
Example 29
Project: iTAP-controller   File: DeviceRoutable.java   Source Code and License 5 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/all/json", DeviceResource.class);
    router.attach("/", DeviceResource.class);
    router.attach("/debug", DeviceEntityResource.class);
    return router;
}
 
Example 30
Project: iTAP-controller   File: VirtualNetworkWebRoutable.java   Source Code and License 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 31
Project: iTAP-controller   File: LinkDiscoveryWebRoutable.java   Source Code and License 5 votes vote down vote up
/**
 * Create the Restlet router and bind to the proper resources.
 */
@Override
public Router getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/autoportfast/{state}/json", AutoPortFast.class); // enable/true or disable/false
    return router;
}
 
Example 32
Project: iTAP-controller   File: LoadBalancerWebRoutable.java   Source Code and License 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 33
Project: iTAP-controller   File: StaticWebRoutable.java   Source Code and License 5 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
       Router router = new Router(context);
       router.attach("", new Directory(context, "clap://classloader/web/"));
       context.setClientDispatcher(new Client(context, Protocol.CLAP));
       return router;
}
 
Example 34
Project: iTAP-controller   File: ACLWebRoutable.java   Source Code and License 5 votes vote down vote up
/**
    * Create the Restlet router and bind to the proper resources.
    */
@Override
public Restlet getRestlet(Context context) {
       Router router = new Router(context);
       router.attach("/rules/json", ACLRuleResource.class);
       router.attach("/clear/json", ClearACRulesResource.class);
       return router;
}
 
Example 35
Project: iTAP-controller   File: StaticFlowEntryWebRoutable.java   Source Code and License 5 votes vote down vote up
/**
 * Create the Restlet router and bind to the proper resources.
 */
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/json", StaticFlowEntryPusherResource.class);
    router.attach("/json/store", StaticFlowEntryPusherResource.class);
    router.attach("/json/delete", StaticFlowEntryDeleteResource.class);
    router.attach("/clear/{switch}/json", ClearStaticFlowEntriesResource.class);
    router.attach("/list/{switch}/json", ListStaticFlowEntriesResource.class);
    return router;
}
 
Example 36
Project: iTAP-controller   File: TopologyWebRoutable.java   Source Code and License 5 votes vote down vote up
/**
 * Create the Restlet router and bind to the proper resources.
 */
@Override
public Router getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/links/json", LinksResource.class);
    router.attach("/directed-links/json", DirectedLinksResource.class);
    router.attach("/external-links/json", ExternalLinksResource.class);
    router.attach("/tunnellinks/json", TunnelLinksResource.class);
    router.attach("/switchclusters/json", SwitchClustersResource.class);
    router.attach("/broadcastdomainports/json", BroadcastDomainPortsResource.class);
    router.attach("/enabledports/json", EnabledPortsResource.class);
    router.attach("/blockedports/json", BlockedPortsResource.class);
    router.attach("/route/{src-dpid}/{src-port}/{dst-dpid}/{dst-port}/json", RouteResource.class);
    return router;
}
 
Example 37
Project: iTAP-controller   File: RestApiServer.java   Source Code and License 5 votes vote down vote up
@Override
public Restlet createInboundRoot() {
	Router baseRouter = new Router(context);
	baseRouter.setDefaultMatchingMode(Template.MODE_STARTS_WITH);
	for (RestletRoutable rr : restlets) {
		baseRouter.attach(rr.basePath(), rr.getRestlet(context));
	}

	Filter slashFilter = new Filter() {            
		@Override
		protected int beforeHandle(Request request, Response response) {
			Reference ref = request.getResourceRef();
			String originalPath = ref.getPath();
			if (originalPath.contains("//"))
			{
				String newPath = originalPath.replaceAll("/+", "/");
				ref.setPath(newPath);
			}
			return Filter.CONTINUE;
		}

	};
	slashFilter.setNext(baseRouter);

	return slashFilter;
}
 
Example 38
Project: iTAP-controller   File: FirewallWebRoutable.java   Source Code and License 5 votes vote down vote up
/**
 * Create the Restlet router and bind to the proper resources.
 */
@Override
public Router getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/module/status/json",       FirewallStatusResource.class);
    router.attach("/module/enable/json",       FirewallEnableResource.class);
    router.attach("/module/disable/json",      FirewallDisableResource.class);
    router.attach("/module/subnet-mask/json",  FirewallSubnetMaskResource.class);
    router.attach("/module/storageRules/json", FirewallStorageRulesResource.class);

    router.attach("/rules/json",               FirewallRulesResource.class);

    return router;
}
 
Example 39
Project: iTAP-controller   File: CoreWebRoutable.java   Source Code and License 5 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/module/all/json", ModuleLoaderResource.class);
    router.attach("/module/loaded/json", LoadedModuleLoaderResource.class);
    router.attach("/switch/{" + STR_SWITCH_ID + "}/role/json", SwitchRoleResource.class);
    router.attach("/switch/all/{" + STR_STAT_TYPE + "}/json", AllSwitchStatisticsResource.class);
    router.attach("/switch/{" + STR_SWITCH_ID + "}/{" + STR_STAT_TYPE + "}/json", SwitchStatisticsResource.class);
    router.attach("/controller/switches/json", ControllerSwitchesResource.class);
    router.attach("/counter/{" + STR_CTR_MODULE + "}/{" + STR_CTR_TITLE + "}/json", CounterResource.class);
    router.attach("/memory/json", ControllerMemoryResource.class);
    router.attach("/packettrace/json", PacketTraceResource.class);
    router.attach("/storage/tables/json", StorageSourceTablesResource.class);
    router.attach("/controller/summary/json", ControllerSummaryResource.class);
    router.attach("/role/json", ControllerRoleResource.class);
    router.attach("/health/json", HealthCheckResource.class);
    router.attach("/system/uptime/json", SystemUptimeResource.class);
    return router;
}
 
Example 40
Project: SDN-Multicast   File: PerfWebRoutable.java   Source Code and License 5 votes vote down vote up
@Override
public Restlet getRestlet(Context context) {
    Router router = new Router(context);
    router.attach("/data/json", PerfMonDataResource.class);
    router.attach("/{perfmonstate}/json", PerfMonToggleResource.class); // enable, disable, or reset
    return router;
}