requestwrapper.java

来自「RESIN 3.2 最新源码」· Java 代码 · 共 710 行 · 第 1/2 页

JAVA
710
字号
   * Returns the real path.   */  public String getRealPath(String uri)  {    return getRequest().getRealPath(uri);  }    /**   * Returns the HTTP method, e.g. "GET" or "POST"   *   * <p/>Equivalent to CGI's <code>REQUEST_METHOD</code>   */  public String getMethod()  {    return getRequest().getMethod();  }  /**   * Returns the entire request URI   */  public String getRequestURI()  {    return getRequest().getRequestURI();  }  /**   * Reconstructs the URL the client used for the request.   *   * @since Servlet 2.3   */  public StringBuffer getRequestURL()  {    return getRequest().getRequestURL();  }  /**   * Returns the part of the URI corresponding to the application's   * prefix.  The first part of the URI selects applications   * (ServletContexts).   *   * <p><code>getContextPath()</code> is /myapp for the uri   * /myapp/servlet/Hello,    */  public String getContextPath()  {    return getRequest().getContextPath();  }  /**   * Returns the URI part corresponding to the selected servlet.   * The URI is relative to the application.   *   * <p/>Corresponds to CGI's <code>SCRIPT_NAME</code>   *   * <code>getServletPath()</code> is /servlet/Hello for the uri   * /myapp/servlet/Hello/foo.   *   * <code>getServletPath()</code> is /dir/hello.jsp   * for the uri /myapp/dir/hello.jsp/foo,   */  public String getServletPath()  {    return getRequest().getServletPath();  }  /**   * Returns the URI part after the selected servlet and null if there   * is no suffix.   *   * <p/>Corresponds to CGI's <code>PATH_INFO</code>   *   * <p><code>getPathInfo()</code> is /foo for   * the uri /myapp/servlet/Hello/foo.   *   * <code>getPathInfo()</code> is /hello.jsp for for the uri   * /myapp/dir/hello.jsp/foo.   */  public String getPathInfo()  {    return getRequest().getPathInfo();  }  /**   * Returns the physical path name for the path info.   *   * <p/>Corresponds to CGI's <code>PATH_TRANSLATED</code>   *   * @return null if there is no path info.   */  public String getPathTranslated()  {    return getRequest().getPathTranslated();  }  /**   * Returns the request's query string.  Form based servlets will use   * <code>ServletRequest.getParameter()</code> to decode the form values.   *   * <p/>Corresponds to CGI's <code>PATH_TRANSLATED</code>   */  public String getQueryString()  {    return getRequest().getQueryString();  }  /**   * Returns the first value for a request header.   *   * <p/>Corresponds to CGI's <code>HTTP_*</code>   *   * <code><pre>   * String userAgent = request.getHeader("User-Agent");   * </pre></code>   *   * @param name the header name   * @return the header value   */  public String getHeader(String name)  {    return getRequest().getHeader(name);  }  /**   * Returns all the values for a request header.  In some rare cases,   * like cookies, browsers may return multiple headers.   *   * @param name the header name   * @return an enumeration of the header values.   */  public Enumeration getHeaders(String name)  {    return getRequest().getHeaders(name);  }  /**   * Returns an enumeration of all headers sent by the client.   */  public Enumeration getHeaderNames()  {    return getRequest().getHeaderNames();  }  /**   * Converts a header value to an integer.   *   * @param name the header name   * @return the header value converted to an integer   */  public int getIntHeader(String name)  {    return getRequest().getIntHeader(name);  }  /**   * Converts a date header to milliseconds since the epoch.   *   * <pre><code>   * long mod = getRequest().getDateHeader("If-Modified-Since");   * </code></pre>   *   * @param name the header name   * @return the header value converted to an date   */  public long getDateHeader(String name)  {    return getRequest().getDateHeader(name);  }  /**   * Returns an array of all cookies sent by the client.   */  public Cookie []getCookies()  {    return getRequest().getCookies();  }  /**   * Returns a session.  If no session exists and create is true, then   * create a new session, otherwise return null.   *   * @param create If true, then create a new session if none exists.   */  public HttpSession getSession(boolean create)  {    return getRequest().getSession(create);  }  /**   * Returns the current session, creating one if necessary.   * Sessions are a convenience for keeping user state   * across requests.   */  public HttpSession getSession()  {    return getSession(true);  }  /**   * Returns the session id.  Sessions are a convenience for keeping   * user state across requests.   *   * <p/>The session id is the value of the JSESSION cookie.   */  public String getRequestedSessionId()  {    return getRequest().getRequestedSessionId();  }  /**   * Returns true if the session is valid.   */  public boolean isRequestedSessionIdValid()  {    return getRequest().isRequestedSessionIdValid();  }  /**   * Returns true if the session came from a cookie.   */  public boolean isRequestedSessionIdFromCookie()  {    return getRequest().isRequestedSessionIdFromCookie();  }  /**   * Returns true if the session came URL-encoding.   */  public boolean isRequestedSessionIdFromURL()  {    return getRequest().isRequestedSessionIdFromURL();  }  /**   * Returns the auth type, e.g. basic.   */  public String getAuthType()  {    return getRequest().getAuthType();  }  /**   * Returns the remote user if authenticated.   */  public String getRemoteUser()  {    return getRequest().getRemoteUser();  }  /**   * Returns true if the user is in the given role.   */  public boolean isUserInRole(String role)  {    return getRequest().isUserInRole(role);  }    /**   * Returns the equivalent principal object for the authenticated user.   */  public Principal getUserPrincipal()  {    return getRequest().getUserPrincipal();  }    /**   * @deprecated   */  public boolean isRequestedSessionIdFromUrl()  {    return getRequest().isRequestedSessionIdFromUrl();  }  /**   * Returns the servlet context for the request   *   * @since Servlet 3.0   */  public ServletContext getServletContext()  {    return null;  }  /**   * Returns the servlet response for the request   *   * @since Servlet 3.0   */  public ServletResponse getServletResponse()  {    return null;  }  /**   * Suspend the request   *   * @since Servlet 3.0   */  public void suspend(long timeout)  {  }  /**   * Suspend the request   *   * @since Servlet 3.0   */  public void suspend()  {  }  /**   * Resume the request   *   * @since Servlet 3.0   */  public void resume()  {  }  /**   * Complete the request   *   * @since Servlet 3.0   */  public void complete()  {  }  /**   * Returns true if the servlet is suspended   *   * @since Servlet 3.0   */  public boolean isSuspended()  {    return false;  }  /**   * Returns true if the servlet is resumed   *   * @since Servlet 3.0   */  public boolean isResumed()  {    return false;  }  /**   * Returns true if the servlet timed out   *   * @since Servlet 3.0   */  public boolean isTimeout()  {    return false;  }  /**   * Returns true for the initial dispatch   *   * @since Servlet 3.0   */  public boolean isInitial()  {    return true;  }  /**   * Clears the wrapper.   */  protected void free()  {    _request = null;  }}

⌨️ 快捷键说明

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