public class BBUtils
In BBj 12.0 and higher, the BBUtils utility is a generalized utility that provides information and interactivity with the Jetty web server, registers BUI applications, and more.
Modifier and Type | Field and Description |
---|---|
static BBjNumber | BUFFER_SIZE=32768 A constant to define the maximum buffer size when copying files to the Web Server |
static BBjNumber | MAX_FILE_SIZE=10240000 This constant is ignored in BBj 24.12 and higher. |
static BBjString | MIME_TYPE_CSS$ A constant to define CSS text mime type |
static BBjString | MIME_TYPE_GIF$ A constant to define GIF image mime type |
static BBjString | MIME_TYPE_JPG$ A constant to define JPG image mime type |
static BBjString | MIME_TYPE_PNG$ A constant to define PNG image mime type |
Modifier and Type | Method and Description |
---|---|
static BBjResourceUrl | addAppServerResource(BBjString p_file$, BBjString p_mimetype$) Adds the contents of the file represented by p_file$, with the MIME type p_mimetype$, to the set of static resources in the BBjAppServer. If the resource already exists, the existing version will be returned. This method allows you to add various resources, including the following mime types which are defined as constants:
Example
|
static BBjResourceUrl | applyCss(BBjString p_app$, BBjString p_cssFile$, BBjNumber p_overwrite) Sets the custom CSS for the specified BUI app. This is similar to the setBUICSS() method. |
static BBjString | copyFileToWebServer(BBjString p_srcFile$) |
static BBjString | copyFileToWebServer(BBjString p_srcFile$, BBjNumber p_requireSSL) |
static BBjString | copyFileToWebServer(BBjString p_srcFile$, BBjString p_destSubDir$) |
static BBjString | copyFileToWebServer(BBjString p_srcFile$, BBjString p_destSubDir$, BBjNumber p_requireSSL) |
static BBjString | copyFileToWebServer(BBjString p_srcFile$, BBjString p_destSubDir$, BBjString p_destFile$) |
static BBjString | copyFileToWebServer(BBjString p_srcFile$, BBjString p_destSubDir$, BBjString p_destFile$, BBjNumber p_requireSSL) |
static BBjString | copyFileToWebServer(BBjString p_srcFile$, BBjString p_destSubDir$, BBjString p_destFile$, BBjNumber p_requireSSL, BBjNumber p_obfuscatePath) |
static void | deleteFromWebServer(BBjString p_url!) |
static void | deleteWebServerFilesOlderThanNDays(BBjString p_destSubDir$, BBjNumber p_numDaysOld) |
static BBjString | getBuiIosMajorVersion() Get the major iOS version if running in a BUI environment in iOS (5, 6, 7, etc.) as determined by the client browser's user agent string. |
static BBjString | getBuiIosVersion() Get the iOS version if running in a BUI environment in iOS (7, 7.1, etc.) as determined by the client browser's user agent string. |
static BBjString | getWebServerAppsURL() Get the URL of the Jetty Web Server's apps directory. |
static BBjString | getWebServerAppsURL(BBjNumber p_requireSSL) Get the URL of the Jetty Web Server's apps directory, specifying whether an SSL connection is required or not. |
static BBjString | getWebServerFilesURL() Get the URL of the Jetty Web Server's files directory. |
static BBjString | getWebServerFilesURL(BBjNumber p_requireSSL) Get the URL of the Jetty Web Server's files directory, specifying whether an SSL connection is required or not. |
static BBjString | getWebServerFileURL(BBjString p_file$, BBjString p_subDir$, BBjNumber p_requireSSL) |
static BBjString | getWebServerHost() Get the host of the Jetty Web Server. |
static BBjString | getWebServerHttpPort() Get the port of the Jetty Web Server. |
static BBjString | getWebServerPort() Get the port of the Jetty Web Server. |
static BBjString | getWebServerPort(BBjNumber p_requireSSL) Get the port of the Jetty Web Server, specifying whether an SSL connection is required or not. |
static BBjString | getWebServerProtocol() |
static BBjString | getWebServerProtocol(BBjNumber p_requireSSL) |
static BBjString | getWebServerSSLPort() Get the SSL port of the Jetty Web Server. |
static BBjString | getWebServerURL() Get the URL of the Jetty Web Server's root directory. |
static BBjString | getWebServerURL(BBjNumber p_requireSSL) Get the URL of the Jetty Web Server's root directory, specifying whether an SSL connection is required or not. |
static BBjNumber | isBuiAndroidDevice() Indicates if BBj is running in a BUI environment in Android as determined by the client browser's user agent string. |
static BBjNumber | isBuiIosDevice() Indicates if BBj is running in a BUI environment in iOS as determined by the client browser's user agent string. |
static BBjNumber | isBuiTouchSupported() Indicates if BBj is running in a touch-enabled environment or not as determined by the BBjBuiManager. |
static BBjNumber | isWebServerEnabled() Returns a number indicating whether the Web Server is enabled or not |
static BBjNumber | isWebServerHttpEnabled() Returns a number indicating whether the Web Server has enabled the HTTP protocol or not |
static BBjNumber | isWebServerSSLEnabled() Returns a number indicating whether the Web Server has enabled the SSL protocol or not |
static void | loadAppServer() |
static void | publishBUIApp(BBjString p_appName!, BBjAppConfig p_config!) |
static void | registerBUIApp(BBjString p_prog$) Registers a BUI app given the provided parameters. |
static void | registerBUIApp(BBjString p_prog$, BBjString p_app$) Registers a BUI app given the provided parameters. |
static void | registerBUIApp(BBjString p_prog$, BBjString p_app$, BBjString p_configFile$, BBjString p_workingDir$, BBjString p_InterpUser$) Registers a BUI app given the provided parameters. |
static void | registerBUIApp(BBjString p_prog$, BBjString p_app$, BBjString p_configFile$, BBjString p_workingDir$, BBjString p_InterpUser$, BBjVector p_args!) Registers a BUI app given the provided parameters. |
static void | registerBUIApp(BBjString p_prog$, BBjString p_app$, BBjString p_configFile$, BBjString p_workingDir$, BBjString p_InterpUser$, BBjVector p_args!, BBjNumber p_quiet) Registers a BUI app given the provided parameters. |
static void | registerBUIApp(BBjString p_prog$, BBjString p_app$, BBjString p_configFile$, BBjString p_workingDir$, BBjString p_InterpUser$, BBjVector p_args!, BBjNumber p_quiet, BBjString p_cpName$) Registers a BUI app given the provided parameters. |
static void | registerBUIApp(BBjString p_prog$, BBjString p_app$, BBjString p_configFile$, BBjString p_workingDir$, BBjString p_InterpUser$, BBjVector p_args!, BBjNumber p_quiet, BBjString p_cpName$, BBjString p_bbjAppName$, BBjString p_userName$, BBjString p_term$) Registers a BUI app given the provided parameters. |
static void | setAppServer(BBjAppServer p_appServer!) |
static BBjResourceUrl | setBUIAppIcon(BBjString p_app$, BBjString p_iconFile$, BBjNumber p_overwrite) Sets the application icon for the specified BUI app. The application will be shown in the browser's tab and will be used as the default icon on a mobile device when saving the BUI app to the home screen. |
static BBjResourceUrl | setBUICSS(BBjString p_app$, BBjString p_cssFile$, BBjNumber p_overwrite) Sets the custom CSS for the specified BUI app. This is similar to the applyCss() method. |
static BBjResourceUrl | setBUISplash(BBjString p_app$, BBjString p_imageFile$, BBjNumber p_overwrite) Sets the splash screen or loading image for the specified BUI app. The image can be a static image, such as a PNG file, or an animated GIF image. |
static void | setShowBrowserWarning(BBjString p_app$, BBjNumber p_show) |
static void | setShowClientConfirmationDialog(BBjString p_app$, BBjNumber p_show) |
public static BBjNumber BUFFER_SIZE=32768
A constant to define the maximum buffer size when copying files to the Web Server
public static BBjNumber MAX_FILE_SIZE=10240000
This constant is ignored in BBj 24.12 and higher.
public static BBjString MIME_TYPE_CSS$
A constant to define CSS text mime type
public static BBjString MIME_TYPE_GIF$
A constant to define GIF image mime type
public static BBjString MIME_TYPE_JPG$
A constant to define JPG image mime type
public static BBjString MIME_TYPE_PNG$
A constant to define PNG image mime type
public static BBjResourceUrl addAppServerResource(BBjString p_file$, BBjString p_mimetype$)
Adds the contents of the file represented by p_file$, with the MIME type p_mimetype$, to the set of static resources in the BBjAppServer.
If the resource already exists, the existing version will be returned.
This method allows you to add various resources, including the following mime types which are defined as constants:
Example
BBUtils.addAppServerResource(myPngFilePath$, BBUtils.getMIME_TYPE_PNG())
public static BBjResourceUrl applyCss(BBjString p_app$, BBjString p_cssFile$, BBjNumber p_overwrite)
Sets the custom CSS for the specified BUI app.
This is similar to the setBUICSS() method.
p_app$
The registered name of the BUI appp_iconFile$
The path to the CSS filep_overwrite
A number that indicates whether to overwrite an existing CSS definition if one already exists for the specified BUI app. (0=Do not overwrite, 1=Overwrite).public static BBjString copyFileToWebServer(BBjString p_srcFile$)
public static BBjString copyFileToWebServer(BBjString p_srcFile$, BBjNumber p_requireSSL)
public static BBjString copyFileToWebServer(BBjString p_srcFile$, BBjString p_destSubDir$)
public static BBjString copyFileToWebServer(BBjString p_srcFile$, BBjString p_destSubDir$, BBjNumber p_requireSSL)
public static BBjString copyFileToWebServer(BBjString p_srcFile$, BBjString p_destSubDir$, BBjString p_destFile$)
public static BBjString copyFileToWebServer(BBjString p_srcFile$, BBjString p_destSubDir$, BBjString p_destFile$, BBjNumber p_requireSSL)
public static BBjString copyFileToWebServer(BBjString p_srcFile$, BBjString p_destSubDir$, BBjString p_destFile$, BBjNumber p_requireSSL, BBjNumber p_obfuscatePath)
public static void deleteFromWebServer(BBjString p_url!)
public static void deleteWebServerFilesOlderThanNDays(BBjString p_destSubDir$, BBjNumber p_numDaysOld)
public static BBjString getBuiIosMajorVersion()
Get the major iOS version if running in a BUI environment in iOS (5, 6, 7, etc.) as determined by the client browser's user agent string.
public static BBjString getBuiIosVersion()
Get the iOS version if running in a BUI environment in iOS (7, 7.1, etc.) as determined by the client browser's user agent string.
public static BBjString getWebServerAppsURL()
Get the URL of the Jetty Web Server's apps directory.
public static BBjString getWebServerAppsURL(BBjNumber p_requireSSL)
Get the URL of the Jetty Web Server's apps directory, specifying whether an SSL connection is required or not.
p_requireSSL
A number that indicates whether the URL should require an SSL connection or not.public static BBjString getWebServerFilesURL()
Get the URL of the Jetty Web Server's files directory.
public static BBjString getWebServerFilesURL(BBjNumber p_requireSSL)
Get the URL of the Jetty Web Server's files directory, specifying whether an SSL connection is required or not.
p_requireSSL
A number that indicates whether the URL should require an SSL connection or not.public static BBjString getWebServerFileURL(BBjString p_file$, BBjString p_subDir$, BBjNumber p_requireSSL)
public static BBjString getWebServerHost()
Get the host of the Jetty Web Server.
public static BBjString getWebServerHttpPort()
Get the port of the Jetty Web Server.
public static BBjString getWebServerPort()
Get the port of the Jetty Web Server.
public static BBjString getWebServerPort(BBjNumber p_requireSSL)
Get the port of the Jetty Web Server, specifying whether an SSL connection is required or not.
p_requireSSL
A number that indicates whether the port should require an SSL connection or not.public static BBjString getWebServerProtocol()
public static BBjString getWebServerProtocol(BBjNumber p_requireSSL)
public static BBjString getWebServerSSLPort()
Get the SSL port of the Jetty Web Server.
public static BBjString getWebServerURL()
Get the URL of the Jetty Web Server's root directory.
public static BBjString getWebServerURL(BBjNumber p_requireSSL)
Get the URL of the Jetty Web Server's root directory, specifying whether an SSL connection is required or not.
p_requireSSL
A number that indicates whether the URL should require an SSL connection or not.public static BBjNumber isBuiAndroidDevice()
Indicates if BBj is running in a BUI environment in Android as determined by the client browser's user agent string.
public static BBjNumber isBuiIosDevice()
Indicates if BBj is running in a BUI environment in iOS as determined by the client browser's user agent string.
public static BBjNumber isBuiTouchSupported()
Indicates if BBj is running in a touch-enabled environment or not as determined by the BBjBuiManager.
public static BBjNumber isWebServerEnabled()
Returns a number indicating whether the Web Server is enabled or not
public static BBjNumber isWebServerHttpEnabled()
Returns a number indicating whether the Web Server has enabled the HTTP protocol or not
public static BBjNumber isWebServerSSLEnabled()
Returns a number indicating whether the Web Server has enabled the SSL protocol or not
public static void loadAppServer()
public static void publishBUIApp(BBjString p_appName!, BBjAppConfig p_config!)
public static void registerBUIApp(BBjString p_prog$)
Registers a BUI app given the provided parameters.
p_prog$
The path to the BBj programpublic static void registerBUIApp(BBjString p_prog$, BBjString p_app$)
Registers a BUI app given the provided parameters.
p_prog$
The path to the BBj programp_app$
Optional registered name of the BUI app (defaults to a built name based on the program name)public static void registerBUIApp(BBjString p_prog$, BBjString p_app$, BBjString p_configFile$, BBjString p_workingDir$, BBjString p_InterpUser$)
Registers a BUI app given the provided parameters.
p_prog$
The path to the BBj programp_app$
Optional registered name of the BUI app (defaults to a built name based on the program name)p_configFile$
Optional path to the configuration file (-c arg)p_workingDir$
Optional path to the working directory for the app (-WD arg)p_InterpUser$
Optioanl interpreter user to run as (-u arg (defaults to INFO(3, 2)))public static void registerBUIApp(BBjString p_prog$, BBjString p_app$, BBjString p_configFile$, BBjString p_workingDir$, BBjString p_InterpUser$, BBjVector p_args!)
Registers a BUI app given the provided parameters.
p_prog$
The path to the BBj programp_app$
Optional registered name of the BUI app (defaults to a built name based on the program name)p_configFile$
Optional path to the configuration file (-c arg)p_workingDir$
Optional path to the working directory for the app (-WD arg)p_InterpUser$
Optioanl interpreter user to run as (-u arg (defaults to INFO(3, 2)))p_args!
Optional BBjVector filled with runtime arguments for the BBj program being invokedpublic static void registerBUIApp(BBjString p_prog$, BBjString p_app$, BBjString p_configFile$, BBjString p_workingDir$, BBjString p_InterpUser$, BBjVector p_args!, BBjNumber p_quiet)
Registers a BUI app given the provided parameters.
p_prog$
The path to the BBj programp_app$
Optional registered name of the BUI app (defaults to a built name based on the program name)p_configFile$
Optional path to the configuration file (-c arg)p_workingDir$
Optional path to the working directory for the app (-WD arg)p_InterpUser$
Optioanl interpreter user to run as (-u arg (defaults to INFO(3, 2)))p_args!
Optional BBjVector filled with runtime arguments for the BBj program being invokedp_quiet
A BBj boolean indicating whether to launch quietly or not (0=Not Quiet, 1=Quiet) (-q arg)public static void registerBUIApp(BBjString p_prog$, BBjString p_app$, BBjString p_configFile$, BBjString p_workingDir$, BBjString p_InterpUser$, BBjVector p_args!, BBjNumber p_quiet, BBjString p_cpName$)
Registers a BUI app given the provided parameters.
p_prog$
The path to the BBj programp_app$
Optional registered name of the BUI app (defaults to a built name based on the program name)p_configFile$
Optional path to the configuration file (-c arg)p_workingDir$
Optional path to the working directory for the app (-WD arg)p_InterpUser$
Optioanl interpreter user to run as (-u arg (defaults to INFO(3, 2)))p_args!
Optional BBjVector filled with runtime arguments for the BBj program being invokedp_quiet
A BBj boolean indicating whether to launch quietly or not (0=Not Quiet, 1=Quiet) (-q arg)p_cpName$
Optional session classpath name to use when launching the app (-CP arg)public static void registerBUIApp(BBjString p_prog$, BBjString p_app$, BBjString p_configFile$, BBjString p_workingDir$, BBjString p_InterpUser$, BBjVector p_args!, BBjNumber p_quiet, BBjString p_cpName$, BBjString p_bbjAppName$, BBjString p_userName$, BBjString p_term$)
Registers a BUI app given the provided parameters.
p_prog$
The path to the BBj programp_app$
Optional registered name of the BUI app (defaults to a built name based on the program name)p_configFile$
Optional path to the configuration file (-c arg)p_workingDir$
Optional path to the working directory for the app (-WD arg)p_InterpUser$
Optioanl interpreter user to run as (-u arg (defaults to INFO(3, 2)))p_args!
Optional BBjVector filled with runtime arguments for the BBj program being invokedp_quiet
A BBj boolean indicating whether to launch quietly or not (0=Not Quiet, 1=Quiet) (-q arg)p_cpName$
Optional session classpath name to use when launching the app (-CP arg)p_bbjAppName$
Optional application name (-a arg)p_userName$
Optional application user name (-n arg)p_term$
Optional name of a terminal alias of type MINI (may also be "MINI") (-t arg)public static void setAppServer(BBjAppServer p_appServer!)
public static BBjResourceUrl setBUIAppIcon(BBjString p_app$, BBjString p_iconFile$, BBjNumber p_overwrite)
Sets the application icon for the specified BUI app.
The application will be shown in the browser's tab and will be used as the default icon on a mobile device when saving the BUI app to the home screen.
p_app$
The registered name of the BUI appp_iconFile$
The path to the icon filep_overwrite
A number that indicates whether to overwrite an existing application icon if one already exists for the specified BUI app. (0=Do not overwrite, 1=Overwrite).public static BBjResourceUrl setBUICSS(BBjString p_app$, BBjString p_cssFile$, BBjNumber p_overwrite)
Sets the custom CSS for the specified BUI app.
This is similar to the applyCss() method.
p_app$
The registered name of the BUI appp_iconFile$
The path to the CSS filep_overwrite
A number that indicates whether to overwrite an existing CSS definition if one already exists for the specified BUI app. (0=Do not overwrite, 1=Overwrite).public static BBjResourceUrl setBUISplash(BBjString p_app$, BBjString p_imageFile$, BBjNumber p_overwrite)
Sets the splash screen or loading image for the specified BUI app.
The image can be a static image, such as a PNG file, or an animated GIF image.
p_app$
The registered name of the BUI appp_imageFile$
The path to the image filep_overwrite
A number that indicates whether to overwrite an existing splash image if one already exists for the specified BUI app. (0=Do not overwrite, 1=Overwrite).public static void setShowBrowserWarning(BBjString p_app$, BBjNumber p_show)
public static void setShowClientConfirmationDialog(BBjString p_app$, BBjNumber p_show)