View Javadoc

1   /*
2    * $Id: OutboundHeadersAnnotationComponent.java 19191 2010-08-25 21:05:23Z tcarlson $
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  package org.mule.api.annotations.param;
11  
12  import java.util.List;
13  import java.util.Map;
14  
15  /**
16   * Tests various cases for how headers can added to an outbound message through a generic map by injecting the 
17   * map into a component invocation
18   */
19  public class OutboundHeadersAnnotationComponent
20  {
21      public Map<String, Object> processHeaders(@OutboundHeaders Map<String, Object> headers)
22      {
23          headers.put("bar", "barValue");
24          //Verify that we receive any outbound headers already set on the message
25          if(headers.containsKey("foo"))
26          {
27              headers.put("foo", "fooValue");
28          }
29          return headers;
30      }
31  
32      //Can only use the {@link OutboundHeaders} annotation on Map parameters
33      public List<?> invalidParamType(@OutboundHeaders List<?> headers)
34      {
35          return headers;
36      }
37  }