Class ScreenLoaderServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
com.isomorphic.servlet.BaseServlet
com.isomorphic.servlet.ScreenLoaderServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

public class ScreenLoaderServlet extends BaseServlet
This servlet returns the Javascript representation of a list of comma separated screens passed in parameter "screenName".
Screens are loaded from files <screenName>.ui.xml. The default location of these files is "$webRoot/shared/ui", but this can be overridden in the server.properties file by specifying property "project.ui", like this:
    project.ui: $webRoot/commonUI,$webRoot/userScreen
 
If a screen file is not found, a warning is logged and nothing is returned
See Also:
  • Method Details

    • processRequest

      public void processRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException
      Servlet entry point to process the request.
      Parameters:
      request - HttpServletRequest object that contains the request the client has made of the servlet.
      response - HttpServletResponse object that contains the response the servlet sends to the client.
      Throws:
      jakarta.servlet.ServletException - if the request could not be handled.
      IOException - if an input or output error is detected when the servlet handles request.
    • addDynamicScreenGenerator

      public static void addDynamicScreenGenerator(DynamicScreenGenerator dsg)
      Registers the parameter DynamicScreenGenerator with the ScreenLoaderServlet system. Whenever the system needs a screen in future, it will first call the DynamicScreenGenerator.getScreen(String) method; only if that method returns null will it proceed to use the normal system for obtaining screen instances.

      NOTE:

      • If you use this API, your DynamicScreenGenerator will be called for every screen that the framework needs. You probably don't want this - see addDynamicScreenGenerator(DynamicScreenGenerator, String) and addDynamicScreenGenerator(DynamicScreenGenerator, Pattern) for APIs that are more likely to be suitable
      • If you use this API anyway, you must be certain to return null for screens that you cannot provide an instance of
      • DynamicScreenGenerator registered using this API are considered the default, and any subsequent call to this method will replace the current default. DynamicScreenGenerator registered using the other APIs are accumulative
      Parameters:
      dsg - A DynamicScreenGenerator to register as the default
    • addDynamicScreenGenerator

      public static void addDynamicScreenGenerator(DynamicScreenGenerator dsg, String prefix)
      Registers the parameter DynamicScreenGenerator with the ScreenLoaderServlet system. The DynamicScreenGenerator will only be called for for screen ID's which start with the parameter prefix.

      You can add multiple DynamicScreenGenerators using this API. If two or more are registered with prefixes that match a given screen ID, the one added first wins. Eg, if you have prefixes "c" and "cust" registered, then the "customer" screen will be provided by whichever of those two DynamicScreenGenerators was registered first. Note that this "earliest first" basis also applies to DynamicScreenGenerators registered with a regexp; if you had a screen ID that matched both a prefix and a regexp, whichever one of the two registrations came first would be used - there is no priority given to one or the other styles of ID matching.

      Parameters:
      dsg - A DynamicScreenGenerator to register as the default
      prefix - A prefix String as described above
    • addDynamicScreenGenerator

      public static void addDynamicScreenGenerator(DynamicScreenGenerator dsg, Pattern regex)
      Registers the parameter DynamicScreenGenerator with the ScreenLoaderServlet system. The DynamicScreenGenerator will only be called for for screen ID's which match the regexp provided in the parameter java.util.regex.Pattern

      You can add multiple DynamicScreenGenerators using this API. If two or more are registered with regular expressions that match a given screen ID, the one added first wins. This also applies to DynamicScreenGenerators registered with a simple prefix String.

      Parameters:
      dsg - A DynamicScreenGenerator to register as the default
      regex - A Pattern representing a regular expression to match against incoming screen IDs
    • removeDynamicScreenGenerator

      public static DynamicScreenGenerator removeDynamicScreenGenerator()
      Removes the default DynamicScreenGenerator
      Returns:
      The DynamicDSGenerator we just removed
    • removeDynamicScreenGenerator

      public static DynamicScreenGenerator removeDynamicScreenGenerator(String prefix)
      Removes the DynamicScreenGenerator registered against the parameter prefix String
      Returns:
      The DynamicScreenGenerator we just removed
    • removeDynamicScreenGenerator

      public static DynamicScreenGenerator removeDynamicScreenGenerator(Pattern regex)
      Removes the DynamicScreenGenerator registered against the parameter regexp Pattern
      Returns:
      The DynamicScreenGenerator we just removed
    • clearDynamicScreenGenerators

      public static void clearDynamicScreenGenerators()
      Removes all DynamicScreenGenerators from the system