RestyGWT- custom dispatcher doesn't call registered filters

前端 未结 2 1249
日久生厌
日久生厌 2021-01-20 06:13

I am trying to write my custom dispatcher for resty gwt.

My dispatcher RestyDispatcher will contain two filters:

  • BasicAuthHeaderDi
2条回答
  •  Happy的楠姐
    2021-01-20 06:31

    I manually override send method in RestyDispatcher class, So my implementation have to manually execute super.send(method, builder). Or I should not override send method at all.

    So RestyDispatcher it should look like this:

    public class RestyDispatcher extends DefaultFilterawareDispatcher {
    
        public RestyDispatcher() {
            addFilter(new ForbiddenDispatcherFilter());
            addFilter(new BasicAuthHeaderDispatcherFilter());
        }
    
        @Override
        public Request send(Method method, RequestBuilder builder) throws RequestException {
             return super.send(method, builder);
        }
    
    }
    

    or

    public class RestyDispatcher extends DefaultFilterawareDispatcher {
    
        public RestyDispatcher() {
        addFilter(new ForbiddenDispatcherFilter());
        addFilter(new BasicAuthHeaderDispatcherFilter());
        }
    }
    

提交回复
热议问题