Class ExternalBrowserPagesImpl
java.lang.Object
com.iizix.server.devel.ExternalBrowserPagesImpl
- All Implemented Interfaces:
IExternalBrowserPages
Class to handle external web pages with embedded Jetty.
- Author:
- Christopher Mindus
Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionstatic StringdefaultLanguage(TextTable textTable, List<String> langs) Gets the language of an application's or a panel's default text table as the memberdefaultLangofapp.jsonandpanel.jsoncarries it (CC-FIX-IIZIRUN-SETTINGS-FOLLOWUPS, SI-D-4, ruled 2026-10-29): the launcher's language chain (pickLanguageofjsr/comrun.js) takes it after the device language and before the first language offered.booleandoAuthenticate(PortConfig portConfig, String target) Checks if a request URL is a WebSocket request or an Application URI that should not use authentication.getAppAnalytics(String appID) Gets the Web Analytics settings of an application (CC-ANALYTICS-CONSENT), for the line the servlet injects into iiziApp.html: the Measurement ID and the consent choice from its Module app settings, through the chain of getAppSorryInfo.getAppAnalytics(String appID, String lang) Gets the Web Analytics settings of an application for a language (CC-FIX-GA4-V5): the application throughServerShell.getApplication(String), its module application through the module settings, thenappAnalytics(ModuleApp,String).getAppDirectory(String appID) Gets the virtual directory /app/appID/ of an application (CC-PWA-V5A-APPDIR-ROUTE): the segment is checked byIServer.validateAppID(String)first, so nothing a Browser sent that is not an application ID reaches the application table (design F-6); then the application, or the one its alias names, throughServerShell.getApplication(String).getAppSorryInfo(String appID) Gets what iiziAppSorry.html shows for an application (CC-BROWSER-GATE): the name and the description of the app from its Module app settings, as the app list shows them, and the two store URLs from the App Distribution properties.getAppUIModes(String appID) Gets the appearance modes an application allows a client to show (CC-THEME-DARK-V5): theuiModeschoice of its App page, through the chain of getAppSorryInfo.getCustomizedAppHTML(File file, String appID, String lang) Gets a customized "iiziApp.html" file for a specific application ID and optional language.getFileOrResource(String location, String target) Gets a File or Resource redirection from a web server target request, used for e.g.booleanisAppRefusedOn(String appID, PortConfig portConfig) Tells whether an application is refused on a port configuration (CC-FIX-APP-DEFINITIONS, PR-3/PR-4):ServerAppConfig.isServedOn(AppFactory,PortConfig)on the applicationServerShell.getApplication(String)resolves - an unknown one is refused.booleanisOriginAllowed(String origin, String requestHost) Tells whether a cross-origin page may read this server's responses (CC-FIX-SB-CORS): the server's WebSocket Origin allow-list decides, throughServerShell.isOriginAllowedForCORS(String, String).booleanisTargetValid(PortConfig portConfig, String target) Checks for valid target to handle.voidprint(PortConfig portConfig, PrintWriter pw, String root, String target, HttpServletRequest request, HttpServletResponse response) Print the page output.booleanregisterRequestPrinter(String target, IWebServerRequestPrinter processor) Registers a new request printer.booleanunregisterRequestPrinter(String target, IWebServerRequestPrinter processor) Unregister a previously registered request printer.
Constructor Details
ExternalBrowserPagesImpl
Constructor.
Method Details
doAuthenticate
Checks if a request URL is a WebSocket request or an Application URI that should not use authentication.- Specified by:
doAuthenticatein interfaceIExternalBrowserPages- Parameters:
portConfig- The port configuration.target- The target URI.- Returns:
- true if authentication should be performed, false otherwise.
getFileOrResource
Gets a File or Resource redirection from a web server target request, used for e.g. Asset resource files when used on the server and the file is inside a Jar.- Specified by:
getFileOrResourcein interfaceIExternalBrowserPages- Parameters:
location- The location string between '/$' and '$/'target- The target string from the Web Server after last '$/' (i.e. after location), does NOT begin with '/'.- Returns:
- The
Fileor instance ofResourcefor the resource, null for none.
registerRequestPrinter
Registers a new request printer.- Parameters:
target- The target URL, always starting with "/" and doesn't contain the query.processor- The print processor.- Returns:
- true if added successfully, false if the print processor already exists.
unregisterRequestPrinter
Unregister a previously registered request printer.- Parameters:
target- The target URL, always starting with "/" and doesn't contain the query.processor- The print processor.- Returns:
- true if removed successfully, false if the print processor does not exist or doesn't match.
isTargetValid
Checks for valid target to handle.- Specified by:
isTargetValidin interfaceIExternalBrowserPages- Parameters:
portConfig- The port configuration.target- The target URI.- Returns:
- true if target is processed as an external page, false otherwise.
print
public void print(PortConfig portConfig, PrintWriter pw, String root, String target, HttpServletRequest request, HttpServletResponse response) throws IOException Print the page output.- Specified by:
printin interfaceIExternalBrowserPages- Parameters:
portConfig- The port configuration.pw- The print writer.root- The web server root.target- Target page.request- The request.response- The response.- Throws:
IOException- For I/O errors.
defaultLanguage
Gets the language of an application's or a panel's default text table as the memberdefaultLangofapp.jsonandpanel.jsoncarries it (CC-FIX-IIZIRUN-SETTINGS-FOLLOWUPS, SI-D-4, ruled 2026-10-29): the launcher's language chain (pickLanguageofjsr/comrun.js) takes it after the device language and before the first language offered. The code is written only when it is one of the languages offered (langs), so that the member never names a language the launch cannot start with; the comparison is exact, as the codes come from the same text tables. The iiziGo'spanel.jsonwriter (com.iizigo.comm.ExternalBrowserPagesImpl.addPanelData) calls this method too.- Parameters:
textTable- The default text table, ornullfor none.langs- The language codes offered, as thelangsmember lists them, ornull.- Returns:
- The language code as the text table spells it, or
nullwhen there is no default text table, its language code is not set, or the code is not offered.
getCustomizedAppHTML
Gets a customized "iiziApp.html" file for a specific application ID and optional language.- Specified by:
getCustomizedAppHTMLin interfaceIExternalBrowserPages- Parameters:
file- The compressed iiziApp.html file without customization.appID- The application ID.lang- The language requested, ornullfor default.- Returns:
- The customized (and probably cached) file to send instead of the un-customized one, or
nullfor none, i.e. in case an application ID is not found.
getAppSorryInfo
Gets what iiziAppSorry.html shows for an application (CC-BROWSER-GATE): the name and the description of the app from its Module app settings, as the app list shows them, and the two store URLs from the App Distribution properties.- Specified by:
getAppSorryInfoin interfaceIExternalBrowserPages- Parameters:
appID- The application ID, never null nor empty.- Returns:
- The information, or null for an unknown application.
getAppUIModes
Gets the appearance modes an application allows a client to show (CC-THEME-DARK-V5): theuiModeschoice of its App page, through the chain of getAppSorryInfo.- Specified by:
getAppUIModesin interfaceIExternalBrowserPages- Parameters:
appID- The application ID, never null nor empty.- Returns:
- The choice (
ModuleApp.getUIModes()) asUISchemes.modesValue(int)reads it, both for an unknown application.
getAppAnalytics
Gets the Web Analytics settings of an application (CC-ANALYTICS-CONSENT), for the line the servlet injects into iiziApp.html: the Measurement ID and the consent choice from its Module app settings, through the chain of getAppSorryInfo. Only a valid GA4 id is answered, so nothing from a property file reaches the page unchecked.- Specified by:
getAppAnalyticsin interfaceIExternalBrowserPages- Parameters:
appID- The application ID, never null nor empty.- Returns:
- The settings, or null for an unknown application or one without a valid Measurement ID.
getAppAnalytics
Gets the Web Analytics settings of an application for a language (CC-FIX-GA4-V5): the application throughServerShell.getApplication(String), its module application through the module settings, thenappAnalytics(ModuleApp,String).- Specified by:
getAppAnalyticsin interfaceIExternalBrowserPages- Parameters:
appID- The application ID, never null nor empty.lang- The language code of the request, null or empty for the default language.- Returns:
- The settings, or null for an unknown application or one without a valid Measurement ID.
getAppDirectory
Gets the virtual directory /app/appID/ of an application (CC-PWA-V5A-APPDIR-ROUTE): the segment is checked byIServer.validateAppID(String)first, so nothing a Browser sent that is not an application ID reaches the application table (design F-6); then the application, or the one its alias names, throughServerShell.getApplication(String).- Specified by:
getAppDirectoryin interfaceIExternalBrowserPages- Parameters:
appID- The path segment after/app/, decoded, never null nor empty.- Returns:
- The directory, or null for an invalid or unknown ID.
isAppRefusedOn
Tells whether an application is refused on a port configuration (CC-FIX-APP-DEFINITIONS, PR-3/PR-4):ServerAppConfig.isServedOn(AppFactory,PortConfig)on the applicationServerShell.getApplication(String)resolves - an unknown one is refused.- Specified by:
isAppRefusedOnin interfaceIExternalBrowserPages- Parameters:
appID- The application ID, or an alias.portConfig- The port configuration of the request's connector, null for none.- Returns:
- true when refused, false when served.
isOriginAllowed
Tells whether a cross-origin page may read this server's responses (CC-FIX-SB-CORS): the server's WebSocket Origin allow-list decides, throughServerShell.isOriginAllowedForCORS(String, String).- Specified by:
isOriginAllowedin interfaceIExternalBrowserPages- Parameters:
origin- The request'sOriginheader field.requestHost- The host the request came to, may be null.- Returns:
- true to grant the origin, false to refuse it.