httpservletrequest.html
来自「SUN公司官方J2EE中文帮助文档 应该不错 有兴趣的下来看看 html格式的」· HTML 代码 · 共 1,051 行 · 第 1/3 页
HTML
1,051 行
<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" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<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#getLocale()">getLocale</A>, <A HREF="../../../javax/servlet/ServletRequest.html#getLocales()">getLocales</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#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 Basic 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 Basic 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 Basic 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)
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
reqest<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>.
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 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><CODE>java.lang.NumberFormatException</CODE> - 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.
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>.
The web container does not decode thins 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
URI. The path starts with a "/" character but does not end with a "/"
character. For servlets in the default (root) context, this method
returns "". The container does not decode this string.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>a <code>String</code> specifying the
portion of the request URI that indicates the context
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?