[java-support] branch maint-8 updated: JSPT-119 - Deprecate servlet request/response proxies
Scott Cantor
cantor.2 at osu.edu
Thu Nov 10 14:21:43 UTC 2022
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch maint-8
in repository java-support.
View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=06e87019949cb9cc3e0840b2a06ecc2a98baefa0
The following commit(s) were added to refs/heads/maint-8 by this push:
new 06e8701 JSPT-119 - Deprecate servlet request/response proxies
06e8701 is described below
commit 06e87019949cb9cc3e0840b2a06ecc2a98baefa0
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Nov 10 09:21:40 2022 -0500
JSPT-119 - Deprecate servlet request/response proxies
https://shibboleth.atlassian.net/browse/JSPT-119
---
.../java/support/net/ThreadLocalHttpServletRequestProxy.java | 12 ++++++++++--
.../support/net/ThreadLocalHttpServletResponseProxy.java | 12 +++++++++---
2 files changed, 19 insertions(+), 5 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 f99f495..a5f038b 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
@@ -42,11 +42,19 @@ import javax.servlet.http.HttpUpgradeHandler;
import javax.servlet.http.Part;
import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.primitive.DeprecationSupport;
+import net.shibboleth.utilities.java.support.primitive.DeprecationSupport.ObjectType;
/**
* An implementation of {@link HttpServletRequest} which serves as a proxy for the
* current thread-local servlet request obtained from {@link HttpServletRequestResponseContext}.
+ *
+ * <p>This should be avoided in place of {@link ThreadLocalHttpServletRequestSupplier} which
+ * indirects the access to the interface.</p>
+ *
+ * @deprecated
*/
+ at Deprecated(since="8.4.0", forRemoval=true)
public class ThreadLocalHttpServletRequestProxy implements HttpServletRequest {
/** {@inheritDoc} */
@@ -170,7 +178,6 @@ public class ThreadLocalHttpServletRequestProxy implements HttpServletRequest {
}
/** {@inheritDoc} */
- @SuppressWarnings("deprecation")
public String getRealPath(final String path) {
return getCurrent().getRealPath(path);
}
@@ -316,7 +323,6 @@ public class ThreadLocalHttpServletRequestProxy implements HttpServletRequest {
}
/** {@inheritDoc} */
- @SuppressWarnings("deprecation")
public boolean isRequestedSessionIdFromUrl() {
return getCurrent().isRequestedSessionIdFromUrl();
}
@@ -402,7 +408,9 @@ public class ThreadLocalHttpServletRequestProxy implements HttpServletRequest {
* @return the current request
*/
protected HttpServletRequest getCurrent() {
+ DeprecationSupport.warn(ObjectType.BEAN, "shibboleth.HttpServletRequest", null, "shibboleth.HttpServletRequestSupplier");
return Constraint.isNotNull(HttpServletRequestResponseContext.getRequest(),
"Current HttpServletRequest has not been loaded via HttpServletRequestResponseContext");
}
+
}
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 74c375e..d1842cc 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
@@ -27,11 +27,19 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.primitive.DeprecationSupport;
+import net.shibboleth.utilities.java.support.primitive.DeprecationSupport.ObjectType;
/**
* An implementation of {@link HttpServletResponse} which serves as a proxy for the
* current thread-local servlet response obtained from {@link HttpServletRequestResponseContext}.
+ *
+ * <p>This should be avoided in place of {@link ThreadLocalHttpServletResponseSupplier} which
+ * indirects the access to the interface.</p>
+ *
+ * @deprecated
*/
+ at Deprecated(since="8.4.0", forRemoval=true)
public class ThreadLocalHttpServletResponseProxy implements HttpServletResponse {
/** {@inheritDoc} */
@@ -130,13 +138,11 @@ public class ThreadLocalHttpServletResponseProxy implements HttpServletResponse
}
/** {@inheritDoc} */
- @SuppressWarnings("deprecation")
public String encodeUrl(final String url) {
return getCurrent().encodeUrl(url);
}
/** {@inheritDoc} */
- @SuppressWarnings("deprecation")
public String encodeRedirectUrl(final String url) {
return getCurrent().encodeRedirectUrl(url);
}
@@ -192,7 +198,6 @@ public class ThreadLocalHttpServletResponseProxy implements HttpServletResponse
}
/** {@inheritDoc} */
- @SuppressWarnings("deprecation")
public void setStatus(final int sc, final String sm) {
getCurrent().setStatus(sc, sm);
}
@@ -228,6 +233,7 @@ public class ThreadLocalHttpServletResponseProxy implements HttpServletResponse
* @return the current response
*/
protected HttpServletResponse getCurrent() {
+ DeprecationSupport.warn(ObjectType.BEAN, "shibboleth.HttpServletResponse", null, "shibboleth.HttpServletRespoonseSupplier");
return Constraint.isNotNull(HttpServletRequestResponseContext.getResponse(),
"Current HttpServletResponse has not been loaded via HttpServletRequestResponseContext");
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list