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


Java RestletRoutable类代码示例

本文整理汇总了Java中net.floodlightcontroller.restserver.RestletRoutable的典型用法代码示例。如果您正苦于以下问题:Java RestletRoutable类的具体用法?Java RestletRoutable怎么用?Java RestletRoutable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RestletRoutable类属于net.floodlightcontroller.restserver包,在下文中一共展示了RestletRoutable类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createInboundRoot

import net.floodlightcontroller.restserver.RestletRoutable; //导入依赖的package包/类
/**
 * Sets up the Restlet for the APIs under test using a Router.  Also, a
 * filter is installed to deal with double slashes in URLs.
 * This code is adapted from
 * net.floodlightcontroller.restserver.RestApiServer
 *
 * @return Router object for the APIs under test.
 */
@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 out multiple slashes in URLs to make them a single slash.
     */
    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:opennetworkinglab,项目名称:spring-open,代码行数:37,代码来源:TestRestApiServer.java

示例2: startServer

import net.floodlightcontroller.restserver.RestletRoutable; //导入依赖的package包/类
/**
 * Start up the REST server.  A list of the Restlets being tested is
 * passed in.  The usual use of this method is in the @Before (startUp)
 * of a JUnit test.
 *
 * @param restletsUnderTest list of Restlets to run as part of the server.
 */
public void startServer(final List<RestletRoutable> restletsUnderTest) {
    restlets = restletsUnderTest;

    restApplication = new RestApplication();
    restApplication.run();

}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:15,代码来源:TestRestApiServer.java

示例3: addRestlet

import net.floodlightcontroller.restserver.RestletRoutable; //导入依赖的package包/类
/**
 * Add a restlet to the web server.  Tests call this to add the specific
 * REST APIs they are testing.  Call this before starting the server via
 * setUp().
 *
 * @param newRestlet restlet to add to the web server
 */
void addRestlet(final RestletRoutable newRestlet) {
    restlets.add(newRestlet);
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:11,代码来源:TestRest.java


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