session.html

来自「j2ee帮助文档软件设计/软件工程 文件格式」· HTML 代码 · 共 1,167 行 · 第 1/4 页

HTML
1,167
字号
<P><DD><DL><DT><B>Parameters:</B><DD><CODE>props</CODE> - Properties object. Used only if a new Session                        object is created.<br>                  It is expected that the client supplies values                  for the properties listed in Appendix A of the                  JavaMail spec (particularly  mail.store.protocol,                   mail.transport.protocol, mail.host, mail.user,                   and mail.from) as the defaults are unlikely to                   work in all cases.<DD><CODE>authenticator</CODE> - Authenticator object.  Used only if a                        new Session object is created.  Otherwise,                         it must match the Authenticator used to create                        the Session.<DT><B>Returns:</B><DD>the default Session object</DL></DD></DL><HR><A NAME="getDefaultInstance(java.util.Properties)"><!-- --></A><H3>getDefaultInstance</H3><PRE>public static <A HREF="../../javax/mail/Session.html" title="class in javax.mail">Session</A> <B>getDefaultInstance</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/util/Properties.html" title="class or interface in java.util">Properties</A>&nbsp;props)</PRE><DL><DD>Get the default Session object. If a default has not yet been setup, a new Session object is created and installed as the  default. <p> Note that a default session created with no Authenticator is available to all code executing in the same Java virtual machine, and the session can contain security sensitive information such as user names and passwords.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>props</CODE> - Properties object. Used only if a new Session                        object is created.<br>                  It is expected that the client supplies values                  for the properties listed in Appendix A of the                  JavaMail spec (particularly  mail.store.protocol,                   mail.transport.protocol, mail.host, mail.user,                   and mail.from) as the defaults are unlikely to                   work in all cases.<DT><B>Returns:</B><DD>the default Session object<DT><B>Since:</B></DT>  <DD>JavaMail 1.2</DD></DL></DD></DL><HR><A NAME="setDebug(boolean)"><!-- --></A><H3>setDebug</H3><PRE>public void <B>setDebug</B>(boolean&nbsp;debug)</PRE><DL><DD>Set the debug setting for this Session. <p> Since the debug setting can be turned on only after the Session has been created, to turn on debugging in the Session constructor, set the property <code>mail.debug</code> in the Properties object passed in to the constructor to true.  The value of the <code>mail.debug</code> property is used to initialize the per-Session debugging flag.  Subsequent calls to the <code>setDebug</code> method manipulate the per-Session debugging flag and have no affect on the <code>mail.debug</code> property.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>debug</CODE> - Debug setting</DL></DD></DL><HR><A NAME="getDebug()"><!-- --></A><H3>getDebug</H3><PRE>public boolean <B>getDebug</B>()</PRE><DL><DD>Get the debug setting for this Session.<P><DD><DL><DT><B>Returns:</B><DD>current debug setting</DL></DD></DL><HR><A NAME="setDebugOut(java.io.PrintStream)"><!-- --></A><H3>setDebugOut</H3><PRE>public void <B>setDebugOut</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/io/PrintStream.html" title="class or interface in java.io">PrintStream</A>&nbsp;out)</PRE><DL><DD>Set the stream to be used for debugging output for this session. If <code>out</code> is null, <code>System.out</code> will be used. Note that debugging output that occurs before any session is created, as a result of setting the <code>mail.debug</code> system property, will always be sent to <code>System.out</code>.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>out</CODE> - the PrintStream to use for debugging output<DT><B>Since:</B></DT>  <DD>JavaMail 1.3</DD></DL></DD></DL><HR><A NAME="getDebugOut()"><!-- --></A><H3>getDebugOut</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/io/PrintStream.html" title="class or interface in java.io">PrintStream</A> <B>getDebugOut</B>()</PRE><DL><DD>Returns the stream to be used for debugging output.  If no stream has been set, <code>System.out</code> is returned.<P><DD><DL><DT><B>Returns:</B><DD>the PrintStream to use for debugging output<DT><B>Since:</B></DT>  <DD>JavaMail 1.3</DD></DL></DD></DL><HR><A NAME="getProviders()"><!-- --></A><H3>getProviders</H3><PRE>public <A HREF="../../javax/mail/Provider.html" title="class in javax.mail">Provider</A>[] <B>getProviders</B>()</PRE><DL><DD>This method returns an array of all the implementations installed  via the javamail.[default.]providers files that can be loaded using the ClassLoader available to this application.<P><DD><DL><DT><B>Returns:</B><DD>Array of configured providers</DL></DD></DL><HR><A NAME="getProvider(java.lang.String)"><!-- --></A><H3>getProvider</H3><PRE>public <A HREF="../../javax/mail/Provider.html" title="class in javax.mail">Provider</A> <B>getProvider</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;protocol)                     throws <A HREF="../../javax/mail/NoSuchProviderException.html" title="class in javax.mail">NoSuchProviderException</A></PRE><DL><DD>Returns the default Provider for the protocol specified. Checks mail.&lt;protocol&gt;.class property first and if it exists, returns the Provider associated with this implementation. If it doesn't exist,  returns the Provider that appeared first in the  configuration files. If an implementation for the protocol  isn't found, throws NoSuchProviderException<P><DD><DL><DT><B>Parameters:</B><DD><CODE>protocol</CODE> - Configured protocol (i.e. smtp, imap, etc)<DT><B>Returns:</B><DD>Currently configured Provider for the specified protocol<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/NoSuchProviderException.html" title="class in javax.mail">NoSuchProviderException</A></CODE> - If a provider for the given                        protocol is not found.</DL></DD></DL><HR><A NAME="setProvider(javax.mail.Provider)"><!-- --></A><H3>setProvider</H3><PRE>public void <B>setProvider</B>(<A HREF="../../javax/mail/Provider.html" title="class in javax.mail">Provider</A>&nbsp;provider)                 throws <A HREF="../../javax/mail/NoSuchProviderException.html" title="class in javax.mail">NoSuchProviderException</A></PRE><DL><DD>Set the passed Provider to be the default implementation for the protocol in Provider.protocol overriding any previous values.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>provider</CODE> - Currently configured Provider which will be  set as the default for the protocol<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/NoSuchProviderException.html" title="class in javax.mail">NoSuchProviderException</A></CODE> - If the provider passed in                        is invalid.</DL></DD></DL><HR><A NAME="getStore()"><!-- --></A><H3>getStore</H3><PRE>public <A HREF="../../javax/mail/Store.html" title="class in javax.mail">Store</A> <B>getStore</B>()               throws <A HREF="../../javax/mail/NoSuchProviderException.html" title="class in javax.mail">NoSuchProviderException</A></PRE><DL><DD>Get a Store object that implements this user's desired Store protocol. The <code>mail.store.protocol</code> property specifies the desired protocol. If an appropriate Store object is not obtained,  NoSuchProviderException is thrown<P><DD><DL><DT><B>Returns:</B><DD>a Store object<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/NoSuchProviderException.html" title="class in javax.mail">NoSuchProviderException</A></CODE> - If a provider for the given                        protocol is not found.</DL></DD></DL><HR><A NAME="getStore(java.lang.String)"><!-- --></A><H3>getStore</H3><PRE>public <A HREF="../../javax/mail/Store.html" title="class in javax.mail">Store</A> <B>getStore</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;protocol)               throws <A HREF="../../javax/mail/NoSuchProviderException.html" title="class in javax.mail">NoSuchProviderException</A></PRE><DL><DD>Get a Store object that implements the specified protocol. If an appropriate Store object cannot be obtained,  NoSuchProviderException is thrown.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>protocol</CODE> - <DT><B>Returns:</B><DD>a Store object<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/NoSuchProviderException.html" title="class in javax.mail">NoSuchProviderException</A></CODE> - If a provider for the given                        protocol is not found.</DL></DD></DL><HR><A NAME="getStore(javax.mail.URLName)"><!-- --></A><H3>getStore</H3><PRE>public <A HREF="../../javax/mail/Store.html" title="class in javax.mail">Store</A> <B>getStore</B>(<A HREF="../../javax/mail/URLName.html" title="class in javax.mail">URLName</A>&nbsp;url)               throws <A HREF="../../javax/mail/NoSuchProviderException.html" title="class in javax.mail">NoSuchProviderException</A></PRE><DL><DD>Get a Store object for the given URLName. If the requested Store object cannot be obtained, NoSuchProviderException is thrown. The "scheme" part of the URL string (Refer RFC 1738) is used  to locate the Store protocol. <p><P><DD><DL><DT><B>Parameters:</B><DD><CODE>url</CODE> - URLName that represents the desired Store<DT><B>Returns:</B><DD>a closed Store object<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/NoSuchProviderException.html" title="class in javax.mail">NoSuchProviderException</A></CODE> - If a provider for the given                        URLName is not found.<DT><B>See Also:</B><DD><A HREF="../../javax/mail/Session.html#getFolder(javax.mail.URLName)"><CODE>getFolder(URLName)</CODE></A>, <A HREF="../../javax/mail/URLName.html" title="class in javax.mail"><CODE>URLName</CODE></A></DL></DD></DL><HR><A NAME="getStore(javax.mail.Provider)"><!-- --></A><H3>getStore</H3><PRE>public <A HREF="../../javax/mail/Store.html" title="class in javax.mail">Store</A> <B>getStore</B>(<A HREF="../../javax/mail/Provider.html" title="class in javax.mail">Provider</A>&nbsp;provider)               throws <A HREF="../../javax/mail/NoSuchProviderException.html" title="class in javax.mail">NoSuchProviderException</A></PRE><DL><DD>Get an instance of the store specified by Provider. Instantiates the store and returns it.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>provider</CODE> - Store Provider that will be instantiated<DT><B>Returns:</B><DD>Instantiated Store<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/NoSuchProviderException.html" title="class in javax.mail">NoSuchProviderException</A></CODE> - If a provider for the given                        Provider is not found.</DL></DD></DL><HR><A NAME="getFolder(javax.mail.URLName)"><!-- --></A><H3>getFolder</H3><PRE>public <A HREF="../../javax/mail/Folder.html" title="class in javax.mail">Folder</A> <B>getFolder</B>(<A HREF="../../javax/mail/URLName.html" title="class in javax.mail">URLName</A>&nbsp;url)                 throws <A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></PRE><DL><DD>Get a closed Folder object for the given URLName. If the requested Folder object cannot be obtained, null is returned. <p> The "scheme" part of the URL string (Refer RFC 1738) is used to locate the Store protocol. The rest of the URL string (that is, the "schemepart", as per RFC 1738) is used by that Store in a protocol dependent manner to locate and instantiate the appropriate Folder object. <p> Note that RFC 1738 also specifies the syntax for the  "schemepart" for IP-based protocols (IMAP4, POP3, etc.). Providers of IP-based mail Stores should implement that syntax for referring to Folders. <p><P><DD><DL><DT><B>Parameters:</B><DD><CODE>url</CODE> - URLName that represents the desired folder<DT><B>Returns:</B><DD>Folder<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/NoSuchProviderException.html" title="class in javax.mail">NoSuchProviderException</A></CODE> - If a provider for the given                        URLName is not found.<DD><CODE><A HREF="../../javax/mail/MessagingException.html" title="class in javax.mail">MessagingException</A></CODE> - if the Folder could not be                         located or created.<DT><B>See Also:</B><DD><A HREF="../../javax/mail/Session.html#getStore(javax.mail.URLName)"><CODE>getStore(URLName)</CODE></A>, <A HREF="../../javax/mail/URLName.html" title="class in javax.mail"><CODE>URLName</CODE></A></DL>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?