public class RequestContext extends Object
| 构造器和说明 |
|---|
RequestContext() |
RequestContext(javax.servlet.ServletContext ctx,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
| 限定符和类型 | 方法和说明 |
|---|---|
static RequestContext |
begin(javax.servlet.ServletContext ctx,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
void |
deleteCookie(String name,
boolean all_sub_domain) |
void |
end() |
void |
error(int code,
String... msg) |
void |
forbidden() |
void |
forward(String url,
boolean config) |
static RequestContext |
get() |
Object |
getAttribute(String name) |
Map<String,Object> |
getAttributsMap() |
String |
getBasePath() |
javax.servlet.http.Cookie |
getCookie(String name) |
Map<String,javax.servlet.http.Cookie> |
getCookies() |
String |
getDomainOfServerName(String host)
获取用户访问URL中的根域名 例如: www.dlog.cn -> dlog.cn
|
String |
getIpAddr() |
OutputStream |
getOutputStream() |
String |
getParameter(String name) |
String |
getParameterGBK(String name) |
Map<String,String> |
getParameterMap() |
Map<String,String> |
getParameterMapGBK() |
Map<String,String> |
getParameterMapUTF() |
String |
getParameterUTF(String name) |
String[] |
getparams(String name) |
String |
getRealPage(String url) |
javax.servlet.http.HttpServletRequest |
getRequest() |
javax.servlet.http.HttpServletResponse |
getResponse() |
javax.servlet.ServletContext |
getServletContext() |
javax.servlet.http.HttpSession |
getSession() |
Object |
getSessionAttribute(String name) |
Map<String,String> |
getUrlMap() |
boolean |
isIPAddr(String addr) |
void |
notfound() |
void |
printData(String contentType,
Object data) |
void |
printHTML(Object data) |
void |
printJSON(Object obj) |
void |
redirect(String url) |
void |
removeParam(String name) |
void |
removeSessionParam(String name) |
void |
setAttribute(String name,
Object value) |
void |
setAttributs(Map<String,?> params) |
void |
setCharacterEncoding(String encoding) |
void |
setContentType(String conType) |
void |
setCookie(String name,
String value,
int maxAge)
设置COOKIE
|
void |
setCookie(String name,
String value,
int maxAge,
boolean all_sub_domain)
设置COOKIE
|
void |
setHeader(String param1,
String param2) |
void |
setSessionAttribute(String name,
Object value) |
void |
setUrlMap(Map<String,String> urlMap) |
public static String basePath
public RequestContext()
public RequestContext(javax.servlet.ServletContext ctx,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
public javax.servlet.ServletContext getServletContext()
public javax.servlet.http.HttpSession getSession()
public javax.servlet.http.HttpServletRequest getRequest()
public javax.servlet.http.HttpServletResponse getResponse()
public static RequestContext begin(javax.servlet.ServletContext ctx, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
public static RequestContext get()
public void end()
public void forward(String url, boolean config) throws IOException, javax.servlet.ServletException
IOExceptionjavax.servlet.ServletExceptionpublic void redirect(String url) throws IOException
IOExceptionpublic void error(int code,
String... msg)
throws IOException
IOExceptionpublic void forbidden()
throws IOException
IOExceptionpublic void notfound()
throws IOException
IOExceptionpublic void printData(String contentType, Object data) throws IOException
IOExceptionpublic void printHTML(Object data) throws IOException
IOExceptionpublic void printJSON(Object obj) throws IOException
IOExceptionpublic String getParameterGBK(String name) throws UnsupportedEncodingException
public String getParameterUTF(String name) throws UnsupportedEncodingException
public void setContentType(String conType)
public void setCharacterEncoding(String encoding) throws UnsupportedEncodingException
public OutputStream getOutputStream() throws IOException
IOExceptionpublic void removeParam(String name)
public void removeSessionParam(String name)
public Map<String,String> getParameterMapGBK() throws UnsupportedEncodingException
public javax.servlet.http.Cookie getCookie(String name)
public void setCookie(String name, String value, int maxAge)
name - value - maxAge - public void setCookie(String name, String value, int maxAge, boolean all_sub_domain)
name - value - maxAge - public void deleteCookie(String name, boolean all_sub_domain)
public String getIpAddr()
public String getDomainOfServerName(String host)
req - public boolean isIPAddr(String addr)
public String getBasePath()
Copyright © 2019. All rights reserved.