コード例 #1
0
  /**
   * Gets the instance of the configured {@link LoggingConfigurator}, configured in the Filter
   * Config init params. <br>
   * If no LoggingConfigurator is configured in the Filter Config, then a NoOp LoggingConfigurator
   * will be returned.
   *
   * @param config The Filter Config.
   * @return An instance of the LoggingConfigurator.
   * @throws ServletException If there is an error reading the Filter Config.
   */
  private LoggingConfigurator<MessageInfo> getLoggingConfigurator(final FilterConfig config)
      throws ServletException {
    LoggingConfigurator<MessageInfo> loggingConfigurator =
        filterConfiguration.get(
            config,
            INIT_PARAM_LOGGING_CONFIGURATOR_CLASS,
            INIT_PARAM_LOGGING_CONFIGURATOR_METHOD,
            INIT_PARAM_LOGGING_CONFIGURATOR_METHOD_DEFAULT);

    if (loggingConfigurator == null) {
      LOGGER.debug(
          "Filter init param, "
              + INIT_PARAM_LOGGING_CONFIGURATOR_CLASS
              + ", not set. Falling back "
              + "to the NoOp Logging Configurator.");
      loggingConfigurator =
          new LoggingConfigurator<MessageInfo>() {
            @Override
            public DebugLogger getDebugLogger() {
              return null;
            }

            @Override
            public AuditLogger<MessageInfo> getAuditLogger() {
              return null;
            }
          };
    }

    return loggingConfigurator;
  }
コード例 #2
0
  /**
   * Gets the instance of the configured {@link ServerContextFactory}, configured in the Filter
   * Config init params. <br>
   * If no ServerContextFactory is configured in the Filter Config, then the {@link
   * DefaultServerContextFactory} will be returned.
   *
   * @param config The Filter Config.
   * @return An instance of the ServerContextFactory.
   * @throws ServletException If there is an error reading the Filter Config.
   */
  private ServerContextFactory getServerContextFactory(final FilterConfig config)
      throws ServletException {

    ServerContextFactory serverContextFactory =
        filterConfiguration.get(
            config,
            INIT_PARAM_CONTEXT_CLASS,
            INIT_PARAM_CONTEXT_METHOD,
            INIT_PARAM_CONTEXT_METHOD_DEFAULT);

    if (serverContextFactory == null) {
      LOGGER.debug(
          "Filter init param, "
              + INIT_PARAM_CONTEXT_CLASS
              + ", not set. Falling back to the "
              + DefaultServerContextFactory.class.getSimpleName()
              + ".");
      return DefaultServerContextFactory.getServerContextFactory(config);
    }

    return serverContextFactory;
  }