📄 servletrequest.html
字号:
<CODE> <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/servlet/ServletRequest.html#getParameterValues(java.lang.String)">getParameterValues</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> name)</CODE><BR> 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. </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.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/servlet/ServletRequest.html#getProtocol()">getProtocol</A></B>()</CODE><BR> Returns the name and version of the protocol the request uses in the form <i>protocol/majorVersion.minorVersion</i>, for example, HTTP/1.1. </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.4/docs/api/java/io/BufferedReader.html" title="class or interface in java.io">BufferedReader</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/servlet/ServletRequest.html#getReader()">getReader</A></B>()</CODE><BR> Retrieves the body of the request as character data using a <code>BufferedReader</code>. </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.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/servlet/ServletRequest.html#getRealPath(java.lang.String)">getRealPath</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> path)</CODE><BR> <B>Deprecated.</B> <I>As of Version 2.1 of the Java Servlet API, use <A HREF="../../javax/servlet/ServletContext.html#getRealPath(java.lang.String)"><CODE>ServletContext.getRealPath(java.lang.String)</CODE></A> instead.</I></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.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/servlet/ServletRequest.html#getRemoteAddr()">getRemoteAddr</A></B>()</CODE><BR> Returns the Internet Protocol (IP) address of the client or last proxy that sent the request. </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.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/servlet/ServletRequest.html#getRemoteHost()">getRemoteHost</A></B>()</CODE><BR> Returns the fully qualified name of the client or the last proxy that sent the request. </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#getRemotePort()">getRemotePort</A></B>()</CODE><BR> Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/servlet/RequestDispatcher.html" title="interface in javax.servlet">RequestDispatcher</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/servlet/ServletRequest.html#getRequestDispatcher(java.lang.String)">getRequestDispatcher</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> path)</CODE><BR> Returns a <A HREF="../../javax/servlet/RequestDispatcher.html" title="interface in javax.servlet"><CODE>RequestDispatcher</CODE></A> object that acts as a wrapper for the resource located at the given path. </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.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/servlet/ServletRequest.html#getScheme()">getScheme</A></B>()</CODE><BR> Returns the name of the scheme used to make this request, 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> <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></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>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> 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>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> name, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> 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>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> 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" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><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 <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <B>getAttribute</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> 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" title="interface in javax.servlet"><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>.<P><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 <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/util/Enumeration.html" title="class or interface in java.util">Enumeration</A> <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.<P><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 <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <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<P><DD><DL><DT><B>Returns:</B><DD>a <code>String</code> containing the name of the chararacter 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>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> env) throws <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/UnsupportedEncodingException.html" title="class or interface in java.io">UnsupportedEncodingException</A></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().<P><DD><DL><DT><B>Parameters:</B><DD><CODE>env</CODE> - a <code>String</code> containing the name of the chararacter encoding.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/UnsupportedEncodingException.html" title="class or interface in java.io">UnsupportedEncodingException</A></CODE> - 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.<P><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 <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getContentType</B>()</PRE><DL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -