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

📄 httpservletrequest.html

📁 java API学习JAVA的人必备之品
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<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.
<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>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>
<P>
<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&nbsp;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.
<P>
<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.
<P>
<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.
<P>
<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.
<P>
<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.
<P>
<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
			of the request</DL>
</DD>
</DL>
<HR>

<A NAME="getQueryString()"><!-- --></A><H3>
getQueryString</H3>
<PRE>
public java.lang.String <B>getQueryString</B>()</PRE>
<DL>
<DD>Returns the query string that is contained in the request
 URL after the path. This method returns <code>null</code>
 if the URL does not have a query string. Same as the value
 of the CGI variable QUERY_STRING.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>

<DT><B>Returns:</B><DD>a <code>String</code> containing the query
			string or <code>null</code> if the URL 
			contains no query string. The value is not
			decoded by the container.</DL>
</DD>
</DL>
<HR>

<A NAME="getRemoteUser()"><!-- --></A><H3>
getRemoteUser</H3>
<PRE>
public java.lang.String <B>getRemoteUser</B>()</PRE>
<DL>
<DD>Returns the login of the user making this request, if the
 user has been authenticated, or <code>null</code> if the user 
 has not been authenticated.
 Whether the user name is sent with each subsequent request
 depends on the browser and type of authentication. Same as the 
 value of the CGI variable REMOTE_USER.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>

<DT><B>Returns:</B><DD>a <code>String</code> specifying the login
			of the user making this request, or <code>null</code>
			if the user login is not known</DL>
</DD>
</DL>
<HR>

<A NAME="isUserInRole(java.lang.String)"><!-- --></A><H3>
isUserInRole</H3>
<PRE>
public boolean <B>isUserInRole</B>(java.lang.String&nbsp;role)</PRE>
<DL>
<DD>Returns a boolean indicating whether the authenticated user is included
 in the specified logical "role".  Roles and role membership can be
 defined using deployment descriptors.  If the user has not been
 authenticated, the method returns <code>false</code>.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>role</CODE> - a <code>String</code> specifying the name
				of the role
<DT><B>Returns:</B><DD>a <code>boolean</code> indicating whether
			the user making this request belongs to a given role;
			<code>false</code> if the user has not been 
			authenticated</DL>
</DD>
</DL>
<HR>

<A NAME="getUserPrincipal()"><!-- --></A><H3>
getUserPrincipal</H3>
<PRE>
public java.security.Principal <B>getUserPrincipal</B>()</PRE>
<DL>
<DD>Returns a <code>java.security.Principal</code> object containing
 the name of the current authenticated user. If the user has not been
 authenticated, the method returns <code>null</code>.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>

<DT><B>Returns:</B><DD>a <code>java.security.Principal</code> containing
			the name of the user making this request;
			<code>null</code> if the user has not been 
			authenticated</DL>
</DD>
</DL>
<HR>

<A NAME="getRequestedSessionId()"><!-- --></A><H3>
getRequestedSessionId</H3>
<PRE>
public java.lang.String <B>getRequestedSessionId</B>()</PRE>
<DL>
<DD>Returns the session ID specified by the client. This may
 not be the same as the ID of the current valid session
 for this request.
 If the client did not specify a session ID, this method returns
 <code>null</code>.
<P>
<DD><DL>
</DL>

⌨️ 快捷键说明

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