cn.dreampie.common.http
类 HttpRequest

java.lang.Object
  继承者 cn.dreampie.common.http.AbstractRequest
      继承者 cn.dreampie.common.http.HttpRequest
所有已实现的接口:
Request

public class HttpRequest
extends AbstractRequest

Date: 1/22/13 Time: 2:52 PM


构造方法摘要
HttpRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext)
           
 
方法摘要
protected  String getBasePath()
          The path on which resty is mounted.
 String getCharacterEncoding()
           
 int getContentLength()
           
 InputStream getContentStream()
           
 String getContentType()
           
 Map<String,String> getCookiesMap()
           
 String getCookieValue(String cookieName)
           
 String getHeader(String headerName)
           
 Map<String,String> getHeaders()
           
 Enumeration<String> getHeaders(String headerName)
           
 String getHttpMethod()
          HTTP METHOD, eg GET, POST, ...
 String getLocalClientAddress()
          Returns the client address of this request, without taking proxy into account
 Locale getLocale()
          Returns the preferred Locale that the client will accept content in, based on the Accept-Language header.
 List<Locale> getLocales()
          Returns an ImmutableList of Locale objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language header.
protected  String getLocalScheme()
          The URL scheme used for this request, without taking proxy into account.
protected  Map<String,String[]> getParamMap()
           
 String getQueryParam(String param)
           
 Map<String,List<String>> getQueryParams()
           
 List<String> getQueryParams(String param)
           
 String getQueryString()
           
 String getRealPath(String path)
          Returns the resty portion of the webRoot physical path.
 javax.servlet.RequestDispatcher getRequestDispatcher(String url)
           
 String getRestPath()
          Returns the resty portion of the request path.
 String getRestUri()
          Returns the resty portion of the full request uri.
 boolean isPersistentCookie(String cookie)
           
 void setCharacterEncoding(String encoding)
           
<T> T
unwrap(Class<T> clazz)
          Unwraps the underlying native implementation of given class.
 
从类 cn.dreampie.common.http.AbstractRequest 继承的方法
checkProxyRequest, getBaseNetworkPath, getBaseUri, getClientAddress, getHost, getScheme, isSecured, toString
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

HttpRequest

public HttpRequest(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.ServletContext servletContext)
方法详细信息

getLocalClientAddress

public String getLocalClientAddress()
从类 AbstractRequest 复制的描述
Returns the client address of this request, without taking proxy into account

指定者:
AbstractRequest 中的 getLocalClientAddress
返回:
the client address of this request, without taking proxy into account

getBasePath

protected String getBasePath()
从类 AbstractRequest 复制的描述
The path on which resty is mounted. Eg /api

指定者:
AbstractRequest 中的 getBasePath
返回:
the path on which resty is mounted.

getLocalScheme

protected String getLocalScheme()
从类 AbstractRequest 复制的描述
The URL scheme used for this request, without taking proxy into account. Eg: http, https

指定者:
AbstractRequest 中的 getLocalScheme
返回:
URL scheme used for this request, without taking proxy into account.

getRestPath

public String getRestPath()
从接口 Request 复制的描述
Returns the resty portion of the request path.

If incoming request is http://mydomain.com/api/myresource/test?q=test and baseUri is http://mydomain.com/api, then resty path will be /myresource/test

返回:
the resty portion of the request path.

getRealPath

public String getRealPath(String path)
从接口 Request 复制的描述
Returns the resty portion of the webRoot physical path.

参数:
path - webRoot relative path
返回:
the resty portion of the webRoot physical path.

getRestUri

public String getRestUri()
从接口 Request 复制的描述
Returns the resty portion of the full request uri.

If incoming request is http://mydomain.com/api/myresource/test?q=test and baseUri is http://mydomain.com/api, then resty uri will be /myresource/test?q=test

返回:
the resty portion of the full request uri.

getQueryParam

public String getQueryParam(String param)

getQueryParams

public List<String> getQueryParams(String param)

getQueryParams

public Map<String,List<String>> getQueryParams()

getParamMap

protected Map<String,String[]> getParamMap()

getContentLength

public int getContentLength()

getContentStream

public InputStream getContentStream()
                             throws IOException
抛出:
IOException

getHttpMethod

public String getHttpMethod()
从接口 Request 复制的描述
HTTP METHOD, eg GET, POST, ...

返回:
the request HTTP method

getCookiesMap

public Map<String,String> getCookiesMap()

getCookieValue

public String getCookieValue(String cookieName)

isPersistentCookie

public boolean isPersistentCookie(String cookie)

getQueryString

public String getQueryString()
指定者:
AbstractRequest 中的 getQueryString

getRequestDispatcher

public javax.servlet.RequestDispatcher getRequestDispatcher(String url)
指定者:
AbstractRequest 中的 getRequestDispatcher

getHeader

public String getHeader(String headerName)

getHeaders

public Enumeration<String> getHeaders(String headerName)

getHeaders

public Map<String,String> getHeaders()

getContentType

public String getContentType()

unwrap

public <T> T unwrap(Class<T> clazz)
从接口 Request 复制的描述
Unwraps the underlying native implementation of given class.

Examnple: This is a HttpServletRequest in a servlet container.

类型参数:
T - unwrapped class
参数:
clazz - the class of the underlying implementation
返回:
the unwrapped implementation.

getLocale

public Locale getLocale()
从接口 Request 复制的描述
Returns the preferred Locale 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.

返回:
the preferred Locale for the client

getLocales

public List<Locale> getLocales()
从接口 Request 复制的描述
Returns an ImmutableList of Locale 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 ImmutableList containing one Locale, the default locale for the server.

返回:
an ImmutableList of preferred Locale objects for the client

getCharacterEncoding

public String getCharacterEncoding()

setCharacterEncoding

public void setCharacterEncoding(String encoding)
                          throws UnsupportedEncodingException
抛出:
UnsupportedEncodingException


Copyright © 2015. All rights reserved.