restlet 过滤器
filter代码如下 (具体需要过滤的信息需要更具需求完成):
public class GeneralFilter extends org.restlet.routing.Filter { public GeneralFilter(Context context) { super(context); } public GeneralFilter(Context context, Restlet next) { super(context,next); } protected void afterHandle(Request request, Response response) { super.afterHandle(request, response); } protected int beforeHandle(Request request, Response response) { return super.beforeHandle(request, response); } protected int doHandle(Request request, Response response) { return super.doHandle(request, response); } }
调用方式(在Application的之类中调用)
public Restlet createInboundRoot() { Router router = new Router(getContext()); //... ... GeneralFilter filter = new GeneralFilter(this.getContext(), router); return filter; }