public class RandPortCliChan extends java.lang.Object implements HttpCliChan
Utilities for doing tag-value I/O over TCP from a web page. This class is the core of the client side EventWeb backchannel implementation.
This class is used by the TvIoWwgt class to provide backchannel connection to a web page. It is also used by other java classes to provide backchannel connection to non-web applications.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String[] |
DEP_LIST
Class dependencies
|
static java.lang.String |
VERSION
Class version
|
IF_VERSIONMAX_MODE, MODE_CHANNEL, MODE_GET, MODE_HEAD, MODE_NONE, MODE_POST, STS_CLOSED, STS_CLOSING, STS_DISCONN, STS_ERROR, STS_INIT, STS_LISTENING, STS_OPEN, STS_OPENING, STS_WARNING| Constructor and Description |
|---|
RandPortCliChan()
Create a new RandPortCliChan with default session key, default media,
and debugging turned off.
|
RandPortCliChan(java.lang.String media,
boolean debug)
Create a new RandPortCliChan with default session key.
|
RandPortCliChan(java.lang.String sessionKeyVal,
java.lang.String media)
Create a new RandPortCliChan with debugging turned off.
|
RandPortCliChan(java.lang.String sessionKeyVal,
java.lang.String media,
boolean debug)
Create a new RandPortCliChan.
|
| Modifier and Type | Method and Description |
|---|---|
int |
clearErrorStatus()
Clear connection error status (if set).
|
boolean |
closeUrl()
Disconnect from URL.
|
boolean |
dataIsAvailable()
Determine if data is available.
|
int |
getErrorCode()
Return error status as HTTP status code.
|
int |
getMode()
Get channel communication mode.
|
int |
getStatus()
Get connection status.
|
java.lang.String[] |
getTvPair()
Get the next tag-value pair.
|
int |
openUrl(java.lang.String srcUrlName)
Connect to URL using the default communication mode.
|
int |
openUrl(java.lang.String srcUrlName,
int mode)
Connect to URL.
|
int |
openUrl(java.net.URL srcUrl)
Connect to URL using the default communication mode.
|
int |
openUrl(java.net.URL srcUrl,
int mode)
Connect to URL.
|
TvList |
readUrl()
Read a line from the URL using the current timeout.
|
TvList |
readUrl(int timeoutMs)
Set Timeout and read a line from the URL.
|
boolean |
recHasMore()
Determine if there is more data in the current record.
|
boolean |
sendMsg(java.lang.String msg)
Send message.
|
boolean |
startMonitor(int bcReadTimeout)
Start the channel monitor.
|
void |
stopMonitor()
Stop the channel monitor.
|
public static final java.lang.String VERSION
public static final java.lang.String[] DEP_LIST
public RandPortCliChan()
public RandPortCliChan(java.lang.String sessionKeyVal,
java.lang.String media)
sessionKeyVal - Session key for initial connectionmedia - Media type for the channelpublic RandPortCliChan(java.lang.String media,
boolean debug)
media - Media type for the channeldebug - If true, debugging is turned onpublic RandPortCliChan(java.lang.String sessionKeyVal,
java.lang.String media,
boolean debug)
sessionKeyVal - Session key for initial connectionmedia - Media type for the channeldebug - If true, debugging is turned onpublic int openUrl(java.lang.String srcUrlName)
openUrl in interface HttpCliChansrcUrlName - The URL to connect topublic int openUrl(java.lang.String srcUrlName,
int mode)
openUrl in interface HttpCliChansrcUrlName - The URL to connect tomode - The communication mode for the channel.
(One of the MODE_ values.)public int openUrl(java.net.URL srcUrl)
openUrl in interface HttpCliChansrcUrl - The URL to connect topublic int openUrl(java.net.URL srcUrl,
int mode)
openUrl in interface HttpCliChansrcUrl - The URL to connect tomode - The communication mode for the channel.
(One of the MODE_ values.)public boolean closeUrl()
closeUrl in interface HttpCliChanpublic boolean startMonitor(int bcReadTimeout)
bcReadTimeout - Backchannel read timeoutpublic void stopMonitor()
public java.lang.String[] getTvPair()
getTvPair in interface HttpCliChanpublic boolean sendMsg(java.lang.String msg)
sendMsg in interface HttpCliChanmsg - The message to send.
This should be formatted as one or more urlencoded
tag-value pairs.public TvList readUrl(int timeoutMs)
timeoutMs - Read timeout in millisecondspublic TvList readUrl()
public boolean dataIsAvailable()
dataIsAvailable in interface HttpCliChanpublic boolean recHasMore()
public int getMode()
public int getStatus()
getStatus in interface HttpCliChanpublic int clearErrorStatus()
public int getErrorCode()