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

📄 servletrequest.html

📁 javaservlet 2.4 spec api describe javaservlet 2.4 spec api describe
💻 HTML
📖 第 1 页 / 共 3 页
字号:
 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>.<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.<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.<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. It is the value of the part after ":" in the <code>Host</code> header value, if any, or the server port where the client connection was accepted on.<DD><DL><DT><B>Returns:</B><DD>an integer specifying the port number</DL></DD></DL><HR><A NAME="getReader()"><!-- --></A><H3>getReader</H3><PRE>public java.io.BufferedReader <B>getReader</B>()                                 throws java.io.IOException</PRE><DL><DD>Retrieves the body of the request as character data using a <code>BufferedReader</code>.  The reader translates the character data according to the character encoding used on the body. Either this method or <A HREF="../../javax/servlet/ServletRequest.html#getInputStream()"><CODE>getInputStream()</CODE></A> may be called to read the body, not both.<DD><DL><DT><B>Returns:</B><DD>a <code>BufferedReader</code>						containing the body of the request<DT><B>Throws:</B><DD>java.io.UnsupportedEncodingException - if the character set encoding 						used is not supported and the 						text cannot be decoded<DD>IllegalStateException - if <A HREF="../../javax/servlet/ServletRequest.html#getInputStream()"><CODE>getInputStream()</CODE></A> method 						has been called on this request<DD>java.io.IOException - if an input or output exception occurred<DT><B>See Also: </B><DD><A HREF="../../javax/servlet/ServletRequest.html#getInputStream()"><CODE>getInputStream()</CODE></A></DL></DD></DL><HR><A NAME="getRemoteAddr()"><!-- --></A><H3>getRemoteAddr</H3><PRE>public java.lang.String <B>getRemoteAddr</B>()</PRE><DL><DD>Returns the Internet Protocol (IP) address of the client or last proxy that sent the request. For HTTP servlets, same as the value of the  CGI variable <code>REMOTE_ADDR</code>.<DD><DL><DT><B>Returns:</B><DD>a <code>String</code> containing the 			IP address of the client that sent the request</DL></DD></DL><HR><A NAME="getRemoteHost()"><!-- --></A><H3>getRemoteHost</H3><PRE>public java.lang.String <B>getRemoteHost</B>()</PRE><DL><DD>Returns the fully qualified name of the client or the last proxy that sent the request. If the engine cannot or chooses not to resolve the hostname  (to improve performance), this method returns the dotted-string form of  the IP address. For HTTP servlets, same as the value of the CGI variable  <code>REMOTE_HOST</code>.<DD><DL><DT><B>Returns:</B><DD>a <code>String</code> containing the fully  qualified name of the client</DL></DD></DL><HR><A NAME="getRemotePort()"><!-- --></A><H3>getRemotePort</H3><PRE>public int <B>getRemotePort</B>()</PRE><DL><DD>Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.<DD><DL><DT><B>Returns:</B><DD>an integer specifying the port number<DT><B>Since: </B><DD>2.4</DD></DL></DD></DL><HR><A NAME="setAttribute(java.lang.String, java.lang.Object)"><!-- --></A><H3>setAttribute</H3><PRE>public void <B>setAttribute</B>(java.lang.String&nbsp;name,                         java.lang.Object&nbsp;o)</PRE><DL><DD>Stores an attribute in this request. Attributes are reset between requests.  This method is most often used in conjunction with <A HREF="../../javax/servlet/RequestDispatcher.html"><CODE>RequestDispatcher</CODE></A>. <p>Attribute names should follow the same conventions as package names. Names beginning with <code>java.*</code>, <code>javax.*</code>, and <code>com.sun.*</code>, are reserved for use by Sun Microsystems.<br> If the object passed in is null, the effect is the same as calling <A HREF="../../javax/servlet/ServletRequest.html#removeAttribute(java.lang.String)"><CODE>removeAttribute(java.lang.String)</CODE></A>. <br> It is warned that when the request is dispatched from the servlet resides in a different web application by <code>RequestDispatcher</code>, the object set by this method may not be correctly retrieved in the caller servlet.<DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - a <code>String</code> specifying 					the name of the attribute<DD><CODE>o</CODE> - the <code>Object</code> to be stored</DL></DD></DL><HR><A NAME="removeAttribute(java.lang.String)"><!-- --></A><H3>removeAttribute</H3><PRE>public void <B>removeAttribute</B>(java.lang.String&nbsp;name)</PRE><DL><DD>Removes an attribute from this request.  This method is not generally needed as attributes only persist as long as the request is being handled. <p>Attribute names should follow the same conventions as package names. Names beginning with <code>java.*</code>, <code>javax.*</code>, and <code>com.sun.*</code>, are reserved for use by Sun Microsystems.<DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - a <code>String</code> specifying 					the name of the attribute to remove</DL></DD></DL><HR><A NAME="getLocale()"><!-- --></A><H3>getLocale</H3><PRE>public java.util.Locale <B>getLocale</B>()</PRE><DL><DD>Returns the preferred <code>Locale</code> that the client will  accept content in, based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns the default locale for the server.<DD><DL><DT><B>Returns:</B><DD>the preferred <code>Locale</code> for the client</DL></DD></DL><HR><A NAME="getLocales()"><!-- --></A><H3>getLocales</H3><PRE>public java.util.Enumeration <B>getLocales</B>()</PRE><DL><DD>Returns an <code>Enumeration</code> of <code>Locale</code> objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns an <code>Enumeration</code> containing one  <code>Locale</code>, the default locale for the server.<DD><DL><DT><B>Returns:</B><DD>an <code>Enumeration</code> of preferred                   <code>Locale</code> objects for the client</DL></DD></DL><HR><A NAME="isSecure()"><!-- --></A><H3>isSecure</H3><PRE>public boolean <B>isSecure</B>()</PRE><DL><DD>Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.<DD><DL><DT><B>Returns:</B><DD>a boolean indicating if the request was made using a                  secure channel</DL></DD></DL><HR><A NAME="getRequestDispatcher(java.lang.String)"><!-- --></A><H3>getRequestDispatcher</H3><PRE>public <A HREF="../../javax/servlet/RequestDispatcher.html">RequestDispatcher</A> <B>getRequestDispatcher</B>(java.lang.String&nbsp;path)</PRE><DL><DD>Returns a <A HREF="../../javax/servlet/RequestDispatcher.html"><CODE>RequestDispatcher</CODE></A> object that acts as a wrapper for the resource located at the given path.   A <code>RequestDispatcher</code> object can be used to forward a request to the resource or to include the resource in a response. The resource can be dynamic or static. <p>The pathname specified may be relative, although it cannot extend outside the current servlet context.  If the path begins with  a "/" it is interpreted as relative to the current context root.   This method returns <code>null</code> if the servlet container cannot return a <code>RequestDispatcher</code>. <p>The difference between this method and <A HREF="../../javax/servlet/ServletContext.html#getRequestDispatcher(java.lang.String)"><CODE>ServletContext.getRequestDispatcher(java.lang.String)</CODE></A> is that this method can take a relative path.<DD><DL><DT><B>Parameters:</B><DD><CODE>path</CODE> - a <code>String</code> specifying the pathname                  to the resource. If it is relative, it must be                  relative against the current servlet.<DT><B>Returns:</B><DD>a <code>RequestDispatcher</code> object                  that acts as a wrapper for the resource                  at the specified path, or <code>null</code>                  if the servlet container cannot return a                  <code>RequestDispatcher</code><DT><B>See Also: </B><DD><A HREF="../../javax/servlet/RequestDispatcher.html"><CODE>RequestDispatcher</CODE></A>, <A HREF="../../javax/servlet/ServletContext.html#getRequestDispatcher(java.lang.String)"><CODE>ServletContext.getRequestDispatcher(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="getRealPath(java.lang.String)"><!-- --></A><H3>getRealPath</H3><PRE>public java.lang.String <B>getRealPath</B>(java.lang.String&nbsp;path)</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>As of Version 2.1 of the Java Servlet API, 			use <A HREF="../../javax/servlet/ServletContext.html#getRealPath(java.lang.String)"><CODE>ServletContext.getRealPath(java.lang.String)</CODE></A> instead.</I><P></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../javax/servlet/ServletContextListener.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../javax/servlet/ServletRequestAttributeListener.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="ServletRequest.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR></BODY></HTML>

⌨️ 快捷键说明

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