Skip to content

Commit a7db70b

Browse files
committed
feat: support jakarta jsp
resolves #64 now requires java 8 for runtime requires jdk 17 to build due to jakarta module
1 parent 0fc8cde commit a7db70b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3477
-5
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ nb-configuration.xml
1818
/jsp/target/
1919
/esapi/target/
2020
/target/
21+
/jakarta/target/

core/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<parent>
4343
<groupId>org.owasp.encoder</groupId>
4444
<artifactId>encoder-parent</artifactId>
45-
<version>1.2.3</version>
45+
<version>1.3.0</version>
4646
</parent>
4747

4848
<artifactId>encoder</artifactId>

esapi/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<parent>
4343
<groupId>org.owasp.encoder</groupId>
4444
<artifactId>encoder-parent</artifactId>
45-
<version>1.2.3</version>
45+
<version>1.3.0</version>
4646
</parent>
4747

4848
<artifactId>encoder-esapi</artifactId>

jakarta/pom.xml

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?xml version="1.0" encoding="US-ASCII"?>
2+
<!--
3+
~ Copyright (c) 2015 OWASP.
4+
~ All rights reserved.
5+
~
6+
~ Redistribution and use in source and binary forms, with or without
7+
~ modification, are permitted provided that the following conditions
8+
~ are met:
9+
~
10+
~ * Redistributions of source code must retain the above
11+
~ copyright notice, this list of conditions and the following
12+
~ disclaimer.
13+
~
14+
~ * Redistributions in binary form must reproduce the above
15+
~ copyright notice, this list of conditions and the following
16+
~ disclaimer in the documentation and/or other materials
17+
~ provided with the distribution.
18+
~
19+
~ * Neither the name of the OWASP nor the names of its
20+
~ contributors may be used to endorse or promote products
21+
~ derived from this software without specific prior written
22+
~ permission.
23+
~
24+
~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25+
~ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26+
~ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27+
~ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28+
~ COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
29+
~ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30+
~ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31+
~ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32+
~ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
33+
~ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34+
~ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
35+
~ OF THE POSSIBILITY OF SUCH DAMAGE.
36+
-->
37+
38+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
39+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
40+
<modelVersion>4.0.0</modelVersion>
41+
42+
<parent>
43+
<groupId>org.owasp.encoder</groupId>
44+
<artifactId>encoder-parent</artifactId>
45+
<version>1.3.0</version>
46+
</parent>
47+
48+
<artifactId>encoder-jakarta-jsp</artifactId>
49+
<packaging>jar</packaging>
50+
51+
<name>Jakarta JSP Encoder</name>
52+
<description>
53+
The OWASP Encoder Jakarta JSP package contains JSP tag definitions and TLDs to allow
54+
easy use of the OWASP Encoder Project's core API. The TLDs contain both tag
55+
definitions and JSP EL functions.
56+
</description>
57+
58+
<properties>
59+
<jigsaw.module.name>org.owasp.encoder.jakarta</jigsaw.module.name>
60+
</properties>
61+
62+
<dependencies>
63+
<dependency>
64+
<groupId>org.owasp.encoder</groupId>
65+
<artifactId>encoder</artifactId>
66+
<version>${project.parent.version}</version>
67+
</dependency>
68+
<dependency>
69+
<groupId>jakarta.servlet.jsp</groupId>
70+
<artifactId>jakarta.servlet.jsp-api</artifactId>
71+
<version>3.0.0</version>
72+
<scope>provided</scope>
73+
</dependency>
74+
<dependency>
75+
<groupId>jakarta.servlet</groupId>
76+
<artifactId>jakarta.servlet-api</artifactId>
77+
<version>6.0.0</version>
78+
<scope>test</scope>
79+
</dependency>
80+
<dependency>
81+
<groupId>org.springframework</groupId>
82+
<artifactId>spring-test</artifactId>
83+
<version>6.0.22</version>
84+
<scope>test</scope>
85+
</dependency>
86+
<dependency>
87+
<groupId>org.springframework</groupId>
88+
<artifactId>spring-core</artifactId>
89+
<version>5.3.19</version>
90+
<scope>test</scope>
91+
</dependency>
92+
</dependencies>
93+
<build>
94+
<plugins>
95+
<plugin>
96+
<groupId>org.apache.maven.plugins</groupId>
97+
<artifactId>maven-compiler-plugin</artifactId>
98+
<configuration>
99+
<source>17</source>
100+
<target>17</target>
101+
</configuration>
102+
</plugin>
103+
</plugins>
104+
</build>
105+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Copyright (c) 2012 Jeff Ichnowski
2+
// All rights reserved.
3+
//
4+
// Redistribution and use in source and binary forms, with or without
5+
// modification, are permitted provided that the following conditions
6+
// are met:
7+
//
8+
// * Redistributions of source code must retain the above
9+
// copyright notice, this list of conditions and the following
10+
// disclaimer.
11+
//
12+
// * Redistributions in binary form must reproduce the above
13+
// copyright notice, this list of conditions and the following
14+
// disclaimer in the documentation and/or other materials
15+
// provided with the distribution.
16+
//
17+
// * Neither the name of the OWASP nor the names of its
18+
// contributors may be used to endorse or promote products
19+
// derived from this software without specific prior written
20+
// permission.
21+
//
22+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27+
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28+
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29+
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30+
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31+
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
33+
// OF THE POSSIBILITY OF SUCH DAMAGE.
34+
35+
package org.owasp.encoder.tag;
36+
37+
import jakarta.servlet.jsp.tagext.SimpleTagSupport;
38+
39+
/**
40+
* The base class for the encoding tags within this package.
41+
*
42+
* @author Jeremy Long (jeremy.long@gmail.com)
43+
*/
44+
public abstract class EncodingTag extends SimpleTagSupport {
45+
/**
46+
* The value to be written out by the tag.
47+
*/
48+
protected String _value;
49+
/**
50+
* Sets the value to be written out by the tag.
51+
* @param value the value to be written out by the tag.
52+
*/
53+
public void setValue(String value) {
54+
this._value = value;
55+
}
56+
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright (c) 2012 Jeff Ichnowski
2+
// All rights reserved.
3+
//
4+
// Redistribution and use in source and binary forms, with or without
5+
// modification, are permitted provided that the following conditions
6+
// are met:
7+
//
8+
// * Redistributions of source code must retain the above
9+
// copyright notice, this list of conditions and the following
10+
// disclaimer.
11+
//
12+
// * Redistributions in binary form must reproduce the above
13+
// copyright notice, this list of conditions and the following
14+
// disclaimer in the documentation and/or other materials
15+
// provided with the distribution.
16+
//
17+
// * Neither the name of the OWASP nor the names of its
18+
// contributors may be used to endorse or promote products
19+
// derived from this software without specific prior written
20+
// permission.
21+
//
22+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27+
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28+
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29+
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30+
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31+
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
33+
// OF THE POSSIBILITY OF SUCH DAMAGE.
34+
35+
package org.owasp.encoder.tag;
36+
37+
import java.io.IOException;
38+
import jakarta.servlet.jsp.JspException;
39+
import org.owasp.encoder.Encode;
40+
41+
/**
42+
* A tag to perform encoding sufficient to place into a CDATA block.
43+
* This wraps the {@link org.owasp.encoder.Encode#forCDATA(java.lang.String)}.
44+
*
45+
* @author Jeremy Long (jeremy.long@gmail.com)
46+
*/
47+
public class ForCDATATag extends EncodingTag {
48+
@Override
49+
public void doTag() throws JspException, IOException {
50+
Encode.forCDATA(getJspContext().getOut(), _value);
51+
}
52+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright (c) 2012 Jeff Ichnowski
2+
// All rights reserved.
3+
//
4+
// Redistribution and use in source and binary forms, with or without
5+
// modification, are permitted provided that the following conditions
6+
// are met:
7+
//
8+
// * Redistributions of source code must retain the above
9+
// copyright notice, this list of conditions and the following
10+
// disclaimer.
11+
//
12+
// * Redistributions in binary form must reproduce the above
13+
// copyright notice, this list of conditions and the following
14+
// disclaimer in the documentation and/or other materials
15+
// provided with the distribution.
16+
//
17+
// * Neither the name of the OWASP nor the names of its
18+
// contributors may be used to endorse or promote products
19+
// derived from this software without specific prior written
20+
// permission.
21+
//
22+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27+
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28+
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29+
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30+
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31+
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
33+
// OF THE POSSIBILITY OF SUCH DAMAGE.
34+
35+
package org.owasp.encoder.tag;
36+
37+
import java.io.IOException;
38+
import jakarta.servlet.jsp.JspException;
39+
import org.owasp.encoder.Encode;
40+
41+
/**
42+
* A tag to perform CSS encoding for CSS strings.
43+
* This wraps the {@link org.owasp.encoder.Encode#forCssString(java.lang.String)}.
44+
*
45+
* @author Jeremy Long (jeremy.long@gmail.com)
46+
*/
47+
public class ForCssStringTag extends EncodingTag {
48+
@Override
49+
public void doTag() throws JspException, IOException {
50+
Encode.forCssString(getJspContext().getOut(), _value);
51+
}
52+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright (c) 2012 Jeff Ichnowski
2+
// All rights reserved.
3+
//
4+
// Redistribution and use in source and binary forms, with or without
5+
// modification, are permitted provided that the following conditions
6+
// are met:
7+
//
8+
// * Redistributions of source code must retain the above
9+
// copyright notice, this list of conditions and the following
10+
// disclaimer.
11+
//
12+
// * Redistributions in binary form must reproduce the above
13+
// copyright notice, this list of conditions and the following
14+
// disclaimer in the documentation and/or other materials
15+
// provided with the distribution.
16+
//
17+
// * Neither the name of the OWASP nor the names of its
18+
// contributors may be used to endorse or promote products
19+
// derived from this software without specific prior written
20+
// permission.
21+
//
22+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27+
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28+
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29+
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30+
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31+
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
33+
// OF THE POSSIBILITY OF SUCH DAMAGE.
34+
35+
package org.owasp.encoder.tag;
36+
37+
import java.io.IOException;
38+
import jakarta.servlet.jsp.JspException;
39+
import org.owasp.encoder.Encode;
40+
41+
/**
42+
* A tag to perform CSS encoding for CSS URL contexts.
43+
* This wraps the {@link org.owasp.encoder.Encode#forCssUrl(java.lang.String)}.
44+
*
45+
* @author Jeremy Long (jeremy.long@gmail.com)
46+
*/
47+
public class ForCssUrlTag extends EncodingTag {
48+
@Override
49+
public void doTag() throws JspException, IOException {
50+
Encode.forCssUrl(getJspContext().getOut(), _value);
51+
}
52+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright (c) 2012 Jeff Ichnowski
2+
// All rights reserved.
3+
//
4+
// Redistribution and use in source and binary forms, with or without
5+
// modification, are permitted provided that the following conditions
6+
// are met:
7+
//
8+
// * Redistributions of source code must retain the above
9+
// copyright notice, this list of conditions and the following
10+
// disclaimer.
11+
//
12+
// * Redistributions in binary form must reproduce the above
13+
// copyright notice, this list of conditions and the following
14+
// disclaimer in the documentation and/or other materials
15+
// provided with the distribution.
16+
//
17+
// * Neither the name of the OWASP nor the names of its
18+
// contributors may be used to endorse or promote products
19+
// derived from this software without specific prior written
20+
// permission.
21+
//
22+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27+
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28+
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29+
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30+
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31+
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
33+
// OF THE POSSIBILITY OF SUCH DAMAGE.
34+
35+
package org.owasp.encoder.tag;
36+
37+
import java.io.IOException;
38+
import jakarta.servlet.jsp.JspException;
39+
import org.owasp.encoder.Encode;
40+
41+
/**
42+
* A tag to perform HTML encoding for HTML text attributes.
43+
* This wraps the {@link org.owasp.encoder.Encode#forHtmlAttribute(java.lang.String)}.
44+
*
45+
* @author Jeremy Long (jeremy.long@gmail.com)
46+
*/
47+
public class ForHtmlAttributeTag extends EncodingTag {
48+
@Override
49+
public void doTag() throws JspException, IOException {
50+
Encode.forHtmlAttribute(getJspContext().getOut(), _value);
51+
}
52+
}

0 commit comments

Comments
 (0)