Code example for Set

Methods: addAll

0
        final String allowedMethodsConfig = config.getInitParameter(ALLOWED_METHODS_PARAM);
        if (allowedMethodsConfig == null) {
            allowedMethods.addAll(DEFAULT_ALLOWED_METHODS);
        } 
        else { 
            allowedMethods.addAll(Arrays.asList(allowedMethodsConfig.split(",")));
        } 
    } 
 
    @Override 
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        handle((HttpServletRequest)request, (HttpServletResponse)response, chain);
    } 
 
    private void handle(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
        if (allowedMethods.contains(request.getMethod())) {
            chain.doFilter(request, response);
        } 
        else { 
            LOG.debug("Request with disallowed method {} blocked", request.getMethod());