org.apache.commons.mail.Email.checkSessionAlreadyInitialized()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中org.apache.commons.mail.Email.checkSessionAlreadyInitialized()方法的一些代码示例,展示了Email.checkSessionAlreadyInitialized()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Email.checkSessionAlreadyInitialized()方法的具体详情如下:
包路径:org.apache.commons.mail.Email
类名称:Email
方法名:checkSessionAlreadyInitialized

Email.checkSessionAlreadyInitialized介绍

[英]When a mail session is already initialized setting the session properties has no effect. In order to flag the problem throw an IllegalStateException.
[中]当邮件会话已初始化时,设置会话属性无效。为了标记问题,抛出一个非法状态异常。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Set the hostname of the outgoing mail server.
 *
 * @param   aHostName aHostName
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.0
 */
public void setHostName(final String aHostName)
{
  checkSessionAlreadyInitialized();
  this.hostName = aHostName;
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Sets the SSL port to use for the SMTP transport. Defaults to the standard
 * port, 465.
 *
 * @param sslSmtpPort the SSL port to use for the SMTP transport
 * @throws IllegalStateException if the mail session is already initialized
 * @see #setSmtpPort(int)
 */
public void setSslSmtpPort(final String sslSmtpPort)
{
  checkSessionAlreadyInitialized();
  this.sslSmtpPort = sslSmtpPort;
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Set the socket I/O timeout value in milliseconds.
 * Default is 60 second timeout.
 *
 * @param socketTimeout the socket I/O timeout
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.2
 */
public void setSocketTimeout(final int socketTimeout)
{
  checkSessionAlreadyInitialized();
  this.socketTimeout = socketTimeout;
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Set the socket connection timeout value in milliseconds.
 * Default is a 60 second timeout.
 *
 * @param socketConnectionTimeout the connection timeout
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.2
 */
public void setSocketConnectionTimeout(final int socketConnectionTimeout)
{
  checkSessionAlreadyInitialized();
  this.socketConnectionTimeout = socketConnectionTimeout;
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Sets whether the server identity is checked as specified by RFC 2595
 *
 * @param sslCheckServerIdentity whether to enable server identity check
 * @return An Email.
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.3
 */
public Email setSSLCheckServerIdentity(final boolean sslCheckServerIdentity)
{
  checkSessionAlreadyInitialized();
  this.sslCheckServerIdentity = sslCheckServerIdentity;
  return this;
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Set or disable the STARTTLS encryption.
 *
 * @param startTlsEnabled true if STARTTLS requested, false otherwise
 * @return An Email.
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.3
 */
public Email setStartTLSEnabled(final boolean startTlsEnabled)
{
  checkSessionAlreadyInitialized();
  this.startTlsEnabled = startTlsEnabled;
  this.tls = startTlsEnabled;
  return this;
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Set or disable the required STARTTLS encryption.
 * <p>
 * Defaults to {@link #smtpPort}; can be overridden by using {@link #setSmtpPort(int)}
 *
 * @param startTlsRequired true if STARTTLS requested, false otherwise
 * @return An Email.
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.3
 */
public Email setStartTLSRequired(final boolean startTlsRequired)
{
  checkSessionAlreadyInitialized();
  this.startTlsRequired = startTlsRequired;
  return this;
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Sets whether SSL/TLS encryption should be enabled for the SMTP transport upon connection (SMTPS/POPS).
 * Takes precedence over {@link #setStartTLSRequired(boolean)}
 * <p>
 * Defaults to {@link #sslSmtpPort}; can be overridden by using {@link #setSslSmtpPort(String)}
 *
 * @param ssl whether to enable the SSL transport
 * @return An Email.
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.3
 */
public Email setSSLOnConnect(final boolean ssl)
{
  checkSessionAlreadyInitialized();
  this.sslOnConnect = ssl;
  this.ssl = ssl;
  return this;
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Sets whether the email is partially send in case of invalid addresses.
 * <p>
 * In case the mail server rejects an address as invalid, the call to {@link #send()}
 * may throw a {@link javax.mail.SendFailedException}, even if partial send mode is enabled (emails
 * to valid addresses will be transmitted). In case the email server does not reject
 * invalid addresses immediately, but return a bounce message, no exception will be thrown
 * by the {@link #send()} method.
 *
 * @param sendPartial whether to enable partial send mode
 * @return An Email.
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.3.2
 */
public Email setSendPartial(final boolean sendPartial)
{
  checkSessionAlreadyInitialized();
  this.sendPartial = sendPartial;
  return this;
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Set the non-SSL port number of the outgoing mail server.
 *
 * @param  aPortNumber aPortNumber
 * @throws IllegalArgumentException if the port number is &lt; 1
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.0
 * @see #setSslSmtpPort(String)
 */
public void setSmtpPort(final int aPortNumber)
{
  checkSessionAlreadyInitialized();
  if (aPortNumber < 1)
  {
    throw new IllegalArgumentException(
      "Cannot connect to a port number that is less than 1 ( "
        + aPortNumber
        + " )");
  }
  this.smtpPort = Integer.toString(aPortNumber);
}

代码示例来源:origin: camunda/camunda-bpm-platform

checkSessionAlreadyInitialized();

代码示例来源:origin: org.apache.commons/commons-email

/**
 * Set the hostname of the outgoing mail server.
 *
 * @param   aHostName aHostName
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.0
 */
public void setHostName(final String aHostName)
{
  checkSessionAlreadyInitialized();
  this.hostName = aHostName;
}

代码示例来源:origin: org.apache.commons/commons-email

/**
 * Set the socket I/O timeout value in milliseconds.
 * Default is 60 second timeout.
 *
 * @param socketTimeout the socket I/O timeout
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.2
 */
public void setSocketTimeout(final int socketTimeout)
{
  checkSessionAlreadyInitialized();
  this.socketTimeout = socketTimeout;
}

代码示例来源:origin: org.apache.commons/commons-email

/**
 * Set or disable the STARTTLS encryption.
 *
 * @param startTlsEnabled true if STARTTLS requested, false otherwise
 * @return An Email.
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.3
 */
public Email setStartTLSEnabled(final boolean startTlsEnabled)
{
  checkSessionAlreadyInitialized();
  this.startTlsEnabled = startTlsEnabled;
  this.tls = startTlsEnabled;
  return this;
}

代码示例来源:origin: org.apache.commons/commons-email

/**
 * Sets the SSL port to use for the SMTP transport. Defaults to the standard
 * port, 465.
 *
 * @param sslSmtpPort the SSL port to use for the SMTP transport
 * @throws IllegalStateException if the mail session is already initialized
 * @see #setSmtpPort(int)
 */
public void setSslSmtpPort(final String sslSmtpPort)
{
  checkSessionAlreadyInitialized();
  this.sslSmtpPort = sslSmtpPort;
}

代码示例来源:origin: org.apache.commons/commons-email

/**
 * Set the socket connection timeout value in milliseconds.
 * Default is a 60 second timeout.
 *
 * @param socketConnectionTimeout the connection timeout
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.2
 */
public void setSocketConnectionTimeout(final int socketConnectionTimeout)
{
  checkSessionAlreadyInitialized();
  this.socketConnectionTimeout = socketConnectionTimeout;
}

代码示例来源:origin: org.apache.commons/commons-email

/**
 * Set or disable the required STARTTLS encryption.
 * <p>
 * Defaults to {@link #smtpPort}; can be overridden by using {@link #setSmtpPort(int)}
 *
 * @param startTlsRequired true if STARTTLS requested, false otherwise
 * @return An Email.
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.3
 */
public Email setStartTLSRequired(final boolean startTlsRequired)
{
  checkSessionAlreadyInitialized();
  this.startTlsRequired = startTlsRequired;
  return this;
}

代码示例来源:origin: org.apache.commons/commons-email

/**
 * Sets whether the server identity is checked as specified by RFC 2595
 *
 * @param sslCheckServerIdentity whether to enable server identity check
 * @return An Email.
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.3
 */
public Email setSSLCheckServerIdentity(final boolean sslCheckServerIdentity)
{
  checkSessionAlreadyInitialized();
  this.sslCheckServerIdentity = sslCheckServerIdentity;
  return this;
}

代码示例来源:origin: org.apache.commons/commons-email

/**
 * Sets whether SSL/TLS encryption should be enabled for the SMTP transport upon connection (SMTPS/POPS).
 * Takes precedence over {@link #setStartTLSRequired(boolean)}
 * <p>
 * Defaults to {@link #sslSmtpPort}; can be overridden by using {@link #setSslSmtpPort(String)}
 *
 * @param ssl whether to enable the SSL transport
 * @return An Email.
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.3
 */
public Email setSSLOnConnect(final boolean ssl)
{
  checkSessionAlreadyInitialized();
  this.sslOnConnect = ssl;
  this.ssl = ssl;
  return this;
}

代码示例来源:origin: org.apache.commons/commons-email

/**
 * Set the non-SSL port number of the outgoing mail server.
 *
 * @param  aPortNumber aPortNumber
 * @throws IllegalArgumentException if the port number is &lt; 1
 * @throws IllegalStateException if the mail session is already initialized
 * @since 1.0
 * @see #setSslSmtpPort(String)
 */
public void setSmtpPort(final int aPortNumber)
{
  checkSessionAlreadyInitialized();
  if (aPortNumber < 1)
  {
    throw new IllegalArgumentException(
      "Cannot connect to a port number that is less than 1 ( "
        + aPortNumber
        + " )");
  }
  this.smtpPort = Integer.toString(aPortNumber);
}

相关文章

微信公众号

最新文章

更多