Skip to content

Commit 84afc8f

Browse files
committed
initial work on the servlet API update
eventually fixes #4075
1 parent c101828 commit 84afc8f

File tree

7 files changed

+54
-142
lines changed

7 files changed

+54
-142
lines changed

opengrok-indexer/src/test/java/org/opengrok/indexer/web/DummyHttpServletRequest.java

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import jakarta.servlet.AsyncContext;
2727
import jakarta.servlet.DispatcherType;
2828
import jakarta.servlet.RequestDispatcher;
29+
import jakarta.servlet.ServletConnection;
2930
import jakarta.servlet.ServletContext;
3031
import jakarta.servlet.ServletInputStream;
3132
import jakarta.servlet.ServletRequest;
@@ -98,54 +99,26 @@ public int getMaxInactiveInterval() {
9899
return 3600;
99100
}
100101

101-
@Override
102-
@SuppressWarnings("deprecation")
103-
public jakarta.servlet.http.HttpSessionContext getSessionContext() {
104-
throw new UnsupportedOperationException("Not supported yet.");
105-
}
106-
107102
@Override
108103
public Object getAttribute(String string) {
109104
return attrs.get(string);
110105
}
111106

112-
@Override
113-
@SuppressWarnings("deprecation")
114-
public Object getValue(String string) {
115-
throw new UnsupportedOperationException("Not supported yet.");
116-
}
117-
118107
@Override
119108
public Enumeration<String> getAttributeNames() {
120109
throw new UnsupportedOperationException("Not supported yet.");
121110
}
122111

123-
@Override
124-
@SuppressWarnings("deprecation")
125-
public String[] getValueNames() {
126-
throw new UnsupportedOperationException("Not supported yet.");
127-
}
128-
129112
@Override
130113
public void setAttribute(String string, Object o) {
131114
attrs.put(string, o);
132115
}
133116

134-
@Override
135-
@SuppressWarnings("deprecation")
136-
public void putValue(String string, Object o) {
137-
}
138-
139117
@Override
140118
public void removeAttribute(String string) {
141119
attrs.remove(string);
142120
}
143121

