本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}