⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 httpservletrequest.html

📁 j2ee帮助文档软件设计/软件工程 文件格式
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/StringBuffer.html" title="class or interface in java.lang">StringBuffer</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#getRequestURL()">getRequestURL</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reconstructs the URL the client used to make the request.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5/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/http/HttpServletRequest.html#getServletPath()">getServletPath</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the part of this request's URL that calls the servlet.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../../javax/servlet/http/HttpSession.html" title="interface in javax.servlet.http">HttpSession</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#getSession()">getSession</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the current session associated with this request, or if the request does not have a session, creates one.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../../javax/servlet/http/HttpSession.html" title="interface in javax.servlet.http">HttpSession</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#getSession(boolean)">getSession</A></B>(boolean&nbsp;create)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the current <code>HttpSession</code> associated with this request or, if there is no current session and <code>create</code> is true, returns  a new session.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/security/Principal.html" title="class or interface in java.security">Principal</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#getUserPrincipal()">getUserPrincipal</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a <code>java.security.Principal</code> object containing the name of the current authenticated user.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#isRequestedSessionIdFromCookie()">isRequestedSessionIdFromCookie</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Checks whether the requested session ID came in as a cookie.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#isRequestedSessionIdFromUrl()">isRequestedSessionIdFromUrl</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>As of Version 2.1 of the Java Servlet                                API, use <A HREF="../../../javax/servlet/http/HttpServletRequest.html#isRequestedSessionIdFromURL()"><CODE>isRequestedSessionIdFromURL()</CODE></A>                                instead.</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#isRequestedSessionIdFromURL()">isRequestedSessionIdFromURL</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Checks whether the requested session ID came in as part of the  request URL.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#isRequestedSessionIdValid()">isRequestedSessionIdValid</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Checks whether the requested session ID is still valid.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#isUserInRole(java.lang.String)">isUserInRole</A></B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;role)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a boolean indicating whether the authenticated user is included in the specified logical "role".</TD></TR></TABLE>&nbsp;<A NAME="methods_inherited_from_class_javax.servlet.ServletRequest"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Methods inherited from interface javax.servlet.<A HREF="../../../javax/servlet/ServletRequest.html" title="interface in javax.servlet">ServletRequest</A></B></TH></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>&nbsp;<P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Field Detail</B></FONT></TH></TR></TABLE><A NAME="BASIC_AUTH"><!-- --></A><H3>BASIC_AUTH</H3><PRE>static final <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>BASIC_AUTH</B></PRE><DL><DD>String identifier for Basic authentication. Value "BASIC"<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletRequest.BASIC_AUTH">Constant Field Values</A></DL></DL><HR><A NAME="FORM_AUTH"><!-- --></A><H3>FORM_AUTH</H3><PRE>static final <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>FORM_AUTH</B></PRE><DL><DD>String identifier for Form authentication. Value "FORM"<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletRequest.FORM_AUTH">Constant Field Values</A></DL></DL><HR><A NAME="CLIENT_CERT_AUTH"><!-- --></A><H3>CLIENT_CERT_AUTH</H3><PRE>static final <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>CLIENT_CERT_AUTH</B></PRE><DL><DD>String identifier for Client Certificate authentication. Value "CLIENT_CERT"<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletRequest.CLIENT_CERT_AUTH">Constant Field Values</A></DL></DL><HR><A NAME="DIGEST_AUTH"><!-- --></A><H3>DIGEST_AUTH</H3><PRE>static final <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>DIGEST_AUTH</B></PRE><DL><DD>String identifier for Digest authentication. Value "DIGEST"<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletRequest.DIGEST_AUTH">Constant Field Values</A></DL></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="getAuthType()"><!-- --></A><H3>getAuthType</H3><PRE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <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.<P><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><A HREF="../../../javax/servlet/http/Cookie.html" title="class in javax.servlet.http">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.<P><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>long <B>getDateHeader</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;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>.<P><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><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - 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><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getHeader</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;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.<P><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><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/util/Enumeration.html" title="class or interface in java.util">Enumeration</A> <B>getHeaders</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;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

⌨️ 快捷键说明

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