Re: ProcessFilter problem

> 
> Hi man,
> 
> I set up jigsaw as Proxy server sucessfully. Now I have several
> questions about custamizing the Proxy server:
> 
> 1. I used default parameters for starting server. That is like:
> -host space -root /export/home/jigsaw........
> The problem is when I access the URL: space:8001, it is right as what I
> expected. But when I access space.njit.edu:8001(.njit.edu is default
> domain for my host), it seems to fall in dead loop: without any replies.
> The same situation accured: When I specify space:8001 as my browser's
> http proxy server, it is right. But it fails when I specify
> space.njit.edu:8001 as my browser's http proxy server.
> 
> 2. I am trying to add ProcessFilter to my Proxy server. I think the
> specification about command of ProcessFilter is not so clear. I only
> sucessfully specified UNIX commands without any parameters as
> ProcessFilter's external commands. I can not specify a java program as
> its external command. e.g. I want to mytest.class as the external
> command. I specify
> java mytest
> as the command of ProcessFilter. But browser tell me command
> java mytest
> was not found. I am sure the binpath and classpath is all right.
> 
> 3. If I sucessfully started a java program as ProcessFilter's external
> command, how to get Reply message of ProcessFilter at external java
> program. I mean I want to modify the Reply content in my java grogram,
> and return the modified Reply message back to ProcessFilter.
> 
> Thanks,
> Qiang
> 

 1) This is a known problem, You just have to specify the entire name
    in the properties "general" in the field "host". So put
    space.njit.edu in the "host" field. 
    When a proxy with "host" equals to "space" (which is the default) has a 
    request for "space.njit.edu" it doesn't see that the request is for itself,
    so it ask the server "space.njit.edu" and create a dead loop.
    
 2)

 I have never do that before (call a java program in a Process filter), so
 I have written an simple java program:

**************************** HelloWorld.java *************************
package benoit.test;

import java.io.*;

public class HelloWorld {

  public static void main (String args[]) {
    InputStream in = System.in ;
    byte b = -1;
    System.out.println("----------- Hello World ------------");
    try {
      while( (b = (byte)in.read()) != -1)
	System.out.write(b);
      System.in.close();
    } catch (IOException ex) {
      System.out.println(ex.getMessage());
    }
    System.out.println("----------- Hello World ------------");
  }

}
**********************************************************************

 And I have tried to use it in my processFilter. This java program is
 called in a Runtime.exec(command). So the environment used is the
 default one, not yours!
 I show you the things I have puted in command:

 [0] /usr/local/java/bin/java
 [1] -classpath 
 [2] /usr/local/java11/lib/classes.zip:/u/www43/0/w3c/bmahe/Work/Java/classes
 [3] benoit.test.HelloWorld

 You can see that I have specified the classpath to use in the command line.

 So with this configuration and this class, my processFilter put 
 ----------- Hello World ------------ before and after the document
 requested.

 3) you can see in my HelloWorld class how to modify the Reply.
 You can read the Reply in System.in and modify it by writing the
 new one in System.out. 
 The process filter write the Reply in System.in and read the result of the
 command called in System.out.

 Benoit.


- Benoît Mahé -------------------------------------------------------
                      World Wide Web Consortium (W3C)
                    Architecture domain - Jigsaw Team           

  http://www.w3.org/People/Mahe - bmahe@w3.org - +33.4.92.38.79.89 
---------------------------------------------------------------------

Received on Tuesday, 27 January 1998 05:18:05 UTC