|
1 |
| package net.sf.crispy.strategy; |
|
2 |
| |
|
3 |
| import java.util.Map; |
|
4 |
| |
|
5 |
| import net.sf.crispy.InvocationStrategy; |
|
6 |
| import net.sf.crispy.util.Converter; |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| public class RestInvocationStrategy implements InvocationStrategy { |
|
17 |
| |
|
18 |
108
| public Object convert(Map pvPropertyMap) {
|
|
19 |
108
| String lvClass = (String) pvPropertyMap.get(InvocationStrategy.CLASS_NAME);
|
|
20 |
108
| String lvMethod = (String) pvPropertyMap.get(InvocationStrategy.METHOD_NAME);
|
|
21 |
108
| String lvUrl = (String) pvPropertyMap.get(InvocationStrategy.URL);
|
|
22 |
108
| String lvNameSpace = (String) pvPropertyMap.get(InvocationStrategy.CONST_NAMESPACE);
|
|
23 |
| |
|
24 |
108
| StringBuffer lvReturn = new StringBuffer(lvUrl);
|
|
25 |
108
| if (lvNameSpace == null) {
|
|
26 |
107
| lvReturn.append("?class=").append(lvClass).append("&method=").append(lvMethod);
|
|
27 |
| } else { |
|
28 |
1
| String lvClassName = Converter.getClassWithoutPackage(lvClass, true);
|
|
29 |
1
| lvReturn.append("?method=").append(lvNameSpace).append(".").append(lvClassName)
|
|
30 |
| .append(".").append(lvMethod); |
|
31 |
| |
|
32 |
| } |
|
33 |
| |
|
34 |
108
| return lvReturn.toString();
|
|
35 |
| } |
|
36 |
| |
|
37 |
| } |