org.mortbay.http.handler
Class SetResponseHeadersHandler

java.lang.Object
  extended by org.mortbay.http.handler.AbstractHttpHandler
      extended by org.mortbay.http.handler.SetResponseHeadersHandler
All Implemented Interfaces:
java.io.Serializable, HttpHandler, LifeCycle

public class SetResponseHeadersHandler
extends AbstractHttpHandler

Handler that allows arbitrary HTTP Header values to be set in the response.

Version:
$Id: SetResponseHeadersHandler.java,v 1.6 2005/08/13 00:01:26 gregwilkins Exp $
Author:
Brett Sealey
See Also:
Serialized Form

Constructor Summary
SetResponseHeadersHandler()
           
 
Method Summary
 void handle(java.lang.String pathInContext, java.lang.String pathParams, HttpRequest request, HttpResponse response)
          Handle a request by pre-populating the headers from the configured set of _fields.
 void setHeaderValue(java.lang.String name, java.lang.String value)
          Set a header override, every response handled will have this header set.
 void setHeaderValues(java.lang.String name, java.lang.String[] values)
          Set a multivalued header, every response handled will have this header set with the provided values.
 
Methods inherited from class org.mortbay.http.handler.AbstractHttpHandler
getHttpContext, getName, handleTrace, initialize, isStarted, setName, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SetResponseHeadersHandler

public SetResponseHeadersHandler()
Method Detail

setHeaderValue

public void setHeaderValue(java.lang.String name,
                           java.lang.String value)
Set a header override, every response handled will have this header set.

Parameters:
name - The String name of the header.
value - The String value of the header.

setHeaderValues

public void setHeaderValues(java.lang.String name,
                            java.lang.String[] values)
Set a multivalued header, every response handled will have this header set with the provided values.

Parameters:
name - The String name of the header.
values - An Array of String values to use as the values for a Header.

handle

public void handle(java.lang.String pathInContext,
                   java.lang.String pathParams,
                   HttpRequest request,
                   HttpResponse response)
            throws HttpException,
                   java.io.IOException
Handle a request by pre-populating the headers from the configured set of _fields. Settings made here can be overridden by subsequent handling of the request.

Parameters:
pathInContext - The context path. Ignored.
pathParams - Path parameters such as encoded Session ID. Ignored.
request - The HttpRequest request. Ignored.
response - The HttpResponse response. Updated with new Headers.
Throws:
HttpException
java.io.IOException


Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.