filter代碼以下 (具體須要過濾的信息須要更具需求完成):html
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的之類中調用)this
public Restlet createInboundRoot() { Router router = new Router(getContext()); //... ... GeneralFilter filter = new GeneralFilter(this.getContext(), router); return filter; }