session.html

来自「SUN公司官方J2EE中文帮助文档 应该不错 有兴趣的下来看看 html格式的」· HTML 代码 · 共 800 行 · 第 1/3 页

HTML
800
字号
                              int port,
                              java.lang.String protocol,
                              java.lang.String prompt,
                              java.lang.String&nbsp;defaultUserName)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Session.html#setDebug(boolean)">setDebug</A></B>(boolean&nbsp;debug)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>&nbsp;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">URLName</A>&nbsp;url,
                          <A HREF="../../javax/mail/PasswordAuthentication.html">PasswordAuthentication</A>&nbsp;pw)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>&nbsp;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">Provider</A>&nbsp;provider)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the passed Provider to be the default implementation
 for the protocol in Provider.protocol overriding any previous values.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->


<!-- ========= CONSTRUCTOR DETAIL ======== -->


<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="getInstance(java.util.Properties, javax.mail.Authenticator)"><!-- --></A><H3>
getInstance</H3>
<PRE>
public static <A HREF="../../javax/mail/Session.html">Session</A> <B>getInstance</B>(java.util.Properties&nbsp;props,
                                  <A HREF="../../javax/mail/Authenticator.html">Authenticator</A>&nbsp;authenticator)</PRE>
<DL>
<DD>Get a new Session object.<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"><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">Session</A> <B>getInstance</B>(java.util.Properties&nbsp;props)</PRE>
<DL>
<DD>Get a new Session object.<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><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">Session</A> <B>getDefaultInstance</B>(java.util.Properties&nbsp;props,
                                         <A HREF="../../javax/mail/Authenticator.html">Authenticator</A>&nbsp;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>

 In JDK 1.2, additional security Permission objects may be used to
 control access to the default session.<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">Session</A> <B>getDefaultInstance</B>(java.util.Properties&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.<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><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.<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.<DD><DL>
<DT><B>Returns:</B><DD>current debug setting</DL>
</DD>
</DL>
<HR>

<A NAME="getProviders()"><!-- --></A><H3>
getProviders</H3>
<PRE>
public <A HREF="../../javax/mail/Provider.html">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.<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">Provider</A> <B>getProvider</B>(java.lang.String&nbsp;protocol)
                     throws <A HREF="../../javax/mail/NoSuchProviderException.html">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<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">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">Provider</A>&nbsp;provider)
                 throws <A HREF="../../javax/mail/NoSuchProviderException.html">NoSuchProviderException</A></PRE>
<DL>
<DD>Set the passed Provider to be the default implementation
 for the protocol in Provider.protocol overriding any previous values.<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">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">Store</A> <B>getStore</B>()
               throws <A HREF="../../javax/mail/NoSuchProviderException.html">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<DD><DL>
<DT><B>Returns:</B><DD>a Store object<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/NoSuchProviderException.html">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>

⌨️ 快捷键说明

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