Javelin object javadoc
Javelin is the object representing the legacy screen. Actions can be defined and performed on the legacy screen by programming code using the Javelin object. This section contains the API documentation of the Javelin object.
Fields detailed list
This section presents the list of fields contained in Javelin object, with their description.
Table 3 - 1: Fields list
Type | Field name | Description |
---|---|---|
static char | AT_AUTO_ENTER | Mask for DRCS (downloadable font) attribute bit: 0x8000 (0100 0000 0000 0000). Note: relevant for Videotex only. For 3270 and 5250 this bit indicates an AUTO_TAB flag for the field. |
static char | AT_AUTO_TAB | Mask for double height: 0x0040 (0000 0000 0100 0000). For 32370/5250 also indicates field is AUTO_ENTER. |
static char | AT_BLINK | Mask for blink attribute bit: 0x1000 (0001 0000 0000 0000). |
static char | AT_BOLD | Mask for bold attribute bit: 0x0800 (0000 0100 0000 0000). |
static int | AT_COLOR_BLACK | |
static int | AT_COLOR_BLUE | |
static int | AT_COLOR_CYAN | |
static int | AT_COLOR_GREEN | |
static int | AT_COLOR_MAGENTA | |
static int | AT_COLOR_RED | |
static int | AT_COLOR_WHITE | |
static int | AT_COLOR_YELLOW | |
static char | AT_DOUBLEHEIGHT | Mask for double height: 0x0040 (0000 0000 0100 0000). For 32370/5250 also indicate field is AUTO_ENTER. |
static char | AT_DOUBLEWIDTH | Mask for double width attribute bit: 0x0080 (0000 0000 1000 0000). |
static char | AT_DRCS | Mask for DRCS (downloadable font) attribute bit: 0x8000 (0100 0000 0000 0000). Note: relevant for Videotex only. For 3270 and 5250 this bit indicates an AUTO_TAB flag for the field. |
static int | AT_FIELD_ATTRIBUTE | |
static int | AT_FIELD_HIDDEN | Mask for hidden field attribute: 0x0C0000. Note: relevant for IBM 3270 / 5250 and BULL DKU7xxx only. |
static int | AT_FIELD_HIGH_INTENSITY | Mask for high intensity field attribute: 0x040000. Note: relevant for IBM 3270 / 5250 and BULL DKU7xxx only. |
static int | AT_FIELD_MODIFIED | Mask for modified field attribute: 0x010000. Note: relevant for IBM 3270 / 5250 and BULL DKU7xxx only. |
static int | AT_FIELD_NUMERIC | Mask for numeric field attribute: 0x100000. Note: relevant for IBM 3270 / 5250 and BULL DKU7xxx only. |
static int | AT_FIELD_PEN_SELECTABLE | Mask for pen selectable field attribute: 0x080000. Note: relevant for IBM 3270 / 5250 and BULL DKU7xxx only. |
static int | AT_FIELD_PROTECTED | Mask for protected Field attribute bit: 0x200000. Note: relevant for IBM 3270 / 5250 and BULL DKU7xxx only. |
static int | AT_FIELD_RESERVED | Mask for reserved field attribute: 0x020000. Note: relevant for IBM 3270 / 5250 and BULL DKU7xxx only. |
static char | AT_HIDDEN | Mask for hidden attribute bit: 0x8000 (1000 0000 0000 0000). |
static char | AT_INK | Mask for INK attribute: 0x0007 (0000 0000 0000 0111). |
static char | AT_INVERT | Mask for inverse attribute bit: 0x0200 (0000 0001 0000 0000). |
static char | AT_MASKED | Mask for masked attribute bit: 0x2000 (0010 0000 0000 0000). Note: relevant for VT220 only. |
static char | AT_NPTUI | Mask for NPTUI attribute bit: 0x2000 (0010 0000 0000 0000). Note: relevant for 5250 only. |
static char | AT_PAPER | Mask for PAPER attribute: 0x0038 (0000 0000 0011 1000). |
static char | AT_PROTECTED | Mask for protected attribute bit: 0x4000 (0100 0000 0000 0000). For 5250 reprsent also the NPTUI attribute. |
static char | AT_UNDERLINE | Mask for underline attribute bit: 0x0100 (0000 0001 0000 0000). |
static char | AT_UPHALF | Mask for double height upper row attribute bit: 0x0400 (0000 0100 0000 0000). Note: relevant for VT220 only. |
static java.lang.String | AS400 | Defines an IBM 5250 (AS/400) session. |
static java.lang.String | DKU | Defines a Bull DKU session. |
static java.lang.String | SNA | Defines an IBM 3270 (SNA) session. |
static java.lang.String | TN5250 | Defines a Twinsoft 5250 (AS/400) session. |
static java.lang.String | VDX | Defines a videotex session. |
static java.lang.String | VT | Defines a VT220 session. |
Methods detailed list
This section presents the list of methods contained in Javelin object, with their description and parameters.
Table 3 - 2: Methods list
Return Type | Method signature | Description |
---|---|---|
void | addKeyListener(java.awt.event.KeyListener l) Parameters: l - the component interested by the events. |
Registers a client on the keyListener. KeyListener delivers events for keystokes on Javelin. |
void | addZoneListener(com.twinsoft.twinj.zoneListener l) Parameters: l - the component interested by the events |
Registers a client on the zoneListener. ZoneListener delivers events for selection changes. |
void | clearTrigger() | Remove all arrived trigger from the MsgQueue. |
void | connect() See also: connect(int), disconnect() |
Connects Javelin to a server. The connection is asynchronous. When the connection is made, the Connected event is thrown by Javelin. The connection is made with the parameters provided by helper functions such as setDteAddress(), setCommDevice(), setServiceCode()... |
boolean |
connect(int timeout) Parameters:
See also: connect(), disconnect() |
Connects synchronously Javelin to a server. The connection is made with the parameters provided by helper functions such as setDteAddress(), setCommDevice(), setServiceCode()... |
void | deleteWaitAts() See also: waitAt(String, int, int, long), waitAtId(int, String, int, int), waitForId(int, String), waitFor(String, long), deleteWaitFors() |
Deletes all triggers set by the waitAt() method. |
void | deleteWaitFors() See also: waitAt(String, int, int, long), waitAtId(int, String, int, int), waitForId(int, String), waitFor(String, long), deleteWaitAts() |
Deletes all triggers set by the waitFor() method. |
void | disconnect() See also: connect(), connect(int) |
Disconnects Javelin from the current connected server. The disconnection is synchronous, i.e. Javelin is disconnected when the method Returns. |
void | doAction(java.lang.String action) Parameters: action - the action to execute, see appendix legacy emulator actions table. |
Executes an action on the emulator. |
char | getChar(int column, int line) Parameters:
See also: getCharAttribute(int, int), getString(int, int, int), setChar(int, int, char) |
Returns the ASCII code of the character at coordinates (column, line). |
int | getCharAttribute(int column, int line) Parameters:
See also: getChar(int, int), getString(int, int, int), setChar(int, int, char) |
Returns the character attribute at coordinates ( column , line ). You can access specific attribute bit with AT_xxx masks. |
int | getCurrentColumn() Returns the current column. See also: getCurrentLine() |
Returns the current column of the caret. Columns are designed from top to bottom and beginning by 0. |
int | getCurrentLine() Returns the current line. See also: getCurrentColumn() |
Returns the current line of the caret. Lines are designed from left to right and beginning by 0. |
boolean | getDataStableOnCursorOn() Returns the DataStableOnCursorOn. |
Retrieves the DataStableOnCursorOn flag. This flag controls how the data stable condition is detected. For Videotex emulators. if true, this condition is met when a Videotex cursor is shown by the host. |
int | getDataStableThreshold() Returns the dataStableThreshold value. |
Gets the dataStableThreshold value. |
int | getFieldAttribute(int fieldIndex) Parameters: fieldIndex - the index or the field from 0 to n. Returns: the attribute of the field. |
Gets the attribute of a given field. |
int | getFieldColumn(int fieldIndex) Parameters: fieldIndex - the index or the field from 0 to n. Returns: the column of the field. |
Gets the column of a given field. |
int | getFieldLength(int fieldIndex) Parameters: fieldIndex - the index or the field from 0 to n. Returns: the length of the field. |
Gets the length of a given field. If the length is greater than the width of the screen, it means that the field spans on several lines. |
int |
getFieldLine(int fieldIndex) Parameters: fieldIndex - the index or the field from 0 to n. Returns: the line of the field. |
Gets the line of a given field. |
java.lang.String | getFieldText(int fieldIndex) Parameters: fieldIndex - the index or the field from 0 to n. Returns: the text of the field. |
Gets the text of a given field. |
int | getNumberOfFields() Returns: the number of fields. |
Gets the number of fields on the screen. If the number of fields is 0, then the screen is called "unformatted". This is always the case for VT and VDX emulators but can be the case for IBM in the case of a unformatted screen. |
int | getScreenHeight() Returns: the number of lines. See also: getScreenWidth() |
Gets the number of lines of the current emulator screen. |
int | getScreenWidth() Returns: the number of columns. See also: getScreenHeight() |
Gets the number of columns of the current emulator screen. |
java.awt.Rectangle | getSelectionZone() Returns: zone - the rectangle that holds the zone (x = column 0 based, y = line 0 based, width = width of the selection in chars, height = height of the selection in chars) |
Gets the current selection zone on Javelin. |
java.lang.String | getString(int column, int line, int length) Parameters:
See also: getChar(int, int), getCharAttribute(int, int), setChar(int, int, char) |
Returns the string at coordinates (column, line). |
java.lang.String | getTerminalClass() Returns: the terminal class. |
Retrieves the terminal class of the Javelin object. |
boolean | isConnected() Returns: true if connected, false otherwise. See also: connect(), connect(int), disconnect() |
Retrieves the Javelin connection state. |
void | moveCursor(int column, int line) Parameters:
|
Moves the cursor to coordinates (column, line). |
boolean | printBuffer(java.lang.String printerPort, java.lang.String buffer) Parameters:
|
Writes a string on a given printer port. This port can be any string containing LPTx or a network printer specification as SERVERPRINTER or a file as print.txt. The specified port will be opened, then the buffer will be written to it and the port will be closed in this sequence. If the port is null, then the port will be the default port specified as RawPrinter in the applet. |
void | removeAllZoneListeners() | Unregister all clients on the zoneListener. ZoneListener delivers events for selection changes. |
void | removeKeyListener(java.awt.event.KeyListener l) Parameters: l - the component not anymore interested by the events. |
Unregister a client on the keyListener. KeyListener delivers events for keystokes on Javelin. |
void | removeZoneListener(com.twinsoft.twinj.zoneListener l) Parameters: l - the component not anymore interested by the events. |
Unregister a client on the zoneListener. ZoneListener delivers events for selection changes. |
void | send(java.lang.String keystrokes) Parameters: keystrokes - the string to send. |
Sends a string as if the user has stroken it on keyboard. All characters between 0x00 and 0xFF can be sent by this way. |
void | setAutoConnect(boolean bAutoConnect) Parameters: bAutoConnect - indicates if automatic connection should be performed without having to call one of the connect() methods. |
Sets the auto connect flag. |
void | setChar(int column, int line, char c) Parameters:
|
Sets the ASCII code of the character at coordinates (column, line). |
void | setClientConfig(java.util.Properties p) Parameters:
|
Sets the current terminal properties. The properties depends on the emulator technology. Only the 3270 and 5250 emulators support this api. |
void | setClientConfig(java.lang.String configuration) Parameters:
|
Sets a new configuration for Javelin. |
void | setDataStableOnCursorOn(boolean bool) Parameters: bool - the DataStableOnCursorOn flag. |
Sets the DataStableOnCursorOn flag. |
void | setDataStableThreshold(int val)
Parameters: val - the dataStableThreshold value. |
Sets the dataStableThreshold value. This value is the maximum time allowed with no data received from the host to consider a dataStable condition. |
void | setDoCapture(boolean bDoCapture) Parameters: bDoCapture - indicates if capture should be written or not. |
Sets the capture flag. |
void | setDteAddress(java.lang.String connectionString) Parameters: connectionString - the connection string using the following format: < path>#< destination>-< source sub address>.< destination sub address>/< max level>. |
Sets the connection string. This method is ineffective for 5250 and 3270 emulators. |
For a direct telnet connection (mandatory for IBM and Bull emulators):
|
||
void | setGroup(java.lang.String group) Parameters: group - the user group. |
Sets the group of the user. |
void | setLogOutputStream(java.io.OutputStream outputStream) Parameters: outputStream - the output stream for traces. |
Defines the output stream for traces. |
void | setSelectionZone(java.awt.Rectangle zone) Parameters: zone - the rectangle that holds the zone (x = column 0 based, y = line 0 based, width = width of the selection in chars, height = height of the selection in chars) |
Sets a selection zone on Javelin. This will result as if the user had selected the zone with the mouse. After this api is called, the user will be able to modify the selection zone. |
void | setServiceCode(java.lang.String serviceCode) Parameters: serviceCode - the service code using the following format :
|
Sets the service code (depending of the terminal class). |
void | setVicUser(java.lang.String vicUser) Parameters: vicUser - the user name. |
Sets the name of the user. |
void | showZones(java.util.Vector rv, java.util.Vector cv) Parameters:
|
Shows Zones on the emulator screen. The zones will be represented as rectangles bounding characters. This feature can be used to enhance or to show a grid system on the emulator screen. Zones are described in a vector of rectangles in character 0 based coordinates. For example, Rectangle (0, 0, 10, 1); will describe a zone in column 0, line 0, of 10 chars. |
void | Trace(java.lang.Exception e) Parameters: e - the exception to log. |
Writes an exception in the emulator log output stream. |
void | Trace(int level, java.lang.String message) Parameters:
|
Writes a message in the emulator log output stream with a given log level. |
void | Trace(java.lang.String message) Parameters: message - the message to write. |
Writes a message in the emulator log output stream. |
boolean | waitAt(java.lang.String searchedString, int column, int line, long timeOut) Parameters:
See also: waitAtId(int, String, int, int), waitForId(int, String), waitFor(String, long), deleteWaitAts(), deleteWaitFors() |
Sets up a synchronous screen trigger. This method returns only when the string searchedString is recognized on the screen at coordinates (column, line). |
void | waitAtId(int id, java.lang.String searchedString, int column, int line) Parameters:
|
Sets up an asynchronous screen trigger. When the string searchedString is recognized on the screen at (column, line) coordinates, the WaitAtDone event is generated by the applet with the identificator id. You can set many observations at the same time. Once the event is generated, the observation is freed. |
boolean | waitCursorAt(int column, int line, boolean here, long timeout) Parameters:
See also: waitAtId(int, int, int, boolean) |
Waits synchronously for the cursor to be at a specified position. This function is useful to detect a new page coming in Videotex and VTxxx emulators. |
void | waitCursorAtId(int Id, int column, int line, boolean here) Parameters:
|
Waits Asynchronously for the cursor to be at a specified position. This function is useful to detect a new page coming in Videotex and VTxxx emulators. |
boolean | waitFor(java.lang.String searchedString, long timeout) Parameters:
See also: waitAt(String, int, int, long), waitAtId(int, String, int, int), waitForId(int, String), deleteWaitAts(), deleteWaitFors() |
Set up a synchronous line trigger. |
boolean | waitForDataStable(int timeout, int dataStableThreshold) Parameters:
|
Waits for the screen to be stable. This routine will return after timeout, even if the screen isn't still stable. |
void | waitForId(int id, java.lang.String Str) Parameters:
|
Set up a screen trigger. When the string Str is recognized in the data stream the event id will be generated. You can set many Triggers at the same time. Once the event is generated, the Trigger is freed. You can wait for these triggers with the WaitTrigger() function. |
void | waitSync(int timeOut) Parameters: timeout - the maximum amount of milliseconds during which the wait will occur. |
Calls the Javelin wait() method. |
int | waitTrigger(long timeout) Parameters: timeout - the maximum amount of milliseconds during which the event is expected. Returns: -1 if the timeout has expired, otherwise the trigger ID. See also: waitAt(String, int, int, long), waitAtId(int, String, int, int), waitForId(int, String), deleteWaitAts(), deleteWaitFors() |
Waits for a trigger that has been set by one of the waitAt() or waitFor() functions. |
Context object
Context is the object representing the context of execution of transactions or sequences. This section presents the context, how it works in Convertigo, and then contains the API documentation of the Context object.
Context general presentation
This section presents the Convertigo context :
Definition
Each time a request is sent to Convertigo, a context is created in the Convertigo Server engine. A context is a kind of dedicated environment and specific tunnel between the client and the Convertigo Server. It contains all the relevant information required to process the request: a copy of the requested project and all its necessary objects, the transaction or sequence execution scopes, cookies, variables… If a context already exists and is available, it can also be re-used, depending on conditions that are explained thereafter.
Identification
A Convertigo context is identified by a contextId, based on the session ID.
The standard template for generating the contextId is : < JSESSIONID>_< contextName>.
Let’s detail these two parts of the contextId :
- JSESSIONID : It is the HTTP session ID, identifier of the user session (like JSESSIONID in Tomcat). All requests made by the same client have to be done using the same HTTP session in order to keep using the same context.
For example:
Two different instances of Internet Explorer open two different HTTP sessions. But if you use the New Window menu function from IE, then the spawned window will retain its parent sessions.
When requesting the same server, Firefox tabs create different HTTP sessions, but Internet Explorer Tabs will only use one.
As for web services clients, like Microsoft .NET, or Java Axis, they most of the time use a specific parameter to retain sessions between succesive calls to a server.
- contextName : The context name differentiates several contexts created for the same HTTP session. By default, contextName value is “default”, corresponding to only one Convertigo context for a given HTTP session. When no context name is specified by the request, this default context name is always used and re-used. It is not the case in the following situations:
- Unlike the HTTP session ID, which is fixed by the server at the first connection from a client, the context name can be chosen by the client and sent as a request parameter: __context=XXXX. Therefore, consecutive requests must use not only the same HTTP session but also the same context name to re-use the same execution context.
- In the case of a transaction or sequence initiated by a sequence, through a Call Transaction or a Call Sequence step (not initiated directly by a client), the context name is automatically generated, and can also be specified in the call step.
Context object
The Convertigo developer has access to the execution context of a transaction or a sequence directly in this transaction or sequence, simply by using the context object. This object is usable in JavaScript code (in transaction’s core for a Legacy transaction, in a Transaction JS statement for an HTML transaction, in a Sequence JS step for a sequence, etc).
The context object can be useful to store data, for example variables, XML chunks, etc. and retrieve this data in another request execution during the same session, as well as to encode and decode data.
But the context object is also a useful tool to control some behaviors of the running transaction or sequence, like the cache storage or pool locking, or to add elements to the output XML, etc. See the complete API of the object on the section Context API documentation
Context API documentation
The following sections present the fields and methods of the Context object that are usable in transactions and sequences JavaScript code.
Fields detailed list
This section presents the list of fields contained in Context object, with their description.
Table 3 - 3: Context fields list
Field name | Type | Description |
---|---|---|
contextID | String | The context unique identifier. |
contextNum | int | The context number (it is incremented by 1 for each newly created context). |
creationTime | long | The context creation time (as a timestamp). |
httpServletRequest | HttpServletRequest | The HTTP servlet request object, when the transaction/sequence currently executed is called externally, through HTTP, by the client. When called through internal invoke (for Call Transaction/Call Sequence steps), the HTTP servlet request object is spread from parent sequences/parent context throughout the sequences hierarchy. |
httpSession | HttpSession | The HTTP session object. |
inputDocument | Document | The input XML document generated by the requester. |
isCacheEnabled | boolean | Indicates whether the cache functionnality is enabled. Default value is true, you can set this parameter to false during the transaction/sequence execution in order not to store the XML response in the cache (for example, in case of error, the response should not be stored). |
lastAccessTime | long | The last access time to this context. |
lockPooledContext | boolean | Indicates whether the context is to be kept in the pool even if it is not in the expected state (i.e. wrong screen class). Usually, a pooled context is automatically destroyed after a transaction execution if it is left on a wrong screen class (not the stable state screen class for this context). This property enables keeping this context alive in the pool for a further use. |
outputDocument | Document | The output XML document generated by the current transaction. |
parentContext | Context | The context of parent sequence, if the currently executed transaction/sequence has a parent sequence, i.e. if the current transaction/sequence is executed through a Call Transaction/Call Sequence step from another sequence (called parent sequence). Otherwise, this property is null. |
remoteAddr | String | The remote address from the calling client. |
remoteHost | String | The name of the calling client (if reverse DNS has been enabled). |
requireEndOfContext | boolean | Indicates whether the context is to be destroyed after the transaction handling. By default set to false, a context is re-usable. This property can be set to true if the context needs to be destroyed after a transaction execution. |
servletPath | String | The servlet path for the current request. |
steps | Vector |
The steps objects, useful for asynchronous transaction. These are the asynchronous mode steps objects, not to be confused with Steps of Sequences. |
tasCommDevice | String | The TAS (VIC or Carioca) communication device for establishing the connection. |
tasDteAddress | String | The TAS (VIC or Carioca) remote address for connection. |
tasServiceCode | String | The TAS (VIC or Carioca) service code. |
tasSessionKey | String | The TAS (VIC or Carioca) session key. |
tasUserGroup | String | The TAS (VIC or Carioca) user group. |
tasUserName | String | The TAS (VIC or Carioca) user name. |
tasUserPassword | String | The TAS (VIC or Carioca) user password. |
tasVirtualServerName | String | The TAS (VIC or Carioca) virtual server name. |
userAgent | String | The user agent from the calling client. |
Methods detailed list
This section presents the list of methods contained in Context object, with their description and parameters.
Table 3 - 4: Context methods list
Return Type | Method signature | Description | |
---|---|---|---|
void | abortRequestable() | Requests the end of the transaction/sequence running in the current context as soon as possible and without any condition. | |
Node | addTextNode(Node parentNode, String tagName, String text) Parameters: parentNode - the parent node into which the new node should be inserted tagName - the new node tag name text - the new node text content Returns: the created node |
Adds a new node containing text in the output XML document, under an identified parent node. | |
Node | addTextNodeUnderBlock(String tagName, String text) Parameters: tagName - the new node tag name text - the new node text content Returns: the created node |
Adds a new node containing text in the output XML document, under the blocks node (in the context of a Legacy transaction). | |
Node | addTextNodeUnderRoot(String tagName, String text) Parameters: tagName - the new node tag name text - the new node text content Returns: the created node |
Adds a new node containing text in the output XML document, under the root node (document element). | |
String | decodeFromHexString(String s) | Parameters: s - the string to decrypt; this string must have been encoded by the encodeToHexString() function in order to stay meaningfull. Returns: the decrypted string or null if any error occurs. See also: encodeToHexString(String), encodeToHexString(String, String) |
Decrypts a string using the triple DES algorithm and the Convertigo default passphrase. |
String | decodeFromHexString(String passphrase, String s) Parameters: passphrase - the ciphering passphrase to use for decoding. s - the string to decrypt; this string must have been encoded by the encodeToHexString() function in order to stay meaningfull. Returns: the decrypted string or null if any error occurs. See also: encodeToHexString(String), encodeToHexString(String, String) |
Decrypts a string using the triple DES algorithm and the passphrase passed as parameter. | |
String | encodeToHexString(String s) Parameters: s - the string to encrypt. Returns: the encrypted string; the script is of hexadecimal string format, i.e. it contains only hexadecimal (printable) characters, or null if any error occurs. See also: decodeFromHexString(String), decodeFromHexString(String, String) |
Encrypts a string using the triple DES algorithm and the Convertigo default passphrase. | |
String | encodeToHexString(String passphrase, String s) Parameters: passphrase - the ciphering passphrase to use for encoding. s - the string to encrypt. Returns: the encrypted string; the script is of hexadecimal string format, i.e. it contains only hexadecimal (printable) characters, or null if any error occurs. See also: decodeFromHexString(String), decodeFromHexString(String, String) |
Encrypts a string using the triple DES algorithm and the passphrase passed as parameter. | |
Object | get(String key) Parameters: key - the key identifying the requested object. Returns: the object bound with the key in the context, or null if no object is bound with this key in the context. See also: keys(), set(String, Object), remove(String) |
Gets the object bound with the specified key in the context, or null if no object is bound with this key in the context. | |
String | getAbsoluteRequestedUrl() Returns: the absolute requested URL. See also: getConvertigoUrl(), getProjectUrl() |
Gets the absolute URL of currently executed request. | |
String | getAuthenticatedUser() Returns: the authenticated user ID from the context/session, or null if the context/session is not authenticated. See also: setAuthenticatedUser(String), removeAuthenticatedUser() |
Gets the authenticated user ID from the context/session, if the context/session is authenticated. Otherwise, returns null. | |
String | getConvertigoUrl() Returns: the absolute URL to Convertigo Server web application. See also: getAbsoluteRequestedUrl(), getProjectUrl() |
Gets the absolute URL to Convertigo server web application. | |
String | getProjectDirectory() Returns: the path to project directory. |
Returns the path to the current project directory. | |
String | getProjectName() Returns: the project name. |
Returns the name of the current project. | |
String | getProjectUrl() Returns: the absolute URL to the project root. See also: getAbsoluteRequestedUrl(), getConvertigoUrl() |
Gets the absolute URL of the current project root. | |
Context | getRootContext() Returns: the context of initial parent sequence, i.e. the sequence that is called externally, through HTTP, by the client. See also: parentContext |
Gets the context object of the sequence called by the client, the first sequence called in currently executed sequences hierarchy. This can be the current context when no call hierarchy is executed, i.e. when the current context is the context of a transaction/sequence called directly by the client. |
|
Object | getTransactionProperty(String propertyName) Parameters: propertyName - the name of the property to retreive. Returns: the property value; depending on the property this value may be an object. |
Retrieves the value of a property of the current transaction. | |
boolean | isSOAPRequest() Returns: true if the request is a SOAP request (i.e. if the request path ends by .ws or .wsl), otherwise returns false. |
Says if the request that initiated the transaction/sequence is a SOAP request or not. | |
Set< String> | keys() Returns: the collection of keys identifying objects stored in the context. See also: get(String), set(String, Object), remove(String) |
Returns the collection of keys identifying objects stored in the context. | |
Properties | loadPropertiesFromProject(String fileName) Parameters: fileName - the name of the properties file to load. Returns: the loaded properties. |
Load properties from a file located in current project folder. | |
Properties | loadPropertiesFromWebInf(String fileName) Parameters: fileName - the name of the properties file to load. Returns: the loaded properties. |
Load properties from a file located in WEB-INF folder. | |
Object | project.get(String key) Parameters: key - the key identifying the object to get. Returns: the value if exists or null See also: project.set(key, value) |
Gets the value in a global shared memory across the project. Return null if the key doesn’t exist. | |
void | project.set(String key, Object value) Parameters: key - the key identifying the object to set. value - the value to set, null to remove. See also: project.get(key) |
Sets a value in a global shared memory across the project. | |
void | remove(String key) Parameters: key - the key identifying the object to remove. See also: get(String), keys(), set(String, Object) |
Removes the object bound with the requested key from the context. | |
void | removeAuthenticatedUser() See also: getAuthenticatedUser(), setAuthenticatedUser(String) |
Removes the authenticated user ID from the context/session. The context/session is not authenticated anymore. | |
Object | server.get(String key) Parameters: key - the key identifying the object to get. Returns: the value if exists or null See also: server.set(key, value) |
Gets the value in a global shared memory across the server. Return null if the key doesn’t exist. | |
void | server.set(String key, Object value) Parameters: key - the key identifying the object to set. value - the value to set, null to remove. See also: server.get(key) |
Sets a value in a global shared memory across the project. | |
boolean | savePropertiesToProject(String fileName, Properties properties) Parameters: fileName - the name of the file to save properties. properties - the properties to save. Returns: true if the save succeeds. |
Saves properties in a properties file in current project folder | |
boolean | savePropertiesToWebInf(String fileName, Properties properties) Parameters: fileName - the name of the file to save properties. properties - the properties to save. Returns: true if the save succeeds. |
Saves properties in a properties file in WEB-INF folder. | |
void | set(String key, Object value) Parameters: key - the key identifying the object. value - the object to bind with the key. See also: get(String), keys(), remove(String) |
Stores an object identified by a key into the context. |
void | setAuthenticatedUser(String userID) Parameters: userID - the user ID that has to be positioned in context/session as authenticated user. See also: getAuthenticatedUser(), removeAuthenticatedUser() |
Sets the context/session as authenticated and stores the userID as the authenticated user ID. |
boolean | waitAtScreenClass(int timeout, int hardDelay) Parameters: timeout - the time (in ms) we have to wait for the screen class. hardDelay - a delay (in ms) added after the screen class has arrived. Returns: true if we the screen did arrive, false otherwise. |
This method only concerns Minitel projects. Waits for one of the screens described by the screen classes in the project to arrive. The method waits for all the screen classes except the current one. You can use waitAtScreenClass() method to synchronize your handler before returning “redetect”, “accumulate” or “skip”. |
boolean | waitNextPage(String action, int timeout, int hardDelay) Parameters: action - the action to perform before waiting. timeout - the time (in ms) we have to wait for the screen class. hardDelay - a delay (in ms) added after the screen class has arrived. Returns: true if we the screen did arrive, false otherwise. |
This method only concerns Minitel projects. Waits for a new page for the same screen class or a new screen class. The method wait for one of the screens described by the screen classes in the project to arrive. We wait for all the screen classes except the current one. In the case of a next page on the same screen class, waitNextPage() will monitor the cursor position. the method will return when the cursor position returns to the same position it was before calling waitNextPage(). You can use waitNextPage() method to synchronize your handler before returning “redetect”, “accumulate” or “skip”. |
Interesting methods in Context fields
Some fields of Context object are themselves objects, containing interesting methods to use in Convertigo transactions and sequences JavaScript code. The following list present these objects methods, with their description and parameters.
Table 3 - 5: Interesting methods in Context fields
Return Type | Method signature | Description |
---|---|---|
String | context.httpServletRequest.getMethod() | Returns the name of the HTTP method with which the request to Convertigo was made. It can be GET, POST, PUT, DELETE, HEAD. |
Project API documentation
The following sections present the methods of the project object that are usable in transactions and sequences JavaScript code.
Methods detailed list
This section presents the list of methods contained in project object, with their description.
Table 4 - 1: project methods list
Return Type | Method signature | Description |
---|---|---|
void | set(key, value) | Stores an object identified by a key, in the Project, shared by users and survive until the Engine is stopped or restarted. |
Object | get(key) | Gets the object bound with the specified key in the Project, or null if no object is bound with this key. |
Sample
var sharedObject = project.get("mySharedObject");
if (sharedObject == null) {
project.set("mySharedObject", sharedObject = {});
}
sharedObject.lastCall = new Date();
Server API documentation
The following sections present the methods of the server object that are usable in transactions and sequences JavaScript code.
Methods detailed list
This section presents the list of methods contained in server object, with their description.
Table 4 - 1: server methods list
Return Type | Method signature | Description |
---|---|---|
void | set(key, value) | Stores an object identified by a key, in the Server, shared by users and survive until the Engine is stopped or restarted. |
Object | get(key) | Gets the object bound with the specified key in the Server, or null if no object is bound with this key. |
Sample
var sharedObject = server.get("mySharedObject");
if (sharedObject == null) {
server.set("mySharedObject", sharedObject = {});
}
sharedObject.lastCall = new Date();
Include API documentation
The following sections present the global function include usable in transactions and sequences JavaScript code.
Function API
Return Type | Method signature | Description |
---|---|---|
void | include(path) | Include to the scope the Javascript file resolved by the path variable, relative to the current project. |
Sample
include("js/myCommonLib.js");
myCommonFunction();
Use API documentation
The following sections present the global function use usable in transactions and sequences JavaScript code.
Function API
Return Type | Method signature | Description |
---|---|---|
void | use(“expression”) | Load and cache to the shared Project memory to save time when using native Java classes. |
Sample
var md5 = ("org.apache.commons.codec.digest.DigestUtils.md5Hex"); // saving time for next calls
log.message("'Hello World!' md5 is: " + md5("Hello World!"));
Add your own Java code or library
The JavaScript code can call Java classes already loaded by Convertigo (like some Apaches libraries or internal to Convertigo). You can also provide your own jar file or Java classes. Java classes or methods loading can be speedup by the use function. JDBC drivers can also be overridden with this feature.
Shared for all project
Java classes or jars can be added to the <convertigo workspace>/libs
folder but not in sub folder. If you have classes files, you can add them to <convertigo workspace>/libs/classes
folder.
For a specific project
Java classes or jars can be added to the <project dir>/libs
folder but not in sub folder. If you have classes files, you can add them to <project dir>/libs/classes
folder.