Skip to content

Commit 6152734

Browse files
authored
Set javax.servlet version in the dependency management section (#144)
* Add grizzly-websockets to commons & update servlet version * fix httpdump compilation error * fix httpdump compilation error * downgrade grizzly-framework to keep compatibility with servlet 3.1 * add copyright to HttpDump module files * bump grizzly-framework to 2.3.35
1 parent e1fa6ce commit 6152734

File tree

9 files changed

+131
-56
lines changed

9 files changed

+131
-56
lines changed

commons/audit/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
<dependency>
7878
<groupId>javax.servlet</groupId>
7979
<artifactId>javax.servlet-api</artifactId>
80-
<version>${servlet-api.version}</version>
8180
<scope>provided</scope>
8281
</dependency>
8382
</dependencies>

commons/auth-filters/authz-filter/framework-functional-tests/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@
176176
</dependency>
177177
<dependency>
178178
<groupId>javax.servlet</groupId>
179-
<artifactId>servlet-api</artifactId>
180-
<version>2.5</version>
179+
<artifactId>javax.servlet-api</artifactId>
181180
<scope>provided</scope>
182181
</dependency>
183182
<dependency>

commons/httpdump/pom.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
<dependencies>
1616
<dependency>
1717
<groupId>javax.servlet</groupId>
18-
<artifactId>servlet-api</artifactId>
19-
<version>2.5</version>
20-
<type>jar</type>
18+
<artifactId>javax.servlet-api</artifactId>
2119
<scope>provided</scope>
2220
</dependency>
2321
<dependency>
Lines changed: 76 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* The contents of this file are subject to the terms of the Common Development and
3+
* Distribution License (the License). You may not use this file except in compliance with the
4+
* License.
5+
*
6+
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
7+
* specific language governing permission and limitations under the License.
8+
*
9+
* When distributing Covered Software, include this CDDL Header Notice in each file and include
10+
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
11+
* Header, with the fields enclosed by brackets [] replaced by your own identifying
12+
* information: "Portions copyright [year] [name of copyright owner]".
13+
*
14+
* Copyright 2020-2025 3A Systems LLC.
15+
*/
16+
117
package ru.org.openam.httpdump;
218

319
import java.io.BufferedReader;
@@ -7,6 +23,7 @@
723
import java.io.InputStreamReader;
824
import java.text.MessageFormat;
925

26+
import javax.servlet.ReadListener;
1027
import javax.servlet.ServletInputStream;
1128
import javax.servlet.http.HttpServletRequest;
1229
import javax.servlet.http.HttpServletRequestWrapper;
@@ -17,43 +34,43 @@
1734
import org.slf4j.LoggerFactory;
1835

1936
public class BufferedRequestWrapper extends HttpServletRequestWrapper {
20-
final static Logger logger = LoggerFactory.getLogger(BufferedRequestWrapper.class.getName());
21-
byte[] body=null;
37+
final static Logger logger = LoggerFactory.getLogger(BufferedRequestWrapper.class.getName());
38+
byte[] body = null;
2239

2340
public BufferedRequestWrapper(HttpServletRequest httpServletRequest) {
2441
super(httpServletRequest);
2542
setAttribute(BufferedRequestWrapper.class.getName(), this);
2643
}
2744

28-
private void readBody(){
29-
if (body==null
30-
&& !StringUtils.containsIgnoreCase(getContentType(), "application/x-www-form-urlencoded")
31-
&& !StringUtils.containsIgnoreCase(getContentType(), "multipart/form-data")
32-
)
33-
try{
34-
InputStream is = super.getInputStream();
35-
body = IOUtils.toByteArray(is);
36-
is.close();
37-
}catch(IOException e){
38-
logger.warn("{}: {}",e.getMessage(),Dump.toString(getRequest()));
39-
}
45+
private void readBody() {
46+
if (body == null
47+
&& !StringUtils.containsIgnoreCase(getContentType(), "application/x-www-form-urlencoded")
48+
&& !StringUtils.containsIgnoreCase(getContentType(), "multipart/form-data")
49+
)
50+
try {
51+
InputStream is = super.getInputStream();
52+
body = IOUtils.toByteArray(is);
53+
is.close();
54+
} catch (IOException e) {
55+
logger.warn("{}: {}", e.getMessage(), Dump.toString(getRequest()));
56+
}
4057
}
41-
58+
4259
@Override
4360
public ServletInputStream getInputStream() throws IOException {
44-
readBody();
45-
if (body==null)
46-
return super.getInputStream();
47-
return new ServletInputStreamImpl(new ByteArrayInputStream(body));
61+
readBody();
62+
if (body == null)
63+
return super.getInputStream();
64+
return new ServletInputStreamImpl(new ByteArrayInputStream(body));
4865
}
4966

5067
@Override
5168
public BufferedReader getReader() throws IOException {
52-
readBody();
53-
if (body==null)
54-
return super.getReader();
69+
readBody();
70+
if (body == null)
71+
return super.getReader();
5572
String enc = getCharacterEncoding();
56-
if(enc == null) enc = "UTF-8";
73+
if (enc == null) enc = "UTF-8";
5774
return new BufferedReader(new InputStreamReader(getInputStream(), enc));
5875
}
5976

@@ -68,38 +85,50 @@ public int read() throws IOException {
6885
return is.read();
6986
}
7087

71-
public boolean markSupported() {
88+
public synchronized void mark(int i) {
89+
throw new RuntimeException(new IOException("mark/reset not supported"));
90+
}
91+
92+
@Override
93+
public boolean isFinished() {
94+
try {
95+
return is.available() == 0;
96+
} catch (IOException e) {
97+
logger.warn(e.getMessage());
98+
}
7299
return false;
73100
}
74101

75-
public synchronized void mark(int i) {
76-
throw new RuntimeException(new IOException("mark/reset not supported"));
102+
@Override
103+
public boolean isReady() {
104+
return true;
77105
}
78106

79-
public synchronized void reset() throws IOException {
80-
throw new IOException("mark/reset not supported");
107+
@Override
108+
public void setReadListener(ReadListener readListener) {
109+
throw new UnsupportedOperationException();
81110
}
82111
}
83-
112+
84113
public String getRequestBody() {
85-
readBody();
86-
if (body==null)
87-
return MessageFormat.format("{0}:{1}", getContentType(),getContentLength());
88-
try{
89-
BufferedReader reader = getReader();
90-
String line = null;
91-
StringBuilder inputBuffer = new StringBuilder();
92-
do {
93-
line = reader.readLine();
94-
if (null != line)
95-
inputBuffer.append(line.trim());
96-
} while (line != null);
97-
reader.close();
98-
return inputBuffer.toString().trim();
99-
}catch (IOException e) {
100-
return null;
101-
}
102-
}
114+
readBody();
115+
if (body == null)
116+
return MessageFormat.format("{0}:{1}", getContentType(), getContentLength());
117+
try {
118+
BufferedReader reader = getReader();
119+
String line = null;
120+
StringBuilder inputBuffer = new StringBuilder();
121+
do {
122+
line = reader.readLine();
123+
if (null != line)
124+
inputBuffer.append(line.trim());
125+
} while (line != null);
126+
reader.close();
127+
return inputBuffer.toString().trim();
128+
} catch (IOException e) {
129+
return null;
130+
}
131+
}
103132

104133
}
105134

commons/httpdump/src/main/java/ru/org/openam/httpdump/Dump.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* The contents of this file are subject to the terms of the Common Development and
3+
* Distribution License (the License). You may not use this file except in compliance with the
4+
* License.
5+
*
6+
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
7+
* specific language governing permission and limitations under the License.
8+
*
9+
* When distributing Covered Software, include this CDDL Header Notice in each file and include
10+
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
11+
* Header, with the fields enclosed by brackets [] replaced by your own identifying
12+
* information: "Portions copyright [year] [name of copyright owner]".
13+
*
14+
* Copyright 2020-2025 3A Systems LLC.
15+
*/
16+
117
package ru.org.openam.httpdump;
218

319
import java.text.MessageFormat;

commons/httpdump/src/main/java/ru/org/openam/httpdump/Filter.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
package ru.org.openam.httpdump;
2+
/*
3+
* The contents of this file are subject to the terms of the Common Development and
4+
* Distribution License (the License). You may not use this file except in compliance with the
5+
* License.
6+
*
7+
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
8+
* specific language governing permission and limitations under the License.
9+
*
10+
* When distributing Covered Software, include this CDDL Header Notice in each file and include
11+
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
12+
* Header, with the fields enclosed by brackets [] replaced by your own identifying
13+
* information: "Portions copyright [year] [name of copyright owner]".
14+
*
15+
* Copyright 2020-2025 3A Systems LLC.
16+
*/
217

318
import java.io.IOException;
419

commons/httpdump/src/test/java/Test.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* The contents of this file are subject to the terms of the Common Development and
3+
* Distribution License (the License). You may not use this file except in compliance with the
4+
* License.
5+
*
6+
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
7+
* specific language governing permission and limitations under the License.
8+
*
9+
* When distributing Covered Software, include this CDDL Header Notice in each file and include
10+
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
11+
* Header, with the fields enclosed by brackets [] replaced by your own identifying
12+
* information: "Portions copyright [year] [name of copyright owner]".
13+
*
14+
* Copyright 2020-2025 3A Systems LLC.
15+
*/
16+
117
import org.junit.Ignore;
218

319
import ru.org.openam.geo.Client;

commons/rest/json-resource-http/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
<dependency>
7575
<groupId>javax.servlet</groupId>
7676
<artifactId>javax.servlet-api</artifactId>
77-
<version>4.0.0</version>
7877
<scope>test</scope>
7978
</dependency>
8079
<dependency>

pom.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
<swagger.version>1.6.11</swagger.version>
208208
<rhino.version>1.7.14</rhino.version>
209209
<jetty.version>9.4.57.v20241219</jetty.version>
210-
<grizzly-framework.version>2.4.4</grizzly-framework.version>
210+
<grizzly-framework.version>2.3.35</grizzly-framework.version>
211211
</properties>
212212

213213
<prerequisites>
@@ -896,7 +896,11 @@
896896
<artifactId>grizzly-http-servlet</artifactId>
897897
<version>${grizzly-framework.version}</version>
898898
</dependency>
899-
899+
<dependency>
900+
<groupId>org.glassfish.grizzly</groupId>
901+
<artifactId>grizzly-websockets</artifactId>
902+
<version>${grizzly-framework.version}</version>
903+
</dependency>
900904
</dependencies>
901905
</dependencyManagement>
902906
<build><finalName>${project.groupId}.${project.artifactId}</finalName>

0 commit comments

Comments
 (0)