📄 sipconnection.html
字号:
</DD>
</DL>
<HR>
<A NAME="getHeader(java.lang.String)"><!-- --></A><H3>
getHeader</H3>
<PRE>
public java.lang.String <B>getHeader</B>(java.lang.String name)</PRE>
<DL>
<DD>Gets the header field value of specified header type. The implementations MAY restrict the access to some headers according to RFC 3261 [1], see also <A HREF="SipConnection.html#HEADERACCESS">"Restricted access to headers"</A>. <p> <b>Example1:</b> Get topmost Route header from a message that contains three Route headers in a comma-separated header field value. <br><pre> Route: <sip:al@abc.com>,<sip:carol@chicago.com>,<sip:bob@biloxi.com> getHeader("Route"); the result is: <sip:al@abc.com> </pre> <p>
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - name of the header type, either in full or compact form see [1] p.32<DT><B>Returns:</B><DD>topmost header field value. It is an empty String if the value was set to be <tt>null</tt> or empty. It is <tt>null</tt> if the current message does not have such a header or the header is for other reason not available (e.g. message is not initialized, the connection is closed or the implementation does not allow this header to be read).<DT><B>Throws:</B><DD><CODE>java.lang.NullPointerException</CODE> - if name is null</DL>
</DD>
</DL>
<HR>
<A NAME="getMethod()"><!-- --></A><H3>
getMethod</H3>
<PRE>
public java.lang.String <B>getMethod</B>()</PRE>
<DL>
<DD>Gets the SIP method. Applicable when a message has been initialized or received.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>SIP method name REGISTER, INVITE, NOTIFY, etc. Returns <tt>null</tt> if the method is not available (e.g. message is not initialized, the connection is closed).</DL>
</DD>
</DL>
<HR>
<A NAME="getRequestURI()"><!-- --></A><H3>
getRequestURI</H3>
<PRE>
public java.lang.String <B>getRequestURI</B>()</PRE>
<DL>
<DD>Gets Request-URI. If supported, available when <tt>SipClientConnection</tt> is in <em>Initialized</em> state or when <tt>SipServerConnection</tt> is in <em>Request Received</em> state. Built from the original URI given in <tt>Connector.open()</tt>. See RFC 3261 p.35 (8.1.1.1 Request-URI)<p> It is not mandated that this method be supported, an implementation may return <tt>null</tt> in any state.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>Request-URI of the message. Returns <tt>null</tt> if the Request-URI is not available (e.g. message is not initialized or the connection is closed) or getting the Request-URI is not supported.</DL>
</DD>
</DL>
<HR>
<A NAME="getStatusCode()"><!-- --></A><H3>
getStatusCode</H3>
<PRE>
public int <B>getStatusCode</B>()</PRE>
<DL>
<DD>Gets SIP response status code. Available when <tt>SipClientConnection</tt> is in <em>Proceeding</em>, <em>Unauthorized</em> or <em>Completed</em> state or when <tt>SipServerConnection</tt> is in <em>Initialized</em> state.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>status code 1xx, 2xx, 3xx, 4xx, ... Returns 0 if the status code is not available.</DL>
</DD>
</DL>
<HR>
<A NAME="getReasonPhrase()"><!-- --></A><H3>
getReasonPhrase</H3>
<PRE>
public java.lang.String <B>getReasonPhrase</B>()</PRE>
<DL>
<DD>Gets SIP response reason phrase. Available when <tt>SipClientConnection</tt> is in <em>Proceeding</em>, <em>Unauthorized</em> or <em>Completed</em> state or when <tt>SipServerConnection</tt> is in <em>Initialized</em> state.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>reason phrase. Returns <tt>null</tt> if the reason phrase is not available (e.g. message is not initialized or the connection is closed). Returns an empty string is the reason phrase was set with <tt>null</tt> or empty string in <tt>setReasonPhrase</tt>.</DL>
</DD>
</DL>
<HR>
<A NAME="getDialog()"><!-- --></A><H3>
getDialog</H3>
<PRE>
public <A HREF="../../../javax/microedition/sip/SipDialog.html" title="interface in javax.microedition.sip">SipDialog</A> <B>getDialog</B>()</PRE>
<DL>
<DD>Returns the current SIP dialog. This is available when the <tt>SipConnection</tt> belongs to a created <tt>SipDialog</tt>, which is in <em>Early</em> or <em>Confirmed</em> state (see <A HREF="./SipDialog.html"><code>SipDialog</code></A>). <p> The <tt>SipDialog</tt> returned from the <tt>SipConnection</tt> defines always the peer-to-peer association created by the latest sent or received request or response.<br> The method returns <tt>null</tt> if a terminating error response (3xx - 6xx) is received or sent on the connection or the connection is closed.<br> The following rules apply when this method is called on a <tt>SipServerConnection</tt> instance: <ul><li>If the received request is <tt>CANCEL</tt> then the method returns <tt>null</tt> since the dialog is in early state and the <tt>CANCEL</tt> request does not relate to the dialog.</li> <li>If the request is <tt>ACK</tt> then the method returns the dialog object if it is available.</li> </ul>
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD><tt>SipDialog</tt> object if this connection belongs to a dialog, otherwise returns <tt>null</tt>. See also the rules defined at the method's description.<DT><B>See Also:</B><DD><A HREF="../../../javax/microedition/sip/SipDialog.html" title="interface in javax.microedition.sip"><CODE>SipDialog</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="openContentInputStream()"><!-- --></A><H3>
openContentInputStream</H3>
<PRE>
public java.io.InputStream <B>openContentInputStream</B>() throws java.io.IOException, <A HREF="../../../javax/microedition/sip/SipException.html" title="class in javax.microedition.sip">SipException</A></PRE>
<DL>
<DD>Returns <tt>InputStream</tt> to read the message body content of a request or response received. It is not required that implementations store the message content after it was sent, so calling this method after sending a request or response may fail.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>InputStream to read body content<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if the <tt>InputStream</tt> can not be opened, because of an I/O error occurred.<DD><CODE><A HREF="../../../javax/microedition/sip/SipException.html" title="class in javax.microedition.sip">SipException</A></CODE> - INVALID_STATE if the <tt>InputStream</tt> can not be opened in this state (e.g. no message received or message has already been sent).</DL>
</DD>
</DL>
<HR>
<A NAME="openContentOutputStream()"><!-- --></A><H3>
openContentOutputStream</H3>
<PRE>
public java.io.OutputStream <B>openContentOutputStream</B>() throws java.io.IOException, <A HREF="../../../javax/microedition/sip/SipException.html" title="class in javax.microedition.sip">SipException</A></PRE>
<DL>
<DD>Returns <tt>OutputStream</tt> to fill the SIP message body content. When calling <tt>close()</tt> on <tt>OutputStream</tt> the message will be sent to the network. So it is equivalent to call <tt>send()</tt>. This method must not be called after closing the <tt>OutputStream</tt>, since it will throw Exception because of calling the method in wrong state. <br> Before opening the <tt>OutputStream</tt> the <tt>Content-Type</tt> header has to be set. If not <tt>SipException.UNKNOWN_TYPE</tt> will be thrown. The <tt>Content-Length</tt> header need not be set, it is automatically set by the API implementation immediately before sending the message. If it is set by the application, it will be overwritten with the correct length of the stream.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>OutputStream to write body content<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if the <tt>OutputStream</tt> can not be opened, because of an I/O error occurred.<DD><CODE><A HREF="../../../javax/microedition/sip/SipException.html" title="class in javax.microedition.sip">SipException</A></CODE> - INVALID_STATE if the <tt>OutputStream</tt> can not be opened in this state (e.g. no message initialized). UNKNOWN_TYPE <tt>Content-Type</tt> if the <tt>type</tt> header is not set.<DT><B>See Also:</B><DD><A HREF="../../../javax/microedition/sip/SipConnection.html#send()"><CODE>send()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setErrorListener(javax.microedition.sip.SipErrorListener)"><!-- --></A><H3>
setErrorListener</H3>
<PRE>
public void <B>setErrorListener</B>(<A HREF="../../../javax/microedition/sip/SipErrorListener.html" title="interface in javax.microedition.sip">SipErrorListener</A> sel) throws <A HREF="../../../javax/microedition/sip/SipException.html" title="class in javax.microedition.sip">SipException</A></PRE>
<DL>
<DD>Sets the listener for error notifications. Applications that want to receive notification about a failure of an asynchoronous send operation must implement the <tt>SipErrorListener</tt> interface and register it with a connection using this method. Only one listener can be set at any time, if a listener is already set it will be overwritten. Setting listener to <tt>null</tt> will remove the current listener.<p> This method is added to version 1.1.0 so that applications can receive notifications about transmission errors, like failure in the GPRS connection.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>sel</CODE> - reference to the listener object. The value <tt>null</tt> will remove the existing listener.<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/microedition/sip/SipException.html" title="class in javax.microedition.sip">SipException</A></CODE> - INVALID_STATE if the connection is closed<DT><B>Since:</B></DT> <DD>1.1.0</DD></DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../javax/microedition/sip/SipClientConnectionListener.html" title="interface in javax.microedition.sip"><B>PREV CLASS</B></A>
<A HREF="../../../javax/microedition/sip/SipConnectionNotifier.html" title="interface in javax.microedition.sip"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="SipConnection.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<font size=-1>Copyright © 2003-2007 Nokia Corporation. All Rights Reserved.<br/> Java is a trademark of Sun Microsystems, Inc.
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -