public class ChuiWebDriver extends AbstractChuiDriver implements EmbeddedWebServer
Modifier and Type | Class and Description |
---|---|
private class |
ChuiWebDriver.VT100WebEmulator
Web-specific implementation of the VT100 emulator child process.
|
private class |
ChuiWebDriver.VT100WebRenderer
Swing-specific implementation of the VT100 emulator renderer.
|
Modifier and Type | Field and Description |
---|---|
private BootstrapConfig |
config
Configuration.
|
private static java.util.logging.Logger |
LOG
Logger.
|
private static java.lang.String |
MAIN_TARGET
Main page root target.
|
private ChuiWebSimulator |
simulator
ChUI simulator.
|
private EmbeddedWebServerImpl |
websrv
Delgated implementation for the embedded web server.
|
private static java.lang.String |
WELCOME_PAGE
Welcome page.
|
direct, factory
Constructor and Description |
---|
ChuiWebDriver(BootstrapConfig config)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
beep()
Emit a sound beep on the terminal.
|
void |
clear()
Clear screen.
|
ChildProcessFactory |
getChildProcessFactory()
Get driver-specific child process factory.
|
java.lang.String |
getServerURI()
Get the embedded web server's URI.
|
private java.lang.String |
getWelcomePageUrl(java.lang.String pageContext,
java.lang.String pageFile)
Build the name of the main page as a resource locator string.
|
void |
init()
Initialize driver.
|
int |
readKey()
Read single keystroke from keyboard.
|
void |
resetMode()
Reset current screen mode.
|
void |
resume()
Resume normal driver operation.
|
boolean |
setCursorStatus(boolean on)
Set cursor status (ON/OFF).
|
void |
shutdown()
Perform driver shutdown.
|
void |
shutdownServer()
Shutdown the embedded web server.
|
java.lang.String |
startupServer(ServerKeyStore keyStore,
BootstrapConfig config,
java.lang.String host,
int port)
Startup the embedded server using the server's key store to build the web server SSL
context.
|
void |
suspend()
Suspend all screen I/O operations.
|
void |
waitInitialization()
Wait for the page to notify that it has fully initialized its JS code.
|
captureMouseEvents, convertToOptions, createOutputManager, handleMouseEvent
getFactory, getPrimitives, getWindowSystem, inBackgroundMode, inBatchMode, isChui, setBackgroundMode, setBatchMode, setTerminalType, terminalType
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clientReady, lockMousePointer, openURL, propagate
private static final java.util.logging.Logger LOG
private static final java.lang.String MAIN_TARGET
private static final java.lang.String WELCOME_PAGE
private BootstrapConfig config
private ChuiWebSimulator simulator
private EmbeddedWebServerImpl websrv
public ChuiWebDriver(BootstrapConfig config)
config
- The BootstrapConfig
configuration.public void init()
init
in interface ScreenDriver<ChuiOutputManager>
init
in class AbstractDriver<BasePrimitives,ChuiOutputManager>
public void beep()
beep
in interface ScreenDriver<ChuiOutputManager>
public void clear()
This method should clear the screen and perform necessary flushing of the system-specific buffers if necessary. Users of this method assume that actual screen appearance as it is visible to the user is properly changed upon exit from this method.
clear
in interface ScreenDriver<ChuiOutputManager>
public ChildProcessFactory getChildProcessFactory()
getChildProcessFactory
in interface ScreenDriver<ChuiOutputManager>
public int readKey()
readKey
in interface ScreenDriver<ChuiOutputManager>
public void resetMode()
Upon exit from this method P2J assumes that screen is in correct state and can be used for interaction with the user.
resetMode
in interface ScreenDriver<ChuiOutputManager>
public void resume()
resume
in interface ScreenDriver<ChuiOutputManager>
public void suspend()
suspend
in interface ScreenDriver<ChuiOutputManager>
public boolean setCursorStatus(boolean on) throws java.lang.IllegalStateException
The implementation of this method should show/hide actual screen cursor visible to user. Remaining code assumes that actual cursor status visible to user is properly changed upon exit from this method.
setCursorStatus
in interface ScreenDriver<ChuiOutputManager>
setCursorStatus
in class AbstractChuiDriver
on
- true
- show cursor, false
- hide cursor.true
if operation was successful.java.lang.IllegalStateException
public void shutdown()
shutdown
in interface ScreenDriver<ChuiOutputManager>
shutdown
in class AbstractDriver<BasePrimitives,ChuiOutputManager>
public java.lang.String startupServer(ServerKeyStore keyStore, BootstrapConfig config, java.lang.String host, int port)
There are two page handlers. One is for the root ("/") target and the other is for the index ("/index.html") target. Both load the same page index.html.
When the user is first redirected the URL is https://server:port/
and the
target is "/". The index.html page is loaded for this target.
After redirection and the main page is loaded, the URL in the browser address bar will
become https://server:port/index.html
and the corresponding target is now
"/index.html".
When the user reloads the main page within the browser environment the "/index.html" target is sent to the web server and the same main page index.html is loaded.
startupServer
in interface EmbeddedWebServer
keyStore
- The exported server KeyStore.config
- Client configuration.port
- An explicit port to start the web server or 0 to let the OS assign one.host
- An explicit host to start the web server or null
to use the server's
host.public void shutdownServer()
shutdownServer
in interface EmbeddedWebServer
public java.lang.String getServerURI()
getServerURI
in interface EmbeddedWebServer
public void waitInitialization()
waitInitialization
in interface EmbeddedWebServer
private java.lang.String getWelcomePageUrl(java.lang.String pageContext, java.lang.String pageFile)
pageContext
- Page context root.pageFile
- Main page HTML file.