Package org.openbravo.base
Class VariablesBase
- java.lang.Object
-
- org.openbravo.base.VariablesBase
-
- Direct Known Subclasses:
VariablesSecureApp
public class VariablesBase extends Object
This class is used to manage parameters passed to the servlets either using the URL with HTTP GET method or through the HTTP POST method.- Author:
- Openbravo
-
-
Field Summary
Fields Modifier and Type Field Description boolean
isMultipart
-
Constructor Summary
Constructors Constructor Description VariablesBase()
Default empty constructorVariablesBase(javax.servlet.http.HttpServletRequest request)
Basic constructor that takes the request object and saves it to be used by the subsequent methodsVariablesBase(javax.servlet.http.HttpServletRequest request, boolean f)
Overloaded constructor, used to prevent session removal in case of multipart requests.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
clearSession(boolean all)
Clear session variables.void
clearSession(Predicate<String> removeFilter)
Clear the session variables indicated by the given predicate.String
getGlobalVariable(String requestParameter, String sessionAttribute)
String
getGlobalVariable(String requestParameter, String sessionAttribute, boolean clearSession, boolean requestRequired, boolean sessionRequired, String defaultValue)
String
getGlobalVariable(String requestParameter, String sessionAttribute, boolean clearSession, boolean requestRequired, boolean sessionRequired, String defaultValue, RequestFilter requestFilter)
Returns the value of the requestParameter passed to the servlet by the HTTP GET/POST method.String
getGlobalVariable(String requestParameter, String sessionAttribute, String defaultValue)
String
getGlobalVariable(String requestParameter, String sessionAttribute, String defaultValue, RequestFilter requestFilter)
Returns the value of the requestParameter passed to the servlet by the HTTP GET/POST method.String
getGlobalVariable(String requestParameter, String sessionAttribute, RequestFilter requestFilter)
Returns the value of the requestParameter passed to the servlet by the HTTP GET/POST method.String
getInGlobalVariable(String requestParameter, String sessionAttribute)
Deprecated.String
getInGlobalVariable(String requestParameter, String sessionAttribute, boolean clearSession, boolean requestRequired, boolean sessionRequired, String defaultValue)
Deprecated.String
getInGlobalVariable(String requestParameter, String sessionAttribute, boolean clearSession, boolean requestRequired, boolean sessionRequired, String defaultValue, RequestFilter requestFilter)
Returns the set of comma separated values passed to the servlet by the HTTP GET/POST method.String
getInGlobalVariable(String requestParameter, String sessionAttribute, String defaultValue)
Deprecated.String
getInGlobalVariable(String requestParameter, String sessionAttribute, String defaultValue, RequestFilter requestFilter)
Returns the set of comma separated values passed to the servlet by the HTTP GET/POST method.String
getInGlobalVariable(String requestParameter, String sessionAttribute, RequestFilter requestFilter)
Returns the set of comma separated values passed to the servlet by the HTTP GET/POST method.String
getInParameter(String parameter)
Deprecated.String
getInParameter(String parameter, boolean required, String defaultValue)
Deprecated.String
getInParameter(String parameter, boolean required, String defaultValue, RequestFilter requestFilter)
Retrieves the set of values for the parameter with the specified name as passed to the servlet by the HTTP POST method.String
getInParameter(String parameter, String defaultValue)
Deprecated.String
getInParameter(String parameter, String defaultValue, RequestFilter requestFilter)
Retrieves the set of values for the parameter with the specified name as passed to the servlet by the HTTP POST method.String
getInParameter(String parameter, RequestFilter requestFilter)
Retrieves the set of values for the parameter with the specified name as passed to the servlet by the HTTP POST method.String
getInStringParameter(String parameter)
Deprecated.String
getInStringParameter(String parameter, boolean required, String defaultValue)
Deprecated.String
getInStringParameter(String parameter, boolean required, String defaultValue, RequestFilter requestFilter)
Retrieves the set of string values for the parameter with the specified name as passed to the servlet by the HTTP POST method.String
getInStringParameter(String parameter, String defaultValue)
Deprecated.String
getInStringParameter(String parameter, String defaultValue, RequestFilter requestFilter)
Retrieves the set of string values for the parameter with the specified name as passed to the servlet by the HTTP POST method.String
getInStringParameter(String parameter, RequestFilter requestFilter)
Retrieves the set of string values for the parameter with the specified name as passed to the servlet by the HTTP POST method.Vector<String>
getListFromInString(String _strList)
Convert a list specified as a comma separated list within parentheses into a Vector of individual values.org.apache.commons.fileupload.FileItem
getMultiFile(String parameter)
Retrieve a deserialized file passed to the servlet as a parameter and part of a multi part content.String
getMultiParameter(String parameter)
String
getMultiParameter(String parameter, RequestFilter requestFilter)
Retrieve a parameter passed to the servlet as part of a multi part content.String[]
getMultiParameters(String parameter)
String[]
getMultiParameters(String parameter, RequestFilter requestFilter)
Retrieve a set of values belonging to a parameter passed to the servlet as part of a multi part content.String[]
getMultiValueStringParameter(String parameter, boolean required, RequestFilter requestFilter)
Retrieves the set of string values for the parameter with the specified name as passed to the servlet by the HTTP POST/GET method.String
getNumericGlobalVariable(String requestParameter, String sessionAttribute, String defaultValue)
String
getNumericParameter(String parameter)
String
getNumericParameter(String parameter, String defaultValue)
String
getNumericRequestGlobalVariable(String requestParameter, String sessionAttribute)
Enumeration<String>
getParameterNames()
String
getPostDataHash()
Getter for the postDataHas memberString
getRequestGlobalVariable(String requestParameter, String sessionAttribute)
String
getRequestGlobalVariable(String requestParameter, String sessionAttribute, RequestFilter requestFilter)
Returns the value of the requestParameter passed to the servlet by the HTTP GET/POST method.String
getRequestInGlobalVariable(String requestParameter, String sessionAttribute)
Deprecated.String
getRequestInGlobalVariable(String requestParameter, String sessionAttribute, RequestFilter requestFilter)
Returns the set of comma separated values passed to the servlet by the HTTP GET/POST method.String
getRequiredGlobalVariable(String requestParameter, String sessionAttribute)
String
getRequiredGlobalVariable(String requestParameter, String sessionAttribute, RequestFilter requestFilter)
Returns the value of the requestParameter passed to the servlet by the HTTP GET/POST method.String
getRequiredInGlobalVariable(String requestParameter, String sessionAttribute)
Deprecated.String
getRequiredInGlobalVariable(String requestParameter, String sessionAttribute, RequestFilter requestFilter)
Returns the set of comma separated values passed to the servlet by the HTTP GET/POST method.String
getRequiredInParameter(String parameter)
Deprecated.String
getRequiredInParameter(String parameter, RequestFilter requestFilter)
Retrieves the set of values for the parameter with the specified name as passed to the servlet by the HTTP POST method.String
getRequiredInputGlobalVariable(String requestParameter, String sessionAttribute, String defaultStr)
String
getRequiredInputGlobalVariable(String requestParameter, String sessionAttribute, String defaultStr, RequestFilter requestFilter)
Returns the value of the requestParameter passed to the servlet by the HTTP GET/POST method.String
getRequiredInStringParameter(String parameter)
Deprecated.String
getRequiredInStringParameter(String parameter, RequestFilter requestFilter)
Retrieves the set of string values for the parameter with the specified name as passed to the servlet by the HTTP POST method.String
getRequiredNumericParameter(String parameter)
String
getRequiredNumericParameter(String parameter, String defaultValue)
String
getRequiredStringParameter(String parameter)
String
getRequiredStringParameter(String parameter, RequestFilter requestFilter)
Retrieves the single parameter value passed to the servlet by the HTTP GET/POST method.Object
getSessionObject(String sessionAttribute)
Retrieve an object from the session.String
getSessionValue(String sessionAttribute)
Retrieve a value specified by the sessionAttribute parameter from the session variables.String
getSessionValue(String sessionAttribute, String defaultValue)
Retrieve a value specified by the sessionAttribute parameter from the session variables.String
getStringParameter(String parameter)
String
getStringParameter(String parameter, boolean required, String defaultValue)
String
getStringParameter(String parameter, boolean required, String defaultValue, RequestFilter requestFilter)
Retrieves the single parameter value passed to the servlet by the HTTP GET/POST method.String
getStringParameter(String parameter, String defaultValue)
String
getStringParameter(String parameter, String defaultValue, RequestFilter requestFilter)
Retrieves a single parameter value passed to the servlet by the HTTP GET/POST method.String
getStringParameter(String parameter, RequestFilter requestFilter)
Retrieves a single parameter value passed to the servlet by the HTTP GET/POST method.boolean
hasParameter(String parameter)
Checks if a certain parameter is defined in the variables base.void
removeSessionValue(String attribute)
Remove a variable and its value from the session.void
setSessionObject(String attribute, Serializable value)
Save an object and its value to the session.void
setSessionObject(String attribute, Object value)
Deprecated.OnlySerializable
objects should be set in session: usesetSessionObject(String, Serializable)
insteadvoid
setSessionValue(String attribute, String value)
Store a variable and its value into the session as specified by the parameters.
-
-
-
Constructor Detail
-
VariablesBase
public VariablesBase()
Default empty constructor
-
VariablesBase
public VariablesBase(javax.servlet.http.HttpServletRequest request)
Basic constructor that takes the request object and saves it to be used by the subsequent methods- Parameters:
request
- HttpServletRequest object originating from the user request.
-
VariablesBase
public VariablesBase(javax.servlet.http.HttpServletRequest request, boolean f)
Overloaded constructor, used to prevent session removal in case of multipart requests.- Parameters:
request
- HttpServletRequest object originating from the user request.f
- Dummy boolean only used for overloading the constructor.
-
-
Method Detail
-
getPostDataHash
public String getPostDataHash()
Getter for the postDataHas member- Returns:
- The MD5 hash of the post data
-
getGlobalVariable
public String getGlobalVariable(String requestParameter, String sessionAttribute, boolean clearSession, boolean requestRequired, boolean sessionRequired, String defaultValue) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
- See Also:
getGlobalVariable(String,String,boolean,boolean,boolean,String,RequestFilter)
-
getGlobalVariable
public String getGlobalVariable(String requestParameter, String sessionAttribute, boolean clearSession, boolean requestRequired, boolean sessionRequired, String defaultValue, RequestFilter requestFilter) throws javax.servlet.ServletException
Returns the value of the requestParameter passed to the servlet by the HTTP GET/POST method. If this parameter is not found among the ones submitted to the servlet, it then tries to return the session value specified by the sessionAttribute parameter. Before returning the final value it also saves it to the session variable with the name specified by sessionAtribute parameter.- Parameters:
requestParameter
- The name of the parameter to be retrieved from the parameters passed to the servlet by the HTTP GET/POST methodsessionAttribute
- the name of the parameter to be retrieved from the session variable in case the requestParameter is not foundclearSession
- If true, then the value found within the session variable specified by the sessionAttribute parameter is cleared and reset to the value specified by the defaultValue parameter. This will consequently also be the value returned then.requestRequired
- If true, method throws an exception in case the parameter is not found among the ones passed to the servlet by the HTTP GET/POST method.sessionRequired
- If true, method throws an exception in case the parameter is not found among the ones passed to the servlet by the HTTP GET/POST method or the ones stored in the session.defaultValue
- If requestRequired or sessionRequired are false then the value returned by the method will take this value in case the parameter value is not found within the sought locations.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the value of the parameter.
- Throws:
javax.servlet.ServletException
-
getInGlobalVariable
@Deprecated public String getInGlobalVariable(String requestParameter, String sessionAttribute, boolean clearSession, boolean requestRequired, boolean sessionRequired, String defaultValue) throws javax.servlet.ServletException
Deprecated.- Throws:
javax.servlet.ServletException
- See Also:
getInGlobalVariable(String,String,boolean,boolean,boolean,String,RequestFilter)
-
getInGlobalVariable
public String getInGlobalVariable(String requestParameter, String sessionAttribute, boolean clearSession, boolean requestRequired, boolean sessionRequired, String defaultValue, RequestFilter requestFilter) throws javax.servlet.ServletException
Returns the set of comma separated values passed to the servlet by the HTTP GET/POST method. If this parameter is not found among the ones submitted to the servlet, it then tries to return the session value specified by the sessionAttribute parameter. Before returning the final value it also saves it to the session variable with the name specified by sessionAtribute parameter.- Parameters:
requestParameter
- The name of the parameter to be retrieved from the parameters passed to the servlet by the HTTP GET/POST method.sessionAttribute
- The name of the parameter to be retrieved from the session variable in case the requestParameter is not found.clearSession
- If true, then the value of the session variable specified by the sessionAttribute parameter is cleared. Consequently, an empty string is returned in case requestParameter was not found previously.requestRequired
- If true, method throws an exception in case the parameter is not found among the ones passed to the servlet by the HTTP GET/POST method.sessionRequired
- If true, method throws an exception in case the parameter is not found among the ones passed to the servlet by the HTTP GET/POST method or the ones stored in the session.defaultValue
- If requestRequired or sessionRequired are false then the value returned by the method will take this value in case the parameter value is not found within the sought locations.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the set of comma separated values within parentheses. For example ('value1', 'value2').
- Throws:
javax.servlet.ServletException
-
getGlobalVariable
public String getGlobalVariable(String requestParameter, String sessionAttribute, String defaultValue) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
- See Also:
getGlobalVariable(String,String,String,RequestFilter)
-
getGlobalVariable
public String getGlobalVariable(String requestParameter, String sessionAttribute, String defaultValue, RequestFilter requestFilter) throws javax.servlet.ServletException
Returns the value of the requestParameter passed to the servlet by the HTTP GET/POST method. If this parameter is not found among the ones submitted to the servlet, it then tries to return the session value specified by the sessionAttribute parameter. If none are found the defaultValue is returned. Before returning the final value it also saves it to the session variable with the name specified by sessionAtribute parameter.- Parameters:
requestParameter
- The name of the parameter to be retrieved from the parameters passed to the servlet by the HTTP GET/POST method.sessionAttribute
- The name of the parameter to be retrieved from the session variable in case the requestParameter is not found.defaultValue
- The value returned by the method will take this value in case the parameter value is not found within the sought locations.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the value of the parameter.
- Throws:
javax.servlet.ServletException
-
getGlobalVariable
public String getGlobalVariable(String requestParameter, String sessionAttribute) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
- See Also:
getGlobalVariable(String,String,RequestFilter)
-
getGlobalVariable
public String getGlobalVariable(String requestParameter, String sessionAttribute, RequestFilter requestFilter) throws javax.servlet.ServletException
Returns the value of the requestParameter passed to the servlet by the HTTP GET/POST method. If this parameter is not found among the ones submitted to the servlet, it then tries to return the session value specified by the sessionAttribute parameter. If none are found, an Exception is thrown. If one of the values is found, it is also stored into the session variable with the name specified by sessionAtribute parameter.- Parameters:
requestParameter
- The name of the parameter to be retrieved from the parameters passed to the servlet by the HTTP GET/POST method.sessionAttribute
- The name of the parameter to be retrieved from the session variable in case the requestParameter is not found.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the value of the parameter.
- Throws:
javax.servlet.ServletException
-
getRequiredGlobalVariable
public String getRequiredGlobalVariable(String requestParameter, String sessionAttribute) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
- See Also:
getRequiredGlobalVariable(String,String,RequestFilter)
-
getRequiredGlobalVariable
public String getRequiredGlobalVariable(String requestParameter, String sessionAttribute, RequestFilter requestFilter) throws javax.servlet.ServletException
Returns the value of the requestParameter passed to the servlet by the HTTP GET/POST method. If this parameter is not found among the ones submitted to the servlet, an exception is thrown. Otherwise the value is also stored into the session variable with the name specified by sessionAtribute parameter before being returned.- Parameters:
requestParameter
- The name of the parameter to be retrieved from the parameters passed to the servlet by the HTTP GET/POST methodsessionAttribute
- The name of the session variable where the value of the parameter specified by the requestParameter should be stored.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the value of the parameter.
- Throws:
javax.servlet.ServletException
-
getRequestGlobalVariable
public String getRequestGlobalVariable(String requestParameter, String sessionAttribute) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
- See Also:
getRequestGlobalVariable(String,String,RequestFilter)
-
getRequestGlobalVariable
public String getRequestGlobalVariable(String requestParameter, String sessionAttribute, RequestFilter requestFilter) throws javax.servlet.ServletException
Returns the value of the requestParameter passed to the servlet by the HTTP GET/POST method. If this parameter is not found among the ones submitted to the servlet, it then tries to return the session value specified by the sessionAttribute parameter. If none are found an empty string is returned. Before returning the final value it also clears the session variable with the name specified by sessionAtribute parameter and sets its value to whatever value is being returned.- Parameters:
requestParameter
- The name of the parameter to be retrieved from the parameters passed to the servlet by the HTTP GET/POST method.sessionAttribute
- The name of the parameter to be retrieved from the session variable in case the requestParameter is not found.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the value of the parameter.
- Throws:
javax.servlet.ServletException
-
getRequiredInputGlobalVariable
public String getRequiredInputGlobalVariable(String requestParameter, String sessionAttribute, String defaultStr) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
- See Also:
getRequiredInputGlobalVariable(String,String,String,RequestFilter)
-
getRequiredInputGlobalVariable
public String getRequiredInputGlobalVariable(String requestParameter, String sessionAttribute, String defaultStr, RequestFilter requestFilter) throws javax.servlet.ServletException
Returns the value of the requestParameter passed to the servlet by the HTTP GET/POST method. If this parameter is not found among the ones submitted to the servlet, it then tries to return the session value specified by the sessionAttribute parameter. If none are found the value of defaultStr parameter is returned. Before returning the final value it also clears the session variable with the name specified by sessionAtribute parameter and sets its value to whatever value is being returned.- Parameters:
requestParameter
- The name of the parameter to be retrieved from the parameters passed to the servlet by the HTTP GET/POST method.sessionAttribute
- The name of the parameter to be retrieved from the session variable in case the requestParameter is not found.defaultStr
- The value returned by the method will take this value in case the parameter value is not found within the sought locations.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the value of the parameter.
- Throws:
javax.servlet.ServletException
-
getInGlobalVariable
@Deprecated public String getInGlobalVariable(String requestParameter, String sessionAttribute, String defaultValue) throws javax.servlet.ServletException
Deprecated.- Throws:
javax.servlet.ServletException
- See Also:
getInGlobalVariable(String,String,String,RequestFilter)
-
getInGlobalVariable
public String getInGlobalVariable(String requestParameter, String sessionAttribute, String defaultValue, RequestFilter requestFilter) throws javax.servlet.ServletException
Returns the set of comma separated values passed to the servlet by the HTTP GET/POST method. If this parameter is not found among the ones submitted to the servlet, it then tries to return the session value specified by the sessionAttribute parameter. Before returning the final value it also saves it to the session variable with the name specified by sessionAtribute parameter.- Parameters:
requestParameter
- The name of the parameter to be retrieved from the parameters passed to the servlet by the HTTP GET/POST method.sessionAttribute
- The name of the parameter to be retrieved from the session variable in case the requestParameter is not found.defaultValue
- The value returned by the method will take this value in case the parameter value is not found within the sought locations.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the set of comma separated values within parentheses. For example ('value1', 'value2').
- Throws:
javax.servlet.ServletException
-
getInGlobalVariable
@Deprecated public String getInGlobalVariable(String requestParameter, String sessionAttribute) throws javax.servlet.ServletException
Deprecated.- Throws:
javax.servlet.ServletException
- See Also:
getInGlobalVariable(String,String,RequestFilter)
-
getInGlobalVariable
public String getInGlobalVariable(String requestParameter, String sessionAttribute, RequestFilter requestFilter) throws javax.servlet.ServletException
Returns the set of comma separated values passed to the servlet by the HTTP GET/POST method. If this parameter is not found among the ones submitted to the servlet, it then tries to return the session value specified by the sessionAttribute parameter. If not found here, it throws an exception. If successful, it also saves the return to the session variable with the name specified by sessionAtribute parameter.- Parameters:
requestParameter
- The name of the parameter to be retrieved from the parameters passed to the servlet by the HTTP GET/POST method.sessionAttribute
- The name of the parameter to be retrieved from the session variable in case the requestParameter is not found.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the set of comma separated values within parentheses. For example ('value1', 'value2').
- Throws:
javax.servlet.ServletException
-
getRequiredInGlobalVariable
@Deprecated public String getRequiredInGlobalVariable(String requestParameter, String sessionAttribute) throws javax.servlet.ServletException
Deprecated.- Throws:
javax.servlet.ServletException
- See Also:
getRequiredInGlobalVariable(String,String,RequestFilter)
-
getRequiredInGlobalVariable
public String getRequiredInGlobalVariable(String requestParameter, String sessionAttribute, RequestFilter requestFilter) throws javax.servlet.ServletException
Returns the set of comma separated values passed to the servlet by the HTTP GET/POST method. If not found, it throws an exception. If successful, it also saves the return to the session variable with the name specified by sessionAtribute parameter.- Parameters:
requestParameter
- The name of the parameter to be retrieved from the parameters passed to the servlet by the HTTP GET/POST method.sessionAttribute
- The name of the session variable to set the value to in case the parameter value is successfully found.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the set of comma separated values within parentheses. For example ('value1', 'value2').
- Throws:
javax.servlet.ServletException
-
getRequestInGlobalVariable
@Deprecated public String getRequestInGlobalVariable(String requestParameter, String sessionAttribute) throws javax.servlet.ServletException
Deprecated.- Throws:
javax.servlet.ServletException
- See Also:
getRequestInGlobalVariable(String,String,RequestFilter)
-
getRequestInGlobalVariable
public String getRequestInGlobalVariable(String requestParameter, String sessionAttribute, RequestFilter requestFilter) throws javax.servlet.ServletException
Returns the set of comma separated values passed to the servlet by the HTTP GET/POST method. If found, it saves the value into a session variable specified by the sessionAttribute parameter adn returns it. If not found, it clears the session variable specified by the sessionAttribute parameter and returns an empty string.- Parameters:
requestParameter
- The name of the parameter to be retrieved from the parameters passed to the servlet by the HTTP GET/POST method.sessionAttribute
- The name of the session variable to clear in case the above parameter does not exist.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the set of comma separated values within parentheses. For example ('value1', 'value2').
- Throws:
javax.servlet.ServletException
-
getStringParameter
public String getStringParameter(String parameter, String defaultValue, RequestFilter requestFilter)
Retrieves a single parameter value passed to the servlet by the HTTP GET/POST method. If value is not found among submitted data, the defaultValue will be returned.- Parameters:
parameter
- The name of the parameter that needs to be retrieved.defaultValue
- Value to be returned in case the parameter was not passed to the servlet.- Returns:
- String containing the value of the parameter passed to the servlet by the HTTP GET/POST method.
-
getNumericParameter
public String getNumericParameter(String parameter) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
-
getNumericParameter
public String getNumericParameter(String parameter, String defaultValue) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
-
getRequiredNumericParameter
public String getRequiredNumericParameter(String parameter) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
-
getRequiredNumericParameter
public String getRequiredNumericParameter(String parameter, String defaultValue) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
-
getNumericGlobalVariable
public String getNumericGlobalVariable(String requestParameter, String sessionAttribute, String defaultValue) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
- See Also:
getGlobalVariable(String,String,String)
-
getNumericRequestGlobalVariable
public String getNumericRequestGlobalVariable(String requestParameter, String sessionAttribute) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
- See Also:
getRequestGlobalVariable(String,String)
-
getStringParameter
public String getStringParameter(String parameter)
- See Also:
getStringParameter(String,RequestFilter)
-
getStringParameter
public String getStringParameter(String parameter, RequestFilter requestFilter)
Retrieves a single parameter value passed to the servlet by the HTTP GET/POST method. If value is not found among submitted data, an empty string is returned.- Parameters:
parameter
- The name of the parameter to be retrieved.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String with the value of the parameter. If value is not found among submitted data, an empty string is returned.
-
getRequiredStringParameter
public String getRequiredStringParameter(String parameter) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
- See Also:
getRequiredStringParameter(String,RequestFilter)
-
getRequiredStringParameter
public String getRequiredStringParameter(String parameter, RequestFilter requestFilter) throws javax.servlet.ServletException
Retrieves the single parameter value passed to the servlet by the HTTP GET/POST method. If value is not found among submitted data, a ServletException is thrown.- Parameters:
parameter
- The name of the parameter to be retrieved.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String with the value of the parameter.
- Throws:
javax.servlet.ServletException
-
getStringParameter
public String getStringParameter(String parameter, boolean required, String defaultValue) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
- See Also:
getStringParameter(String,boolean,String,RequestFilter)
-
getStringParameter
public String getStringParameter(String parameter, boolean required, String defaultValue, RequestFilter requestFilter) throws javax.servlet.ServletException
Retrieves the single parameter value passed to the servlet by the HTTP GET/POST method.- Parameters:
parameter
- The name of the parameter to be retrieved.required
- If true, method throws an exception if the value of the parameter is not found in the submitted data.defaultValue
- If parameter is not required, this will be the default value the parameter will take if not found in the submitted data.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String with the value of the parameter.
- Throws:
javax.servlet.ServletException
-
getInParameter
@Deprecated public String getInParameter(String parameter, String defaultValue) throws javax.servlet.ServletException
Deprecated.- Throws:
javax.servlet.ServletException
- See Also:
getInParameter(String,String,RequestFilter)
-
getInParameter
public String getInParameter(String parameter, String defaultValue, RequestFilter requestFilter) throws javax.servlet.ServletException
Retrieves the set of values for the parameter with the specified name as passed to the servlet by the HTTP POST method. String returned is in the form (value1,value2,...) and can be used within SQL statements as part of the 'WHERE columnName IN' filter which is the main purpose of this method. Note that the values are specified as they are, no quotation marks. If there is no such parameter for this entry, the defaultValue is returned.- Parameters:
parameter
- Name of the parameter to be retrieved.defaultValue
- The value that will be returned in case the parameter is not found among the data submitted to the servlet.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the set of values in the form (value1,value2,...).
- Throws:
javax.servlet.ServletException
-
getInParameter
@Deprecated public String getInParameter(String parameter) throws javax.servlet.ServletException
Deprecated.- Throws:
javax.servlet.ServletException
- See Also:
getInParameter(String,RequestFilter)
-
getInParameter
public String getInParameter(String parameter, RequestFilter requestFilter) throws javax.servlet.ServletException
Retrieves the set of values for the parameter with the specified name as passed to the servlet by the HTTP POST method. String returned is in the form (value1,value2,...) and can be used within SQL statements as part of the 'WHERE columnName IN' filter which is the main purpose of this method. Note that the values are specified as they are, no quotation marks. If there is no such parameter for this entry, an empty string is returned.- Parameters:
parameter
- Name of the parameter to be retrieved.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the set of values in the form (value1,value2,...).
- Throws:
javax.servlet.ServletException
-
getRequiredInParameter
@Deprecated public String getRequiredInParameter(String parameter) throws javax.servlet.ServletException
Deprecated.- Throws:
javax.servlet.ServletException
- See Also:
getRequiredInParameter(String,RequestFilter)
-
getRequiredInParameter
public String getRequiredInParameter(String parameter, RequestFilter requestFilter) throws javax.servlet.ServletException
Retrieves the set of values for the parameter with the specified name as passed to the servlet by the HTTP POST method. String returned is in the form (value1,value2,...) and can be used within SQL statements as part of the 'WHERE columnName IN' filter which is the main purpose of this method. Note that the values are specified as they are, no quotation marks. If there is no such parameter for this entry an exception is thrown.- Parameters:
parameter
- Name of the parameter to be retrieved.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the set of values in the form (value1,value2,...).
- Throws:
javax.servlet.ServletException
-
getInParameter
@Deprecated public String getInParameter(String parameter, boolean required, String defaultValue) throws javax.servlet.ServletException
Deprecated.- Throws:
javax.servlet.ServletException
- See Also:
getInParameter(String,boolean,String,RequestFilter)
-
getInParameter
public String getInParameter(String parameter, boolean required, String defaultValue, RequestFilter requestFilter) throws javax.servlet.ServletException
Retrieves the set of values for the parameter with the specified name as passed to the servlet by the HTTP POST method. String returned is in the form (value1,value2,...) and can be used within SQL statements as part of the 'WHERE columnName IN' filter which is the main purpose of this method. Note that the values are specified as they are, no quotation marks. If there is no such parameter for this entry, then if it is required, an exception is thrown, or if not the defaultValue is returned.- Parameters:
parameter
- Name of the parameter to be retrieved.required
- If true, an exception is thrown if the parameter is not among the data submitted to the servlet.defaultValue
- If not required, this is the value that will be returned in case the parameter is not found among the data submitted to the servlet.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the set of values in the form (value1,value2,...).
- Throws:
javax.servlet.ServletException
-
getInStringParameter
@Deprecated public String getInStringParameter(String parameter, String defaultValue) throws javax.servlet.ServletException
Deprecated.- Throws:
javax.servlet.ServletException
- See Also:
getInStringParameter(String,String,RequestFilter)
-
getInStringParameter
public String getInStringParameter(String parameter, String defaultValue, RequestFilter requestFilter) throws javax.servlet.ServletException
Retrieves the set of string values for the parameter with the specified name as passed to the servlet by the HTTP POST method. String returned is in the form ('value1', 'value2',...) and can be used within SQL statements as part of the 'WHERE columnName IN' filter which is the main purpose of this method. Note that the values are specified within single quotation marks. If there is no such parameter for this entry, the defaultValue is returned.- Parameters:
parameter
- Name of the parameter to be retrieved.defaultValue
- In case the parameter is not found among the data submitted to the servlet, this value is returnedrequestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the set of values in the form ('value1', 'value2',...).
- Throws:
javax.servlet.ServletException
-
getInStringParameter
@Deprecated public String getInStringParameter(String parameter) throws javax.servlet.ServletException
Deprecated.- Throws:
javax.servlet.ServletException
- See Also:
getInStringParameter(String,RequestFilter)
-
getInStringParameter
public String getInStringParameter(String parameter, RequestFilter requestFilter) throws javax.servlet.ServletException
Retrieves the set of string values for the parameter with the specified name as passed to the servlet by the HTTP POST method. String returned is in the form ('value1', 'value2',...) and can be used within SQL statements as part of the 'WHERE columnName IN' filter which is the main purpose of this method. Note that the values are specified within single quotation marks. If there is no such parameter for this entry, an empty string is returned.- Parameters:
parameter
- Name of the parameter to be retrieved.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the set of values in the form ('value1', 'value2',...).
- Throws:
javax.servlet.ServletException
-
getRequiredInStringParameter
@Deprecated public String getRequiredInStringParameter(String parameter) throws javax.servlet.ServletException
Deprecated.- Throws:
javax.servlet.ServletException
- See Also:
getRequiredInStringParameter(String,RequestFilter)
-
hasParameter
public boolean hasParameter(String parameter)
Checks if a certain parameter is defined in the variables base.- Parameters:
parameter
- the parameter to check- Returns:
- true if a value is present, false otherwise
-
getParameterNames
public Enumeration<String> getParameterNames()
- Returns:
- the parameter names of the request object
-
getRequiredInStringParameter
public String getRequiredInStringParameter(String parameter, RequestFilter requestFilter) throws javax.servlet.ServletException
Retrieves the set of string values for the parameter with the specified name as passed to the servlet by the HTTP POST method. String returned is in the form ('value1', 'value2',...) and can be used within SQL statements as part of the 'WHERE columnName IN' filter which is the main purpose of this method. Note that the values are specified within single quotation marks. If there is no such parameter for this entry, an exception is thrown.- Parameters:
parameter
- Name of the parameter to be retrieved.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the set of values in the form ('value1', 'value2',...).
- Throws:
javax.servlet.ServletException
-
getInStringParameter
@Deprecated public String getInStringParameter(String parameter, boolean required, String defaultValue) throws javax.servlet.ServletException
Deprecated.- Throws:
javax.servlet.ServletException
- See Also:
getInStringParameter(String,boolean,String,RequestFilter)
-
getInStringParameter
public String getInStringParameter(String parameter, boolean required, String defaultValue, RequestFilter requestFilter) throws javax.servlet.ServletException
Retrieves the set of string values for the parameter with the specified name as passed to the servlet by the HTTP POST method. String returned is in the form ('value1', 'value2',...) and can be used within SQL statements as part of the 'WHERE columnName IN' filter which is the main purpose of this method. Note that the values are specified within single quotation marks. If there is no such parameter for this entry, then if it is required, an exception is thrown, or if not the defaultValue is returned.- Parameters:
parameter
- Name of the parameter to be retrievedrequired
- If true, an exception is thrown if the parameter is not among the data submitted to the servlet.defaultValue
- If not required, this is the value that will be returned in case the parameter is not found among the data submitted to the servlet.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the set of values in the form ('value1', 'value2',...)
- Throws:
javax.servlet.ServletException
-
getMultiValueStringParameter
public String[] getMultiValueStringParameter(String parameter, boolean required, RequestFilter requestFilter) throws javax.servlet.ServletException
Retrieves the set of string values for the parameter with the specified name as passed to the servlet by the HTTP POST/GET method. The parameter must be a multi-valued parameter. If the parameter is not set then a String[0] is returned.- Parameters:
parameter
- Name of the parameter to be retrievedrequired
- If true, an exception is thrown if the parameter is not among the data submitted to the servlet.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- returns a String array with the values present in the request, if the parameter has no value then String[0] is returned.
- Throws:
javax.servlet.ServletException
-
getSessionValue
public String getSessionValue(String sessionAttribute)
Retrieve a value specified by the sessionAttribute parameter from the session variables. If not found, an empty string is returned.- Parameters:
sessionAttribute
- The name of the session variable to be retrieved.- Returns:
- String with the value of the session variable.
-
getSessionValue
public String getSessionValue(String sessionAttribute, String defaultValue)
Retrieve a value specified by the sessionAttribute parameter from the session variables. If not found, the defaultValue is returned.- Parameters:
sessionAttribute
- The name of the session variable to be retrieved.defaultValue
- The value to be returned in case the session variable does not exist.- Returns:
- String with the value of the session variable.
-
setSessionValue
public void setSessionValue(String attribute, String value)
Store a variable and its value into the session as specified by the parameters.- Parameters:
attribute
- The name of the session variable to be set.value
- The value of the session variable to set.
-
removeSessionValue
public void removeSessionValue(String attribute)
Remove a variable and its value from the session.- Parameters:
attribute
- The name of the session variable to remove
-
getSessionObject
public Object getSessionObject(String sessionAttribute)
Retrieve an object from the session.- Parameters:
sessionAttribute
- The name of the object to retrieve.- Returns:
- Object containing the requested object.
-
setSessionObject
public void setSessionObject(String attribute, Serializable value)
Save an object and its value to the session.- Parameters:
attribute
- The name of the object to be stored.value
- The value of the object to store.
-
setSessionObject
@Deprecated public void setSessionObject(String attribute, Object value)
Deprecated.OnlySerializable
objects should be set in session: usesetSessionObject(String, Serializable)
instead
-
clearSession
public void clearSession(boolean all)
Clear session variables.- Parameters:
all
- If false, one session variable named TARGET is kept otherwise all session variables are erased.
-
clearSession
public void clearSession(Predicate<String> removeFilter)
Clear the session variables indicated by the given predicate.- Parameters:
removeFilter
- Indicates the session variables that should be cleared
-
getListFromInString
public Vector<String> getListFromInString(String _strList)
Convert a list specified as a comma separated list within parentheses into a Vector of individual values. Strips parentheses and single quotes. For example, a string like ('1000022', '1000344') becomes a Vector with two values: 1000022 and 1000344.- Parameters:
_strList
- String representing a comma separated list of values.- Returns:
- A Vector of individual values.
-
getMultiParameter
public String getMultiParameter(String parameter)
- See Also:
getMultiParameter(String,RequestFilter)
-
getMultiParameter
public String getMultiParameter(String parameter, RequestFilter requestFilter)
Retrieve a parameter passed to the servlet as part of a multi part content.- Parameters:
parameter
- the name of the parameter to be retrievedrequestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String containing the value of the parameter. Empty string if the content is not multipart or the parameter is not found.
-
getMultiParameters
public String[] getMultiParameters(String parameter)
- See Also:
getMultiParameters(String,RequestFilter)
-
getMultiParameters
public String[] getMultiParameters(String parameter, RequestFilter requestFilter)
Retrieve a set of values belonging to a parameter passed to the servlet as part of a multi part content.- Parameters:
parameter
- The name of the parameter to be retrieved.requestFilter
- filter used to validate the input against list of allowed inputs- Returns:
- String array containing the values of the parameter. Empty string if the content is not multipart.
-
getMultiFile
public org.apache.commons.fileupload.FileItem getMultiFile(String parameter)
Retrieve a deserialized file passed to the servlet as a parameter and part of a multi part content.- Parameters:
parameter
- The name of the parameter that contains the file- Returns:
- FileItem object containing the file content
-
-