· Nov 19 2m read

Java Global Editor from WebTerminal

There are situations when your only access to a server is using a web browser,
and there is just no chance of a Terminal or Console access.
The Online Demo Server is such a case.

So you have WebTerminal. That's fine for ObjectScript and Embedded Python.

But my demo is straight Java. And is interactive.
$ZF(-100...) is some aproach. But it's rater batch-oriented and not interactive.
@Enrico Parisi  presented a nice extension to WebTerminal recently.
It's close to my own package WebCommand that I presented a year ago.

They all act in the same way. It is always a single-shot approach:
Launch a command to your OS and collect the replies. No interaction.

Digging through documentation I found that device CPIPE has a read queue by default.
This means you read the result of the command like a file until it is empty!
Not so bad, but the wrong direction.
BUT: there is a switch /WRITE to reverse the direction. Like for printing.
Much better. However, my requirement is a synchronized  READ/WRITE  exchange.
Not implemented. (or I didn't recognize)

Output Redirection provided the missing piece.
Now I start my Java Demo over CPIPE, redirect the Output to a file, and
ane execute alternate read and write actions.

	set cpipe="|CPIPE|1"
 		,cmd="cd /opt/irisapp/ && java rcc > g.log"
 	open cpipe:(cmd:/WRITE)
 	#;  collect and show the reply
    #; get userinput
    use cpipe WRITE userinput,!
    #; end loop

So I have a synchronized ping-pong  with my Java + IRIS NativeAPI

A hint for reading the file:

  • $ZPOS gives you the last position of READ
  • USE file:StartPosition  allows you to skip already displayed text.

So you can skip the previous file content and just present the new lines.

This works also in the Online Demo 

Discussion (0)1
Log in or sign up to continue