Ejemplo n.º 1
0
    public void log() {

      if (WebConfiguration.LOGGER.isLoggable(loggingLevel)) {
        DeprecationLoggingStrategy strategy = parameter.getDeprecationLoggingStrategy();
        if (strategy != null && strategy.shouldBeLogged(WebConfiguration.this)) {
          WebConfiguration.LOGGER.log(loggingLevel, logKey, params);
        }
      }
    }
Ejemplo n.º 2
0
  /**
   * Obtain the value of the specified parameter
   *
   * @param param the parameter of interest
   * @return the value of the specified parameter
   */
  public String getOptionValue(WebContextInitParameter param) {
    String result = contextParameters.get(param);

    if (null == result) {
      WebContextInitParameter alternate = param.getAlternate();
      if (null != alternate) {
        result = contextParameters.get(alternate);
      }
    }

    return result;
  }
Ejemplo n.º 3
0
  public void overrideContextInitParameter(WebContextInitParameter param, String value) {

    if (param == null || value == null || value.length() == 0) {
      return;
    }
    value = value.trim();
    String oldVal = contextParameters.put(param, value);
    cachedListParams.remove(param);
    if (oldVal != null) {
      if (LOGGER.isLoggable(Level.FINE) && !(oldVal.equals(value))) {
        LOGGER.log(
            Level.FINE,
            "Overriding init parameter {0}.  Changing from {1} to {2}.",
            new Object[] {param.getQualifiedName(), oldVal, value});
      }
    }
  }
Ejemplo n.º 4
0
  /**
   * Process all non-boolean context initialization parameters.
   *
   * @param servletContext the ServletContext of interest
   * @param contextName the context name
   */
  private void processInitParameters(ServletContext servletContext, String contextName) {

    for (WebContextInitParameter param : WebContextInitParameter.values()) {
      String value = servletContext.getInitParameter(param.getQualifiedName());

      if (value != null && value.length() > 0 && param.isDeprecated()) {
        WebContextInitParameter alternate = param.getAlternate();
        DeprecationLoggingStrategy strategy = param.getDeprecationLoggingStrategy();
        if (strategy == null || strategy.shouldBeLogged(this)) {
          if (LOGGER.isLoggable(Level.WARNING)) {
            if (alternate != null) {
              queueLoggingAction(
                  new DeferredParameterLoggingAction(
                      param,
                      Level.WARNING,
                      "jsf.config.webconfig.param.deprecated",
                      new Object[] {
                        contextName, param.getQualifiedName(), alternate.getQualifiedName()
                      }));

            } else {
              queueLoggingAction(
                  new DeferredParameterLoggingAction(
                      param,
                      Level.WARNING,
                      "jsf.config.webconfig.param.deprecated.no_replacement",
                      new Object[] {contextName, param.getQualifiedName()}));
            }
          }
        }

        if (alternate != null) {
          queueLoggingAction(
              new DeferredParameterLoggingAction(
                  param,
                  Level.INFO,
                  "jsf.config.webconfig.configinfo.reset",
                  new Object[] {contextName, alternate.getQualifiedName(), value}));

          contextParameters.put(alternate, value);
        }
        continue;
      }

      if ((value == null || value.length() == 0) && !param.isDeprecated()) {
        value = param.getDefaultValue();
      }
      if (value == null || value.length() == 0) {
        continue;
      }

      if (value.length() > 0) {
        if (LOGGER.isLoggable(loggingLevel)) {
          LOGGER.log(
              loggingLevel,
              "jsf.config.webconfig.configinfo",
              new Object[] {contextName, param.getQualifiedName(), value});
        }
        contextParameters.put(param, value);
      } else {
        if (LOGGER.isLoggable(loggingLevel)) {
          LOGGER.log(
              loggingLevel,
              "jsf.config.webconfig.option.notconfigured",
              new Object[] {contextName, param.getQualifiedName()});
        }
      }
    }
  }
Ejemplo n.º 5
0
  /**
   * @param param the init parameter of interest
   * @return <code>true</code> if the parameter was explicitly set, otherwise, <code>false</code>
   */
  public boolean isSet(WebContextInitParameter param) {

    return isSet(param.getQualifiedName());
  }