Class BLCRequestUtils
java.lang.Object
org.broadleafcommerce.common.util.BLCRequestUtils
Convenience methods for interacting with the request
- Author:
- bpolster
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Convenience method to obtain the server prefix of the current request.static String
getRequestURIWithoutContext
(jakarta.servlet.http.HttpServletRequest request) static Object
getSessionAttributeIfOk
(org.springframework.web.context.request.WebRequest request, String attribute) TakesisOKtoUseSession(WebRequest)
into account when retrieving session attributes.static String
getURLorHeaderParameter
(org.springframework.web.context.request.WebRequest request, String varName) Get header or url parameter.static boolean
isFilteringIgnoredForUri
(org.springframework.web.context.request.WebRequest request) static boolean
isOKtoUseSession
(org.springframework.web.context.request.WebRequest request) Broadleaf "Resolver" and "Filter" classes may need to know if they are allowed to utilize the session.static void
setIsFilteringIgnoredForUri
(org.springframework.web.context.request.WebRequest request, Boolean value) static void
setOKtoUseSession
(org.springframework.web.context.request.WebRequest request, Boolean value) Sets whether or not Broadleaf can utilize the session in request processing.static boolean
setSessionAttributeIfOk
(org.springframework.web.context.request.WebRequest request, String attribute, Object value) TakesisOKtoUseSession(WebRequest)
into account when setting a session attribute
-
Constructor Details
-
BLCRequestUtils
public BLCRequestUtils()
-
-
Method Details
-
isOKtoUseSession
public static boolean isOKtoUseSession(org.springframework.web.context.request.WebRequest request) Broadleaf "Resolver" and "Filter" classes may need to know if they are allowed to utilize the session. BLC uses a pattern where we will store an attribute in the request indicating whether or not the session can be used. For example, when using the REST APIs, we typically do not want to utilize the session. -
isFilteringIgnoredForUri
public static boolean isFilteringIgnoredForUri(org.springframework.web.context.request.WebRequest request) -
getSessionAttributeIfOk
public static Object getSessionAttributeIfOk(org.springframework.web.context.request.WebRequest request, String attribute) TakesisOKtoUseSession(WebRequest)
into account when retrieving session attributes. If it's not ok, this will return null -
setSessionAttributeIfOk
public static boolean setSessionAttributeIfOk(org.springframework.web.context.request.WebRequest request, String attribute, Object value) TakesisOKtoUseSession(WebRequest)
into account when setting a session attribute- Returns:
- true if this set the session attribute, false otherwise
-
setOKtoUseSession
public static void setOKtoUseSession(org.springframework.web.context.request.WebRequest request, Boolean value) Sets whether or not Broadleaf can utilize the session in request processing. Used by the REST API flow so that RESTful calls do not utilize the session. -
setIsFilteringIgnoredForUri
public static void setIsFilteringIgnoredForUri(org.springframework.web.context.request.WebRequest request, Boolean value) -
getURLorHeaderParameter
public static String getURLorHeaderParameter(org.springframework.web.context.request.WebRequest request, String varName) Get header or url parameter. Will obtain the parameter from a header variable or a URL parameter, preferring header values if they are set. -
getRequestedServerPrefix
Convenience method to obtain the server prefix of the current request. Useful for many modules that configure Relative URL's and need to send absolute URL's to Third Party Gateways. -
getRequestURIWithoutContext
-