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


Java Filter.setNext方法代码示例

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


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

示例1: createInboundRoot

import org.restlet.routing.Filter; //导入方法依赖的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.Filter; //导入方法依赖的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: createInterceptors

import org.restlet.routing.Filter; //导入方法依赖的package包/类
private Restlet createInterceptors( Filter guard )
{
    Filter inner = createInnerInterceptor();
    if( inner != null )
    {
        inner.setNext( router );
        guard.setNext( inner );             // guard -> interceptor -> router
    }
    else
    {
        guard.setNext( router );            // guard -> router
    }
    inner = guard;                      // inner = guard

    Filter outer = createOuterInterceptor();
    if( outer != null )
    {
        outer.setNext( inner );             // outer -> inner
        return outer;
    }
    return inner;
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:23,代码来源:PolygeneRestApplication.java

示例4: createInboundRoot

import org.restlet.routing.Filter; //导入方法依赖的package包/类
/**
 * (non-Javadoc)
 * 
 * @see org.restlet.ext.jaxrs.JaxRsApplication#createInboundRoot()
 */
@Override
public Restlet createInboundRoot() {
	Restlet root = super.createInboundRoot();
	if (this.getFilters() != null) {
		Restlet next = root;
		for (int index = this.getFilters().size() - 1; index >= 0; index--) {
			Filter filter = this.getFilters().get(index);
			filter.setNext(next);
			next = filter;
		}
		return next;
	} else {
		return root;
	}
}
 
开发者ID:bradwoo8621,项目名称:nest-old,代码行数:21,代码来源:Application.java

示例5: createInboundRoot

import org.restlet.routing.Filter; //导入方法依赖的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:opennetworkinglab,项目名称:spring-open,代码行数:26,代码来源:RestApiServer.java

示例6: ReportRouter

import org.restlet.routing.Filter; //导入方法依赖的package包/类
public ReportRouter(Context context, Application application) throws ConfigurationException, ValidationException {
	super(context);

	String reportsLocation = Configuration.getInstance().getProperty("slipstream.reports.location");

	Authorizer authorizer = new ReportsAuthorizer();
	Authenticator authenticator = new CookieAuthenticator(getContext());
	authenticator.setOptional(false);
	authenticator.setEnroler(new SuperEnroler(application));
	authenticator.setNext(authorizer);

	ResultsDirectory directory = new ResultsDirectory(getContext(), "file://" + reportsLocation);
	Filter decorator = new ReportDecorator();
	decorator.setNext(directory);
	authorizer.setNext(decorator);
	attach("", authenticator);
}
 
开发者ID:slipstream,项目名称:SlipStreamServer,代码行数:18,代码来源:ReportRouter.java

示例7: createInboundRoot

import org.restlet.routing.Filter; //导入方法依赖的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

示例8: createInboundRoot

import org.restlet.routing.Filter; //导入方法依赖的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

示例9: createInboundRoot

import org.restlet.routing.Filter; //导入方法依赖的package包/类
@Override
public Restlet createInboundRoot() {
    
    Router router = new Router(getContext());

    // GET
    router.attach("/", Tables.class);
    router.attach("/tables", Tables.class);
    router.attach("/tables/{tableNs}", Tables.class);
    router.attach("/table/{tableNs}/{tableName}", Table.class);

    // GET
    router.attach("/info", Info.class);
    
    // GET, DELETE
    router.attach("/blacklist", BlacklistTables.class);
    router.attach("/blacklist/{tableNs}", BlacklistTables.class);
    router.attach("/blacklist/{tableNs}/{tableName}", BlacklistTable.class);
    
    // GET, DELETE
    router.attach("/table/{tableNs}/{tableName}/cache", Cache.class);

    // GET
    router.attach("/queries", Queries.class);

    // POST
    router.attach("/query", Query.class);

    // GET, DELETE
    router.attach("/query/{queryId}", Query.class);

    // GET
    router.attach("/query/{queryId}/count", Count.class);

    // GET
    router.attach("/query/{queryId}/data", Data.class);
    router.attach("/query/{queryId}/page/{perPage}/{page}/data", Data.class);
    router.attach("/query/{queryId}/{row}/{col}/lob", Lob.class);
    router.attach("/query/{queryId}/page/{perPage}/{page}/{row}/{col}/lob", Lob.class);
            
    // GET
    router.attach("/table/{tableNs}/{tableName}/data", TableData.class);
    router.attach("/table/{tableNs}/{tableName}/page/{perPage}/{page}/data", TableData.class);
    
    // GET, DELETE
    router.attach("/query/{queryId}/cache", Cache.class);

    Filter filter = new RequestFilter(getContext());
    filter.setNext(router);

    return filter;

}
 
开发者ID:valdasraps,项目名称:resthub,代码行数:54,代码来源:ServerApp.java


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