예제 #1
0
 protected void handleHostIncludeExcludesIfNeeded(@Nonnull FilterConfig filterConfig) {
   final String includeHosts = filterConfig.getInitParameter(INCLUDES_HOSTS);
   final String excludeHosts = filterConfig.getInitParameter(EXCLUDES_HOSTS);
   if (!isEmpty(includeHosts) || !isEmpty(excludeHosts)) {
     final ServletHealthInterceptor originalInterceptor = getInterceptor();
     final AllowedHostsServletHealthInterceptor newInterceptor =
         new AllowedHostsServletHealthInterceptor();
     newInterceptor.setIncludesPattern(includeHosts);
     newInterceptor.setExcludesPattern(excludeHosts);
     setInterceptor(
         originalInterceptor != null
             ? new CombinedServletHealthInterceptor(originalInterceptor, newInterceptor)
             : newInterceptor);
   }
 }
예제 #2
0
 @Override
 public void init(@Nonnull FilterConfig filterConfig) throws ServletException {
   final String mapping = filterConfig.getInitParameter(MAPPING_INIT_ATTRIBUTE);
   if (mapping != null) {
     setMapping(mapping);
   }
   final String registryRef = filterConfig.getInitParameter(REGISTRY_REF_INIT_ATTRIBUTE);
   if (!isEmpty(registryRef)) {
     setRegistry(getBeanFor(filterConfig.getServletContext(), registryRef, JmxRegistry.class));
   }
   final String interceptor = filterConfig.getInitParameter(INTERCEPTOR_INIT_ATTRIBUTE);
   if (!isEmpty(interceptor)) {
     setInterceptor(loadInterceptor(interceptor));
   }
   final String interceptorRef = filterConfig.getInitParameter(INTERCEPTOR_REF_INIT_ATTRIBUTE);
   if (!isEmpty(interceptorRef)) {
     setInterceptor(
         getBeanFor(
             filterConfig.getServletContext(), interceptorRef, ServletHealthInterceptor.class));
   }
   handleHostIncludeExcludesIfNeeded(filterConfig);
   init();
 }