| 1 |
|
package com.atlassian.xwork.interceptors; |
| 2 |
|
|
| 3 |
|
import com.opensymphony.xwork.interceptor.AroundInterceptor; |
| 4 |
|
import com.opensymphony.xwork.ActionInvocation; |
| 5 |
|
import com.opensymphony.xwork.ActionContext; |
| 6 |
|
|
| 7 |
|
import java.util.*; |
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
|
|
|
| 0% |
Uncovered Elements: 29 (29) |
Complexity: 8 |
Complexity Density: 0.5 |
|
| 13 |
|
public class RequestParameterHackInterceptor extends AroundInterceptor |
| 14 |
|
{ |
| 15 |
|
private static ThreadLocal hack = new ThreadLocal(); |
| 16 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 17 |
0
|
public static void setHackMap(Map hackMap)... |
| 18 |
|
{ |
| 19 |
0
|
com.atlassian.xwork.interceptors.RequestParameterHackInterceptor.hack.set(hackMap); |
| 20 |
|
} |
| 21 |
|
|
|
|
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 6 |
Complexity Density: 0.4 |
|
| 22 |
0
|
protected void before(ActionInvocation invocation) throws Exception... |
| 23 |
|
{ |
| 24 |
0
|
Map hackMap = (Map) com.atlassian.xwork.interceptors.RequestParameterHackInterceptor.hack.get(); |
| 25 |
|
|
| 26 |
0
|
if (hackMap != null) |
| 27 |
|
{ |
| 28 |
0
|
Map acParameters = ActionContext.getContext().getParameters(); |
| 29 |
|
|
| 30 |
0
|
List parametersToSetOnAction = new ArrayList(hackMap.size()); |
| 31 |
0
|
for (Iterator iterator = hackMap.keySet().iterator(); iterator.hasNext();) |
| 32 |
|
{ |
| 33 |
0
|
String key = (String) iterator.next(); |
| 34 |
0
|
if (!acParameters.containsKey(key)) |
| 35 |
|
{ |
| 36 |
0
|
parametersToSetOnAction.add(key); |
| 37 |
|
} |
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
|
| 41 |
0
|
if (parametersToSetOnAction.size() > 0) |
| 42 |
|
{ |
| 43 |
0
|
Map parameters = new HashMap(acParameters); |
| 44 |
0
|
for (Iterator iterator = parametersToSetOnAction.iterator(); iterator.hasNext();) |
| 45 |
|
{ |
| 46 |
0
|
String key = (String) iterator.next(); |
| 47 |
0
|
parameters.put(key, hackMap.get(key)); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
0
|
ActionContext.getContext().setParameters(parameters); |
| 51 |
|
} |
| 52 |
|
|
| 53 |
0
|
com.atlassian.xwork.interceptors.RequestParameterHackInterceptor.setHackMap(null); |
| 54 |
|
} |
| 55 |
|
} |
| 56 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 57 |
0
|
protected void after(ActionInvocation actionInvocation, String s) throws Exception... |
| 58 |
|
{ |
| 59 |
|
} |
| 60 |
|
} |