Class HttpHelper
java.lang.Object
cool.scx.http.HttpHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetDownloadContentDisposition(String downloadName) todo 这是一个 hack URLEncoder.encode 针对 ' ' (空格) 会编码为 '+' , 而这里我们需要的是编码为 %20static MediaTypestatic MediaTypegetMediaTypeByFileName(String filename) static StringgetRequestIP(ScxHttpServerRequest request) 获取访问者IP
-
Constructor Details
-
HttpHelper
public HttpHelper()
-
-
Method Details
-
getRequestIP
获取访问者IP先从Header中获取X-Real-IP,如果不存在再从X-Forwarded-For获得第一个IP(用,分割), 如果还不存在则调用 HttpServerRequest.remoteAddress()
- Parameters:
request- a- Returns:
- IP
-
getDownloadContentDisposition
-
getMediaTypeByExtension
-
getMediaTypeByFileName
-