Package com.jk.web.mvc
Class MvcUtil
java.lang.Object
com.jk.web.mvc.MvcUtil
This class provides utility methods for managing Model-View-Controller (MVC)
related operations.
- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Map<String,
MvcUserBinding> This method creates a new empty map for storing MVC user bindings.static jakarta.servlet.http.HttpServletRequest
This method retrieves the current HttpServletRequest for the ongoing request.static jakarta.servlet.http.HttpSession
This method retrieves the current HttpSession for the ongoing session.static jakarta.servlet.ServletContext
This method retrieves the ServletContext associated with the MVC application.static Map<String,
MvcUserBinding> getUserBinding
(jakarta.servlet.http.HttpServletRequest req) This method retrieves the user bindings map associated with the user's session.static void
init
(jakarta.servlet.ServletContext context) This method initializes theMvcUtil
class with theServletContext
.static void
initRequestInfo
(jakarta.servlet.http.HttpServletRequest req) This method initializes request-related information in thread-local storage.
-
Constructor Details
-
MvcUtil
public MvcUtil()
-
-
Method Details
-
init
public static void init(jakarta.servlet.ServletContext context) This method initializes theMvcUtil
class with theServletContext
.- Parameters:
context
- Specifies theServletContext
of the MVC application.
-
createUserBindingMap
This method creates a new empty map for storing MVC user bindings.- Returns:
- an empty map for storing MVC user bindings.
-
getUserBinding
public static Map<String,MvcUserBinding> getUserBinding(jakarta.servlet.http.HttpServletRequest req) This method retrieves the user bindings map associated with the user's session.- Parameters:
req
- Specifies theHttpServletRequest
for the user's session.- Returns:
- the user bindings map associated with the session.
-
initRequestInfo
public static void initRequestInfo(jakarta.servlet.http.HttpServletRequest req) This method initializes request-related information in thread-local storage.- Parameters:
req
- Specifies theHttpServletRequest
for the current request.
-
getServletContext
public static jakarta.servlet.ServletContext getServletContext()This method retrieves the ServletContext associated with the MVC application.- Returns:
- the ServletContext of the MVC application.
-
getCurrentServletRequest
public static jakarta.servlet.http.HttpServletRequest getCurrentServletRequest()This method retrieves the current HttpServletRequest for the ongoing request.- Returns:
- the current HttpServletRequest for the ongoing request.
-
getCurrentSession
public static jakarta.servlet.http.HttpSession getCurrentSession()This method retrieves the current HttpSession for the ongoing session.- Returns:
- the current HttpSession for the ongoing session.
-