View Javadoc

1   /*
2    * $Id: OutboundHeadersAnnotationComponent.java 20321 2010-11-24 15:21:24Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.api.annotations.param;
12  
13  import java.util.List;
14  import java.util.Map;
15  
16  /**
17   * Tests various cases for how headers can added to an outbound message through a generic map by injecting the 
18   * map into a component invocation
19   */
20  public class OutboundHeadersAnnotationComponent
21  {
22      public Map<String, Object> processHeaders(@OutboundHeaders Map<String, Object> headers)
23      {
24          headers.put("bar", "barValue");
25          //Verify that we receive any outbound headers already set on the message
26          if(headers.containsKey("foo"))
27          {
28              headers.put("foo", "fooValue");
29          }
30          return headers;
31      }
32  
33      //Can only use the {@link OutboundHeaders} annotation on Map parameters
34      public List<?> invalidParamType(@OutboundHeaders List<?> headers)
35      {
36          return headers;
37      }
38  }