Package overit.geocall.servlet
Class WebParameters
java.lang.Object
java.util.AbstractMap
java.util.HashMap
overit.geocall.servlet.WebParameters
- All Implemented Interfaces:
Serializable,Cloneable,Map,Getter
This class represents the http parameters of a
Every WebParameters object implements the
GET or a POST session. Every WebParameters object implements the
Getter interface and adds also indexed methods
in order to access the i-th parameter of a session.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringprotected PropertyGetterprotected overit.geocall.servlet.WebParametersErrorprotected HttpServletprotected overit.geocall.servlet.Referenceprotected Stringprotected static Stringprotected overit.geocall.servlet.UserAgentprotected Principal -
Constructor Summary
ConstructorsConstructorDescriptionWebParameters(HttpServletRequest hsr, HttpServlet hs) Main constructor that creates a WebParameters starting from a standard javaHttpServletRequestand anHttpServlet -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanbooleanValue(Object value, int i, boolean def) Converts a parameter in the http parameter liststatic BooleanbooleanValue(Object value, int i, Boolean def) Converts a parameter in the http parameter listbooleancontainsKey(String key) Checks if in theGetterthere is an entry with the kay passed as parameterstatic DatedateValue(Object value, int i, Date def, SimpleDateFormat sdf) Converts a parameter in the http parameter liststatic doubledoublevalue(Object value, int i, double def) Converts a parameter in the http parameter liststatic DoubledoubleValue(Object value, int i, Double def) Converts a parameter in the http parameter listfloatfloatValue(Object value, int i, float def) Converts a parameter in the http parameter liststatic FloatfloatValue(Object value, int i, Float def) Converts a parameter in the http parameter listExtracts the object corresponding to the key from the WebParameters.Extracts the object corresponding to the key from the WebParameters.Returns the value of the http header "Accept-Language"booleangetboolean(String key, boolean def) Represents a shortcut for the equivalent indexed method assuming the index to 0 (getdouble(java.lang.String, int, double)).booleangetboolean(String key, int i, boolean def) Retrieves a parameter from the list of http parameters and converts it appropriatelygetBoolean(String key, int i, Boolean def) Retrieves a parameter from the list of http parameters and converts it appropriatelygetBoolean(String key, Boolean def) Represents a shortcut for the equivalent indexed method assuming the index to 0 (getBoolean(java.lang.String, int, java.lang.Boolean)).Returns aPropertyGettercontaining all of theCookieobjects the client sent with this request.getDate(String key, int i, Date def, SimpleDateFormat sdf) Retrieves a parameter from the list of http parameters and converts it appropriatelygetDate(String key, Date def, SimpleDateFormat sdf) Represents a shortcut for the equivalent indexed method assuming the index to 0 (getDate(java.lang.String, int, java.util.Date, java.text.SimpleDateFormat)).doubleRepresents a shortcut for the equivalent indexed method assuming the index to 0 (getdouble(java.lang.String, int, double)).doubleRetrieves a parameter from the list of http parameters and converts it appropriatelyRetrieves a parameter from the list of http parameters and converts it appropriatelyRepresents a shortcut for the equivalent indexed method assuming the index to 0 (getDouble(java.lang.String, int, java.lang.Double)).getError()Returns theWebParametersError.errorRetrieves a parameter from the list of http parameters and converts it appropriatelyUpFile[]Retrieves a parameter from the list of http parameters and converts it appropriatelyfloatRepresents a shortcut for the equivalent indexed method assuming the index to 0 (getfloat(java.lang.String, int, float)).floatRetrieves a parameter from the list of http parameters and converts it appropriatelyRetrieves a parameter from the list of http parameters and converts it appropriatelyRepresents a shortcut for the equivalent indexed method assuming the index to 0 (getFloat(java.lang.String, int, java.lang.Float)).intRepresents a shortcut for the equivalent indexed method assuming the index to 0 (getdouble(java.lang.String, int, double)).intRetrieves a parameter from the list of http parameters and converts it appropriatelygetInteger(String key, int i, Integer def) Retrieves a parameter from the list of http parameters and converts it appropriatelygetInteger(String key, Integer def) Represents a shortcut for the equivalent indexed method assuming the index to 0 (getdouble(java.lang.String, int, double)).longRetrieves a parameter from the list of http parameters and converts it appropriatelylongRepresents a shortcut for the equivalent indexed method assuming the index to 0 (getlong(java.lang.String, int, long)).Retrieves a parameter from the list of http parameters and converts it appropriatelyRepresents a shortcut for the equivalent indexed method assuming the index to 0 (getLong(java.lang.String, int, java.lang.Long)).overit.geocall.servlet.ReferenceReturns theReferencecreated starting from theHttpServletRequestReturns the IP address of the client or last proxy that sent the requestReturns the file used to trace the interactionDeprecated.Retrieves a parameter from the list of http parameters and converts it appropriatelyRepresents a shortcut for the equivalent indexed method assuming the index to 0 (getString(java.lang.String, int, java.lang.String)).String[]getStringArray(String key) Allows to retrieve the entire array of string parameters with a certain nameoverit.geocall.servlet.UserAgentReturns theUserAgent, ie the parser that can recognize the user Agent.Returns thePrincipalof theHttpServletRequest, ie the object containing the name of the current authenticated useroverit.geocall.servlet.WebParametersErrorReturns theWebParametersErrorobject, the one that defines any errorsstatic intConverts a parameter in the http parameter liststatic IntegerConverts a parameter in the http parameter listExtracts an Iterator that allows you to browse through all the elements of the WebParametrsstatic intReturns the number of parameters equals to the one passed to the methodintReturns the number of parameters with the same namestatic LongConverts a parameter in the http parameter listvoidSanitize collected values by removing those that should not be kept in memory/session (e.g.voidsetRequestTraceFile(String requestTraceFile) Sets the file used to trace the interactionstatic StringstringValue(Object value, int i, String def) Converts a parameter in the http parameter listReturns the string version of the WebParameters formatted as requesttoString()Returns the string version of the WebParametersMethods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode
-
Field Details
-
_requestTraceFile
-
_userAgent
protected overit.geocall.servlet.UserAgent _userAgent -
_hs
-
_ref
protected overit.geocall.servlet.Reference _ref -
_error
protected overit.geocall.servlet.WebParametersError _error -
_userPrincipal
-
_agentHeader
-
_cookies
-
_remoteAddress
-
_acceptLanguage
-
-
Constructor Details
-
WebParameters
Main constructor that creates a WebParameters starting from a standard javaHttpServletRequestand anHttpServlet- Parameters:
hsr- Instance of the http request as passed to theGETorPOSTServlet methodshs- TheHttpServletinstance
-
-
Method Details
-
getRequestTraceFile
Returns the file used to trace the interaction- Returns:
- The path of the file used to trace
-
setRequestTraceFile
Sets the file used to trace the interaction- Parameters:
requestTraceFile- The path of the file used to trace
-
getUserAgent
public overit.geocall.servlet.UserAgent getUserAgent()Returns theUserAgent, ie the parser that can recognize the user Agent. It returns a new parser for every WebParameters object, so it is preferable to use the one stored in the Identity- Returns:
- The
UserAgentthat can recognize the User Agent
-
getError
Returns theWebParametersError.error- Returns:
- Returns the
WebParametersError.error, ornull
-
getWebParametersError
public overit.geocall.servlet.WebParametersError getWebParametersError()Returns theWebParametersErrorobject, the one that defines any errors- Returns:
- Returns the
WebParametersErrorobject
-
getStringArray
Allows to retrieve the entire array of string parameters with a certain name- Parameters:
key- Name of the parameter or parameters- Returns:
- The array of parameters with that name
-
getString
Retrieves a parameter from the list of http parameters and converts it appropriately- Parameters:
key- Parameter name in the http parameter listi- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The required parameter appropriately converted to String
-
stringValue
Converts a parameter in the http parameter list- Parameters:
value- The value to converti- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The parameter appropriately converted to String
-
getString
Represents a shortcut for the equivalent indexed method assuming the index to 0 (getString(java.lang.String, int, java.lang.String)). This method should be used if the parameter you are looking for is not a multiple parameter.
Implements theGetterinterface -
getLong
Retrieves a parameter from the list of http parameters and converts it appropriately- Parameters:
key- Parameter name in the http parameter listi- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The required parameter appropriately converted to Long
-
longValue
Converts a parameter in the http parameter list- Parameters:
value- The value to converti- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The parameter appropriately converted to Long
-
getDouble
Retrieves a parameter from the list of http parameters and converts it appropriately- Parameters:
key- Parameter name in the http parameter listi- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The required parameter appropriately converted to Double
-
doubleValue
Converts a parameter in the http parameter list- Parameters:
value- The value to converti- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The parameter appropriately converted to Double
-
getDouble
Represents a shortcut for the equivalent indexed method assuming the index to 0 (getDouble(java.lang.String, int, java.lang.Double)). This method should be used if the parameter you are looking for is not a multiple parameter.
Implements theGetterinterface -
getdouble
Retrieves a parameter from the list of http parameters and converts it appropriately- Parameters:
key- Parameter name in the http parameter listi- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The required parameter appropriately converted to double
-
doublevalue
Converts a parameter in the http parameter list- Parameters:
value- The value to converti- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The parameter appropriately converted to double
-
getdouble
Represents a shortcut for the equivalent indexed method assuming the index to 0 (getdouble(java.lang.String, int, double)). This method should be used if the parameter you are looking for is not a multiple parameter.
Implements theGetterinterface -
getBoolean
Retrieves a parameter from the list of http parameters and converts it appropriately- Parameters:
key- Parameter name in the http parameter listi- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The required parameter appropriately converted to Boolean
-
booleanValue
Converts a parameter in the http parameter list- Parameters:
value- The value to converti- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The parameter appropriately converted to Boolean
-
getBoolean
Represents a shortcut for the equivalent indexed method assuming the index to 0 (getBoolean(java.lang.String, int, java.lang.Boolean)). This method should be used if the parameter you are looking for is not a multiple parameter.
Implements theGetterinterface- Specified by:
getBooleanin interfaceGetter- Parameters:
key- Parameter name in the http parameter listdef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The required parameter appropriately converted to Boolean
-
getboolean
Retrieves a parameter from the list of http parameters and converts it appropriately- Parameters:
key- Parameter name in the http parameter listi- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The required parameter appropriately converted to boolean
-
booleanValue
Converts a parameter in the http parameter list- Parameters:
value- The value to converti- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The parameter appropriately converted to boolean
-
getboolean
Represents a shortcut for the equivalent indexed method assuming the index to 0 (getdouble(java.lang.String, int, double)). This method should be used if the parameter you are looking for is not a multiple parameter.
Implements theGetterinterface- Specified by:
getbooleanin interfaceGetter- Parameters:
key- Parameter name in the http parameter listdef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The required parameter appropriately converted to boolean
-
getInteger
Retrieves a parameter from the list of http parameters and converts it appropriately- Parameters:
key- Parameter name in the http parameter listi- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The required parameter appropriately converted to Integer
-
intValue
Converts a parameter in the http parameter list- Parameters:
value- The value to converti- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The parameter appropriately converted to Integer
-
getInteger
Represents a shortcut for the equivalent indexed method assuming the index to 0 (getdouble(java.lang.String, int, double)). This method should be used if the parameter you are looking for is not a multiple parameter.
Implements theGetterinterface- Specified by:
getIntegerin interfaceGetter- Parameters:
key- Parameter name in the http parameter listdef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The required parameter appropriately converted to Integer
-
getint
Retrieves a parameter from the list of http parameters and converts it appropriately- Parameters:
key- Parameter name in the http parameter listi- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The required parameter appropriately converted to int
-
intvalue
Converts a parameter in the http parameter list- Parameters:
value- The value to converti- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The parameter appropriately converted to int
-
getint
Represents a shortcut for the equivalent indexed method assuming the index to 0 (getdouble(java.lang.String, int, double)). This method should be used if the parameter you are looking for is not a multiple parameter.
Implements theGetterinterface -
getDate
Retrieves a parameter from the list of http parameters and converts it appropriately- Parameters:
key- Parameter name in the http parameter listi- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not validsdf- TheSimpleDateFormatthat defines the format for the conversion- Returns:
- The required parameter appropriately converted to Date
-
dateValue
Converts a parameter in the http parameter list- Parameters:
value- The value to converti- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not validsdf- TheSimpleDateFormatthat defines the format for the conversion- Returns:
- The parameter appropriately converted to Date
-
getDate
Represents a shortcut for the equivalent indexed method assuming the index to 0 (getDate(java.lang.String, int, java.util.Date, java.text.SimpleDateFormat)). This method should be used if the parameter you are looking for is not a multiple parameter.
Implements theGetterinterface- Specified by:
getDatein interfaceGetter- Parameters:
key- Parameter name in the http parameter listdef- Default value, returned in case the required parameter does not exist or is not validsdf- TheSimpleDateFormatthat defines the format for the conversion- Returns:
- The required parameter appropriately converted to Date
-
length
Returns the number of parameters with the same name- Parameters:
key- Name of the parameter searched- Returns:
- Number of parameters with the same name
-
length
Returns the number of parameters equals to the one passed to the method- Parameters:
value- The parameter searched- Returns:
- Number of equal parameters
-
getFloat
Retrieves a parameter from the list of http parameters and converts it appropriately- Parameters:
key- Parameter name in the http parameter listi- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The required parameter appropriately converted to Float
-
floatValue
Converts a parameter in the http parameter list- Parameters:
value- The value to converti- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The parameter appropriately converted to Float
-
floatValue
Converts a parameter in the http parameter list- Parameters:
value- The value to converti- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The parameter appropriately converted to float
-
getfloat
Retrieves a parameter from the list of http parameters and converts it appropriately- Parameters:
key- Parameter name in the http parameter listi- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The required parameter appropriately converted to float
-
getlong
Retrieves a parameter from the list of http parameters and converts it appropriately- Parameters:
key- Parameter name in the http parameter listi- Index of the i-th parameter with the same namedef- Default value, returned in case the required parameter does not exist or is not valid- Returns:
- The required parameter appropriately converted to long
-
getFloat
Represents a shortcut for the equivalent indexed method assuming the index to 0 (getFloat(java.lang.String, int, java.lang.Float)). This method should be used if the parameter you are looking for is not a multiple parameter.
Implements theGetterinterface -
getLong
Represents a shortcut for the equivalent indexed method assuming the index to 0 (getLong(java.lang.String, int, java.lang.Long)). This method should be used if the parameter you are looking for is not a multiple parameter.
Implements theGetterinterface -
getfloat
Represents a shortcut for the equivalent indexed method assuming the index to 0 (getfloat(java.lang.String, int, float)). This method should be used if the parameter you are looking for is not a multiple parameter.
Implements theGetterinterface -
getlong
Represents a shortcut for the equivalent indexed method assuming the index to 0 (getlong(java.lang.String, int, long)). This method should be used if the parameter you are looking for is not a multiple parameter.
Implements theGetterinterface -
keyIterator
Extracts an Iterator that allows you to browse through all the elements of the WebParametrs- Specified by:
keyIteratorin interfaceGetter- Returns:
- The iterator over the WebParameters elements
-
get
Extracts the object corresponding to the key from the WebParameters. In this case no default is provided. -
get
Extracts the object corresponding to the key from the WebParameters. If the object does not exists, it returns the default one. -
containsKey
Checks if in theGetterthere is an entry with the kay passed as parameter- Specified by:
containsKeyin interfaceGetter- Parameters:
key- The key to check- Returns:
trueif there is at least one entry with the specified key,falseotherwise specificata, false in caso contrario.
-
getServlet
Deprecated.Needed by the Axis engine to know the Servlet and retrieve the list of deploied services- Returns:
- The
HttpServlet
-
getUserPrincipal
Returns thePrincipalof theHttpServletRequest, ie the object containing the name of the current authenticated user- Returns:
- The object that contains the name of the current authenticated user
-
toString
Returns the string version of the WebParameters- Overrides:
toStringin classAbstractMap- Returns:
- The string that represents the Webparameters
-
toRequestString
Returns the string version of the WebParameters formatted as request- Returns:
- The string that represents the Webparameters
-
getFile
Retrieves a parameter from the list of http parameters and converts it appropriately- Parameters:
key- Parameter name in the http parameter list- Returns:
- The required parameter appropriately converted to
UpFile
-
getFiles
Retrieves a parameter from the list of http parameters and converts it appropriately- Parameters:
key- Parameter name in the http parameter list- Returns:
- The required parameter appropriately converted to
UpFile
-
getCookies
Returns aPropertyGettercontaining all of theCookieobjects the client sent with this request.- Returns:
- The cookie sent by the client
-
getReference
public overit.geocall.servlet.Reference getReference()Returns theReferencecreated starting from theHttpServletRequest- Returns:
- The
Referencecreated starting from theHttpServletRequest
-
getRemoteAddress
Returns the IP address of the client or last proxy that sent the request- Returns:
- The IP address of the client or last proxy that sent the request
-
getAcceptLanguage
Returns the value of the http header "Accept-Language"- Returns:
- The value of the http header "Accept-Language"
-
sanitizeValues
public void sanitizeValues()Sanitize collected values by removing those that should not be kept in memory/session (e.g. UpFiles)
-