- From: Yves Lafon <ylafon@w3.org>
- Date: Tue, 13 Jan 1998 15:21:18 +0100 (MET)
- To: Yael Stav <stav@radview.com>
- cc: George Vardaggalos <gvard@telecom.ece.ntua.gr>, jigsaw mailing list <www-jigsaw@w3.org>
On Tue, 13 Jan 1998, Yael Stav wrote:
>
>
> George Vardaggalos wrote:
>
> > Hi Yael.
> >
> > I'm a new user of Jigsaw. I saw you in the mailing list of jigsaw, and
> > also saw you've already used jigsaw as a proxy.
> >
> > I want to make a java client which will request a url from the jigsaw
> > proxy, (that means I'll use jigsaw as a proxy. After the process
> > described in the FAQ for setting jigsaw as a proxy do I need to do
> > anything with the admin and what's this?) and the proxy will fetch it
> > from the desired web server. (of course I'd like to support get and post
> > methods)
> >
> > How could I do it if I wanted to call jigsaw proxy via HTTP so as to
> > download the desired url? I've made a java process, not so efficient
> > indeed to download urls to my hard disk. But I'd like to use this
> > proxy so as to check before it gets the original web server its cache.
> > Is it easy to be done too? You know, I'm a new java programmer, and I'm a
> > bit confused with all this huge API.
> >
> > Could you give me some simple solutions?
> >
> > that's the code I wrote, how could be done using jigsaw proxy?
> > ( I know it's not the best code but I saw url saved in my hard disk)
> >
> > import HtmlException.*;
> > import java.io.*;
> > import java.net.*;
> >
> >
> >
> > class getURL {
> >
> >
> > public static void main(String[] args) {
> >
> > try {
> > URL url = new URL(args[0]);
> > File f = new File(url.getHost());
> > URLConnection urlc = url.openConnection();
> > BufferedReader br = new BufferedReader(new
> > InputStreamReader(urlc.getInputStream()));
> > String inputLine;
> >
> > DataOutputStream out = new DataOutputStream(new
> > FileOutputStream(url.getHost()));
> >
> >
> >
> > while (( inputLine = br.readLine()) != null)
> >
> >
> >
> > for (int i=0;i<inputLine.length();++i)
> >
> > out.write((byte)inputLine.charAt(i));
> >
> > out.close();
> > br.close();
> >
> >
> > } catch (FileNotFoundException e) {
> > System.err.println("FileStreamsTest: " + e);
> > } catch (IOException e) {
> > System.err.println("FileStreamsTest: " + e);
> > }
> > }
> >
> > }
> >
> > Thanks in advance,
> >
> > George.
>
> Hi,
> I can answer some of your questions, since I'm indeed using
> Jigsaw as a proxy server (though I'm using it with no caching functionality):
>
> a. After you install Jigsaw as a proxy, as described in the FAQ,
> you should be able to check whether it's working or not.
> Just use any web browser, configured to use the proxy, and see if you get all
> the web documents alright.
> 4 example: In Netscape Communicator go to Edit/Preferences/Advanced/Proxies
> and choose in the manual proxy configuration, as the HTTP proxy, the host (and
> port) where you installed jigsaw.
>
> b. If phase a went OK, this means the Jigsaw is indeed working.
> Now all you have to find out is how (if possible) you get the
> URLConnection to address Jigsaw as a proxy, instead of sending the HTTP
> request directly to the destiny web server.
> I can't help you with this, but I think that if it doesn't appear in the
> URLConnection API you should probably write some new class extending it, which
> will set the appropriate headers in the HTTP request.
The use of a proxy to do the request is here (and it is the same in the
URLConnection of the JDK api), you must set some properties at startup or
in a properties file:
proxyHost=myproxy.mydomain.com
proxyPort=8008
proxySet=true
ex:
java -DproxyHost=myproxy.mydomain.com -DproxyPort=8008 -DproxySet=true
getUrl http://www.foo.bar/
/\ - Yves Lafon - World Wide Web Consortium -
/\ / \ Architecture Domain - Jigsaw
/ \ \/\
/ \ / \ http://www.w3.org/People/Lafon - ylafon@w3.org
Received on Tuesday, 13 January 1998 09:24:24 UTC