service.html

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

HTML
705
字号
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Service.html#queueEvent(javax.mail.event.MailEvent, java.util.Vector)">queueEvent</A></B>(<A HREF="../../javax/mail/event/MailEvent.html">MailEvent</A>&nbsp;event,
           java.util.Vector&nbsp;vector)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Add the event and vector of listeners to the queue to be delivered.</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/Service.html#removeConnectionListener(javax.mail.event.ConnectionListener)">removeConnectionListener</A></B>(<A HREF="../../javax/mail/event/ConnectionListener.html">ConnectionListener</A>&nbsp;l)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Remove a Connection event listener.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Service.html#setConnected(boolean)">setConnected</A></B>(boolean&nbsp;connected)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the connection state of this service.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Service.html#setURLName(javax.mail.URLName)">setURLName</A></B>(<A HREF="../../javax/mail/URLName.html">URLName</A>&nbsp;url)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the URLName representing this service.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/mail/Service.html#toString()">toString</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return <code>getURLName.toString()</code> if this service has a URLName,
 otherwise it will return the default <code>toString</code>.</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, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

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

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

<A NAME="session"><!-- --></A><H3>
session</H3>
<PRE>
protected <A HREF="../../javax/mail/Session.html">Session</A> <B>session</B></PRE>
<DL>
<DD>The session from which this service was created.</DL>
<HR>

<A NAME="url"><!-- --></A><H3>
url</H3>
<PRE>
protected <A HREF="../../javax/mail/URLName.html">URLName</A> <B>url</B></PRE>
<DL>
<DD>The <code>URLName</code> of this service.</DL>
<HR>

<A NAME="debug"><!-- --></A><H3>
debug</H3>
<PRE>
protected boolean <B>debug</B></PRE>
<DL>
<DD>Debug flag for this service.  Set from the session's debug
 flag when this service is created.</DL>

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

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

<A NAME="Service(javax.mail.Session, javax.mail.URLName)"><!-- --></A><H3>
Service</H3>
<PRE>
protected <B>Service</B>(<A HREF="../../javax/mail/Session.html">Session</A>&nbsp;session,
                  <A HREF="../../javax/mail/URLName.html">URLName</A>&nbsp;urlname)</PRE>
<DL>
<DD>Constructor.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>session</CODE> - Session object for this service<DD><CODE>url</CODE> - URLName object to be used for this service</DL>
</DD>
</DL>

<!-- ============ 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="connect()"><!-- --></A><H3>
connect</H3>
<PRE>
public void <B>connect</B>()
             throws <A HREF="../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>A generic connect method that takes no parameters. Subclasses
 can implement the appropriate authentication schemes. Subclasses
 that need additional information might want to use some properties
 or might get it interactively using a popup window. <p>

 If the connection is successful, an "open" <code>ConnectionEvent</code>
 is delivered to any <code>ConnectionListeners</code> on this service. <p>

 Most clients should just call this method to connect to the service.<p>

 It is an error to connect to an already connected service. <p>

 The implementation provided here simply calls the following
 <code>connect(String, String, String)</code> method with nulls.<DD><DL>
