org.makumba.commons.attributes
Class RequestAttributes
java.lang.Object
org.makumba.commons.attributes.RequestAttributes
- All Implemented Interfaces:
- Attributes
public class RequestAttributes
- extends Object
- implements Attributes
Implementation of the Makumba Attributes
- Version:
- $Id: RequestAttributes.java 1707 2007-09-28 15:35:48Z manuel_gay $
- Author:
- Cristian Bogdan
PARAMETERS_NAME
public static final String PARAMETERS_NAME
- See Also:
- Constant Field Values
ATTRIBUTES_NAME
public static final String ATTRIBUTES_NAME
- See Also:
- Constant Field Values
CONTROLLER_NAME
public static final String CONTROLLER_NAME
- See Also:
- Constant Field Values
logger
static final Logger logger
request
HttpServletRequest request
controller
Object controller
PROVIDER_ATTRIBUTE
public static final String PROVIDER_ATTRIBUTE
- See Also:
- Constant Field Values
notFound
public static final Object notFound
RequestAttributes
RequestAttributes(HttpServletRequest req)
throws LogicException
- Throws:
LogicException
RequestAttributes
public RequestAttributes(Object controller,
HttpServletRequest req,
String db)
throws LogicException
- Throws:
LogicException
getRequestDatabase
public String getRequestDatabase()
getRequestController
public Object getRequestController()
getAttributes
public static RequestAttributes getAttributes(HttpServletRequest req)
throws LogicException
- Throws:
LogicException
setFormRedirectionResponseAttributes
static void setFormRedirectionResponseAttributes(HttpServletRequest req)
getConnectionProvider
public static DbConnectionProvider getConnectionProvider(HttpServletRequest req)
- Gives a provider to get connection to the database
- Parameters:
req - the http request corresponding to the current access
- Returns:
- A
DbConnectionProvider providing the database connection service
getParameters
public static HttpParameters getParameters(HttpServletRequest req)
makeParameters
public static HttpParameters makeParameters(HttpServletRequest req)
setAttribute
public static void setAttribute(HttpServletRequest req,
String var,
Object o)
setAttribute
public Object setAttribute(String s,
Object o)
- Description copied from interface:
Attributes
- Sets the value of an attribute
- Specified by:
setAttribute in interface Attributes
- Parameters:
s - the name of the attributeo - the value of the attribute
- Returns:
- the old value of the attribue, or null if there was none
- See Also:
Attributes.setAttribute(java.lang.String, java.lang.Object)
removeAttribute
public void removeAttribute(String s)
throws LogicException
- Description copied from interface:
Attributes
- Removes an attribute
- Specified by:
removeAttribute in interface Attributes
- Parameters:
s - the name of the attribute
- Throws:
LogicException - if a business logic problem occured while trying to remove the attribute- See Also:
Attributes.removeAttribute(java.lang.String)
hasAttribute
public boolean hasAttribute(String s)
- Description copied from interface:
Attributes
- Checks whether an attribute exists
- Specified by:
hasAttribute in interface Attributes
- Parameters:
s - the name of the attribute
- Returns:
- true if the attribute exists, false otherwise.
- See Also:
Attributes.hasAttribute(java.lang.String)
toString
public String toString()
- Overrides:
toString in class Object
- See Also:
Object.toString()
getAttribute
public Object getAttribute(String s)
throws LogicException
- Description copied from interface:
Attributes
- Gets the attribute with the given name.
- Specified by:
getAttribute in interface Attributes
- Parameters:
s - the name of the attribute
- Returns:
- the attribute value
- Throws:
LogicException - if a business logic problem occured while trying to determine the attribute
AttributeNotFoundException - if there was no error but the attribute could not be found.- See Also:
Attributes.getAttribute(java.lang.String)
checkSessionForAttribute
public Object checkSessionForAttribute(String s)
checkServletLoginForAttribute
public Object checkServletLoginForAttribute(String s)
checkLogicForAttribute
public Object checkLogicForAttribute(String s)
throws LogicException
- Throws:
LogicException
checkParameterForAttribute
public Object checkParameterForAttribute(String s)
toMap
public Map<String,Object> toMap()
- Computes a Map that holds all Attributes (meaning, session attributes, request attributes and parameters) FIXME
should also take into account all the rest (BL, login, ...)