public abstract class BaseStripesBean extends Object implements net.sourceforge.stripes.action.ActionBean
Base class for beans serving a response to be used as HTML page data
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_BUNDLE |
static String |
DEFAULT_RESOURCE_BASE |
| Constructor and Description |
|---|
BaseStripesBean()
Create action bean with resource base path /WEB-INF/classes/ and resource bundle prefix StripesResources
|
BaseStripesBean(String resourceBasepath,
String resourceBundleName)
Create action bean
|
| Modifier and Type | Method and Description |
|---|---|
String |
errorsToXML(Collection<net.sourceforge.stripes.validation.SimpleError> errors)
Get error collection as XML String like:
|
net.sourceforge.stripes.action.ActionBeanContext |
getContext() |
String |
getCookie(String cookieName)
Get value of cookie from HttpServletRequest
|
String |
getLastUrl()
Concatenate attributes javax.servlet.forward.request_uri and javax.servlet.forward.path_info, then append parameter key=value pairs.
|
String |
getPageName()
Call HttpServletRequest.getServletPath() and return the substring after the last slash / and before the first hash # after the slash (if present).
|
String |
getParam(String paramName)
Get parameter value from HttpServletRequest
|
String |
getParam(String paramName,
String defaultValue)
Get parameter value from HttpServletRequest with default value
|
String |
getResource(String key,
String... params)
Get string resource from the associated ResourceBundle and replace {n} parameter with given values.
|
StringBuffer |
getResourceAsStringBuffer(String fileName)
Call ServletContect.getResourceAsStream() and convert the returned InputStream into a StringBuffer.
|
StringBuffer |
getResourceAsStringBuffer(String fileName,
String language)
Get localized resource file as StringBuffer.
|
abstract String |
getSessionToken()
Get session token
|
void |
setContext(net.sourceforge.stripes.action.ActionBeanContext actionBeanContext) |
void |
setCookie(String cookieName,
String cookieValue)
Set value of cookie.
|
void |
setParam(String sParamName,
String sParamValue)
Set parameter value at FlashScope
|
public static final String DEFAULT_RESOURCE_BASE
public static final String DEFAULT_BUNDLE
public BaseStripesBean()
public net.sourceforge.stripes.action.ActionBeanContext getContext()
getContext in interface net.sourceforge.stripes.action.ActionBeanpublic void setContext(net.sourceforge.stripes.action.ActionBeanContext actionBeanContext)
setContext in interface net.sourceforge.stripes.action.ActionBeanactionBeanContext - public String getPageName()
Call HttpServletRequest.getServletPath() and return the substring after the last slash / and before the first hash # after the slash (if present).
public String getResource(String key, String... params)
Get string resource from the associated ResourceBundle and replace {n} parameter with given values.
Parameters must be numbered starting with 1. So at the resource bundle the resource will look like:
key=Phrase with parameter {1} and {2}key - String Resource nameparams - String[] Parameter valuespublic StringBuffer getResourceAsStringBuffer(String fileName) throws FileNotFoundException, IOException
Call ServletContect.getResourceAsStream() and convert the returned InputStream into a StringBuffer.
fileName - String Name of resource file to be read.FileNotFoundExceptionIOExceptionpublic StringBuffer getResourceAsStringBuffer(String fileName, String language) throws FileNotFoundException, IOException
Get localized resource file as StringBuffer.
fileName - String Prefix of of resource file to be read.language - String Language code. It is expected to be appended after the file name with an underscore like "fileName_es" or "fileName_fr"FileNotFoundExceptionIOExceptionpublic String getCookie(String cookieName)
Get value of cookie from HttpServletRequest
Cookie value must be ISO8859_1 encoded.
cookieName - Stringpublic void setCookie(String cookieName, String cookieValue)
Set value of cookie. The supplied string value will be ISO8859_1 encoded.
cookieName - StringcookieValue - Stringpublic String getParam(String paramName)
Get parameter value from HttpServletRequest
paramName - String Parameter namepublic String getParam(String paramName, String defaultValue)
Get parameter value from HttpServletRequest with default value
paramName - String Parameter namedefaultValue - String Default valuepublic void setParam(String sParamName, String sParamValue)
Set parameter value at FlashScope
sParamName - String Parameter namesParamValue - String Parameter valuepublic abstract String getSessionToken()
Get session token
public String getLastUrl()
Concatenate attributes javax.servlet.forward.request_uri and javax.servlet.forward.path_info, then append parameter key=value pairs.
public String errorsToXML(Collection<net.sourceforge.stripes.validation.SimpleError> errors)
Get error collection as XML String like:
<errors count="1"/>
<error field=\"field_name">Error Message</error>
</errors>errors - Collection<SimpleError>Copyright © 2019 KnowGate. All rights reserved.