Package lumis.portal.servlet
Class ServletUtil
- java.lang.Object
-
- lumis.portal.servlet.ServletUtil
-
public class ServletUtil extends Object
Contains Servlet-related utilities.- Since:
- 6.0.0
- Version:
- $Revision: 24678 $ $Date: 2021-08-21 22:28:26 -0300 (Sat, 21 Aug 2021) $
-
-
Constructor Summary
Constructors Constructor Description ServletUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clearQueryStringParameters(HttpServletRequest request)
Removes cached query string parameters (if any).static String
getApplicationRequestedPath(HttpServletRequest request)
Returns the requested path, relative to the web application root.static String
getQueryStringParameter(HttpServletRequest request, String parameterName)
Tries to read a request parameter from itsquery string
.static Object
getSessionMutex(HttpSession session)
Return the object to synchronize on for the given session.static void
sendMovedPermanentlyWithNoCache(HttpServletResponse response, String location)
Sends aHttpServletResponse.SC_MOVED_PERMANENTLY
status with a no-cache header.
-
-
-
Method Detail
-
getApplicationRequestedPath
public static String getApplicationRequestedPath(HttpServletRequest request)
Returns the requested path, relative to the web application root. This path starts with '/'. Does not include the query string.- Parameters:
request
- the http servlet request.- Returns:
- the path.
- Since:
- 6.0.0
-
getQueryStringParameter
public static String getQueryStringParameter(HttpServletRequest request, String parameterName)
Tries to read a request parameter from itsquery string
. If the parameter has multiple values, any of them may be returned.- Parameters:
request
- the request.parameterName
- the parameter name.- Returns:
- the parameter value, or
null
if it was not found. - Since:
- 8.0.0
-
clearQueryStringParameters
public static void clearQueryStringParameters(HttpServletRequest request)
Removes cached query string parameters (if any).- Parameters:
request
- the request- Since:
- 14.0.0
-
sendMovedPermanentlyWithNoCache
public static void sendMovedPermanentlyWithNoCache(HttpServletResponse response, String location)
Sends aHttpServletResponse.SC_MOVED_PERMANENTLY
status with a no-cache header.The 301 moved permanently HTTP response is cached by default. This method is a utility to send this type of response with caching disabled.
- Parameters:
response
- the response to send the status.location
- the location to set in the response.- Since:
- 10.0.0
-
getSessionMutex
public static Object getSessionMutex(HttpSession session)
Return the object to synchronize on for the given session.- Parameters:
session
- the session.- Returns:
- the mutex object.
-
-