當前位置: 首頁>>代碼示例>>Java>>正文


Java Router類代碼示例

本文整理匯總了Java中org.restlet.routing.Router的典型用法代碼示例。如果您正苦於以下問題:Java Router類的具體用法?Java Router怎麽用?Java Router使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Router類屬於org.restlet.routing包,在下文中一共展示了Router類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createInboundRoot

import org.restlet.routing.Router; //導入依賴的package包/類
@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;
}
 
開發者ID:xuraylei,項目名稱:fresco_floodlight,代碼行數:27,代碼來源:RestApiServer.java

示例2: getRestlet

import org.restlet.routing.Router; //導入依賴的package包/類
@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;
}
 
開發者ID:JianqingJiang,項目名稱:QoS-floodlight,代碼行數:22,代碼來源:CoreWebRoutable.java

示例3: main

import org.restlet.routing.Router; //導入依賴的package包/類
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();
}
 
開發者ID:ibm-watson-data-lab,項目名稱:sync-android-p2p,代碼行數:26,代碼來源:Application.java

示例4: getRestlet

import org.restlet.routing.Router; //導入依賴的package包/類
@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;
}
 
開發者ID:zhenshengcai,項目名稱:floodlight-hardware,代碼行數:20,代碼來源:CoreWebRoutable.java

示例5: getRestlet

import org.restlet.routing.Router; //導入依賴的package包/類
@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;
}
 
開發者ID:hexec,項目名稱:floodlight-simple-multicast,代碼行數:12,代碼來源:MulticastWebRoutable.java

示例6: getRestlet

import org.restlet.routing.Router; //導入依賴的package包/類
@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;
}
 
開發者ID:telstra,項目名稱:open-kilda,代碼行數:9,代碼來源:SwitchManagerWebRoutable.java

示例7: configurePublicRouter

import org.restlet.routing.Router; //導入依賴的package包/類
@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);
}
 
開發者ID:FightForSub,項目名稱:FFS-Api,代碼行數:12,代碼來源:ApiV1.java

示例8: configureRouter

import org.restlet.routing.Router; //導入依賴的package包/類
@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;
	}
}
 
開發者ID:FightForSub,項目名稱:FFS-Api,代碼行數:24,代碼來源:ApiV1.java

示例9: createInboundRoot

import org.restlet.routing.Router; //導入依賴的package包/類
@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;
}
 
開發者ID:rtr-nettest,項目名稱:open-rmbt,代碼行數:11,代碼來源:RestletApplication.java

示例10: createInboundRoot

import org.restlet.routing.Router; //導入依賴的package包/類
@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;
}
 
開發者ID:rtr-nettest,項目名稱:open-rmbt,代碼行數:27,代碼來源:MapServer.java

示例11: getRestlet

import org.restlet.routing.Router; //導入依賴的package包/類
@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;
}
 
開發者ID:xuraylei,項目名稱:fresco_floodlight,代碼行數:8,代碼來源:PerfWebRoutable.java

示例12: getRestlet

import org.restlet.routing.Router; //導入依賴的package包/類
@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;
}
 
開發者ID:xuraylei,項目名稱:fresco_floodlight,代碼行數:9,代碼來源:DeviceRoutable.java

示例13: getRestlet

import org.restlet.routing.Router; //導入依賴的package包/類
@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;
}
 
開發者ID:xuraylei,項目名稱:fresco_floodlight,代碼行數:11,代碼來源:VirtualNetworkWebRoutable.java

示例14: getRestlet

import org.restlet.routing.Router; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:xuraylei,項目名稱:fresco_floodlight,代碼行數:10,代碼來源:LinkDiscoveryWebRoutable.java

示例15: getRestlet

import org.restlet.routing.Router; //導入依賴的package包/類
@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;
 }
 
開發者ID:xuraylei,項目名稱:fresco_floodlight,代碼行數:16,代碼來源:LoadBalancerWebRoutable.java


注:本文中的org.restlet.routing.Router類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。