Class RequestMenuSelector

java.lang.Object
com.foreach.across.modules.web.menu.RequestMenuSelector
All Implemented Interfaces:
MenuSelector

public class RequestMenuSelector extends Object implements MenuSelector
Will search a menu for the item that best matches with the requested url. A fallback matching is performed:
  1. lowest item with exact url or path
  2. lowest item with url or path without querystring
  3. lowest item with longest prefix of the requested url
  • Field Details

    • ATTRIBUTE_MATCHERS

      public static final String ATTRIBUTE_MATCHERS
      Attribute on a menu to provide extra matching apart from url and standard path. Value should be a collection of strings.
  • Constructor Details

    • RequestMenuSelector

      public RequestMenuSelector(jakarta.servlet.http.HttpServletRequest request)
    • RequestMenuSelector

      public RequestMenuSelector(String fullUrl, String servletPath, String servletPathWithQueryString)
      Parameters:
      fullUrl - Full url - including schema and querystring.
      servletPath - Path within the application, excluding the querystring.
      servletPathWithQueryString - Path within the application including the querystring.
  • Method Details

    • find

      public Menu find(Menu menu)
      Description copied from interface: MenuSelector
      Search the given Menu for an item that matches the current selector.
      Specified by:
      find in interface MenuSelector
      Parameters:
      menu - Menu tree to search top-down.
      Returns:
      Matching Menu item or null if not found.