W3C home > Mailing lists > Public > www-jigsaw@w3.org > January to February 2000

Re: Scanning header fields as they pass through proxy

From: Yves Lafon <ylafon@w3.org>
Date: Tue, 25 Jan 2000 11:39:32 +0100 (MET)
To: "CAMERON, CRAIG" <CRAIG.CAMERON1@corpmail.telstra.com.au>
cc: W3 Jigsaw Mailinglist <www-jigsaw@w3.org>
Message-ID: <Pine.GSO.4.21.0001251131090.5149-100000@tarantula.inria.fr>
On Tue, 25 Jan 2000, CAMERON, CRAIG wrote:

> Hi,
> 	I've finally modified HeaderFilter to add headers as requests pass
> through the proxy but I want to be able to add different information based
> on a particular (non-standard) header.  Looking through org\w3c\www\http\
> reveals lots of methods for scanning particular fields but I haven't found a
> function which just returns a particular header value (as a String) when
> given the header name (as a String).

You can use getHeaderValue(String name).toExternalForm()
If you want to get all the headers from a reply for example taken from the
cache resource:
	    
	    ArrayDictionary a = new ArrayDictionary(5, 5);
	    Enumeration     e = reply.enumerateHeaderDescriptions();
    	    while ( e.hasMoreElements() ) {
		HeaderDescription d = (HeaderDescription) e.nextElement();
		// Skip all well-known headers:
		if ( d.isHeader(Reply.H_CONTENT_TYPE)
		     || d.isHeader(Reply.H_CONTENT_LENGTH)
		     || d.isHeader(Reply.H_LAST_MODIFIED)
		     || d.isHeader(Reply.H_ETAG)
		     || d.isHeader(Reply.H_AGE)
		     || d.isHeader(Reply.H_DATE)
		     || d.isHeader(reply.H_CONNECTION))
		    continue;
		// This is an extra header:
		a.put(d.getName(), reply.getValue(d));
	    }

By default, the setValue of HttpMessage is using HttpString.
Hope this helps,


      /\          - Yves Lafon - World Wide Web Consortium - 
  /\ /  \        Architecture Domain - Jigsaw Activity Leader
 /  \    \/\    
/    \   /  \   http://www.w3.org/People/Lafon - ylafon@w3.org    
Received on Tuesday, 25 January 2000 05:38:01 GMT

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