1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.expression; |
12 | |
|
13 | |
import org.mule.api.MuleMessage; |
14 | |
import org.mule.api.expression.ExpressionEnricher; |
15 | |
import org.mule.api.transport.PropertyScope; |
16 | |
|
17 | 0 | public class MessageHeaderExpressionEnricher implements ExpressionEnricher |
18 | |
{ |
19 | |
|
20 | |
public static final String NAME = "header"; |
21 | |
|
22 | |
public void enrich(String expression, MuleMessage message, Object object) |
23 | |
{ |
24 | 0 | String propertyName = expression; |
25 | 0 | PropertyScope scope = ExpressionUtils.getScope(expression); |
26 | 0 | if (scope != null) |
27 | |
{ |
28 | |
|
29 | 0 | propertyName = expression.substring(scope.getScopeName().length() + 1); |
30 | |
} |
31 | |
else |
32 | |
{ |
33 | |
|
34 | 0 | scope = PropertyScope.OUTBOUND; |
35 | |
} |
36 | |
|
37 | 0 | message.setProperty(propertyName, object, scope); |
38 | 0 | } |
39 | |
|
40 | |
public String getName() |
41 | |
{ |
42 | 0 | return NAME; |
43 | |
} |
44 | |
|
45 | |
public void setName(String name) |
46 | |
{ |
47 | 0 | throw new UnsupportedOperationException(); |
48 | |
} |
49 | |
|
50 | |
} |