📄 httpservletrequest.html
字号:
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from interface javax.servlet.<A HREF="../../../javax/servlet/ServletRequest.html">ServletRequest</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../javax/servlet/ServletRequest.html#getAttribute(java.lang.String)">getAttribute</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getAttributeNames()">getAttributeNames</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getCharacterEncoding()">getCharacterEncoding</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getContentLength()">getContentLength</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getContentType()">getContentType</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getInputStream()">getInputStream</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getLocalAddr()">getLocalAddr</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getLocale()">getLocale</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getLocales()">getLocales</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getLocalName()">getLocalName</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getLocalPort()">getLocalPort</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getParameter(java.lang.String)">getParameter</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getParameterMap()">getParameterMap</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getParameterNames()">getParameterNames</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getParameterValues(java.lang.String)">getParameterValues</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getProtocol()">getProtocol</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getReader()">getReader</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getRealPath(java.lang.String)">getRealPath</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getRemoteAddr()">getRemoteAddr</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getRemoteHost()">getRemoteHost</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getRemotePort()">getRemotePort</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getRequestDispatcher(java.lang.String)">getRequestDispatcher</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getScheme()">getScheme</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getServerName()">getServerName</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getServerPort()">getServerPort</A>, <A HREF="../../../javax/servlet/ServletRequest.html#isSecure()">isSecure</A>, <A HREF="../../../javax/servlet/ServletRequest.html#removeAttribute(java.lang.String)">removeAttribute</A>, <A HREF="../../../javax/servlet/ServletRequest.html#setAttribute(java.lang.String, java.lang.Object)">setAttribute</A>, <A HREF="../../../javax/servlet/ServletRequest.html#setCharacterEncoding(java.lang.String)">setCharacterEncoding</A></CODE></TD></TR></TABLE> <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="BASIC_AUTH"><!-- --></A><H3>BASIC_AUTH</H3><PRE>public static final java.lang.String <B>BASIC_AUTH</B></PRE><DL><DD>String identifier for Basic authentication. Value "BASIC"</DL><HR><A NAME="FORM_AUTH"><!-- --></A><H3>FORM_AUTH</H3><PRE>public static final java.lang.String <B>FORM_AUTH</B></PRE><DL><DD>String identifier for Form authentication. Value "FORM"</DL><HR><A NAME="CLIENT_CERT_AUTH"><!-- --></A><H3>CLIENT_CERT_AUTH</H3><PRE>public static final java.lang.String <B>CLIENT_CERT_AUTH</B></PRE><DL><DD>String identifier for Client Certificate authentication. Value "CLIENT_CERT"</DL><HR><A NAME="DIGEST_AUTH"><!-- --></A><H3>DIGEST_AUTH</H3><PRE>public static final java.lang.String <B>DIGEST_AUTH</B></PRE><DL><DD>String identifier for Digest authentication. Value "DIGEST"</DL><!-- ========= 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="getAuthType()"><!-- --></A><H3>getAuthType</H3><PRE>public java.lang.String <B>getAuthType</B>()</PRE><DL><DD>Returns the name of the authentication scheme used to protect the servlet. All servlet containers support basic, form and client certificate authentication, and may additionally support digest authentication. If the servlet is not authenticated <code>null</code> is returned. <p>Same as the value of the CGI variable AUTH_TYPE.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>one of the static members BASIC_AUTH, FORM_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH (suitable for == comparison) or the container-specific string indicating the authentication scheme, or <code>null</code> if the request was not authenticated.</DL></DD></DL><HR><A NAME="getCookies()"><!-- --></A><H3>getCookies</H3><PRE>public <A HREF="../../../javax/servlet/http/Cookie.html">Cookie</A>[] <B>getCookies</B>()</PRE><DL><DD>Returns an array containing all of the <code>Cookie</code> objects the client sent with this request. This method returns <code>null</code> if no cookies were sent.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>an array of all the <code>Cookies</code> included with this request, or <code>null</code> if the request has no cookies</DL></DD></DL><HR><A NAME="getDateHeader(java.lang.String)"><!-- --></A><H3>getDateHeader</H3><PRE>public long <B>getDateHeader</B>(java.lang.String name)</PRE><DL><DD>Returns the value of the specified request header as a <code>long</code> value that represents a <code>Date</code> object. Use this method with headers that contain dates, such as <code>If-Modified-Since</code>. <p>The date is returned as the number of milliseconds since January 1, 1970 GMT. The header name is case insensitive. <p>If the request did not have a header of the specified name, this method returns -1. If the header can't be converted to a date, the method throws an <code>IllegalArgumentException</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - a <code>String</code> specifying the name of the header<DT><B>Returns:</B><DD>a <code>long</code> value representing the date specified in the header expressed as the number of milliseconds since January 1, 1970 GMT, or -1 if the named header was not included with the request<DT><B>Throws:</B><DD>java.lang.IllegalArgumentException - If the header value can't be converted to a date</DL></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>Returns the value of the specified request header as a <code>String</code>. If the request did not include a header of the specified name, this method returns <code>null</code>. If there are multiple headers with the same name, this method returns the first head in the request. The header name is case insensitive. You can use this method with any request header.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - a <code>String</code> specifying the header name<DT><B>Returns:</B><DD>a <code>String</code> containing the value of the requested header, or <code>null</code> if the request does not have a header of that name</DL></DD></DL><HR><A NAME="getHeaders(java.lang.String)"><!-- --></A><H3>getHeaders</H3><PRE>public java.util.Enumeration <B>getHeaders</B>(java.lang.String name)</PRE><DL><DD>Returns all the values of the specified request header as an <code>Enumeration</code> of <code>String</code> objects. <p>Some headers, such as <code>Accept-Language</code> can be sent by clients as several headers each with a different value rather than sending the header as a comma separated list. <p>If the request did not include any headers of the specified name, this method returns an empty <code>Enumeration</code>. The header name is case insensitive. You can use this method with any request header.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - a <code>String</code> specifying the header name<DT><B>Returns:</B><DD>an <code>Enumeration</code> containing the values of the requested header. If the request does not have any headers of that name return an empty enumeration. If the container does not allow access to header information, return null</DL></DD></DL><HR><A NAME="getHeaderNames()"><!-- --></A><H3>getHeaderNames</H3><PRE>public java.util.Enumeration <B>getHeaderNames</B>()</PRE><DL><DD>Returns an enumeration of all the header names this request contains. If the request has no headers, this method returns an empty enumeration. <p>Some servlet containers do not allow servlets to access headers using this method, in which case this method returns <code>null</code><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>an enumeration of all the header names sent with this request; if the request has no headers, an empty enumeration; if the servlet container does not allow servlets to use this method, <code>null</code></DL></DD></DL><HR><A NAME="getIntHeader(java.lang.String)"><!-- --></A><H3>getIntHeader</H3><PRE>public int <B>getIntHeader</B>(java.lang.String name)</PRE><DL><DD>Returns the value of the specified request header as an <code>int</code>. If the request does not have a header of the specified name, this method returns -1. If the header cannot be converted to an integer, this method throws a <code>NumberFormatException</code>. <p>The header name is case insensitive.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - a <code>String</code> specifying the name of a request header<DT><B>Returns:</B><DD>an integer expressing the value of the request header or -1 if the request doesn't have a header of this name<DT><B>Throws:</B><DD>java.lang.NumberFormatException - If the header value can't be converted to an <code>int</code></DL></DD></DL><HR><A NAME="getMethod()"><!-- --></A><H3>getMethod</H3><PRE>public java.lang.String <B>getMethod</B>()</PRE><DL><DD>Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT. Same as the value of the CGI variable REQUEST_METHOD.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>a <code>String</code> specifying the name of the method with which this request was made</DL></DD></DL><HR><A NAME="getPathInfo()"><!-- --></A><H3>getPathInfo</H3><PRE>public java.lang.String <B>getPathInfo</B>()</PRE><DL><DD>Returns any extra path information associated with the URL the client sent when it made this request. The extra path information follows the servlet path but precedes the query string and will start with a "/" character. <p>This method returns <code>null</code> if there was no extra path information. <p>Same as the value of the CGI variable PATH_INFO.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>a <code>String</code>, decoded by the web container, specifying extra path information that comes after the servlet path but before the query string in the request URL; or <code>null</code> if the URL does not have any extra path information</DL></DD></DL><HR><A NAME="getPathTranslated()"><!-- --></A><H3>getPathTranslated</H3><PRE>public java.lang.String <B>getPathTranslated</B>()</PRE><DL><DD>Returns any extra path information after the servlet name but before the query string, and translates it to a real path. Same as the value of the CGI variable PATH_TRANSLATED. <p>If the URL does not have any extra path information, this method returns <code>null</code> or the servlet container cannot translate the virtual path to a real path for any reason (such as when the web application is executed from an archive). The web container does not decode this string.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>a <code>String</code> specifying the real path, or <code>null</code> if the URL does not have any extra path information</DL></DD></DL><HR><A NAME="getContextPath()"><!-- --></A><H3>getContextPath</H3><PRE>public java.lang.String <B>getContextPath</B>()</PRE><DL><DD>Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -