@Override public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); if (encoding == null || encoding.length() == 0 || encoding.equalsIgnoreCase("default")) { encoding = DEFAULT_ENCODING; } else if (encoding.equalsIgnoreCase("system")) { encoding = Charset.defaultCharset().name(); } else if (!Charset.isSupported(encoding)) { throw new IllegalArgumentException(sm.getString( "addDefaultCharset.unsupportedCharset", encoding)); } }
@Override public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); if (encoding == null || encoding.length() == 0 || encoding.equalsIgnoreCase("default")) { encoding = DEFAULT_ENCODING; } else if (encoding.equalsIgnoreCase("system")) { encoding = Charset.defaultCharset().name(); } else if (!Charset.isSupported(encoding)) { throw new IllegalArgumentException(sm.getString( "addDefaultCharset.unsupportedCharset", encoding)); } }
@Override public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); if (encoding == null || encoding.length() == 0 || encoding.equalsIgnoreCase("default")) { encoding = DEFAULT_ENCODING; } else if (encoding.equalsIgnoreCase("system")) { encoding = Charset.defaultCharset().name(); } else if (!Charset.isSupported(encoding)) { throw new IllegalArgumentException(sm.getString( "addDefaultCharset.unsupportedCharset", encoding)); } }
@Override public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); if (encoding == null || encoding.length() == 0 || encoding.equalsIgnoreCase("default")) { encoding = DEFAULT_ENCODING; } else if (encoding.equalsIgnoreCase("system")) { encoding = Charset.defaultCharset().name(); } else if (!Charset.isSupported(encoding)) { throw new IllegalArgumentException(sm.getString( "addDefaultCharset.unsupportedCharset", encoding)); } }
@Override public void init(FilterConfig filterConfig) throws ServletException { // Set the parameters super.init(filterConfig); try { Class<?> clazz = Class.forName(randomClass); randomSource = (Random) clazz.getConstructor().newInstance(); } catch (ReflectiveOperationException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } }
@Override public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); if (encoding == null || encoding.length() == 0 || encoding.equalsIgnoreCase("default")) { encoding = DEFAULT_ENCODING; } else if (encoding.equalsIgnoreCase("system")) { encoding = Charset.defaultCharset().name(); } else if (!Charset.isSupported(encoding)) { throw new IllegalArgumentException(sm.getString( "addDefaultCharset.unsupportedCharset", encoding)); } }
@Override public void init(FilterConfig filterConfig) throws ServletException { // Set the parameters super.init(filterConfig); try { Class<?> clazz = Class.forName(randomClass); randomSource = (Random) clazz.getConstructor().newInstance(); } catch (ReflectiveOperationException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } }
@Override public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); if (encoding == null || encoding.length() == 0 || encoding.equalsIgnoreCase("default")) { encoding = DEFAULT_ENCODING; } else if (encoding.equalsIgnoreCase("system")) { encoding = Charset.defaultCharset().name(); } else if (!Charset.isSupported(encoding)) { throw new IllegalArgumentException(sm.getString( "addDefaultCharset.unsupportedCharset", encoding)); } }
@Override public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); if (encoding == null || encoding.length() == 0 || encoding.equalsIgnoreCase("default")) { encoding = DEFAULT_ENCODING; } else if (encoding.equalsIgnoreCase("system")) { encoding = Charset.defaultCharset().name(); } else if (!Charset.isSupported(encoding)) { throw new IllegalArgumentException(sm.getString( "addDefaultCharset.unsupportedCharset", encoding)); } }
@Override public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); if (encoding == null || encoding.length() == 0 || encoding.equalsIgnoreCase("default")) { encoding = DEFAULT_ENCODING; } else if (encoding.equalsIgnoreCase("system")) { encoding = Charset.defaultCharset().name(); } else if (!Charset.isSupported(encoding)) { throw new IllegalArgumentException(sm.getString( "addDefaultCharset.unsupportedCharset", encoding)); } }
@Override public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); // Build HSTS header value StringBuilder hstsValue = new StringBuilder("max-age="); hstsValue.append(hstsMaxAgeSeconds); if (hstsIncludeSubDomains) { hstsValue.append(";includeSubDomains"); } if (hstsPreload) { hstsValue.append(";preload"); } hstsHeaderValue = hstsValue.toString(); // Anti click-jacking StringBuilder cjValue = new StringBuilder(antiClickJackingOption.headerValue); if (antiClickJackingOption == XFrameOption.ALLOW_FROM) { cjValue.append(' '); cjValue.append(antiClickJackingUri); } antiClickJackingHeaderValue = cjValue.toString(); }
@Override public void init(FilterConfig filterConfig) throws ServletException { // Set the parameters super.init(filterConfig); String msg = MessageFormat.format(rb.getString(LogFacade.UNABLE_CREATE_RANDOM_SOURCE_EXCEPTION), randomClass); try { Class<?> clazz = Class.forName(randomClass); randomSource = (Random) clazz.newInstance(); } catch (ClassNotFoundException e) { ServletException se = new ServletException(msg, e); throw se; } catch (InstantiationException e) { ServletException se = new ServletException(msg, e); throw se; } catch (IllegalAccessException e) { ServletException se = new ServletException(msg, e); throw se; } }
@Override public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); // Build HSTS header value StringBuilder hstsValue = new StringBuilder("max-age="); hstsValue.append(hstsMaxAgeSeconds); if (hstsIncludeSubDomains) { hstsValue.append(";includeSubDomains"); } if (hstsPreload) { hstsValue.append(";preload"); } hstsHeaderValue = hstsValue.toString(); // Anti click-jacking StringBuilder cjValue = new StringBuilder(antiClickJackingOption.headerValue); if (antiClickJackingOption == XFrameOption.ALLOW_FROM) { cjValue.append(' '); cjValue.append(antiClickJackingUri); } antiClickJackingHeaderValue = cjValue.toString(); }
@Override public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); String headerItems[] = additionalHeaders.split("\\|"); for (String headerItem : headerItems) { headerItem = headerItem.trim(); int eq = headerItem.indexOf('='); if (eq < 0) { log.warn("skipping headerItem without equals sign: " + headerItem); } else { headers.add(new Header(headerItem.substring(0, eq).trim(), headerItem.substring(eq + 1).trim())); } } }
@Override public void init(FilterConfig filterConfig) throws ServletException { // Set the parameters super.init(filterConfig); try { Class<?> clazz = Class.forName(randomClass); randomSource = (Random) clazz.newInstance(); } catch (ClassNotFoundException e) { ServletException se = new ServletException(MESSAGES.cannotCreateRandom(randomClass), e); throw se; } catch (InstantiationException e) { ServletException se = new ServletException(MESSAGES.cannotCreateRandom(randomClass), e); throw se; } catch (IllegalAccessException e) { ServletException se = new ServletException(MESSAGES.cannotCreateRandom(randomClass), e); throw se; } }
@Override public void init(FilterConfig filterConfig) throws ServletException { // Set the parameters super.init(filterConfig); try { Class<?> clazz = Class.forName(randomClass); randomSource = (Random) clazz.newInstance(); } catch (ClassNotFoundException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } catch (InstantiationException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } catch (IllegalAccessException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } }
@Override public void init(FilterConfig filterConfig) throws ServletException { // Set the parameters super.init(filterConfig); try { Class<?> clazz = Class.forName(randomClass); randomSource = (Random) clazz.newInstance(); } catch (ClassNotFoundException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } catch (InstantiationException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } catch (IllegalAccessException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } }
@Override public void init(FilterConfig filterConfig) throws ServletException { // Set the parameters super.init(filterConfig); try { Class<?> clazz = Class.forName(randomClass); randomSource = (Random) clazz.newInstance(); } catch (ClassNotFoundException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } catch (InstantiationException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } catch (IllegalAccessException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } }
@Override public void init(FilterConfig filterConfig) throws ServletException { // Set the parameters super.init(filterConfig); try { Class<?> clazz = Class.forName(randomClass); randomSource = (Random) clazz.newInstance(); } catch (ClassNotFoundException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } catch (InstantiationException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } catch (IllegalAccessException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } }
@Override public void init(FilterConfig filterConfig) throws ServletException { // Set the parameters super.init(filterConfig); try { Class<?> clazz = Class.forName(randomClass); randomSource = (Random) clazz.newInstance(); } catch (ClassNotFoundException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } catch (InstantiationException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } catch (IllegalAccessException e) { ServletException se = new ServletException(sm.getString( "csrfPrevention.invalidRandomClass", randomClass), e); throw se; } }