コード例 #1
0
  public boolean isGzipEnabled() throws PropertyManagerException {
    try {
      Property property = getPropertyObject(GZIP_ENABLED);

      return Boolean.parseBoolean(property.getValue());

    } catch (ObjectNotFoundException e) {
      throw new PropertyManagerException(e.getMessage(), e);
    }
  }
コード例 #2
0
  public boolean isSecureCookie() {
    try {
      Property property = getPropertyObject(SECURE_COOKIE);

      return Boolean.parseBoolean(property.getValue());

    } catch (Exception e) {
      return false;
    }
  }
コード例 #3
0
  public boolean isCacheEnabled() {
    try {
      Property property = getPropertyObject(CACHE_ENABLED);

      return Boolean.parseBoolean(property.getValue());

    } catch (Exception e) {
      return false;
    }
  }
コード例 #4
0
  public boolean isUsingDatabaseTokenStorage() throws PropertyManagerException {
    boolean usingDatabaseStorage;
    try {
      usingDatabaseStorage =
          Boolean.parseBoolean(getPropertyObject(DATABASE_TOKEN_STORAGE_ENABLED).getValue());
    } catch (ObjectNotFoundException e) {
      // By default return true
      usingDatabaseStorage = true;
    }

    return usingDatabaseStorage;
  }
コード例 #5
0
  private SMTPServer buildSMTPServer(InternetAddress fromAddress, String prefix)
      throws PropertyManagerException {
    String host;

    // Required
    try {
      host = getPropertyObject(MAILSERVER_HOST).getValue();
    } catch (ObjectNotFoundException e) {
      throw new PropertyManagerException(e);
    }

    // Optional Attributes
    String password = null;
    try {
      password = getPropertyObject(MAILSERVER_PASSWORD).getValue();
    } catch (ObjectNotFoundException ignored) {
      // Ignore since these are optional
    }

    String username = null;
    try {
      username = getPropertyObject(MAILSERVER_USERNAME).getValue();
    } catch (ObjectNotFoundException ignored) {
      // Ignore since these are optional
    }

    int port = SMTPServer.DEFAULT_MAIL_PORT;
    try {
      String value = getPropertyObject(MAILSERVER_PORT).getValue();
      if (StringUtils.isNotBlank(value)) {
        port = Integer.parseInt(value);
      }
    } catch (NumberFormatException e) {
      throw new IllegalArgumentException("SMTP port number was not a valid number", e);
    } catch (ObjectNotFoundException ignored) {
      // Ignore since these are optional
    }

    boolean useSSL = false;
    try {
      useSSL = Boolean.valueOf(getPropertyObject(MAILSERVER_USE_SSL).getValue());
    } catch (ObjectNotFoundException ignored) {
      // Ignore since these are optional
    }

    return new SMTPServer(port, prefix, fromAddress, password, username, host, useSSL);
  }
コード例 #6
0
 public void setUsingDatabaseTokenStorage(boolean usingMemoryTokenStorage) {
   setProperty(DATABASE_TOKEN_STORAGE_ENABLED, Boolean.toString(usingMemoryTokenStorage));
 }
コード例 #7
0
 public void setGzipEnabled(boolean gzip) {
   setProperty(GZIP_ENABLED, Boolean.toString(gzip));
 }
コード例 #8
0
 public void setCacheEnabled(boolean enabled) {
   setProperty(CACHE_ENABLED, Boolean.toString(enabled));
 }
コード例 #9
0
 public void setSecureCookie(boolean secure) {
   setProperty(SECURE_COOKIE, Boolean.toString(secure));
 }