|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectnet.hasor.web.controller.AbstractController
public abstract class AbstractController
| 构造方法摘要 | |
|---|---|
AbstractController()
|
|
| 方法摘要 | ||
|---|---|---|
AbstractController |
addHeader(String key,
String value)
设置 HttpServletResponseHeader属性 |
|
net.hasor.core.AppContext |
getAppContext()
Return AppContext. |
|
|
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()
Get all cookie objects. |
|
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)
Get model from AppContext. |
|
protected Object |
getModel(String modelName)
Get model from AppContext. |
|
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()
Return HttpServletRequest. |
|
javax.servlet.http.HttpServletResponse |
getResponse()
Return HttpServletResponse. |
|
javax.servlet.http.HttpSession |
getSession()
Return HttpSession. |
|
javax.servlet.http.HttpSession |
getSession(boolean create)
Return HttpSession. |
|
|
getSessionAttr(String key)
Return a Object from session. |
|
void |
initController(javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
|
|
AbstractController |
putAtt(String attKey,
Object attValue)
设置 HttpServletRequest属性 |
|
AbstractController |
removeAttr(String name)
Removes an attribute from this request |
|
AbstractController |
removeCookie(String name)
Remove Cookie with path = "/". |
|
AbstractController |
removeCookie(String name,
String path)
Remove Cookie. |
|
AbstractController |
removeCookie(String name,
String path,
String domain)
Remove Cookie. |
|
AbstractController |
removeSessionAttr(String key)
Remove Object in session. |
|
void |
resetController()
|
|
AbstractController |
setAttr(String name,
Object value)
Stores an attribute in this request |
|
AbstractController |
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 |
|
AbstractController |
setCookie(javax.servlet.http.Cookie cookie)
Set Cookie to response. |
|
AbstractController |
setCookie(String name,
String value,
int maxAgeInSeconds)
Set Cookie with path = "/". |
|
AbstractController |
setCookie(String name,
String value,
int maxAgeInSeconds,
String path)
Set Cookie to response. |
|
AbstractController |
setCookie(String name,
String value,
int maxAgeInSeconds,
String path,
String domain)
Set Cookie to response. |
|
AbstractController |
setHeader(String key,
String value)
设置 HttpServletResponseHeader属性 |
|
AbstractController |
setSessionAttr(String key,
Object value)
Store Object to session. |
|
Integer |
toInt(String value,
Integer defaultValue)
|
|
Long |
toLong(String value,
Long defaultValue)
|
|
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public AbstractController()
| 方法详细信息 |
|---|
public void initController(javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
public void resetController()
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 exists
public AbstractController putAtt(String attKey,
Object attValue)
HttpServletRequest属性
public AbstractController setHeader(String key,
String value)
HttpServletResponseHeader属性
public AbstractController addHeader(String key,
String value)
HttpServletResponseHeader属性
public AbstractController setAttr(String name,
Object value)
name - a String specifying the name of the attributevalue - the Object to be storedpublic AbstractController removeAttr(String name)
name - a String specifying the name of the attribute to removepublic AbstractController 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 parameter
public 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 null
public 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 requested
public Integer[] getParaValuesToInt(String name)
name - a String containing the name of the parameter whose value is requested
public Enumeration<String> getAttrNames()
public <T> T getAttr(String name)
name - a String specifying the name of the attribute
public String getAttrForStr(String name)
name - a String specifying the name of the attribute
public Integer getAttrForInt(String name)
name - a String specifying the name of the attribute
public Integer toInt(String value,
Integer defaultValue)
public Integer getParaToInt(String name)
name - a String specifying the name of the parameter
public Integer getParaToInt(String name,
Integer defaultValue)
name - a String specifying the name of the parameter
public Long toLong(String value,
Long defaultValue)
public Long getParaToLong(String name)
name - a String specifying the name of the parameter
public Long getParaToLong(String name,
Long defaultValue)
name - a String specifying the name of the parameter
public Boolean getParaToBoolean(String name)
name - a String specifying the name of the parameter
public Boolean getParaToBoolean(String name,
Boolean defaultValue)
name - a String specifying the name of the parameter
public <T> T getSessionAttr(String key)
key - a String specifying the key of the Object stored in session
public AbstractController 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 AbstractController removeSessionAttr(String key)
key - a String specifying the key of the Object stored in session
public String getCookie(String name,
String defaultValue)
public String getCookie(String name)
public Integer getCookieToInt(String name)
public Integer getCookieToInt(String name,
Integer defaultValue)
public Long getCookieToLong(String name)
public Long getCookieToLong(String name,
Long defaultValue)
public javax.servlet.http.Cookie getCookieObject(String name)
public javax.servlet.http.Cookie[] getCookieObjects()
public AbstractController setCookie(javax.servlet.http.Cookie cookie)
public AbstractController 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 AbstractController 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 2109
public AbstractController setCookie(String name,
String value,
int maxAgeInSeconds)
public AbstractController removeCookie(String name)
public AbstractController removeCookie(String name,
String path)
public AbstractController removeCookie(String name,
String path,
String domain)
protected Object getModel(Class<?> modelClass)
protected Object getModel(String modelName)
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||