?? servletrequest.html
字號:
for example, <code>http</code>, <code>https</code>, or <code>ftp</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/servlet/ServletRequest.html#getServerName()">getServerName</A></B>()</CODE><BR> Returns the host name of the server to which the request was sent.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/servlet/ServletRequest.html#getServerPort()">getServerPort</A></B>()</CODE><BR> Returns the port number to which the request was sent.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/servlet/ServletRequest.html#isSecure()">isSecure</A></B>()</CODE><BR> Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.</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/servlet/ServletRequest.html#removeAttribute(java.lang.String)">removeAttribute</A></B>(java.lang.String name)</CODE><BR> Removes an attribute from this request.</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/servlet/ServletRequest.html#setAttribute(java.lang.String, java.lang.Object)">setAttribute</A></B>(java.lang.String name, java.lang.Object o)</CODE><BR> Stores an attribute in this request.</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/servlet/ServletRequest.html#setCharacterEncoding(java.lang.String)">setCharacterEncoding</A></B>(java.lang.String env)</CODE><BR> Overrides the name of the character encoding used in the body of this request.</TD></TR></TABLE> <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="getAttribute(java.lang.String)"><!-- --></A><H3>getAttribute</H3><PRE>public java.lang.Object <B>getAttribute</B>(java.lang.String name)</PRE><DL><DD>Returns the value of the named attribute as an <code>Object</code>, or <code>null</code> if no attribute of the given name exists. <p> Attributes can be set two ways. The servlet container may set attributes to make available custom information about a request. For example, for requests made using HTTPS, the attribute <code>javax.servlet.request.X509Certificate</code> can be used to retrieve information on the certificate of the client. Attributes can also be set programatically using <A HREF="../../javax/servlet/ServletRequest.html#setAttribute(java.lang.String, java.lang.Object)"><CODE>setAttribute(java.lang.String, java.lang.Object)</CODE></A>. This allows information to be embedded into a request before a <A HREF="../../javax/servlet/RequestDispatcher.html"><CODE>RequestDispatcher</CODE></A> call. <p>Attribute names should follow the same conventions as package names. This specification reserves names matching <code>java.*</code>, <code>javax.*</code>, and <code>sun.*</code>.<DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - a <code>String</code> specifying the name of the attribute<DT><B>Returns:</B><DD>an <code>Object</code> containing the value of the attribute, or <code>null</code> if the attribute does not exist</DL></DD></DL><HR><A NAME="getAttributeNames()"><!-- --></A><H3>getAttributeNames</H3><PRE>public java.util.Enumeration <B>getAttributeNames</B>()</PRE><DL><DD>Returns an <code>Enumeration</code> containing the names of the attributes available to this request. This method returns an empty <code>Enumeration</code> if the request has no attributes available to it.<DD><DL><DT><B>Returns:</B><DD>an <code>Enumeration</code> of strings containing the names of the request's attributes</DL></DD></DL><HR><A NAME="getCharacterEncoding()"><!-- --></A><H3>getCharacterEncoding</H3><PRE>public java.lang.String <B>getCharacterEncoding</B>()</PRE><DL><DD>Returns the name of the character encoding used in the body of this request. This method returns <code>null</code> if the request does not specify a character encoding<DD><DL><DT><B>Returns:</B><DD>a <code>String</code> containing the name of the character encoding, or <code>null</code> if the request does not specify a character encoding</DL></DD></DL><HR><A NAME="setCharacterEncoding(java.lang.String)"><!-- --></A><H3>setCharacterEncoding</H3><PRE>public void <B>setCharacterEncoding</B>(java.lang.String env) throws java.io.UnsupportedEncodingException</PRE><DL><DD>Overrides the name of the character encoding used in the body of this request. This method must be called prior to reading request parameters or reading input using getReader().<DD><DL><DT><B>Parameters:</B><DD><CODE>env</CODE> - a <code>String</code> containing the name of the character encoding.<DT><B>Throws:</B><DD>java.io.UnsupportedEncodingException - if this is not a valid encoding</DL></DD></DL><HR><A NAME="getContentLength()"><!-- --></A><H3>getContentLength</H3><PRE>public int <B>getContentLength</B>()</PRE><DL><DD>Returns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known. For HTTP servlets, same as the value of the CGI variable CONTENT_LENGTH.<DD><DL><DT><B>Returns:</B><DD>an integer containing the length of the request body or -1 if the length is not known</DL></DD></DL><HR><A NAME="getContentType()"><!-- --></A><H3>getContentType</H3><PRE>public java.lang.String <B>getContentType</B>()</PRE><DL><DD>Returns the MIME type of the body of the request, or <code>null</code> if the type is not known. For HTTP servlets, same as the value of the CGI variable CONTENT_TYPE.<DD><DL><DT><B>Returns:</B><DD>a <code>String</code> containing the name of the MIME type of the request, or null if the type is not known</DL></DD></DL><HR><A NAME="getInputStream()"><!-- --></A><H3>getInputStream</H3><PRE>public <A HREF="../../javax/servlet/ServletInputStream.html">ServletInputStream</A> <B>getInputStream</B>() throws java.io.IOException</PRE><DL><DD>Retrieves the body of the request as binary data using a <A HREF="../../javax/servlet/ServletInputStream.html"><CODE>ServletInputStream</CODE></A>. Either this method or <A HREF="../../javax/servlet/ServletRequest.html#getReader()"><CODE>getReader()</CODE></A> may be called to read the body, not both.<DD><DL><DT><B>Returns:</B><DD>a <A HREF="../../javax/servlet/ServletInputStream.html"><CODE>ServletInputStream</CODE></A> object containing the body of the request<DT><B>Throws:</B><DD>IllegalStateException - if the <A HREF="../../javax/servlet/ServletRequest.html#getReader()"><CODE>getReader()</CODE></A> method has already been called for this request<DD>java.io.IOException - if an input or output exception occurred</DL></DD></DL><HR><A NAME="getLocalAddr()"><!-- --></A><H3>getLocalAddr</H3><PRE>public java.lang.String <B>getLocalAddr</B>()</PRE><DL><DD>Returns the Internet Protocol (IP) address of the interface on which the request was received.<DD><DL><DT><B>Returns:</B><DD>a <code>String</code> containing the IP address on which the request was received.<DT><B>Since: </B><DD>2.4</DD></DL></DD></DL><HR><A NAME="getLocalName()"><!-- --></A><H3>getLocalName</H3><PRE>public java.lang.String <B>getLocalName</B>()</PRE><DL><DD>Returns the host name of the Internet Protocol (IP) interface on which the request was received.<DD><DL><DT><B>Returns:</B><DD>a <code>String</code> containing the host name of the IP on which the request was received.<DT><B>Since: </B><DD>2.4</DD></DL></DD></DL><HR><A NAME="getLocalPort()"><!-- --></A><H3>getLocalPort</H3><PRE>public int <B>getLocalPort</B>()</PRE><DL><DD>Returns the Internet Protocol (IP) port number of the interface on which the request was received.<DD><DL><DT><B>Returns:</B><DD>an integer specifying the port number<DT><B>Since: </B><DD>2.4</DD></DL></DD></DL><HR><A NAME="getParameter(java.lang.String)"><!-- --></A><H3>getParameter</H3><PRE>public java.lang.String <B>getParameter</B>(java.lang.String name)</PRE><DL><DD>Returns the value of a request parameter as a <code>String</code>, or <code>null</code> if the parameter does not exist. Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data. <p>You should only use this method when you are sure the parameter has only one value. If the parameter might have more than one value, use <A HREF="../../javax/servlet/ServletRequest.html#getParameterValues(java.lang.String)"><CODE>getParameterValues(java.lang.String)</CODE></A>. <p>If you use this method with a multivalued parameter, the value returned is equal to the first value in the array returned by <code>getParameterValues</code>. <p>If the parameter data was sent in the request body, such as occurs with an HTTP POST request, then reading the body directly via <A HREF="../../javax/servlet/ServletRequest.html#getInputStream()"><CODE>getInputStream()</CODE></A> or <A HREF="../../javax/servlet/ServletRequest.html#getReader()"><CODE>getReader()</CODE></A> can interfere with the execution of this method.<DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - a <code>String</code> specifying the name of the parameter<DT><B>Returns:</B><DD>a <code>String</code> representing the single value of the parameter<DT><B>See Also: </B><DD><A HREF="../../javax/servlet/ServletRequest.html#getParameterValues(java.lang.String)"><CODE>getParameterValues(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="getParameterNames()"><!-- --></A><H3>getParameterNames</H3><PRE>public java.util.Enumeration <B>getParameterNames</B>()</PRE><DL><DD>Returns an <code>Enumeration</code> of <code>String</code> objects containing the names of the parameters contained in this request. If the request has no parameters, the method returns an empty <code>Enumeration</code>.<DD><DL><DT><B>Returns:</B><DD>an <code>Enumeration</code> of <code>String</code> objects, each <code>String</code> containing the name of a request parameter; or an empty <code>Enumeration</code> if the request has no parameters</DL></DD></DL><HR><A NAME="getParameterValues(java.lang.String)"><!-- --></A><H3>getParameterValues</H3><PRE>public java.lang.String[] <B>getParameterValues</B>(java.lang.String name)</PRE><DL><DD>Returns an array of <code>String</code> objects containing all of the values the given request parameter has, or <code>null</code> if the parameter does not exist. <p>If the parameter has a single value, the array has a length of 1.<DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - a <code>String</code> containing the name of the parameter whose value is requested<DT><B>Returns:</B><DD>an array of <code>String</code> objects containing the parameter's values<DT><B>See Also: </B><DD><A HREF="../../javax/servlet/ServletRequest.html#getParameter(java.lang.String)"><CODE>getParameter(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="getParameterMap()"><!-- --></A><H3>getParameterMap</H3><PRE>public java.util.Map <B>getParameterMap</B>()</PRE><DL><DD>Returns a java.util.Map of the parameters of this request. Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.<DD><DL><DT><B>Returns:</B><DD>an immutable java.util.Map containing parameter names as keys and parameter values as map values. The keys in the parameter
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -