Class ScreenLoaderServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
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 Summary
Modifier and TypeMethodDescriptionstatic voidRegisters the parameter DynamicScreenGenerator with the ScreenLoaderServlet system.static voidaddDynamicScreenGenerator(DynamicScreenGenerator dsg, String prefix) Registers the parameter DynamicScreenGenerator with the ScreenLoaderServlet system.static voidaddDynamicScreenGenerator(DynamicScreenGenerator dsg, Pattern regex) Registers the parameter DynamicScreenGenerator with the ScreenLoaderServlet system.static voidRemoves all DynamicScreenGenerators from the systemvoidprocessRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Servlet entry point to process the request.static DynamicScreenGeneratorRemoves the default DynamicScreenGeneratorstatic DynamicScreenGeneratorremoveDynamicScreenGenerator(String prefix) Removes the DynamicScreenGenerator registered against the parameter prefix Stringstatic DynamicScreenGeneratorRemoves the DynamicScreenGenerator registered against the parameter regexp PatternMethods inherited from class com.isomorphic.servlet.BaseServlet
handleError, handleError
-
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-HttpServletRequestobject that contains the request the client has made of the servlet.response-HttpServletResponseobject 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
Registers the parameter DynamicScreenGenerator with the ScreenLoaderServlet system. Whenever the system needs a screen in future, it will first call theDynamicScreenGenerator.getScreen(String)method; only if that method returnsnullwill 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)andaddDynamicScreenGenerator(DynamicScreenGenerator, Pattern)for APIs that are more likely to be suitable - If you use this API anyway, you must be certain to return
nullfor 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
- 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
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 defaultprefix- A prefix String as described above
-
addDynamicScreenGenerator
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 parameterjava.util.regex.PatternYou 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 defaultregex- A Pattern representing a regular expression to match against incoming screen IDs
-
removeDynamicScreenGenerator
Removes the default DynamicScreenGenerator- Returns:
- The DynamicDSGenerator we just removed
-
removeDynamicScreenGenerator
Removes the DynamicScreenGenerator registered against the parameter prefix String- Returns:
- The DynamicScreenGenerator we just removed
-
removeDynamicScreenGenerator
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
-