public abstract class AbstractWebController extends Object implements ModelController
| 构造器和说明 |
|---|
AbstractWebController() |
| 限定符和类型 | 方法和说明 |
|---|---|
AbstractWebController |
addHeader(String key,
String value)
设置
HttpServletResponseHeader属性 |
net.hasor.core.AppContext |
getAppContext() |
<T> T |
getAttr(String name)
Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.
|
Integer |
getAttrForInt(String name)
Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.
|
String |
getAttrForStr(String name)
Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.
|
Enumeration<String> |
getAttrNames()
Returns an Enumeration containing the names of the attributes available to this request.
|
String |
getCookie(String name)
Get cookie value by cookie name.
|
String |
getCookie(String name,
String defaultValue)
Get cookie value by cookie name.
|
javax.servlet.http.Cookie |
getCookieObject(String name)
Get cookie object by cookie name.
|
javax.servlet.http.Cookie[] |
getCookieObjects() |
Integer |
getCookieToInt(String name)
Get cookie value by cookie name and convert to Integer.
|
Integer |
getCookieToInt(String name,
Integer defaultValue)
Get cookie value by cookie name and convert to Integer.
|
Long |
getCookieToLong(String name)
Get cookie value by cookie name and convert to Long.
|
Long |
getCookieToLong(String name,
Long defaultValue)
Get cookie value by cookie name and convert to Long.
|
protected Object |
getModel(Class<?> modelClass) |
protected Object |
getModel(String bindID) |
String |
getPara(String name)
Returns the value of a request parameter as a String, or null if the parameter does not exist.
|
String |
getPara(String name,
String defaultValue)
Returns the value of a request parameter as a String, or default value if the parameter does not exist.
|
Map<String,String[]> |
getParaMap()
Returns the values of the request parameters as a Map.
|
Enumeration<String> |
getParaNames()
Returns an Enumeration of String objects containing the names of the parameters
contained in this request.
|
Boolean |
getParaToBoolean(String name)
Returns the value of a request parameter and convert to Boolean.
|
Boolean |
getParaToBoolean(String name,
Boolean defaultValue)
Returns the value of a request parameter and convert to Boolean with a default value if it is null.
|
Integer |
getParaToInt(String name)
Returns the value of a request parameter and convert to Integer.
|
Integer |
getParaToInt(String name,
Integer defaultValue)
Returns the value of a request parameter and convert to Integer with a default value if it is null.
|
Long |
getParaToLong(String name)
Returns the value of a request parameter and convert to Long.
|
Long |
getParaToLong(String name,
Long defaultValue)
Returns the value of a request parameter and convert to Long with a default value if it is null.
|
String[] |
getParaValues(String name)
Returns an array of String objects containing all of the values the given request
parameter has, or null if the parameter does not exist.
|
Integer[] |
getParaValuesToInt(String name)
Returns an array of Integer objects containing all of the values the given request
parameter has, or null if the parameter does not exist.
|
javax.servlet.http.HttpServletRequest |
getRequest() |
javax.servlet.http.HttpServletResponse |
getResponse() |
javax.servlet.http.HttpSession |
getSession() |
javax.servlet.http.HttpSession |
getSession(boolean create)
Return HttpSession.
|
<T> T |
getSessionAttr(String key)
Return a Object from session.
|
void |
initController(javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse) |
AbstractWebController |
putAtt(String attKey,
Object attValue)
设置
HttpServletRequest属性 |
AbstractWebController |
removeAttr(String name)
Removes an attribute from this request
|
AbstractWebController |
removeCookie(String name)
Remove Cookie with path = "/".
|
AbstractWebController |
removeCookie(String name,
String path)
Remove Cookie.
|
AbstractWebController |
removeCookie(String name,
String path,
String domain)
Remove Cookie.
|
AbstractWebController |
removeSessionAttr(String key)
Remove Object in session.
|
AbstractWebController |
setAttr(String name,
Object value)
Stores an attribute in this request
|
AbstractWebController |
setAttrs(Map<String,Object> attrMap)
Stores attributes in this request, key of the map as attribute name and value of the map as attribute value
|
AbstractWebController |
setCookie(javax.servlet.http.Cookie cookie)
Set Cookie to response.
|
AbstractWebController |
setCookie(String name,
String value,
int maxAgeInSeconds)
Set Cookie with path = "/".
|
AbstractWebController |
setCookie(String name,
String value,
int maxAgeInSeconds,
String path)
Set Cookie to response.
|
AbstractWebController |
setCookie(String name,
String value,
int maxAgeInSeconds,
String path,
String domain)
Set Cookie to response.
|
AbstractWebController |
setHeader(String key,
String value)
设置
HttpServletResponseHeader属性 |
AbstractWebController |
setSessionAttr(String key,
Object value)
Store Object to session.
|
Integer |
toInt(String value,
Integer defaultValue) |
public void initController(javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
public javax.servlet.http.HttpServletRequest getRequest()
public javax.servlet.http.HttpServletResponse getResponse()
public net.hasor.core.AppContext getAppContext()
public javax.servlet.http.HttpSession getSession()
public javax.servlet.http.HttpSession getSession(boolean create)
create - a boolean specifying create HttpSession if it not existspublic AbstractWebController putAtt(String attKey, Object attValue)
HttpServletRequest属性attKey - 属性名attValue - 属性值public AbstractWebController setHeader(String key, String value)
HttpServletResponseHeader属性key - 参数 keyvalue - 参数值public AbstractWebController addHeader(String key, String value)
HttpServletResponseHeader属性key - 参数 keyvalue - 参数值public AbstractWebController setAttr(String name, Object value)
name - a String specifying the name of the attributevalue - the Object to be storedpublic AbstractWebController removeAttr(String name)
name - a String specifying the name of the attribute to removepublic AbstractWebController setAttrs(Map<String,Object> attrMap)
attrMap - key and value as attribute of the map to be storedpublic String getPara(String name)
You should only use this method when you are sure the parameter has only one value. If the parameter might have more than one value, use getParaValues(java.lang.String).
If you use this method with a multivalued parameter, the value returned is equal to the first value in the array returned by getParameterValues.
name - a String specifying the name of the parameterpublic String getPara(String name, String defaultValue)
name - a String specifying the name of the parameterdefaultValue - a String value be returned when the value of parameter is nullpublic Map<String,String[]> getParaMap()
public Enumeration<String> getParaNames()
public String[] getParaValues(String name)
name - a String containing the name of the parameter whose value is requestedpublic Integer[] getParaValuesToInt(String name)
name - a String containing the name of the parameter whose value is requestedpublic Enumeration<String> getAttrNames()
public <T> T getAttr(String name)
name - a String specifying the name of the attributepublic String getAttrForStr(String name)
name - a String specifying the name of the attributepublic Integer getAttrForInt(String name)
name - a String specifying the name of the attributepublic Integer getParaToInt(String name)
name - a String specifying the name of the parameterpublic Integer getParaToInt(String name, Integer defaultValue)
name - a String specifying the name of the parameterdefaultValue - default value for the parameterpublic Long getParaToLong(String name)
name - a String specifying the name of the parameterpublic Long getParaToLong(String name, Long defaultValue)
name - a String specifying the name of the parameterdefaultValue - default value for the parameterpublic Boolean getParaToBoolean(String name)
name - a String specifying the name of the parameterpublic Boolean getParaToBoolean(String name, Boolean defaultValue)
name - a String specifying the name of the parameterdefaultValue - default value for the parameterpublic <T> T getSessionAttr(String key)
key - a String specifying the key of the Object stored in sessionpublic AbstractWebController setSessionAttr(String key, Object value)
key - a String specifying the key of the Object stored in sessionvalue - a Object specifying the value stored in sessionpublic AbstractWebController removeSessionAttr(String key)
key - a String specifying the key of the Object stored in sessionpublic String getCookie(String name, String defaultValue)
name - cookie namedefaultValue - default valuepublic String getCookie(String name)
name - cookie namepublic Integer getCookieToInt(String name)
name - cookie namepublic Integer getCookieToInt(String name, Integer defaultValue)
name - cookie namedefaultValue - default valuepublic Long getCookieToLong(String name)
name - cookie namepublic Long getCookieToLong(String name, Long defaultValue)
name - cookie namedefaultValue - default valuepublic javax.servlet.http.Cookie getCookieObject(String name)
name - cookie namepublic javax.servlet.http.Cookie[] getCookieObjects()
public AbstractWebController setCookie(javax.servlet.http.Cookie cookie)
cookie - new cookie.public AbstractWebController setCookie(String name, String value, int maxAgeInSeconds, String path)
name - cookie namevalue - cookie valuemaxAgeInSeconds - -1: clear cookie when close browser. 0: clear cookie immediately. n > 0 : max age in n seconds.path - see Cookie.setPath(String)public AbstractWebController setCookie(String name, String value, int maxAgeInSeconds, String path, String domain)
name - cookie namevalue - cookie valuemaxAgeInSeconds - -1: clear cookie when close browser. 0: clear cookie immediately. n > 0 : max age in n seconds.path - see Cookie.setPath(String)domain - the domain name within which this cookie is visible; form is according to RFC 2109public AbstractWebController setCookie(String name, String value, int maxAgeInSeconds)
name - cookie namevalue - cookie valuemaxAgeInSeconds - max agepublic AbstractWebController removeCookie(String name)
name - cookie namepublic AbstractWebController removeCookie(String name, String path)
name - cookie namepath - cookie with path = "/".public AbstractWebController removeCookie(String name, String path, String domain)
name - cookie namepath - cookie with path = "/".domain - domainCopyright © 2015. All rights reserved.