session.html
来自「j2ee帮助文档软件设计/软件工程 文件格式」· HTML 代码 · 共 1,167 行 · 第 1/4 页
HTML
1,167 行
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../javax/mail/Session.html" title="class in javax.mail">Session</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#getInstance(java.util.Properties)">getInstance</A></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> props)</CODE><BR> Get a new Session object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../javax/mail/Session.html" title="class in javax.mail">Session</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#getInstance(java.util.Properties, javax.mail.Authenticator)">getInstance</A></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> props, <A HREF="../../javax/mail/Authenticator.html" title="class in javax.mail">Authenticator</A> authenticator)</CODE><BR> Get a new Session object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/mail/PasswordAuthentication.html" title="class in javax.mail">PasswordAuthentication</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#getPasswordAuthentication(javax.mail.URLName)">getPasswordAuthentication</A></B>(<A HREF="../../javax/mail/URLName.html" title="class in javax.mail">URLName</A> url)</CODE><BR> Return any saved PasswordAuthentication for this (store or transport) URLName.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/util/Properties.html" title="class or interface in java.util">Properties</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#getProperties()">getProperties</A></B>()</CODE><BR> Returns the Properties object associated with this Session</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#getProperty(java.lang.String)">getProperty</A></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> name)</CODE><BR> Returns the value of the specified property.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/mail/Provider.html" title="class in javax.mail">Provider</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#getProvider(java.lang.String)">getProvider</A></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> protocol)</CODE><BR> Returns the default Provider for the protocol specified.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/mail/Provider.html" title="class in javax.mail">Provider</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#getProviders()">getProviders</A></B>()</CODE><BR> This method returns an array of all the implementations installed via the javamail.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/mail/Store.html" title="class in javax.mail">Store</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#getStore()">getStore</A></B>()</CODE><BR> Get a Store object that implements this user's desired Store protocol.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/mail/Store.html" title="class in javax.mail">Store</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#getStore(javax.mail.Provider)">getStore</A></B>(<A HREF="../../javax/mail/Provider.html" title="class in javax.mail">Provider</A> provider)</CODE><BR> Get an instance of the store specified by Provider.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/mail/Store.html" title="class in javax.mail">Store</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#getStore(java.lang.String)">getStore</A></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> protocol)</CODE><BR> Get a Store object that implements the specified protocol.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/mail/Store.html" title="class in javax.mail">Store</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#getStore(javax.mail.URLName)">getStore</A></B>(<A HREF="../../javax/mail/URLName.html" title="class in javax.mail">URLName</A> url)</CODE><BR> Get a Store object for the given URLName.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/mail/Transport.html" title="class in javax.mail">Transport</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#getTransport()">getTransport</A></B>()</CODE><BR> Get a Transport object that implements this user's desired Transport protcol.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/mail/Transport.html" title="class in javax.mail">Transport</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#getTransport(javax.mail.Address)">getTransport</A></B>(<A HREF="../../javax/mail/Address.html" title="class in javax.mail">Address</A> address)</CODE><BR> Get a Transport object that can transport a Message to the specified address type.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/mail/Transport.html" title="class in javax.mail">Transport</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#getTransport(javax.mail.Provider)">getTransport</A></B>(<A HREF="../../javax/mail/Provider.html" title="class in javax.mail">Provider</A> provider)</CODE><BR> Get an instance of the transport specified in the Provider.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/mail/Transport.html" title="class in javax.mail">Transport</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#getTransport(java.lang.String)">getTransport</A></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> protocol)</CODE><BR> Get a Transport object that implements the specified protocol.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/mail/Transport.html" title="class in javax.mail">Transport</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#getTransport(javax.mail.URLName)">getTransport</A></B>(<A HREF="../../javax/mail/URLName.html" title="class in javax.mail">URLName</A> url)</CODE><BR> Get a Transport object for the given URLName.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/mail/PasswordAuthentication.html" title="class in javax.mail">PasswordAuthentication</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#requestPasswordAuthentication(java.net.InetAddress, int, java.lang.String, java.lang.String, java.lang.String)">requestPasswordAuthentication</A></B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/net/InetAddress.html" title="class or interface in java.net">InetAddress</A> addr, int port, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> protocol, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> prompt, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> defaultUserName)</CODE><BR> Call back to the application to get the needed user name and password.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#setDebug(boolean)">setDebug</A></B>(boolean debug)</CODE><BR> Set the debug setting for this Session.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#setDebugOut(java.io.PrintStream)">setDebugOut</A></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> out)</CODE><BR> Set the stream to be used for debugging output for this session.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#setPasswordAuthentication(javax.mail.URLName, javax.mail.PasswordAuthentication)">setPasswordAuthentication</A></B>(<A HREF="../../javax/mail/URLName.html" title="class in javax.mail">URLName</A> url, <A HREF="../../javax/mail/PasswordAuthentication.html" title="class in javax.mail">PasswordAuthentication</A> pw)</CODE><BR> Save a PasswordAuthentication for this (store or transport) URLName.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#setProtocolForAddress(java.lang.String, java.lang.String)">setProtocolForAddress</A></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> addresstype, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> protocol)</CODE><BR> Set the default transport protocol to use for addresses of the specified type.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/mail/Session.html#setProvider(javax.mail.Provider)">setProvider</A></B>(<A HREF="../../javax/mail/Provider.html" title="class in javax.mail">Provider</A> provider)</CODE><BR> Set the passed Provider to be the default implementation for the protocol in Provider.protocol overriding any previous values.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD></TR></TABLE> <P><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="getInstance(java.util.Properties, javax.mail.Authenticator)"><!-- --></A><H3>getInstance</H3><PRE>public static <A HREF="../../javax/mail/Session.html" title="class in javax.mail">Session</A> <B>getInstance</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> props, <A HREF="../../javax/mail/Authenticator.html" title="class in javax.mail">Authenticator</A> authenticator)</PRE><DL><DD>Get a new Session object.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>props</CODE> - Properties object that hold relevant properties.<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 to call back to the application when a user name and password is needed.<DT><B>Returns:</B><DD>a new Session object<DT><B>See Also:</B><DD><A HREF="../../javax/mail/Authenticator.html" title="class in javax.mail"><CODE>Authenticator</CODE></A></DL></DD></DL><HR><A NAME="getInstance(java.util.Properties)"><!-- --></A><H3>getInstance</H3><PRE>public static <A HREF="../../javax/mail/Session.html" title="class in javax.mail">Session</A> <B>getInstance</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> props)</PRE><DL><DD>Get a new Session object.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>props</CODE> - Properties object that hold relevant properties.<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>a new Session object<DT><B>Since:</B></DT> <DD>JavaMail 1.2</DD></DL></DD></DL><HR><A NAME="getDefaultInstance(java.util.Properties, javax.mail.Authenticator)"><!-- --></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> props, <A HREF="../../javax/mail/Authenticator.html" title="class in javax.mail">Authenticator</A> authenticator)</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> Since the default session is potentially 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, access to the default session is restricted. The Authenticator object, which must be created by the caller, is used indirectly to check access permission. The Authenticator object passed in when the session is created is compared with the Authenticator object passed in to subsequent requests to get the default session. If both objects are the same, or are from the same ClassLoader, the request is allowed. Otherwise, it is denied. <p> Note that if the Authenticator object used to create the session is null, anyone can get the default session by passing in null. <p> Note also that the Properties object is used only the first time this method is called, when a new Session object is created. Subsequent calls return the Session object that was created by the first call, and ignore the passed Properties object. Use the <code>getInstance</code> method to get a new Session object every time the method is called. <p> In JDK 1.2, additional security Permission objects may be used to control access to the default session.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?