help-java2html
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-java2html] Setup java2html as cgi


From: Robert Wetzel
Subject: Re: [Help-java2html] Setup java2html as cgi
Date: Wed, 11 Apr 2001 14:16:37 +0200 (MET DST)

Hi,

  as I had some spare time last weekend I tried myself at
  programming a CGI-interface for java2html. Currently
  it's more a quick hack than anything else. But heh,
  it's better than nothing. :-)

  I can't claim it will compile on Windows, I tested
  it only on my Linux box (thats one reason why this
  is a quick hack and nothing more).


How it is accomplished?

  The main question was: How will the QUERY_STRING be
  parsed without implementing a fullsized scanner? As
  using libraries may lead to problems with Windows,
  a different solution have to be found.

  The current solution is based on the option parser
  which is already used by java2html. The QUERY_STRING
  is splitted by '&'. Every resulting substring will
  be preceded by a "--" and added to the list of
  arguments, i.e.

    http://...../java2html?css=~me/java.css&input=~me/Hello.java

  will result in two 'real' arguments:

  #1: --css=~me/java.css
  #2: --input=~me/Hello.java

  Thereafter they will be parsed and interpreted as
  normal arguments.

  The method which maps the QUERY_STRING to the list
  of arguments is located in envmapper.c and named
  map_environment(). In case QUERY_STRING is defined
  it will create a new list of arguments, copying
  the old ones to the new list. Currently up to 128
  arguments are allowed, maybe the algorithm will be
  replaced with an adaptive version.


Decision between normal and CGI mode

  The decision between the normal and the CGI mode
  is done by searching the environment after the
  variable QUERY_STRING. If this environment variable
  is defined, java2html runs in CGI mode, otherwise
  it runs in normal mode.
  main.cc contains now a (more or less) global
  variable called "is_cgi" (int), which contains a
  value !=0 if java2html runs in CGI mode.


Problems with file names

  Currently all file names (input file, css file, ...)
  must be given relatively to the java2html program
  or as an absolute path name.


Which files has been changed

  Beside the two new files src/envmapper.h and
  src/envmapper.c, the files src/main.cc and
  src/Makefile.am has been changed.


Further Problems

  There are (as usual) a bunch of problems lurking around:

  * In my limited view I think it's sufficient to display
    only one file at once. If there is the need for more,
    there should be a way to divide the files (i.e. by
    a <HR> in a simple case).
  * What should happen if no arguments were given? Display
    an error page?
  * Currently the files given are related to the location
    of java2html in the 'real' filesystem. I don't like to
    give full pathnames only because I like to share one
    java2html between all users of a web host/site.

 -----

I added a full tar.gz archive, which contains java2html-1.7
and my changes. Do what you want with it :-)

cheers,

  Robert.

Attachment: java2html-1.7cgi.tar.gz
Description: java2html-1.7cgi.tar.gz


reply via email to

[Prev in Thread] Current Thread [Next in Thread]