-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from weblegacy/bugfix/issue#11
bugfix for issue #11 (skip xml entities in filter method)
- Loading branch information
Showing
6 changed files
with
217 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | ||
<%-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--%> | ||
<%@ page contentType="text/html;charset=UTF-8" language="java" %> | ||
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> | ||
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> | ||
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> | ||
<html:html> | ||
<head> | ||
<title>Test html:button Tag</title> | ||
</head> | ||
|
||
<body bgcolor="white"> | ||
|
||
<div align="center"> | ||
<h1>Test struts html:button Tag</h1> | ||
</div> | ||
|
||
<h2>Button</h2> | ||
<p> | ||
<html:button property="Test" value="Test"/> | ||
</p> | ||
<p> | ||
<html:button property="Test äöü" value="Test äöü"/> | ||
</p> | ||
<p> | ||
Test for XML Entities not handled correctly #11: | ||
<html:button property="Test äöü" value="Test äöü"/> | ||
</p> | ||
|
||
<h2>Cancel</h2> | ||
<p> | ||
<html:cancel property="Test" value="Test"/> | ||
</p> | ||
<p> | ||
<html:cancel property="Test äöü" value="Test äöü"/> | ||
</p> | ||
<p> | ||
Test for XML Entities not handled correctly #11: | ||
<html:cancel property="Test äöü" value="Test äöü"/> | ||
</p> | ||
|
||
<h2>Reset</h2> | ||
<p> | ||
<html:reset property="Test" value="Test"/> | ||
</p> | ||
<p> | ||
<html:reset property="Test äöü" value="Test äöü"/> | ||
</p> | ||
<p> | ||
Test for XML Entities not handled correctly #11: | ||
<html:reset property="Test äöü" value="Test äöü"/> | ||
</p> | ||
|
||
<hr/> | ||
|
||
<p> | ||
<html:link action="welcome"> | ||
Return to the Taglib Exercises main page | ||
</html:link> | ||
</p> | ||
|
||
</body> | ||
</html:html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
core/src/test/java/org/apache/struts/util/TestResponseUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* $Id$ | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.struts.util; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.apache.struts.mock.TestMockBase; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* Unit tests for {@link ResponseUtils}. | ||
* | ||
* @version $Rev$ $Date$ | ||
*/ | ||
public class TestResponseUtils extends TestMockBase { | ||
// ----------------------------------------------------- Instance Variables | ||
// ----------------------------------------------------- Setup and Teardown | ||
@BeforeEach | ||
public void setUp() { | ||
super.setUp(); | ||
} | ||
|
||
@AfterEach | ||
public void tearDown() { | ||
super.tearDown(); | ||
} | ||
|
||
// ------------------------------------------------------- Individual Tests | ||
// ---------------------------------------------------------- filter() | ||
@Test | ||
public void testFilter() { | ||
assertEquals("123&456", ResponseUtils.filter("123&456")); | ||
assertEquals("123&456;", ResponseUtils.filter("123&456;")); | ||
assertEquals("123&456", ResponseUtils.filter("123&456")); | ||
assertEquals("123{456", ResponseUtils.filter("123{456")); | ||
assertEquals("123&#12a;456", ResponseUtils.filter("123a;456")); | ||
assertEquals("123Ī456", ResponseUtils.filter("123Ī456")); | ||
assertEquals("123&#x12ah;456", ResponseUtils.filter("123Īh;456")); | ||
assertEquals("123<>"'456", ResponseUtils.filter("123<>\"'456")); | ||
assertEquals("123Ü456;", ResponseUtils.filter("123Ü456;")); | ||
assertEquals("123&x;456", ResponseUtils.filter("123&x;456")); | ||
assertEquals("123&1;456", ResponseUtils.filter("123&1;456")); | ||
assertEquals("&456Ü4", ResponseUtils.filter("&456Ü4")); | ||
assertEquals("&45&6Ü4'", ResponseUtils.filter("&45&6Ü4'")); | ||
} | ||
} |