MappedFilterFactory.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:bootique-jetty 作者:
public MappedFilter toMappedFilter(Filter filter, int order) {

        WebFilter wfAnnotation = filter.getClass().getAnnotation(WebFilter.class);

        if (wfAnnotation == null) {
            throw new IllegalArgumentException(
                    "Filter contains no @WebFilter annotation and can not be mapped directly. Wrap it in a MappedFilter instead.");
        }

        String name = wfAnnotation.filterName() != null && wfAnnotation.filterName().length() > 0
                ? wfAnnotation.filterName() : null;
        Set<String> urlPatterns = new HashSet<>(asList(wfAnnotation.urlPatterns()));

        Map<String, String> initParams = new HashMap<>();

        WebInitParam[] paramsArray = wfAnnotation.initParams();
        if (paramsArray != null) {
            asList(paramsArray).forEach(p -> initParams.put(p.name(), p.value()));
        }

        return new MappedFilter(filter, urlPatterns, name, initParams, order);
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号