WebinterfaceUtils#
- public class WebinterfaceUtils#
This class is responsible for two things: Resolving relative paths of files of the web interface to
Fileobjects.Generating URIs to public files of the web interface from relative string paths.Especially the
AbstractCaosDBServerResourceand theWebinterfaceuse this class for these tasks.- Author:
Timm Fitschen (t.fitschen@indiscale.com)
Fields#
DEFAULT_BUILD_NUMBER_FILE#
DEFAULT_ROUTE#
DEFAULT_WEBUI_PUBLIC#
Constructors#
WebinterfaceUtils#
WebinterfaceUtils#
- WebinterfaceUtils(Reference host)#
Create a utility class for creating references to resources of the web interface.
The route to the web interface, the build number file and the public folder of the web interface build directory are set to default values (
DEFAULT_BUILD_NUMBER_FILE,DEFAULT_ROUTE, andDEFAULT_WEBUI_PUBLIC).The contextRoute defaults to the server property
ServerProperties.KEY_CONTEXT_ROOT.- Parameters:
host –
the host of the web interface.
See also:
{@linkWebinterfaceUtils.WebinterfaceUtils(String,String,String,String)}.
WebinterfaceUtils#
- WebinterfaceUtils(String host)#
Create a utility class for creating references to resources of the web interface.
The route to the web interface, the build number file and the public folder of the web interface build directory are set to default values (
DEFAULT_BUILD_NUMBER_FILE,DEFAULT_ROUTE, andDEFAULT_WEBUI_PUBLIC).The contextRoot defaults to the server property
ServerProperties.KEY_CONTEXT_ROOT.- Parameters:
host –
the host of the web interface.
See also:
{@linkWebinterfaceUtils.WebinterfaceUtils(String,String,String,String)}.
Methods#
getBuildNumber#
- public String getBuildNumber()#
Determine the build number of the webui. Returns null if the build number could not be determined.
Because opening and reading the
buildNumberFilecontent is expensive, the buildNumber is cached.The cached buildNumber invalidates when the files modified time stamp is younger than the
buildNumberDate. The validity of the cache is checked once every minute with aCronJob.- Returns:
Build number or null.
getBuildNumberFile#
getForwardedProto#
getInstance#
- public static WebinterfaceUtils getInstance(Request request)#
Retrieve an instance of
WebinterfaceUtilsfor the request. The instance can be shared with other callers.- Parameters:
request
- Returns:
a shared instance of
WebinterfaceUtils.
getInstance#
- public static WebinterfaceUtils getInstance(String host)#
Retrieve an instance of
WebinterfaceUtilsfor the host. The instance can be shared with other callers.- Parameters:
host
- Returns:
a shared instance of
WebinterfaceUtils.
getPublicFile#
getPublicFilePath#
- public Path getPublicFilePath(String path)#
Return the absolute path to the public file denoted by the path.
This method is used to resolve requests for files of the web interface.
- Parameters:
path –
path to the file of the web interface, relative to the public directory of the web interface.
- Returns:
The absolute path of the web interface file.
getPublicRootPath#
getServerRootURI#
- public String getServerRootURI()#
Return the server root reference.
The server root is composed of the scheme (https://) the host name (example.com) the port if necessary (:10443) and the context root of the application (beta).
- Returns:
the server root reference e.g. https://example.com:10443/beta.
getWebinterfaceRootURI#
- public String getWebinterfaceRootURI()#
Return the root reference for the web interface.
The root reference for the web interface is the server root reference (
getServerRootURI()) plus the route to the resource which routes to the individual resources of the web interface (Webinterface).- Returns:
root reference for the web interface.
getWebinterfaceURI#
- public String getWebinterfaceURI(String publicFile)#
Return a URI to a public file of the web interface.
This method is used to generate references for *.xsl files or other resources of the web interface.
- Parameters:
publicFile –
the path of the public file, relative to the public directory of the web interface.
- Returns:
a URI for the public file of the web interface.
readBuildNumber#
validateBuildNumber#
- public void validateBuildNumber()#
Check the validity of the buildNumber and invalidate the buildNumber if the buildNumberDate is older than the
File.lastModifiedtime stamp of the buildNumberFile.