|PREV PACKAGE NEXT PACKAGE||FRAMES NO FRAMES|
|JagTask||Deprecated. Replaced by
|JarTask||Deprecated. Replaced by
|JavacTask||Deprecated. Replaced by
|ProcessTask||Deprecated. Replaced by
|RmTask||Deprecated. Replaced by
|Servlet||Deprecated. Replaced by
|Task||Deprecated. Replaced by
|Task.In||generic input source.|
|Task.In.None||empty input as input source.|
|Task.In.Stream||byte stream as input source.|
|Task.In.String||string as input source.|
|Task.Out||generic output sink.|
|Task.Out.None||black hole as output sink.|
|Task.Out.Stream||byte stream as output sink.|
|Task.Exception||wraps any exception during
Deprecated, replaced by
This is the homepage of gs, a servlet to provide preprocessing
jag, compilation with javac, and execution in an applet.
gs can be accessed with the GET or POST
methods of HTTP. It will reply with a request page, Java source
resulting from preprocessing with
jag, an applet page,
or error messages from
jag and javac. The expected
key/value pairs are documented in
Servlet. The table below
shows possible queries and responses.
|?||request page with sample program.|
|request page with sources. Either source can also be a HTTP-based URL. A partial URL is resolved against the HTTP referer.|
|page with Java code resulting from preprocessing.|
|applet page to execute the main program in the
|?applet=basename.jar||archive for applet (once only).|
By default gs will return a request page with a sample,
editable jag source and
a URL for the Java code of a
suitable frontend which resulted from preprocessing an annotated grammar with
The example can produce stack machine code for arithmetic
The request page submits
jag and Java source texts or
URLs as values for the keys jag.source and javac.source
and true for jag and (optionally) for javac.
Partial URLs would be resolved against the referer which
only exists if the submission comes from a page obtained via HTTP.
The only protocol supported is HTTP.
If jag.source is not accompanied by true for
jag gs replies with a request page presenting the
jag source text for editing and submission. This is intended to
present tutorial examples for execution within some other course
If jag.source is accompanied by true for jag but not for javac, gs replies with an error report or Java code resulting from preprocessing the source. This is intended to demonstrate the effects of preprocessing.
javac.source can contain Java source text or one or more (partial) URLs separated by white space. Multiple sources must be in the same package, however.
If both, jag and javac, have the value
true gs sets up a temporary directory and a package
path, if any, with the (preprocessed) sources and
placed into the package and executes javac with
jay.yydebug and the runtime support of
jag on the
If preprocessing and compilation succeed gs builds a
temporary archive file with the class files,
and the runtime support of
jag, and replies with an applet
page referencing the archive. If preprocessing or compilation
fails gs replies with the relevant error log. All files
but the archive file are deleted in either case.
The applet page contains a request with a value for applet so that the archive file will be returned and deleted from the temporary file area.
Both source texts are searched for the package path, if any, and the name of the first class, which must be public. The search uses pattern matching and accounts for comments and white space but it will fail if package or import paths contain white space or comments. The package may not be java.lang and the class name may not be System. Both source texts must belong to the same package.
The applet class
System is placed into the same package
as the source texts and is compiled together with the source
texts. This means that as long as there is no explicit reference
to java.lang.System rather then System and as
long as there is no reference from another class,
will take over.
System inserts a fresh
yyPrintStream each time the
is started in the applet. These streams emulate a terminal in a
text area in the applet.
System delegates all other methods
Apparently, the Java code has access to whatever libraries are available within the web browser, including, e.g., the AWT, as long as it sticks within the security constraints for an applet. Without a policy setup there can be no local file access and no network activity.
There seems to be no reliable way to really terminate a thread. However, standard i/o is disconnected from the Java program when it is "stopped" in the applet and the web browser will forcibly remove the remains once the applet page is closed.
It should be noted that a class is loaded into an applet only once, i.e., if a program is restarted in the applet, the static items of the program are not initialized again.
Taskis a useful framework. Can it be scripted to support other tutorial scenarios?
|PREV PACKAGE NEXT PACKAGE||FRAMES NO FRAMES|