mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
WW-4250 Uses proper character set for Chinese
This commit is contained in:
+1
-1
@@ -141,7 +141,7 @@ public class ParametersInterceptor extends MethodFilterInterceptor {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ParametersInterceptor.class);
|
||||
|
||||
public static final String ACCEPTED_PARAM_NAMES = "\\w+((\\.\\w+)|(\\[\\d+\\])|(\\(\\d+\\))|(\\['(\\w|[^x00-xff])+'\\])|(\\('(\\w|[^x00-xff])+'\\)))*";
|
||||
public static final String ACCEPTED_PARAM_NAMES = "\\w+((\\.\\w+)|(\\[\\d+\\])|(\\(\\d+\\))|(\\['(\\w|[\\u4e00-\\u9fa5])+'\\])|(\\('(\\w|[\\u4e00-\\u9fa5])+'\\)))*";
|
||||
|
||||
protected static final int PARAM_NAME_MAX_LENGTH = 100;
|
||||
|
||||
|
||||
+13
@@ -237,6 +237,19 @@ public class ParametersInterceptorTest extends XWorkTestCase {
|
||||
assertEquals(0, existingMap.size());
|
||||
}
|
||||
|
||||
public void testParametersWithChineseInTheName() throws Exception {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("theProtectedMap['名字']", "test1");
|
||||
|
||||
HashMap<String, Object> extraContext = new HashMap<String, Object>();
|
||||
extraContext.put(ActionContext.PARAMETERS, params);
|
||||
|
||||
ActionProxy proxy = actionProxyFactory.createActionProxy("", MockConfigurationProvider.PARAM_INTERCEPTOR_ACTION_NAME, null, extraContext);
|
||||
proxy.execute();
|
||||
Map<String, String> existingMap = ((SimpleAction) proxy.getAction()).getTheProtectedMap();
|
||||
assertEquals(1, existingMap.size());
|
||||
}
|
||||
|
||||
public void testLargeParameterNameWithDefaultLimit() throws Exception {
|
||||
ParametersInterceptor parametersInterceptor = createParametersInterceptor();
|
||||
doTestParameterNameLengthRestriction(parametersInterceptor, ParametersInterceptor.PARAM_NAME_MAX_LENGTH);
|
||||
|
||||
Reference in New Issue
Block a user