<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/AuthenticationFailedException.html">AuthenticationFailedException</A></CODE> - for authentication failures<DD><CODE><A HREF="../../javax/mail/MessagingException.html">MessagingException</A></CODE> - for other failures<DD><CODE>java.lang.IllegalStateException</CODE> - if the service is already connected<DT><B>See Also: </B><DD><A HREF="../../javax/mail/event/ConnectionEvent.html"><CODE>ConnectionEvent</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="connect(java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3>
connect</H3>
<PRE>
public void <B>connect</B>(java.lang.String&nbsp;host,
                    java.lang.String&nbsp;user,
                    java.lang.String&nbsp;password)
             throws <A HREF="../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Connect to the specified address. This method provides a simple
 authentication scheme that requires a username and password. <p>

 If the connection is successful, an "open" <code>ConnectionEvent</code>
 is delivered to any <code>ConnectionListeners</code> on this service. <p>

 It is an error to connect to an already connected service. <p>

 The implementation in the Service class will collect defaults
 for the host, user, and password from the session, from the
 <code>URLName</code> for this service, and from the supplied
 parameters and then call the <code>protocolConnect</code> method.
 If the <code>protocolConnect</code> method returns <code>false</code>,
 the user will be prompted for any missing information and the
 <code>protocolConnect</code> method will be called again.  The
 subclass should override the <code>protocolConnect</code> method.
 The subclass should also implement the <code>getURLName</code>
 method, or use the implementation in this class. <p>

 On a successful connection, the <code>setURLName</code> method is
 called with a URLName that includes the information used to make
 the connection, including the password. <p>

 If the password passed in is null and this is the first successful
 connection to this service, the user name and the password
 collected from the user will be saved as defaults for subsequent
 connection attempts to this same service when using other Service object
 instances (the connection information is typically always saved within
 a particular Service object instance).  The password is saved using the
 Session method <code>setPasswordAuthenticaiton</code>.  If the
 password passed in is not null, it is not saved, on the assumption
 that the application is managing passwords explicitly.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>host</CODE> - the host to connect to<DD><CODE>user</CODE> - the user name<DD><CODE>password</CODE> - this user's password<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/AuthenticationFailedException.html">AuthenticationFailedException</A></CODE> - for authentication failures<DD><CODE><A HREF="../../javax/mail/MessagingException.html">MessagingException</A></CODE> - for other failures<DD><CODE>java.lang.IllegalStateException</CODE> - if the service is already connected<DT><B>See Also: </B><DD><A HREF="../../javax/mail/event/ConnectionEvent.html"><CODE>ConnectionEvent</CODE></A>, 
<A HREF="../../javax/mail/Session.html#setPasswordAuthentication(javax.mail.URLName, javax.mail.PasswordAuthentication)"><CODE>Session.setPasswordAuthentication(javax.mail.URLName, javax.mail.PasswordAuthentication)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="connect(java.lang.String, int, java.lang.String, java.lang.String)"><!-- --></A><H3>
connect</H3>
<PRE>
public void <B>connect</B>(java.lang.String&nbsp;host,
                    int&nbsp;port,
                    java.lang.String&nbsp;user,
                    java.lang.String&nbsp;password)
             throws <A HREF="../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>Similar to connect(host, user, password) except a specific port
 can be specified.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>host</CODE> - the host to connect to<DD><CODE>port</CODE> - the port to connect to (-1 means the default port)<DD><CODE>user</CODE> - the user name<DD><CODE>password</CODE> - this user's password<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/mail/AuthenticationFailedException.html">AuthenticationFailedException</A></CODE> - for authentication failures<DD><CODE><A HREF="../../javax/mail/MessagingException.html">MessagingException</A></CODE> - for other failures<DD><CODE>java.lang.IllegalStateException</CODE> - if the service is already connected<DT><B>See Also: </B><DD><A HREF="../../javax/mail/Service.html#connect(java.lang.String, java.lang.String, java.lang.String)"><CODE>connect(java.lang.String, java.lang.String, java.lang.String)</CODE></A>, 
<A HREF="../../javax/mail/event/ConnectionEvent.html"><CODE>ConnectionEvent</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="protocolConnect(java.lang.String, int, java.lang.String, java.lang.String)"><!-- --></A><H3>
protocolConnect</H3>
<PRE>
protected boolean <B>protocolConnect</B>(java.lang.String&nbsp;host,
                                  int&nbsp;port,
                                  java.lang.String&nbsp;user,
                                  java.lang.String&nbsp;password)
                           throws <A HREF="../../javax/mail/MessagingException.html">MessagingException</A></PRE>
<DL>
<DD>The service implementation should override this method to
 perform the actual protocol-specific connection attempt.
 The default implementation of the <code>connect</code> method
 calls this method as needed. <p>

 The <code>protocolConnect</code> method should return
 <code>false</code> if a user name or password is required
 for authentication but the corresponding parameter is null;
 the <code>connect</code> method will prompt the user when
 needed to supply missing information.  This method may
 also return <code>false</code> if authentication fails for
 the supplied user name or password.  Alternatively, this method
 may throw an AuthenticationFailedException when authentication
 fails.  This exception may include a String message with more
 detail about the failure. <p>

 The <code>protocolConnect</code> method should throw an

⌨️ 快捷键说明

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