144-
@Override
145-
@SuppressWarnings("deprecation")
146-
public void removeValue(String string) {
147-
}
148-
149122
@Override
150123
public void invalidate() {
151124
attrs = new HashMap<>();
@@ -291,11 +264,6 @@ public boolean isRequestedSessionIdFromURL() {
291264
throw new UnsupportedOperationException("Not supported yet.");
292265
}
293266

294-
@Override @Deprecated
295-
public boolean isRequestedSessionIdFromUrl() {
296-
throw new UnsupportedOperationException("Not supported yet.");
297-
}
298-
299267
@Override
300268
public boolean authenticate(HttpServletResponse httpServletResponse) {
301269
return false;
@@ -456,11 +424,6 @@ public RequestDispatcher getRequestDispatcher(String string) {
456424
throw new UnsupportedOperationException("Not supported yet.");
457425
}
458426

459-
@Override @Deprecated
460-
public String getRealPath(String string) {
461-
throw new UnsupportedOperationException("Not supported yet.");
462-
}
463-
464427
@Override
465428
public int getRemotePort() {
466429
throw new UnsupportedOperationException("Not supported yet.");
@@ -515,4 +478,19 @@ public AsyncContext getAsyncContext() {
515478
public DispatcherType getDispatcherType() {
516479
return null;
517480
}
481+
482+
@Override
483+
public String getRequestId() {
484+
return "123";
485+
}
486+
487+
@Override
488+
public String getProtocolRequestId() {
489+
return null;
490+
}
491+
492+
@Override
493+
public ServletConnection getServletConnection() {
494+
return null;
495+
}
518496
}

opengrok-web/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Portions Copyright (c) 2018, 2020, Chris Fraire <[email protected]>.
6868
<dependency>
6969
<groupId>jakarta.servlet.jsp</groupId>
7070
<artifactId>jakarta.servlet.jsp-api</artifactId>
71-
<version>3.0.0</version>
71+
<version>3.1.0</version>
7272
<scope>provided</scope>
7373
</dependency>
7474
<dependency>

opengrok-web/src/main/webapp/WEB-INF/web.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
5-
https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
6-
version="5.0">
5+
https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
6+
version="6.0">
77

88
<display-name>OpenGrok</display-name>
99
<description>A wicked fast source browser</description>

opengrok-web/src/test/java/org/opengrok/web/CookieFilterTest.java

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
import static org.mockito.Mockito.mock;
5252
import static org.mockito.Mockito.spy;
5353

54-
public class CookieFilterTest {
54+
class CookieFilterTest {
5555
static class DummyHttpServletResponse implements HttpServletResponse {
5656

5757
@Override
@@ -74,18 +74,6 @@ public String encodeRedirectURL(String s) {
7474
return null;
7575
}
7676

77-
@Override
78-
@Deprecated
79-
public String encodeUrl(String s) {
80-
return null;
81-
}
82-
83-
@Override
84-
@Deprecated
85-
public String encodeRedirectUrl(String s) {
86-
return null;
87-
}
88-
8977
@Override
9078
public void sendError(int i, String s) throws IOException {
9179

@@ -142,12 +130,6 @@ public void setStatus(int i) {
142130

143131
}
144132

145-
@Override
146-
@Deprecated
147-
public void setStatus(int i, String s) {
148-
149-
}
150-
151133
@Override
152134
public int getStatus() {
153135
return 0;

plugins/src/test/java/opengrok/auth/plugin/util/DummyHttpServletRequestLdap.java

Lines changed: 16 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import jakarta.servlet.AsyncContext;
3636
import jakarta.servlet.DispatcherType;
3737
import jakarta.servlet.RequestDispatcher;
38+
import jakarta.servlet.ServletConnection;
3839
import jakarta.servlet.ServletContext;
3940
import jakarta.servlet.ServletInputStream;
4041
import jakarta.servlet.ServletRequest;
@@ -90,54 +91,26 @@ public int getMaxInactiveInterval() {
9091
return 3600;
9192
}
9293

93-
@Override
94-
@SuppressWarnings("deprecation")
95-
public jakarta.servlet.http.HttpSessionContext getSessionContext() {
96-
throw new UnsupportedOperationException("Not supported yet.");
97-
}
98-
9994
@Override
10095
public Object getAttribute(String string) {
10196
return attrs.get(string);
10297
}
10398

104-
@Override
105-
@SuppressWarnings("deprecation")
106-
public Object getValue(String string) {
107-
throw new UnsupportedOperationException("Not supported yet.");
108-
}
109-
11099
@Override
111100
public Enumeration<String> getAttributeNames() {
112101
throw new UnsupportedOperationException("Not supported yet.");
113102
}
114103

115-
@Override
116-
@SuppressWarnings("deprecation")
117-
public String[] getValueNames() {
118-
throw new UnsupportedOperationException("Not supported yet.");
119-
}
120-
121104
@Override
122105
public void setAttribute(String string, Object o) {
123106
attrs.put(string, o);
124107
}
125108

126-
@Override
127-
@SuppressWarnings("deprecation")
128-
public void putValue(String string, Object o) {
129-
}
130-
131109
@Override
132110
public void removeAttribute(String string) {
133111
attrs.remove(string);
134112
}
135113

136-
@Override
137-
@SuppressWarnings("deprecation")
138-
public void removeValue(String string) {
139-
}
140-
141114
@Override
142115
public void invalidate() {
143116
}
@@ -273,12 +246,6 @@ public boolean isRequestedSessionIdFromURL() {
273246
throw new UnsupportedOperationException("Not supported yet.");
274247
}
275248

276-
@Override
277-
@Deprecated
278-
public boolean isRequestedSessionIdFromUrl() {
279-
throw new UnsupportedOperationException("Not supported yet.");
280-
}
281-
282249
@Override
283250
public boolean authenticate(HttpServletResponse httpServletResponse) {
284251
return false;
@@ -434,12 +401,6 @@ public RequestDispatcher getRequestDispatcher(String string) {
434401
throw new UnsupportedOperationException("Not supported yet.");
435402
}
436403

437-
@Override
438-
@Deprecated
439-
public String getRealPath(String string) {
440-
throw new UnsupportedOperationException("Not supported yet.");
441-
}
442-
443404
@Override
444405
public int getRemotePort() {
445406
throw new UnsupportedOperationException("Not supported yet.");
@@ -494,4 +455,19 @@ public AsyncContext getAsyncContext() {
494455
public DispatcherType getDispatcherType() {
495456
return null;
496457
}
458+
459+
@Override
460+
public String getRequestId() {
461+
return "123";
462+
}
463+
464+
@Override
465+
public String getProtocolRequestId() {
466+
return null;
467+
}
468+
469+
@Override
470+
public ServletConnection getServletConnection() {
471+
return null;
472+
}
497473
}

plugins/src/test/java/opengrok/auth/plugin/util/DummyHttpServletRequestUser.java

Lines changed: 16 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import jakarta.servlet.AsyncContext;
2626
import jakarta.servlet.DispatcherType;
2727
import jakarta.servlet.RequestDispatcher;
28+
import jakarta.servlet.ServletConnection;
2829
import jakarta.servlet.ServletContext;
2930
import jakarta.servlet.ServletInputStream;
3031
import jakarta.servlet.ServletRequest;
@@ -85,54 +86,26 @@ public int getMaxInactiveInterval() {
8586
return 3600;
8687
}
8788

88-
@Override
89-
@SuppressWarnings("deprecation")
90-
public jakarta.servlet.http.HttpSessionContext getSessionContext() {
91-
throw new UnsupportedOperationException("Not supported yet.");
92-
}
93-
9489
@Override
9590
public Object getAttribute(String string) {
9691
return attrs.get(string);
9792
}
9893

99-
@Override
100-
@SuppressWarnings("deprecation")
101-
public Object getValue(String string) {
102-
throw new UnsupportedOperationException("Not supported yet.");
103-
}
104-
10594
@Override
10695
public Enumeration<String> getAttributeNames() {
10796
throw new UnsupportedOperationException("Not supported yet.");
10897
}
10998

110-
@Override
111-
@SuppressWarnings("deprecation")
112-
public String[] getValueNames() {
113-
throw new UnsupportedOperationException("Not supported yet.");
114-
}
115-
11699
@Override
117100
public void setAttribute(String string, Object o) {
118101
attrs.put(string, o);
119102
}
120103

121-
@Override
122-
@SuppressWarnings("deprecation")
123-
public void putValue(String string, Object o) {
124-
}
125-
126104
@Override
127105
public void removeAttribute(String string) {
128106
attrs.remove(string);
129107
}
130108

131-
@Override
132-
@SuppressWarnings("deprecation")
133-
public void removeValue(String string) {
134-
}
135-
136109
@Override
137110
public void invalidate() {
138111
}
@@ -284,12 +257,6 @@ public boolean isRequestedSessionIdFromURL() {
284257
throw new UnsupportedOperationException("Not supported yet.");
285258
}
286259

287-
@Override
288-
@Deprecated
289-
public boolean isRequestedSessionIdFromUrl() {
290-
throw new UnsupportedOperationException("Not supported yet.");
291-
}
292-
293260
@Override
294261
public boolean authenticate(HttpServletResponse httpServletResponse) {
295262
return false;
@@ -445,12 +412,6 @@ public RequestDispatcher getRequestDispatcher(String string) {
445412
throw new UnsupportedOperationException("Not supported yet.");
446413
}
447414

448-
@Override
449-
@Deprecated
450-
public String getRealPath(String string) {
451-
throw new UnsupportedOperationException("Not supported yet.");
452-
}
453-
454415
@Override
455416
public int getRemotePort() {
456417
throw new UnsupportedOperationException("Not supported yet.");
@@ -505,4 +466,19 @@ public AsyncContext getAsyncContext() {
505466
public DispatcherType getDispatcherType() {
506467
return null;
507468
}
469+
470+
@Override
471+
public String getRequestId() {
472+
return "123";
473+
}
474+
475+
@Override
476+
public String getProtocolRequestId() {
477+
return null;
478+
}
479+
480+
@Override
481+
public ServletConnection getServletConnection() {
482+
return null;
483+
}
508484
}

0 commit comments

Comments
 (0)