Re: Eclipse query

From: Joachim Schimpf <j.schimpf_at_icparc.ic.ac.uk>
Date: Mon 11 Mar 2002 08:48:50 PM GMT
Message-ID: <3C8D1832.4E140873@icparc.ic.ac.uk>
Kevin wrote:
> 
> Is it possible to "launch" eclipse code wia the web... I.e User enters his
> info into text fields and clicks submit, is it then possible to initiates
> eclipse code and
> returns an answer/output onto the browser for the user to view???


I attach some code that uses the cgi interface of an
http server to call Eclipse:

run.html is an html page that lets you input code and a query.
When you click the submit-button, your http server should
launch eclipse.cgi (provided you have put eclipse.cgi in the
right place and set all the permissions correctly).

eclipse.cgi is a sh-script that lauches eclipse, which then
loads run.pl and exexcutes go/0.

go/0 uses predicates from lib(cgi) to get the user input
from the web form, and processes this data. It then writes
an html page to standard output, which should then appear
on your browser.


Note that the attached example code is very dangerous because
it allows the user of the html page to specify an arbitrary
Eclipse goal and execute it on you machine. There are no
safeguards (apart from the unix permissions) to restrict
what this goal can do (delete files etc). So under no
circumstances put this on a public web server... it is
only for demonstration. Normally you would let eclipse only
execute a fixed goal and check all user input to this goal
very carefully.


There is a different way of achieving the same thing, which
is not to use an http server and cgi, but to have Eclipse itself
be the http server. There is a lib(http_server) in the distribution
which should do that, but I have not really used it recently and
it might be broken (however, the source is there and you may be
able to fix it :-)

Best regards,
Joachim
-- 
 Joachim Schimpf              /             phone: +44 20 7594 8187
 IC-Parc, Imperial College   /            mailto:J.Schimpf@ic.ac.uk
 London SW7 2AZ, UK         /    http://www.icparc.ic.ac.uk/eclipse
#! /bin/sh
exec /usr/local/eclipse/release/bin/sparc_sunos5/eclipse -b /homes/js10/public_html/icparc_only/run.pl -e go


Run Eclipse Run with ECLiPSe:

Code:

Query:




Received on Mon Mar 11 20:48:52 2002

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:08:14 PM GMT GMT