This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

a Kawa console using AJAX


his year's buzzword is/was AJAX "Asynchronous JavaScript and XML"
(http://en.wikipedia.org/wiki/Ajax_%28programming%29).
I've long been disappointed by the lack of console terminal application
that go beyond text, and was sad to see XMLterm die.  Well, I realize
using JavaScript and AJAX may be a reasonable solution, so I put
together a working prototype / proof of concept.

See the atached repl.png for a screenshot.

To get this to work you need Tomcat 4.1.x, amd then to install
kawa-1.8.jar (from CVS) into $CATALINA_HOME/shared/lib/kawa-1.8.jar.
You need to add:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app>
  <servlet>
    <servlet-name>ReplServlet</servlet-name>
    <servlet-class>gnu.kawa.servlet.ReplServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>ReplServlet</servlet-name>
    <url-pattern>*.term</url-pattern>
  </servlet-mapping>
</web-app>
to a suitable $CATALINA_HOME/webapps/$APP/WEB-INF/web.xml, and
install the attached repl.html into webapps/$APP/repl.html.
Then start up Tomcat and your your browser at
http://localhost:8080/$APP/repl.html
(repl.html is gzip-compressed not because it is big, but because
sources.redhat.com doesn't allow html attachments. Sigh.)
(This is somewhat terse - it helps if you've set up Tomcat before.)

The repl.html uses JavaScipt and specifically XMLHttpRequest (i.e. AJAX)
to communite with a ReplSession object running inside Tomcat.
It works tolerably well.  Standard output, error, the prompt, and
the input all have different attributes so they can be styled
differently, if desired.

Interesting extensions that come to mind:
* A Kawa hook to emit html/xml/svg into the output.  (Trivial - just a
matter of decining on the interface.)
* Hooks to modify previously-emitted html/xml/svg objects.  This can
be extended to true distributed GUI programming.
* A trivial Http server with basic servlet support built into Kawa
so we can start Kawa a a server without needing Tomcat.
* A C (or C++)-based simple Http engine that speaks the needed protocol.
At that point we can add a "raw mode" to handle curses/termcap/readline
applications.  (Long ago I wrote an emacs "term" mode that embodies a
suitable design.)  Handling font/color changes is easily done at the
server end; cursor motion and editing is trickier of course.
* A terminal emulator that combines the latter with a standalone
XUL application.

Anyone inspired?
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/

PNG image

Attachment: repl.html.gz
Description: GNU Zip compressed data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]