W3C home > Mailing lists > Public > www-jigsaw@w3.org > May to June 1997

Re: external program (process filter).

From: Joseph M. Futrelle <futrelle@ncsa.uiuc.edu>
Date: Fri, 20 Jun 1997 11:15:06 -0500 (CDT)
Message-Id: <199706201615.LAA18541@pecos.ncsa.uiuc.edu>
To: www-jigsaw@w3.org

 If your program is written in Java, you shouldn't be calling it as
an external command using ProcessFilter. This usually results in the OS
creating a new Java runtime every time an HTTP request comes into your
resource. This can be **very** slow!
 You should modify your Java program so that it is a subclass of
w3c.jigsaw.resources.ResourceFilter. Then it will be able to do everything
an external program called by ProcessFilter can do, and more. The tutorial
on "Implementing a Filter" shows how to do this.
 If you absolutely have to write your filter as an external java program,
(which I *don't* recommend!) it should look something like this:

class MyProgram {
  public static void main (String args[]) {
    BufferedReader br = new BufferedReader
      (new InputStreamReader (System.in));
    for (;;) {
      String line = br.readLine ();
      if (line == null) break;
      // insert code to do something here ...
      System.out.println (line);
    }
  }
}

ProcessFilter is good when the processing program is written in a language
other than Java. For instance, here's a Perl script which removes <blink>
tags from html files:

#!/usr/local/bin/perl -np
s#\<(/|)\w*blink\w*\>##ig;

Julianne Freire de Sousa Pepeu spake thusly:
> Hi, all.
> 
> Does anybody have a program that can be  called by
> the command attribute of the processfilter? I would
> like to know about the communication between the 
> processfilter and the external program.
> 
> My program (in Java) isn't working...
> 
> Thanks in advance,
> 
> Julianne.
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Julianne Freire Pepeu    Departamento de Informatica, UFPE
> jfsp@di.ufpe.br          http://www.di.ufpe.br/~jfsp

-- 
Joe Futrelle
Developer, EMERGE Joule/Jigsaw Java/HTTP
National Center for Supercomputing Applications
futrelle@ncsa.uiuc.edu (217) 265-0296
Received on Friday, 20 June 1997 12:15:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:26 GMT