W3C home > Mailing lists > Public > www-jigsaw@w3.org > November to December 1999

how to generate valid http1.1 request & compile source file

From: Chan Wing Luk <cscwl@cityu.edu.hk>
Date: Wed, 15 Dec 1999 13:07:07 +0800
To: www-jigsaw@w3.org
Message-id: <000401bf46ba$3cc6b4e0$6a25d690@cspc50>
gentleman,

below is my classpath info and Test.java
when compile the file, it fails to reference jigsaw class files.
can u show me how can i compile the file and generate valid request?
or, can u send a sample code to me for reference?

btw, do u know where should i start if i want to study/modify how's jigsaw
proxy doing paging?
becoz, i wanna write some resource & paging method for mobile environment.

many thanks

set classpath=.;..;c:\java\jdk1.2.1\src.jar
set classpath=%classpath%;c:\java\jsdk2.1\server.jar
set classpath=%classpath%;c:\java\jsdk2.1\servlet.jar
set
classpath=%classpath%;e:\Jigsaw\classes\jigsaw.zip;e:\Jigsaw\classes\jigadmi
n.jar;e:\Jigsaw\classes\sax.jar;e:\Jigsaw\classes\xp.jar

package src/classes/org/w3c/jigsaw/test
import java.util.*;
import java.net.*;
import java.io.*; // FIXME - DEBUG
import org.w3c.www.mime.*;
import org.w3c.util.*;

   public static void main(String args[]) {
	try {
	    // Get the manager, and define some global headers:
	    HttpManager manager = HttpManager.getManager();
	    manager.setGlobalHeader("User-Agent", "Jigsaw/1.0a");
	    manager.setGlobalHeader("Accept", "*/*;q=1.0");
	    manager.setGlobalHeader("Accept-Encoding", "gzip");
	    PropRequestFilter filter =
	      new org.w3c.www.protocol.http.cookies.CookieFilter();
	    filter.initialize(manager);
	    PropRequestFilter pdebug =
	      new org.w3c.www.protocol.http.DebugFilter();
	    pdebug.initialize(manager);
	    Request request = manager.createRequest();
	    request.setURL(new URL(args[0]));
	    request.setMethod("GET");
	    Reply       reply   = manager.runRequest(request);
	    //Display some infos:
	    System.out.println("last-modified: "+reply.getLastModified());
	    System.out.println("length       : "+reply.getContentLength());
	    // Display the returned body:
	    InputStream in = reply.getInputStream();
	    byte buf[] = new byte[4096];
	    int  cnt   = 0;
	    while ((cnt = in.read(buf)) > 0)
	      System.out.print(new String(buf, 0, 0, cnt));
	    System.out.println("-");
	    in.close();
	    manager.sync();
	} catch (Exception ex) {
	    ex.printStackTrace();
	}
	System.exit(1);
    }
}


regards,
Julian Minci
Received on Wednesday, 15 December 1999 00:03:41 GMT

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