HTTP requests and proxies

Hello everyone;

Disclaimer ... I've recently received a fairly large set of code which
implements
a resource (extending PostableResource), integrated into Jigsaw1.0beta.
I've only become familiar with Jigsaw as of last week, and need to modify
this resource code very quickly for an upcoming demo ... hence, I'll probably
display a good amount of ignorance of Jigsaw in this message, and I do
not have the time, before my demo, to upgrade Jigsaw to 2.0 (though I plan
to do this as soon as I can).  Here's my situation:

I am attempting to modify this resource to simply load a page via HTTP, and
send it back to the client.  In my test case, I randomly chose

http://www.altavista.com/.  This is the code I inserted:

	public class MyResource extends PostableResource { 
	...
	public synchronized Reply handle (Request request, URLDecoder data) 
		throws HTTPException {
	...
	Reply  r = request.makeReply(HTTP.OK);
	...	// *** my code begins ***
	w3c.www.protocol.http.HttpManager manager =
w3c.www.protocol.http.HttpManager.getManager() ;
	 w3c.www.protocol.http.Request avreq = manager.createRequest() ;
	 avreq.setMethod("GET") ;
	 try {
		avreq.setURL(new URL("http://www.altavista.com/"));
		w3c.www.protocol.http.Reply reply = manager.runRequest(avreq) ;
		r.setStream(reply.getInputStream());
	 } catch (Exception e) { e.printStackTrace(); }
	 return r;

In your opinion, is this the most straight-forward way to make an HTTP
request for a page, and return it as a reply to the request which called
MyResource?

I was able to get this code to work when I was dialed into my ISP.
However, when I was dialed into my work system, which is behind
a firewall, I needed to use a proxy in order to reach www.altavista.com.
I specified proxyHost, proxyPort and proxySet in the http-server.props
config file, setting the Jigsaw proxy to our company proxy server.
I then set my web browser proxy settings to my Jigsaw server, and
was able to reach http://www.altavista.com/

However, the MyResource code doesn't appear to be picking up
the http-server.props proxy settings.  I get the following exception:

	w3c.www.protocol.http.HttpException: The host name [www.altavista.com]
couldn't
	be resolved. Details: "www.altavista.com"

In the code above, I inserted a call to manager.usingProxy() and got back
a false ... this made sense.  So I inserted the following code:

	// set proxy to the same URL specified by config proxyHost and proxyPort
	manager.setProxy(new URL("http://ourproxyserver.com:8000"));

Now the call to manager.usingProxy() returns true, but I still get the same
HttpException.  Do you have any ideas?

Thanks in advance, I'm grateful for any information or advice you may have.

_________________________
Dave Clark
Secure Technologies
Lucent Technologies/Bell Labs
dac@lucent.com
PGP 5.5 Key ID: 0xE660D187
Fingerprint: 4F14 F76D 8E35 362C CECA  0BCD 21BC 007E E660 D187

Received on Tuesday, 12 May 1998 11:35:16 UTC