📄 httpservletrequest.html
字号:
<TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#getRequestURI()">getRequestURI</A></B>()</CODE>
<BR>
Returns the part of this request's URL from the protocol
name up to the query string in the first line of the HTTP request.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.StringBuffer</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#getRequestURL()">getRequestURL</A></B>()</CODE>
<BR>
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> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#getServletPath()">getServletPath</A></B>()</CODE>
<BR>
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> <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>
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> <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 create)</CODE>
<BR>
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> java.security.Principal</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#getUserPrincipal()">getUserPrincipal</A></B>()</CODE>
<BR>
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> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#isRequestedSessionIdFromCookie()">isRequestedSessionIdFromCookie</A></B>()</CODE>
<BR>
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> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#isRequestedSessionIdFromUrl()">isRequestedSessionIdFromUrl</A></B>()</CODE>
<BR>
<B>Deprecated.</B> <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> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#isRequestedSessionIdFromURL()">isRequestedSessionIdFromURL</A></B>()</CODE>
<BR>
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> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#isRequestedSessionIdValid()">isRequestedSessionIdValid</A></B>()</CODE>
<BR>
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> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletRequest.html#isUserInRole(java.lang.String)">isUserInRole</A></B>(java.lang.String role)</CODE>
<BR>
Returns a boolean indicating whether the authenticated user is included
in the specified logical "role".</TD>
</TR>
</TABLE>
<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">
<TD><B>Methods inherited from interface javax.servlet.<A HREF="../../../javax/servlet/ServletRequest.html" title="interface in javax.servlet">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" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<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"
<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>
public static final java.lang.String <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>
public static final java.lang.String <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>
public static final java.lang.String <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>
<!-- ========= 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="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.
<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>
public <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>
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>.
<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>java.lang.IllegalArgumentException</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>
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.
<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>
public java.util.Enumeration <B>getHeaders</B>(java.lang.String name)</PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -