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

📄 servletrequest.html

📁 java API学习JAVA的人必备之品
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<TD><CODE><B><A HREF="../../javax/servlet/ServletRequest.html#getServerPort()">getServerPort</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the port number to which the request was sent.</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/ServletRequest.html#isSecure()">isSecure</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a boolean indicating whether this request was made using a
 secure channel, such as HTTPS.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/servlet/ServletRequest.html#removeAttribute(java.lang.String)">removeAttribute</A></B>(java.lang.String&nbsp;name)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Removes an attribute from this request.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/servlet/ServletRequest.html#setAttribute(java.lang.String, java.lang.Object)">setAttribute</A></B>(java.lang.String&nbsp;name,
             java.lang.Object&nbsp;o)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Stores an attribute in this request.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/servlet/ServletRequest.html#setCharacterEncoding(java.lang.String)">setCharacterEncoding</A></B>(java.lang.String&nbsp;env)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Overrides the name of the character encoding used in the body of this
 request.</TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->


<!-- ========= 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="getAttribute(java.lang.String)"><!-- --></A><H3>
getAttribute</H3>
<PRE>
public java.lang.Object <B>getAttribute</B>(java.lang.String&nbsp;name)</PRE>
<DL>
<DD>Returns the value of the named attribute as an <code>Object</code>,
 or <code>null</code> if no attribute of the given name exists. 

 <p> Attributes can be set two ways.  The servlet container may set
 attributes to make available custom information about a request.
 For example, for requests made using HTTPS, the attribute
 <code>javax.servlet.request.X509Certificate</code> can be used to
 retrieve information on the certificate of the client.  Attributes
 can also be set programatically using 
 <A HREF="../../javax/servlet/ServletRequest.html#setAttribute(java.lang.String, java.lang.Object)"><CODE>setAttribute(java.lang.String, java.lang.Object)</CODE></A>.  This allows information to be
 embedded into a request before a <A HREF="../../javax/servlet/RequestDispatcher.html" title="interface in javax.servlet"><CODE>RequestDispatcher</CODE></A> call.

 <p>Attribute names should follow the same conventions as package
 names. This specification reserves names matching <code>java.*</code>,
 <code>javax.*</code>, and <code>sun.*</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - a <code>String</code> specifying the name of 
			the attribute
<DT><B>Returns:</B><DD>an <code>Object</code> containing the value 
			of the attribute, or <code>null</code> if
			the attribute does not exist</DL>
</DD>
</DL>
<HR>

<A NAME="getAttributeNames()"><!-- --></A><H3>
getAttributeNames</H3>
<PRE>
public java.util.Enumeration <B>getAttributeNames</B>()</PRE>
<DL>
<DD>Returns an <code>Enumeration</code> containing the
 names of the attributes available to this request. 
 This method returns an empty <code>Enumeration</code>
 if the request has no attributes available to it.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>an <code>Enumeration</code> of strings 
			containing the names 
 			of the request's attributes</DL>
</DD>
</DL>
<HR>

<A NAME="getCharacterEncoding()"><!-- --></A><H3>
getCharacterEncoding</H3>
<PRE>
public java.lang.String <B>getCharacterEncoding</B>()</PRE>
<DL>
<DD>Returns the name of the character encoding used in the body of this
 request. This method returns <code>null</code> if the request
 does not specify a character encoding
<P>
<DD><DL>

<DT><B>Returns:</B><DD>a <code>String</code> containing the name of 
			the character encoding, or <code>null</code>
			if the request does not specify a character encoding</DL>
</DD>
</DL>
<HR>

<A NAME="setCharacterEncoding(java.lang.String)"><!-- --></A><H3>
setCharacterEncoding</H3>
<PRE>
public void <B>setCharacterEncoding</B>(java.lang.String&nbsp;env)
                          throws java.io.UnsupportedEncodingException</PRE>
<DL>
<DD>Overrides the name of the character encoding used in the body of this
 request. This method must be called prior to reading request parameters
 or reading input using getReader().
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>env</CODE> - a <code>String</code> containing the name of 
			the character encoding.
<DT><B>Throws:</B>
<DD><CODE>java.io.UnsupportedEncodingException</CODE> - if this is not a valid encoding</DL>
</DD>
</DL>
<HR>

<A NAME="getContentLength()"><!-- --></A><H3>
getContentLength</H3>
<PRE>
public int <B>getContentLength</B>()</PRE>
<DL>
<DD>Returns the length, in bytes, of the request body 
 and made available by the input stream, or -1 if the
 length is not known. For HTTP servlets, same as the value
 of the CGI variable CONTENT_LENGTH.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>an integer containing the length of the 
 			request body or -1 if the length is not known</DL>
</DD>
</DL>
<HR>

<A NAME="getContentType()"><!-- --></A><H3>
getContentType</H3>
<PRE>
public java.lang.String <B>getContentType</B>()</PRE>
<DL>
<DD>Returns the MIME type of the body of the request, or 
 <code>null</code> if the type is not known. For HTTP servlets, 
 same as the value of the CGI variable CONTENT_TYPE.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>a <code>String</code> containing the name 
			of the MIME type of 
 			the request, or null if the type is not known</DL>
</DD>
</DL>
<HR>

<A NAME="getInputStream()"><!-- --></A><H3>
getInputStream</H3>
<PRE>
public <A HREF="../../javax/servlet/ServletInputStream.html" title="class in javax.servlet">ServletInputStream</A> <B>getInputStream</B>()
                                  throws java.io.IOException</PRE>
<DL>
<DD>Retrieves the body of the request as binary data using
 a <A HREF="../../javax/servlet/ServletInputStream.html" title="class in javax.servlet"><CODE>ServletInputStream</CODE></A>.  Either this method or 
 <A HREF="../../javax/servlet/ServletRequest.html#getReader()"><CODE>getReader()</CODE></A> may be called to read the body, not both.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>a <A HREF="../../javax/servlet/ServletInputStream.html" title="class in javax.servlet"><CODE>ServletInputStream</CODE></A> object containing
 				the body of the request
<DT><B>Throws:</B>
<DD><CODE>java.lang.IllegalStateException</CODE> - if the <A HREF="../../javax/servlet/ServletRequest.html#getReader()"><CODE>getReader()</CODE></A> method
 					 has already been called for this request
<DD><CODE>java.io.IOException</CODE> - if an input or output exception occurred</DL>
</DD>
</DL>
<HR>

<A NAME="getParameter(java.lang.String)"><!-- --></A><H3>
getParameter</H3>
<PRE>
public java.lang.String <B>getParameter</B>(java.lang.String&nbsp;name)</PRE>
<DL>
<DD>Returns the value of a request parameter as a <code>String</code>,
 or <code>null</code> if the parameter does not exist. Request parameters
 are extra information sent with the request.  For HTTP servlets,
 parameters are contained in the query string or posted form data.

 <p>You should only use this method when you are sure the
 parameter has only one value. If the parameter might have
 more than one value, use <A HREF="../../javax/servlet/ServletRequest.html#getParameterValues(java.lang.String)"><CODE>getParameterValues(java.lang.String)</CODE></A>.

 <p>If you use this method with a multivalued
 parameter, the value returned is equal to the first value
 in the array returned by <code>getParameterValues</code>.

 <p>If the parameter data was sent in the request body, such as occurs
 with an HTTP POST request, then reading the body directly via <A HREF="../../javax/servlet/ServletRequest.html#getInputStream()"><CODE>getInputStream()</CODE></A> or <A HREF="../../javax/servlet/ServletRequest.html#getReader()"><CODE>getReader()</CODE></A> can interfere
 with the execution of this method.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - a <code>String</code> specifying the 
			name of the parameter
<DT><B>Returns:</B><DD>a <code>String</code> representing the 
			single value of the parameter<DT><B>See Also:</B><DD><A HREF="../../javax/servlet/ServletRequest.html#getParameterValues(java.lang.String)"><CODE>getParameterValues(java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getParameterNames()"><!-- --></A><H3>
getParameterNames</H3>
<PRE>
public java.util.Enumeration <B>getParameterNames</B>()</PRE>
<DL>
<DD>Returns an <code>Enumeration</code> of <code>String</code>
 objects containing the names of the parameters contained
 in this request. If the request has 
 no parameters, the method returns an 
 empty <code>Enumeration</code>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>an <code>Enumeration</code> of <code>String</code>
			objects, each <code>String</code> containing
 			the name of a request parameter; or an 
			empty <code>Enumeration</code> if the
			request has no parameters</DL>
</DD>
</DL>
<HR>

<A NAME="getParameterValues(java.lang.String)"><!-- --></A><H3>
getParameterValues</H3>
<PRE>
public java.lang.String[] <B>getParameterValues</B>(java.lang.String&nbsp;name)</PRE>
<DL>
<DD>Returns an array of <code>String</code> objects containing 
 all of the values the given request parameter has, or 
 <code>null</code> if the parameter does not exist.

 <p>If the parameter has a single value, the array has a length
 of 1.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - a <code>String</code> containing the name of 
			the parameter whose value is requested
<DT><B>Returns:</B><DD>an array of <code>String</code> objects 
			containing the parameter's values<DT><B>See Also:</B><DD><A HREF="../../javax/servlet/ServletRequest.html#getParameter(java.lang.String)"><CODE>getParameter(java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getParameterMap()"><!-- --></A><H3>
getParameterMap</H3>
<PRE>
public java.util.Map <B>getParameterMap</B>()</PRE>
<DL>
<DD>Returns a java.util.Map of the parameters of this request.
 Request parameters
 are extra information sent with the request.  For HTTP servlets,
 parameters are contained in the query string or posted form data.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>an immutable java.util.Map containing parameter names as 
 keys and parameter values as map values. The keys in the parameter
 map are of type String. The values in the parameter map are of type
 String array.</DL>
</DD>
</DL>
<HR>

<A NAME="getProtocol()"><!-- --></A><H3>
getProtocol</H3>
<PRE>
public java.lang.String <B>getProtocol</B>()</PRE>
<DL>
<DD>Returns the name and version of the protocol the request uses
 in the form <i>protocol/majorVersion.minorVersion</i>, for 
 example, HTTP/1.1. For HTTP servlets, the value
 returned is the same as the value of the CGI variable 
 <code>SERVER_PROTOCOL</code>.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>a <code>String</code> containing the protocol 
			name and version number</DL>
</DD>
</DL>
<HR>

<A NAME="getScheme()"><!-- --></A><H3>
getScheme</H3>
<PRE>
public java.lang.String <B>getScheme</B>()</PRE>
<DL>
<DD>Returns the name of the scheme used to make this request, 
 for example,
 <code>http</code>, <code>https</code>, or <code>ftp</code>.
 Different schemes have different rules for constructing URLs,
 as noted in RFC 1738.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>a <code>String</code> containing the name 
			of the scheme used to make this request</DL>
</DD>
</DL>
<HR>

<A NAME="getServerName()"><!-- --></A><H3>
getServerName</H3>
<PRE>
public java.lang.String <B>getServerName</B>()</PRE>
<DL>
<DD>Returns the host name of the server to which the request was sent.
 It is the value of the part before ":" in the <code>Host</code>
 header value, if any, or the resolved server name, or the server IP address.
<P>
<DD><DL>

<DT><B>Returns:</B><DD>a <code>String</code> containing the name 
			of the server</DL>
</DD>
</DL>
<HR>

<A NAME="getServerPort()"><!-- --></A><H3>
getServerPort</H3>
<PRE>
public int <B>getServerPort</B>()</PRE>
<DL>
<DD>Returns the port number to which the request was sent.

⌨️ 快捷键说明

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