Re: Scanning header fields as they pass through proxy

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 UTC