cn.dreampie.common.http
类 AbstractRequest

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

public abstract class AbstractRequest
extends Object
implements Request

Date: 15/11/13 Time: 18:38


构造方法摘要
protected AbstractRequest()
           
 
方法摘要
protected  void checkProxyRequest()
           
 String getBaseNetworkPath()
          Returns the base network path of this request (ie baseUri without the protocol).
protected abstract  String getBasePath()
          The path on which resty is mounted.
 String getBaseUri()
          Returns the base URI of this request.
 String getClientAddress()
          The address (IP) of the client.
protected  String getHost()
           
protected abstract  String getLocalClientAddress()
          Returns the client address of this request, without taking proxy into account
protected abstract  String getLocalScheme()
          The URL scheme used for this request, without taking proxy into account.
protected abstract  String getQueryString()
           
protected abstract  javax.servlet.RequestDispatcher getRequestDispatcher(String url)
           
protected  String getScheme()
           
 boolean isSecured()
          Is this request performed through a secured connection or not.
 String toString()
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
从接口 cn.dreampie.common.Request 继承的方法
getCharacterEncoding, getContentLength, getContentStream, getContentType, getCookiesMap, getCookieValue, getHeader, getHeaders, getHeaders, getHttpMethod, getLocale, getLocales, getQueryParam, getQueryParams, getQueryParams, getRealPath, getRestPath, getRestUri, isPersistentCookie, setCharacterEncoding, unwrap
 

构造方法详细信息

AbstractRequest

protected AbstractRequest()
方法详细信息

toString

public String toString()
覆盖:
Object 中的 toString

getBaseUri

public String getBaseUri()
从接口 Request 复制的描述
Returns the base URI of this request. Eg http://mydomain.com/api or http://mydomain.com:8080

When used behind a proxy, this will try to return the client facing URI, by using: - X-Forwarded-Host for the host - X-Forwarded-Proto for the scheme - checking first Via to know if request was made in HTTPS

see http://en.wikipedia.org/wiki/X-Forwarded-For see http://en.wikipedia.org/wiki/List_of_HTTP_header_fields see http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxyvia

指定者:
接口 Request 中的 getBaseUri
返回:
the base URI of this request.

getBaseNetworkPath

public String getBaseNetworkPath()
从接口 Request 复制的描述
Returns the base network path of this request (ie baseUri without the protocol). Eg //mydomain.com/api or //mydomain.com:8080

This is useful to create paths using the same protocol as the one seen by the client, as opposed to the protocol seen by the server (server can see http if you have a front http server like Apache doing https and reverse proxy).

See also this discussion: http://stackoverflow.com/questions/5799577/does-using-www-example-com-in-javascript-chose-http-https-protocol-automatical

Note that if Via headers are set getBaseUri should be fine too.

指定者:
接口 Request 中的 getBaseNetworkPath
返回:
the base network path of this request.

getHost

protected String getHost()

isSecured

public boolean isSecured()
从接口 Request 复制的描述
Is this request performed through a secured connection or not.

This will return true if: - the HttpSettings proto() is set to 'https' - the request has a 'X-Forwarded-Proto' header with value 'https', and comes from an authorized proxy as defined by HttpSettings.forwardedSupport() - the request was performed in HTTPS on this server

指定者:
接口 Request 中的 isSecured
返回:
true if this request is performed through a secured (HTTPS) connection.

getScheme

protected String getScheme()

getClientAddress

public String getClientAddress()
从接口 Request 复制的描述
The address (IP) of the client.

If X-Forwarded-For header is present, it will return its value, otherwise it returns the remote client address.

see http://httpd.apache.org/docs/current/mod/mod_proxy.html#x-headers for details on this header.

指定者:
接口 Request 中的 getClientAddress
返回:
IP address of the client.

checkProxyRequest

protected void checkProxyRequest()

getQueryString

protected abstract String getQueryString()

getRequestDispatcher

protected abstract javax.servlet.RequestDispatcher getRequestDispatcher(String url)

getLocalClientAddress

protected abstract String getLocalClientAddress()
Returns the client address of this request, without taking proxy into account

返回:
the client address of this request, without taking proxy into account

getBasePath

protected abstract String getBasePath()
The path on which resty is mounted. Eg /api

返回:
the path on which resty is mounted.

getLocalScheme

protected abstract String getLocalScheme()
The URL scheme used for this request, without taking proxy into account. Eg: http, https

返回:
URL scheme used for this request, without taking proxy into account.


Copyright © 2015. All rights reserved.