You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2023/02/22 08:21:12 UTC
[wicket] branch master updated: WICKET-7005: Fix the broken Servlet APIs in wicket-native-websocket modules
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git
The following commit(s) were added to refs/heads/master by this push:
new 4ed118cde7 WICKET-7005: Fix the broken Servlet APIs in wicket-native-websocket modules
4ed118cde7 is described below
commit 4ed118cde785a0c53792603aae5951fb0561c641
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Wed Feb 22 10:20:27 2023 +0200
WICKET-7005: Fix the broken Servlet APIs in wicket-native-websocket modules
Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
---
.../wicket/protocol/ws/api/HttpSessionCopy.java | 31 ----------------------
.../wicket/protocol/ws/api/ServletRequestCopy.java | 31 +++++++++++++---------
.../protocol/ws/javax/JavaxUpgradeHttpRequest.java | 31 +++++++++++++---------
3 files changed, 38 insertions(+), 55 deletions(-)
diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/HttpSessionCopy.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/HttpSessionCopy.java
index 9de32bc423..5759aab3a1 100644
--- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/HttpSessionCopy.java
+++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/HttpSessionCopy.java
@@ -22,7 +22,6 @@ import java.util.concurrent.ConcurrentHashMap;
import jakarta.servlet.ServletContext;
import jakarta.servlet.http.HttpSession;
-import jakarta.servlet.http.HttpSessionContext;
/**
* A copy of the HttpSession used at the WebSocket connection creation time
@@ -90,60 +89,30 @@ public class HttpSessionCopy implements HttpSession
return maxInactiveInterval;
}
- @Override
- public HttpSessionContext getSessionContext()
- {
- return null;
- }
-
@Override
public Object getAttribute(String name)
{
return attributes.get(name);
}
- @Override
- public Object getValue(String name)
- {
- return attributes.get(name);
- }
-
@Override
public Enumeration<String> getAttributeNames()
{
return attributes.keys();
}
- @Override
- public String[] getValueNames()
- {
- return Collections.list(attributes.keys()).toArray(new String[0]);
- }
-
@Override
public void setAttribute(String name, Object value)
{
attributes.put(name, value);
}
- @Override
- public void putValue(String name, Object value)
- {
- attributes.put(name, value);
- }
-
@Override
public void removeAttribute(String name)
{
attributes.remove(name);
}
- @Override
- public void removeValue(String name)
- {
- attributes.remove(name);
- }
-
@Override
public void invalidate()
{
diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/ServletRequestCopy.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/ServletRequestCopy.java
index 50ef164c20..860fc12ada 100644
--- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/ServletRequestCopy.java
+++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/ServletRequestCopy.java
@@ -26,10 +26,12 @@ import java.util.Enumeration;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
+import java.util.UUID;
import jakarta.servlet.AsyncContext;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.ServletConnection;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletInputStream;
@@ -82,6 +84,7 @@ public class ServletRequestCopy implements HttpServletRequest
private final Principal principal;
private String characterEncoding;
+ private final String requestId;
public ServletRequestCopy(HttpServletRequest request) {
this.servletPath = request.getServletPath();
@@ -132,6 +135,7 @@ public class ServletRequestCopy implements HttpServletRequest
s = e.nextElement();
parameters.put(s, request.getParameterValues(s));
}
+ requestId = UUID.randomUUID().toString();
}
@Override
@@ -348,12 +352,6 @@ public class ServletRequestCopy implements HttpServletRequest
return null;
}
- @Override
- public String getRealPath(String path)
- {
- return null;
- }
-
@Override
public int getRemotePort()
{
@@ -420,6 +418,21 @@ public class ServletRequestCopy implements HttpServletRequest
return null;
}
+ @Override
+ public String getRequestId() {
+ return requestId;
+ }
+
+ @Override
+ public String getProtocolRequestId() {
+ return null;
+ }
+
+ @Override
+ public ServletConnection getServletConnection() {
+ return null;
+ }
+
@Override
public String getContextPath() {
return contextPath;
@@ -505,12 +518,6 @@ public class ServletRequestCopy implements HttpServletRequest
return false;
}
- @Override
- public boolean isRequestedSessionIdFromUrl()
- {
- return false;
- }
-
@Override
public boolean authenticate(HttpServletResponse response) throws IOException, ServletException
{
diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxUpgradeHttpRequest.java b/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxUpgradeHttpRequest.java
index 581818d23a..04bb59d14c 100644
--- a/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxUpgradeHttpRequest.java
+++ b/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxUpgradeHttpRequest.java
@@ -28,10 +28,12 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
+import java.util.UUID;
import jakarta.servlet.AsyncContext;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.ServletConnection;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletInputStream;
@@ -61,6 +63,7 @@ public class JavaxUpgradeHttpRequest implements HttpServletRequest
private final Map<String, String[]> parametersMap;
private final Map<String, List<String>> headers;
private final String contextPath;
+ private final String requestId;
public JavaxUpgradeHttpRequest(final Session session, EndpointConfig endpointConfig)
{
@@ -92,6 +95,7 @@ public class JavaxUpgradeHttpRequest implements HttpServletRequest
parametersMap.put(name, value.toArray(new String[0]));
}
}
+ requestId = UUID.randomUUID().toString();
}
@Override
@@ -301,12 +305,6 @@ public class JavaxUpgradeHttpRequest implements HttpServletRequest
return false;
}
- @Override
- public boolean isRequestedSessionIdFromUrl()
- {
- return false;
- }
-
@Override
public boolean authenticate(HttpServletResponse response) throws IOException, ServletException
{
@@ -516,12 +514,6 @@ public class JavaxUpgradeHttpRequest implements HttpServletRequest
return null;
}
- @Override
- public String getRealPath(String path)
- {
- return null;
- }
-
@Override
public int getRemotePort()
{
@@ -587,4 +579,19 @@ public class JavaxUpgradeHttpRequest implements HttpServletRequest
{
return null;
}
+
+ @Override
+ public String getRequestId() {
+ return requestId;
+ }
+
+ @Override
+ public String getProtocolRequestId() {
+ return null;
+ }
+
+ @Override
+ public ServletConnection getServletConnection() {
+ return null;
+ }
}