[java-support] 01/01: IDP-1793 Use Suppliers for HttpRequest/Response
Rod Widdowson
rdw at steadingsoftware.com
Thu Jul 28 19:12:50 UTC 2022
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch dev/11/IDP-1793
in repository java-support.
View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=3fa522d9a9da9d70efe0e4213e19d21768f26e0f
commit 3fa522d9a9da9d70efe0e4213e19d21768f26e0f
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Jul 28 19:36:59 2022 +0100
IDP-1793 Use Suppliers for HttpRequest/Response
https://shibboleth.atlassian.net/browse/IDP-1793
Inital testing commit - ThreadLocalHttpServletRequestProxy
and ThreadLocalHttpServletResponseProxy also implement
and appropriate Supplier<>
---
.../java/support/net/ThreadLocalHttpServletRequestProxy.java | 8 +++++++-
.../java/support/net/ThreadLocalHttpServletResponseProxy.java | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/main/java/net/shibboleth/utilities/java/support/net/ThreadLocalHttpServletRequestProxy.java b/src/main/java/net/shibboleth/utilities/java/support/net/ThreadLocalHttpServletRequestProxy.java
index 700f2a2..459a119 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/net/ThreadLocalHttpServletRequestProxy.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/net/ThreadLocalHttpServletRequestProxy.java
@@ -25,6 +25,7 @@ import java.util.Collection;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
+import java.util.function.Supplier;
import javax.servlet.AsyncContext;
import javax.servlet.DispatcherType;
@@ -47,7 +48,7 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
* An implementation of {@link HttpServletRequest} which serves as a proxy for the
* current thread-local servlet request obtained from {@link HttpServletRequestResponseContext}.
*/
-public class ThreadLocalHttpServletRequestProxy implements HttpServletRequest {
+public class ThreadLocalHttpServletRequestProxy implements HttpServletRequest, Supplier<HttpServletRequest> {
/** {@inheritDoc} */
public Object getAttribute(final String name) {
@@ -406,4 +407,9 @@ public class ThreadLocalHttpServletRequestProxy implements HttpServletRequest {
"Current HttpServletRequest has not been loaded via HttpServletRequestResponseContext");
}
+ /** {@inheritDoc} */
+ public HttpServletRequest get() {
+ return getCurrent();
+ }
+
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/net/ThreadLocalHttpServletResponseProxy.java b/src/main/java/net/shibboleth/utilities/java/support/net/ThreadLocalHttpServletResponseProxy.java
index 5577e45..a6b5215 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/net/ThreadLocalHttpServletResponseProxy.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/net/ThreadLocalHttpServletResponseProxy.java
@@ -21,6 +21,7 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Locale;
+import java.util.function.Supplier;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie;
@@ -32,7 +33,7 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
* An implementation of {@link HttpServletResponse} which serves as a proxy for the
* current thread-local servlet response obtained from {@link HttpServletRequestResponseContext}.
*/
-public class ThreadLocalHttpServletResponseProxy implements HttpServletResponse {
+public class ThreadLocalHttpServletResponseProxy implements HttpServletResponse, Supplier<HttpServletResponse> {
/** {@inheritDoc} */
public String getCharacterEncoding() {
@@ -232,4 +233,9 @@ public class ThreadLocalHttpServletResponseProxy implements HttpServletResponse
"Current HttpServletResponse has not been loaded via HttpServletRequestResponseContext");
}
+ /** {@inheritDoc} */
+ public HttpServletResponse get() {
+ return getCurrent();
+ }
+
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list