|
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | ||||||||
| 概要: 内部クラス | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | ||||||||
java.lang.Object | +--javax.mail.Session
Session クラスはメールセッションを表し、サブクラス化されません。Session クラスは、メール API により使用されるプロパティとデフォルトを収集します。1 つのデフォルトセッションを、デスクトップ上の複数のアプリケーションにより共有可能です。共有されないセッションを作成することもできます。
| メソッドの概要 | |
boolean |
getDebug()
この Session のデバッグ設定を取得します。 |
static Session |
getDefaultInstance(java.util.Properties props)
デフォルトの Session オブジェクトを取得します。 |
static Session |
getDefaultInstance(java.util.Properties props,
Authenticator authenticator)
デフォルトの Session オブジェクトを取得します。 |
Folder |
getFolder(URLName url)
指定された URLName の閉じた Folder オブジェクトを取得します。 |
static Session |
getInstance(java.util.Properties props)
新しい Session オブジェクトを取得します。 |
static Session |
getInstance(java.util.Properties props,
Authenticator authenticator)
新しい Session オブジェクトを取得します。 |
PasswordAuthentication |
getPasswordAuthentication(URLName url)
この (ストアまたはトランスポート) URLName の任意の保存された PasswordAuthentication を返します。 |
java.util.Properties |
getProperties()
この Session に関連付けられた Properties オブジェクトを返します。 |
java.lang.String |
getProperty(java.lang.String name)
指定されたプロパティの値を返します。 |
Provider |
getProvider(java.lang.String protocol)
指定されたプロトコルのデフォルトの Provider を返します。 |
Provider[] |
getProviders()
このメソッドは、このアプリケーションで使用可能な ClassLoader によりロードできる javamail.[default.]providers ファイル経由でインストールされたすべての実装の配列を返します。 |
Store |
getStore()
このユーザが望む Store プロトコルを実装する Store オブジェクトを取得します。 |
Store |
getStore(Provider provider)
Provider により指定されたストアのインスタンスを取得します。 |
Store |
getStore(java.lang.String protocol)
指定されたプロトコルを実装する Store オブジェクトを取得します。 |
Store |
getStore(URLName url)
指定された URLName の Store オブジェクトを取得します。 |
Transport |
getTransport()
このユーザが望む Transport プロトコルを実装する Transport オブジェクトを取得します。 |
Transport |
getTransport(Address address)
Message を指定されたアドレス型にトランスポート可能な Transport オブジェクトを取得します。 |
Transport |
getTransport(Provider provider)
Provider 中に指定されたトランスポートのインスタンスを取得します。 |
Transport |
getTransport(java.lang.String protocol)
指定されたプロトコルを実装する Transport オブジェクトを取得します。 |
Transport |
getTransport(URLName url)
指定された URLName の Transport オブジェクトを取得します。 |
PasswordAuthentication |
requestPasswordAuthentication(java.net.InetAddress addr,
int port,
java.lang.String protocol,
java.lang.String prompt,
java.lang.String defaultUserName)
必要なユーザ名とパスワードを取得するために、アプリケーションにコールバックします。 |
void |
setDebug(boolean debug)
この Session のデバッグ設定を行います。 |
void |
setPasswordAuthentication(URLName url,
PasswordAuthentication pw)
この (ストアまたはトランスポート) URLName の PasswordAuthentication を保存します。 |
void |
setProvider(Provider provider)
渡された Provider を、以前のすべての値をオーバーライドすることにより、Provider.protocol 中のプロトコルに対するデフォルトの実装として設定します。 |
| クラス java.lang.Object から継承したメソッド |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| メソッドの詳細 |
public static Session getInstance(java.util.Properties props,
Authenticator authenticator)
props - 関連プロパティを保持する Properties オブジェクト
authenticator - ユーザ名とパスワードが必要な場合、アプリケーションにコールバックするために使用される Authenticator オブジェクトAuthenticatorpublic static Session getInstance(java.util.Properties props)
props - 関連プロパティを保持する Properties オブジェクト
public static Session getDefaultInstance(java.util.Properties props,
Authenticator authenticator)
デフォルトのセッションは同じ Java 仮想マシン中で実行するすべてのコードで使用できる可能性があり、セッションはユーザ名やパスワードといったセキュリティ上機密の情報を含むことがあるので、デフォルトのセッションへのアクセスは制限されます。呼び出し側により作成されなければならない Authenticator オブジェクトは、アクセス権限をチェックするために間接的に使用されます。セッションが作成される際に渡される Authenticator オブジェクトは、デフォルトのセッションを取得するための後続要求に渡される Authenticator オブジェクトと比較されます。2 つのオブジェクトが同じ場合、または同じ ClassLoader の場合、要求は許可されます。そうでない場合は拒否されます。
セッションを作成するために使用される Authenticator オブジェクトが null の場合、null を渡すことにより誰でもデフォルトのセッションを取得できます。
JDK 1.2 では、デフォルトのセッションへのアクセスを制御するために、追加のセキュリティ Permission オブジェクトを使用できます。
props - Properties オブジェクト。新しい Session オブジェクトが作成される場合にのみ使用される
authenticator - Authenticator オブジェクト。新しい Session オブジェクトが作成される場合にのみ使用される。そうでない場合、Session を作成するために使用される Authenticator に一致しなければならないpublic static Session getDefaultInstance(java.util.Properties props)
Authenticator なしで作成されたデフォルトのセッションは、同じ Java 仮想マシンで実行中のすべてのコードが使用可能であり、セッションにはユーザ名やパスワードといったセキュリティ上機密の情報が含まれる場合があります。
props - Properties オブジェクト。新しい Session オブジェクトが作成される場合にのみ使用される
public void setDebug(boolean debug)
Session を作成した後にしかデバッグ設定を有効にできないため、Session コンストラクタ中のデバッギングを有効にするには、コンストラクタに渡される Properties オブジェクト中の mail.debug プロパティを true に設定します。mail.debug プロパティの値は、Session 単位のデバッギングフラグを初期化するために使用されます。setDebug メソッドに対する後続の呼び出しは、Session 単位のデバッギングフラグを操作し、mail.debug プロパティに影響を与えません。
debug - デバッグ設定public boolean getDebug()
public Provider[] getProviders()
public Provider getProvider(java.lang.String protocol)
throws NoSuchProviderException
protocol - 設定されたプロトコル (つまり、smtp、imap など)NoSuchProviderException - 指定されたプロトコルのプロバイダが見つからない場合
public void setProvider(Provider provider)
throws NoSuchProviderException
provider - プロトコルのデフォルトとして設定される現在設定されている ProviderNoSuchProviderException - 渡されたプロバイダが無効の場合
public Store getStore()
throws NoSuchProviderException
mail.store.protocol プロパティは希望するプロトコルを指定します。適切な Store オブジェクトが取得されない場合、NoSuchProviderException がスローされます。NoSuchProviderException - 指定されたプロトコルのプロバイダが見つからない場合
public Store getStore(java.lang.String protocol)
throws NoSuchProviderException
protocol - NoSuchProviderException - 指定されたプロトコルのプロバイダが見つからない場合
public Store getStore(URLName url)
throws NoSuchProviderException
url - 希望する Store を表す URLNameNoSuchProviderException - 指定された URLName のプロバイダが見つからない場合getFolder(URLName),
URLName
public Store getStore(Provider provider)
throws NoSuchProviderException
provider - インスタンス化されるストアの ProviderNoSuchProviderException - 指定された Provider のプロバイダが見つからない場合
public Folder getFolder(URLName url)
throws MessagingException
Store プロトコルの特定には、URL 文字列の「scheme」部分 (RFC 1738 を参照) が使用されます。URL 文字列の残り (つまり、RFC 1738 で規定される「schemepart」) は Store により、プロトコルに依存した方法で、適切な Folder オブジェクトの特定とインスタンス化に使用されます。
RFC 1738 は、IP ベースのプロトコル (IMAP4、POP3 など) の「schemepart」に関する構文も指定しています。IP ベースのメール Store のプロバイダは、Folder を参照するための構文を実装しなければなりません。
url - 希望する Folder を表す URLNameNoSuchProviderException - 指定された URLName のプロバイダが見つからない場合MessagingException - Folder を特定または作成できない場合getStore(URLName),
URLName
public Transport getTransport()
throws NoSuchProviderException
mail.transport.protocol プロパティは希望するプロトコルを指定します。適切な Transport オブジェクトが取得できない場合、MessagingException がスローされます。NoSuchProviderException - プロバイダが見つからない場合
public Transport getTransport(java.lang.String protocol)
throws NoSuchProviderException
NoSuchProviderException - 指定されたプロトコルのプロバイダが見つからない場合
public Transport getTransport(URLName url)
throws NoSuchProviderException
url - 希望する Transport を表す URLNameNoSuchProviderException - 指定された URLName のプロバイダが見つからない場合URLName
public Transport getTransport(Provider provider)
throws NoSuchProviderException
provider - インスタンス化されるトランスポートの ProviderNoSuchProviderException - 指定されたプロバイダのプロバイダが見つからない場合
public Transport getTransport(Address address)
throws NoSuchProviderException
address - NoSuchProviderException - Address 型のプロバイダが見つからない場合Address
public void setPasswordAuthentication(URLName url,
PasswordAuthentication pw)
これは通常、ストアまたはトランスポートの実装により、認証情報が 1 つのセッションで複数回使用できるようにするためだけに使用されます。
public PasswordAuthentication getPasswordAuthentication(URLName url)
public PasswordAuthentication requestPasswordAuthentication(java.net.InetAddress addr,
int port,
java.lang.String protocol,
java.lang.String prompt,
java.lang.String defaultUserName)
Connecting to <protocol> mail service on host <addr>, port <port>. <prompt> User Name: <defaultUserName> Password:
addr - ホストの InetAddress。null の場合があるprotocol - プロトコル体系 (imap、pop3 など)prompt - プロンプトの一部として表示するための任意の追加 String。null の場合があるdefaultUserName - デフォルトのユーザ名。null の場合があるpublic java.util.Properties getProperties()
public java.lang.String getProperty(java.lang.String name)
|
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | ||||||||
| 概要: 内部クラス | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | ||||||||