其他分享
首页 > 其他分享> > restlet 过滤器

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;
    }

 

标签:restlet,request,public,GeneralFilter,context,过滤器,super,response
来源: https://www.cnblogs.com/hi-gdl/p/11451648.html