Class MvcUtil

java.lang.Object
com.jk.web.mvc.MvcUtil

public class MvcUtil extends Object
This class provides utility methods for managing Model-View-Controller (MVC) related operations.
Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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 the MvcUtil class with the ServletContext.
    static void
    initRequestInfo(jakarta.servlet.http.HttpServletRequest req)
    This method initializes request-related information in thread-local storage.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MvcUtil

      public MvcUtil()
  • Method Details

    • init

      public static void init(jakarta.servlet.ServletContext context)
      This method initializes the MvcUtil class with the ServletContext.
      Parameters:
      context - Specifies the ServletContext of the MVC application.
    • createUserBindingMap

      public static Map<String,MvcUserBinding> 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 the HttpServletRequest 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 the HttpServletRequest 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.