当前位置: 首页>>代码示例>>Java>>正文


Java Router.setDefaultMatchingMode方法代码示例

本文整理汇总了Java中org.restlet.routing.Router.setDefaultMatchingMode方法的典型用法代码示例。如果您正苦于以下问题:Java Router.setDefaultMatchingMode方法的具体用法?Java Router.setDefaultMatchingMode怎么用?Java Router.setDefaultMatchingMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.restlet.routing.Router的用法示例。


在下文中一共展示了Router.setDefaultMatchingMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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:JianqingJiang,项目名称:QoS-floodlight,代码行数:27,代码来源:RestApiServer.java

示例3: createInboundRoot

import org.restlet.routing.Router; //导入方法依赖的package包/类
@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;
}
 
开发者ID:uber,项目名称:uReplicator,代码行数:28,代码来源:ControllerRestApplication.java

示例4: 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:zhenshengcai,项目名称:floodlight-hardware,代码行数:27,代码来源:RestApiServer.java


注:本文中的org.restlet.routing.Router.setDefaultMatchingMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。