Package com.iizix.server.devel
Class ExternalBrowserPagesImpl
- java.lang.Object
- com.iizix.server.devel.ExternalBrowserPagesImpl
- All Implemented Interfaces:
IExternalBrowserPages
public class ExternalBrowserPagesImpl extends java.lang.Object implements IExternalBrowserPages
Class to handle external web pages with embedded Jetty.- Author:
- Christopher Mindus
Constructor Summary
Constructors Constructor Description ExternalBrowserPagesImpl(ServerShell server)Constructor.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandoAuthenticate(java.lang.String target)Checks if a request URL is a WebSocket request or an Application URI that should not use authentication.java.io.FilegetCustomizedAppHTML(java.io.File file, java.lang.String appID, java.lang.String lang)Gets a customized "iiziApp.html" file for a specific application ID and optional language.java.lang.ObjectgetFileOrResource(java.lang.String location, java.lang.String target)Gets a File or Resource redirection from a web server target request, used for e.g.booleanisTargetValid(java.lang.String target)Checks for valid target to handle.voidprint(java.io.PrintWriter pw, java.lang.String root, java.lang.String target, HttpServletRequest request, HttpServletResponse response)Print the page output.booleanregisterRequestPrinter(java.lang.String target, IWebServerRequestPrinter processor)Registers a new request printer.booleanunregisterRequestPrinter(java.lang.String target, IWebServerRequestPrinter processor)Unregister a previously registered request printer.
Constructor Detail
ExternalBrowserPagesImpl
public ExternalBrowserPagesImpl(ServerShell server)
Constructor.
Method Detail
doAuthenticate
public boolean doAuthenticate(java.lang.String target)
Checks if a request URL is a WebSocket request or an Application URI that should not use authentication.- Specified by:
doAuthenticatein interfaceIExternalBrowserPages- Parameters:
target- The target URI.- Returns:
- true if authentication should be performed, false otherwise.
getFileOrResource
public java.lang.Object getFileOrResource(java.lang.String location, java.lang.String target)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
public boolean registerRequestPrinter(java.lang.String target, IWebServerRequestPrinter processor)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
public boolean unregisterRequestPrinter(java.lang.String target, IWebServerRequestPrinter processor)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
public boolean isTargetValid(java.lang.String target)
Checks for valid target to handle.- Specified by:
isTargetValidin interfaceIExternalBrowserPages
print
public void print(java.io.PrintWriter pw, java.lang.String root, java.lang.String target, HttpServletRequest request, HttpServletResponse response) throws java.io.IOExceptionPrint the page output.- Specified by:
printin interfaceIExternalBrowserPages- Parameters:
pw- The print writer.root- The web server root.target- Target page.request- The request.response- The response.- Throws:
java.io.IOException- For I/O errors.
getCustomizedAppHTML
public java.io.File getCustomizedAppHTML(java.io.File file, java.lang.String appID, java.lang.String lang)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.