balld       01/06/13 21:30:37

  Added:       src/org/apache/cocoon/acting HttpHeaderAction.java
  Log:
  added a simple class to add http headers to the response object
  
  Revision  Changes    Path
  1.1                  xml-cocoon2/src/org/apache/cocoon/acting/HttpHeaderAction.java
  
  Index: HttpHeaderAction.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included  with this distribution in *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  package org.apache.cocoon.acting;
  
  import java.util.Collections;
  import java.util.HashMap;
  import java.util.Map;
  import java.util.Iterator;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.cocoon.Constants;
  import org.apache.cocoon.environment.Redirector;
  import org.apache.cocoon.environment.Response;
  import org.apache.cocoon.environment.SourceResolver;
  
  /**
   * This action adds HTTP headers to the response.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Donald Ball</a>
   * @version CVS $Revision:
   */
  public class HttpHeaderAction extends AbstractAction {
  
      public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, 
String source, Parameters parameters) throws Exception {
          Map results = new HashMap();
          Response response = (Response)objectModel.get(Constants.RESPONSE_OBJECT);
          Iterator iterator = parameters.getParameterNames();
          while (iterator.hasNext()) {
              String name = (String)iterator.next();
              response.setHeader(name,parameters.getParameter(name));
              results.put(name,parameters.getParameter(name));
          }
          return Collections.unmodifiableMap(results);
      }
  
  }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to