You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2021/09/22 13:21:30 UTC
[tomcat] 02/05: Delete references to deprecated (and deleted)
Servlet API elements
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit ab17b97b74ca141813ee1eb1f784089b319dd9e2
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Sep 21 12:11:49 2021 +0100
Delete references to deprecated (and deleted) Servlet API elements
---
java/org/apache/catalina/connector/Request.java | 43 -----
.../apache/catalina/connector/RequestFacade.java | 25 ---
java/org/apache/catalina/connector/Response.java | 53 ------
.../apache/catalina/connector/ResponseFacade.java | 36 -----
.../apache/catalina/core/ApplicationContext.java | 40 -----
.../catalina/core/ApplicationContextFacade.java | 70 --------
.../catalina/core/ApplicationHttpResponse.java | 21 ---
java/org/apache/catalina/core/StandardContext.java | 24 ---
java/org/apache/catalina/core/StandardWrapper.java | 9 --
.../catalina/filters/CsrfPreventionFilter.java | 12 --
.../apache/catalina/session/StandardSession.java | 177 +-------------------
.../catalina/session/StandardSessionFacade.java | 55 -------
java/org/apache/catalina/startup/Tomcat.java | 6 -
.../apache/jasper/servlet/JspCServletContext.java | 54 -------
.../apache/jasper/servlet/JspServletWrapper.java | 13 +-
.../apache/catalina/core/TestStandardWrapper.java | 178 ---------------------
.../catalina/filters/TestCsrfPreventionFilter.java | 10 --
.../catalina/filters/TesterHttpServletRequest.java | 10 --
.../filters/TesterHttpServletResponse.java | 12 --
.../apache/catalina/startup/TomcatBaseTest.java | 3 +-
.../tomcat/unittest/TesterServletContext.java | 23 ---
21 files changed, 3 insertions(+), 871 deletions(-)
diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java
index 82f4a5a..de46807 100644
--- a/java/org/apache/catalina/connector/Request.java
+++ b/java/org/apache/catalina/connector/Request.java
@@ -1233,35 +1233,6 @@ public class Request implements HttpServletRequest {
/**
- * @return the real path of the specified virtual path.
- *
- * @param path Path to be translated
- *
- * @deprecated As of version 2.1 of the Java Servlet API, use
- * <code>ServletContext.getRealPath()</code>.
- */
- @Override
- @Deprecated
- public String getRealPath(String path) {
-
- Context context = getContext();
- if (context == null) {
- return null;
- }
- ServletContext servletContext = context.getServletContext();
- if (servletContext == null) {
- return null;
- }
-
- try {
- return servletContext.getRealPath(path);
- } catch (IllegalArgumentException e) {
- return null;
- }
- }
-
-
- /**
* @return the remote IP address making this Request.
*/
@Override
@@ -2499,20 +2470,6 @@ public class Request implements HttpServletRequest {
/**
* @return <code>true</code> if the session identifier included in this
- * request came from the request URI.
- *
- * @deprecated As of Version 2.1 of the Java Servlet API, use
- * <code>isRequestedSessionIdFromURL()</code> instead.
- */
- @Override
- @Deprecated
- public boolean isRequestedSessionIdFromUrl() {
- return isRequestedSessionIdFromURL();
- }
-
-
- /**
- * @return <code>true</code> if the session identifier included in this
* request identifies a valid session.
*/
@Override
diff --git a/java/org/apache/catalina/connector/RequestFacade.java b/java/org/apache/catalina/connector/RequestFacade.java
index 78a889f..69cad36 100644
--- a/java/org/apache/catalina/connector/RequestFacade.java
+++ b/java/org/apache/catalina/connector/RequestFacade.java
@@ -53,7 +53,6 @@ import org.apache.tomcat.util.res.StringManager;
* @author Craig R. McClanahan
* @author Remy Maucherat
*/
-@SuppressWarnings("deprecation")
public class RequestFacade implements HttpServletRequest {
@@ -616,18 +615,6 @@ public class RequestFacade implements HttpServletRequest {
}
@Override
- public String getRealPath(String path) {
-
- if (request == null) {
- throw new IllegalStateException(
- sm.getString("requestFacade.nullRequest"));
- }
-
- return request.getRealPath(path);
- }
-
-
- @Override
public String getAuthType() {
if (request == null) {
@@ -968,18 +955,6 @@ public class RequestFacade implements HttpServletRequest {
@Override
- public boolean isRequestedSessionIdFromUrl() {
-
- if (request == null) {
- throw new IllegalStateException(
- sm.getString("requestFacade.nullRequest"));
- }
-
- return request.isRequestedSessionIdFromURL();
- }
-
-
- @Override
public String getLocalAddr() {
if (request == null) {
diff --git a/java/org/apache/catalina/connector/Response.java b/java/org/apache/catalina/connector/Response.java
index 652b6b9..6096d02 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -1144,23 +1144,6 @@ public class Response implements HttpServletResponse {
/**
* Encode the session identifier associated with this response
- * into the specified redirect URL, if necessary.
- *
- * @param url URL to be encoded
- * @return <code>true</code> if the URL was encoded
- *
- * @deprecated As of Version 2.1 of the Java Servlet API, use
- * <code>encodeRedirectURL()</code> instead.
- */
- @Override
- @Deprecated
- public String encodeRedirectUrl(String url) {
- return encodeRedirectURL(url);
- }
-
-
- /**
- * Encode the session identifier associated with this response
* into the specified URL, if necessary.
*
* @param url URL to be encoded
@@ -1193,23 +1176,6 @@ public class Response implements HttpServletResponse {
/**
- * Encode the session identifier associated with this response
- * into the specified URL, if necessary.
- *
- * @param url URL to be encoded
- * @return <code>true</code> if the URL was encoded
- *
- * @deprecated As of Version 2.1 of the Java Servlet API, use
- * <code>encodeURL()</code> instead.
- */
- @Override
- @Deprecated
- public String encodeUrl(String url) {
- return encodeURL(url);
- }
-
-
- /**
* Send an acknowledgement of a request.
*
* @param continueResponseTiming Indicates when the request for the ACK
@@ -1443,23 +1409,6 @@ public class Response implements HttpServletResponse {
*/
@Override
public void setStatus(int status) {
- setStatus(status, null);
- }
-
-
- /**
- * Set the HTTP status and message to be returned with this response.
- *
- * @param status The new HTTP status
- * @param message The associated text message
- *
- * @deprecated As of Version 2.1 of the Java Servlet API, this method
- * has been deprecated due to the ambiguous meaning of the message
- * parameter.
- */
- @Override
- @Deprecated
- public void setStatus(int status, String message) {
if (isCommitted()) {
return;
@@ -1471,8 +1420,6 @@ public class Response implements HttpServletResponse {
}
getCoyoteResponse().setStatus(status);
- getCoyoteResponse().setMessage(message);
-
}
diff --git a/java/org/apache/catalina/connector/ResponseFacade.java b/java/org/apache/catalina/connector/ResponseFacade.java
index 9304303..fa79566 100644
--- a/java/org/apache/catalina/connector/ResponseFacade.java
+++ b/java/org/apache/catalina/connector/ResponseFacade.java
@@ -41,7 +41,6 @@ import org.apache.tomcat.util.res.StringManager;
*
* @author Remy Maucherat
*/
-@SuppressWarnings("deprecation")
public class ResponseFacade implements HttpServletResponse {
// ----------------------------------------------------------- DoPrivileged
@@ -424,30 +423,6 @@ public class ResponseFacade implements HttpServletResponse {
@Override
- public String encodeUrl(String url) {
-
- if (response == null) {
- throw new IllegalStateException(
- sm.getString("responseFacade.nullResponse"));
- }
-
- return response.encodeURL(url);
- }
-
-
- @Override
- public String encodeRedirectUrl(String url) {
-
- if (response == null) {
- throw new IllegalStateException(
- sm.getString("responseFacade.nullResponse"));
- }
-
- return response.encodeRedirectURL(url);
- }
-
-
- @Override
public void sendError(int sc, String msg)
throws IOException {
@@ -590,17 +565,6 @@ public class ResponseFacade implements HttpServletResponse {
@Override
- public void setStatus(int sc, String sm) {
-
- if (isCommitted()) {
- return;
- }
-
- response.setStatus(sc, sm);
- }
-
-
- @Override
public String getContentType() {
if (response == null) {
diff --git a/java/org/apache/catalina/core/ApplicationContext.java b/java/org/apache/catalina/core/ApplicationContext.java
index c91f540..010d738 100644
--- a/java/org/apache/catalina/core/ApplicationContext.java
+++ b/java/org/apache/catalina/core/ApplicationContext.java
@@ -139,18 +139,6 @@ public class ApplicationContext implements ServletContext {
/**
- * Empty String collection to serve as the basis for empty enumerations.
- */
- private static final List<String> emptyString = Collections.emptyList();
-
-
- /**
- * Empty Servlet collection to serve as the basis for empty enumerations.
- */
- private static final List<Servlet> emptyServlet = Collections.emptyList();
-
-
- /**
* The facade around this object.
*/
private final ServletContext facade = new ApplicationContextFacade(this);
@@ -598,46 +586,18 @@ public class ApplicationContext implements ServletContext {
@Override
- @Deprecated
- public Servlet getServlet(String name) {
- return null;
- }
-
-
- @Override
public String getServletContextName() {
return context.getDisplayName();
}
@Override
- @Deprecated
- public Enumeration<String> getServletNames() {
- return Collections.enumeration(emptyString);
- }
-
-
- @Override
- @Deprecated
- public Enumeration<Servlet> getServlets() {
- return Collections.enumeration(emptyServlet);
- }
-
-
- @Override
public void log(String message) {
context.getLogger().info(message);
}
@Override
- @Deprecated
- public void log(Exception exception, String message) {
- context.getLogger().error(message, exception);
- }
-
-
- @Override
public void log(String message, Throwable throwable) {
context.getLogger().error(message, throwable);
}
diff --git a/java/org/apache/catalina/core/ApplicationContextFacade.java b/java/org/apache/catalina/core/ApplicationContextFacade.java
index b1e39c6..f61be51 100644
--- a/java/org/apache/catalina/core/ApplicationContextFacade.java
+++ b/java/org/apache/catalina/core/ApplicationContextFacade.java
@@ -238,60 +238,6 @@ public class ApplicationContextFacade implements ServletContext {
}
- /**
- * @deprecated As of Java Servlet API 2.1, with no direct replacement.
- */
- @Override
- @Deprecated
- public Servlet getServlet(String name)
- throws ServletException {
- if (SecurityUtil.isPackageProtectionEnabled()) {
- try {
- return (Servlet) invokeMethod(context, "getServlet",
- new Object[]{name});
- } catch (Throwable t) {
- ExceptionUtils.handleThrowable(t);
- if (t instanceof ServletException) {
- throw (ServletException) t;
- }
- return null;
- }
- } else {
- return context.getServlet(name);
- }
- }
-
-
- /**
- * @deprecated As of Java Servlet API 2.1, with no direct replacement.
- */
- @Override
- @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
- @Deprecated
- public Enumeration<Servlet> getServlets() {
- if (SecurityUtil.isPackageProtectionEnabled()) {
- return (Enumeration<Servlet>) doPrivileged("getServlets", null);
- } else {
- return context.getServlets();
- }
- }
-
-
- /**
- * @deprecated As of Java Servlet API 2.1, with no direct replacement.
- */
- @Override
- @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
- @Deprecated
- public Enumeration<String> getServletNames() {
- if (SecurityUtil.isPackageProtectionEnabled()) {
- return (Enumeration<String>) doPrivileged("getServletNames", null);
- } else {
- return context.getServletNames();
- }
- }
-
-
@Override
public void log(String msg) {
if (SecurityUtil.isPackageProtectionEnabled()) {
@@ -302,22 +248,6 @@ public class ApplicationContextFacade implements ServletContext {
}
- /**
- * @deprecated As of Java Servlet API 2.1, use
- * <code>log(String, Throwable)</code> instead
- */
- @Override
- @Deprecated
- public void log(Exception exception, String msg) {
- if (SecurityUtil.isPackageProtectionEnabled()) {
- doPrivileged("log", new Class[]{Exception.class, String.class},
- new Object[]{exception,msg});
- } else {
- context.log(exception, msg);
- }
- }
-
-
@Override
public void log(String message, Throwable throwable) {
if (SecurityUtil.isPackageProtectionEnabled()) {
diff --git a/java/org/apache/catalina/core/ApplicationHttpResponse.java b/java/org/apache/catalina/core/ApplicationHttpResponse.java
index 08b1ffb..0fd9351 100644
--- a/java/org/apache/catalina/core/ApplicationHttpResponse.java
+++ b/java/org/apache/catalina/core/ApplicationHttpResponse.java
@@ -343,27 +343,6 @@ class ApplicationHttpResponse extends HttpServletResponseWrapper {
}
- /**
- * Disallow <code>setStatus()</code> calls on an included response.
- *
- * @param sc The new status code
- * @param msg The new message
- * @deprecated As of version 2.1, due to ambiguous meaning of the message
- * parameter. To set a status code use
- * <code>setStatus(int)</code>, to send an error with a
- * description use <code>sendError(int, String)</code>.
- */
- @Deprecated
- @Override
- public void setStatus(int sc, String msg) {
-
- if (!included) {
- ((HttpServletResponse) getResponse()).setStatus(sc, msg);
- }
-
- }
-
-
// -------------------------------------------------------- Package Methods
/**
diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java
index 7eeb1b2..47c20e1 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -6482,35 +6482,11 @@ public class StandardContext extends ContainerBase
}
@Override
- @Deprecated
- public Servlet getServlet(String name) throws ServletException {
- return sc.getServlet(name);
- }
-
- @Override
- @Deprecated
- public Enumeration<Servlet> getServlets() {
- return sc.getServlets();
- }
-
- @Override
- @Deprecated
- public Enumeration<String> getServletNames() {
- return sc.getServletNames();
- }
-
- @Override
public void log(String msg) {
sc.log(msg);
}
@Override
- @Deprecated
- public void log(Exception exception, String msg) {
- sc.log(exception, msg);
- }
-
- @Override
public void log(String message, Throwable throwable) {
sc.log(message, throwable);
}
diff --git a/java/org/apache/catalina/core/StandardWrapper.java b/java/org/apache/catalina/core/StandardWrapper.java
index 733deff..b003b3d 100644
--- a/java/org/apache/catalina/core/StandardWrapper.java
+++ b/java/org/apache/catalina/core/StandardWrapper.java
@@ -42,7 +42,6 @@ import jakarta.servlet.Servlet;
import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
-import jakarta.servlet.SingleThreadModel;
import jakarta.servlet.UnavailableException;
import jakarta.servlet.annotation.MultipartConfig;
@@ -71,7 +70,6 @@ import org.apache.tomcat.util.modeler.Util;
* @author Craig R. McClanahan
* @author Remy Maucherat
*/
-@SuppressWarnings("deprecation") // SingleThreadModel
public class StandardWrapper extends ContainerBase
implements ServletConfig, Wrapper, NotificationEmitter {
@@ -1087,13 +1085,6 @@ public class StandardWrapper extends ContainerBase
classLoadTime=(int) (System.currentTimeMillis() -t1);
- if (servlet instanceof SingleThreadModel) {
- if (instancePool == null) {
- instancePool = new Stack<>();
- }
- singleThreadModel = true;
- }
-
initServlet(servlet);
fireContainerEvent("load", this);
diff --git a/java/org/apache/catalina/filters/CsrfPreventionFilter.java b/java/org/apache/catalina/filters/CsrfPreventionFilter.java
index 22efa40..43af6eb 100644
--- a/java/org/apache/catalina/filters/CsrfPreventionFilter.java
+++ b/java/org/apache/catalina/filters/CsrfPreventionFilter.java
@@ -225,23 +225,11 @@ public class CsrfPreventionFilter extends CsrfPreventionFilterBase {
}
@Override
- @Deprecated
- public String encodeRedirectUrl(String url) {
- return encodeRedirectURL(url);
- }
-
- @Override
public String encodeRedirectURL(String url) {
return addNonce(super.encodeRedirectURL(url));
}
@Override
- @Deprecated
- public String encodeUrl(String url) {
- return encodeURL(url);
- }
-
- @Override
public String encodeURL(String url) {
return addNonce(super.encodeURL(url));
}
diff --git a/java/org/apache/catalina/session/StandardSession.java b/java/org/apache/catalina/session/StandardSession.java
index 0c41865..545529f 100644
--- a/java/org/apache/catalina/session/StandardSession.java
+++ b/java/org/apache/catalina/session/StandardSession.java
@@ -223,14 +223,6 @@ public class StandardSession implements HttpSession, Session, Serializable {
/**
- * The HTTP session context associated with this session.
- */
- @Deprecated
- protected static volatile
- jakarta.servlet.http.HttpSessionContext sessionContext = null;
-
-
- /**
* The property change support for this component. NOTE: This value
* is not included in the serialized version of this object.
*/
@@ -1104,26 +1096,8 @@ public class StandardSession implements HttpSession, Session, Serializable {
}
- /**
- * Return the session context with which this session is associated.
- *
- * @deprecated As of Version 2.1, this method is deprecated and has no
- * replacement. It will be removed in a future version of the
- * Java Servlet API.
- */
- @Override
- @Deprecated
- public jakarta.servlet.http.HttpSessionContext getSessionContext() {
- if (sessionContext == null) {
- sessionContext = new StandardSessionContext();
- }
- return sessionContext;
- }
-
-
// ----------------------------------------------HttpSession Public Methods
-
/**
* Return the object bound with the specified name in this session, or
* <code>null</code> if no object is bound with that name.
@@ -1169,49 +1143,6 @@ public class StandardSession implements HttpSession, Session, Serializable {
/**
- * Return the object bound with the specified name in this session, or
- * <code>null</code> if no object is bound with that name.
- *
- * @param name Name of the value to be returned
- *
- * @exception IllegalStateException if this method is called on an
- * invalidated session
- *
- * @deprecated As of Version 2.2, this method is replaced by
- * <code>getAttribute()</code>
- */
- @Override
- @Deprecated
- public Object getValue(String name) {
-
- return getAttribute(name);
-
- }
-
-
- /**
- * Return the set of names of objects bound to this session. If there
- * are no such objects, a zero-length array is returned.
- *
- * @exception IllegalStateException if this method is called on an
- * invalidated session
- *
- * @deprecated As of Version 2.2, this method is replaced by
- * <code>getAttributeNames()</code>
- */
- @Override
- @Deprecated
- public String[] getValueNames() {
- if (!isValidInternal()) {
- throw new IllegalStateException
- (sm.getString("standardSession.getValueNames.ise"));
- }
-
- return keys();
- }
-
-
- /**
* Invalidates this session and unbinds any objects bound to it.
*
* @exception IllegalStateException if this method is called on
@@ -1253,33 +1184,6 @@ public class StandardSession implements HttpSession, Session, Serializable {
/**
- * Bind an object to this session, using the specified name. If an object
- * of the same name is already bound to this session, the object is
- * replaced.
- * <p>
- * After this method executes, and if the object implements
- * <code>HttpSessionBindingListener</code>, the container calls
- * <code>valueBound()</code> on the object.
- *
- * @param name Name to which the object is bound, cannot be null
- * @param value Object to be bound, cannot be null
- *
- * @exception IllegalStateException if this method is called on an
- * invalidated session
- *
- * @deprecated As of Version 2.2, this method is replaced by
- * <code>setAttribute()</code>
- */
- @Override
- @Deprecated
- public void putValue(String name, Object value) {
-
- setAttribute(name, value);
-
- }
-
-
- /**
* Remove the object bound with the specified name from this session. If
* the session does not have an object bound with this name, this method
* does nothing.
@@ -1331,32 +1235,6 @@ public class StandardSession implements HttpSession, Session, Serializable {
/**
- * Remove the object bound with the specified name from this session. If
- * the session does not have an object bound with this name, this method
- * does nothing.
- * <p>
- * After this method executes, and if the object implements
- * <code>HttpSessionBindingListener</code>, the container calls
- * <code>valueUnbound()</code> on the object.
- *
- * @param name Name of the object to remove from this session.
- *
- * @exception IllegalStateException if this method is called on an
- * invalidated session
- *
- * @deprecated As of Version 2.2, this method is replaced by
- * <code>removeAttribute()</code>
- */
- @Override
- @Deprecated
- public void removeValue(String name) {
-
- removeAttribute(name);
-
- }
-
-
- /**
* Bind an object to this session, using the specified name. If an object
* of the same name is already bound to this session, the object is
* replaced.
@@ -1896,57 +1774,4 @@ public class StandardSession implements HttpSession, Session, Serializable {
return new StandardSessionFacade(session);
}
}
-}
-
-
-// ------------------------------------------------------------ Protected Class
-
-
-/**
- * This class is a dummy implementation of the <code>HttpSessionContext</code>
- * interface, to conform to the requirement that such an object be returned
- * when <code>HttpSession.getSessionContext()</code> is called.
- *
- * @author Craig R. McClanahan
- *
- * @deprecated As of Java Servlet API 2.1 with no replacement. The
- * interface will be removed in a future version of this API.
- */
-
-@Deprecated
-final class StandardSessionContext
- implements jakarta.servlet.http.HttpSessionContext {
-
- private static final List<String> emptyString = Collections.emptyList();
-
- /**
- * Return the session identifiers of all sessions defined
- * within this context.
- *
- * @deprecated As of Java Servlet API 2.1 with no replacement.
- * This method must return an empty <code>Enumeration</code>
- * and will be removed in a future version of the API.
- */
- @Override
- @Deprecated
- public Enumeration<String> getIds() {
- return Collections.enumeration(emptyString);
- }
-
-
- /**
- * Return the <code>HttpSession</code> associated with the
- * specified session identifier.
- *
- * @param id Session identifier for which to look up a session
- *
- * @deprecated As of Java Servlet API 2.1 with no replacement.
- * This method must return null and will be removed in a
- * future version of the API.
- */
- @Override
- @Deprecated
- public HttpSession getSession(String id) {
- return null;
- }
-}
+}
\ No newline at end of file
diff --git a/java/org/apache/catalina/session/StandardSessionFacade.java b/java/org/apache/catalina/session/StandardSessionFacade.java
index 4c88831..c0cc5c9 100644
--- a/java/org/apache/catalina/session/StandardSessionFacade.java
+++ b/java/org/apache/catalina/session/StandardSessionFacade.java
@@ -86,85 +86,30 @@ public class StandardSessionFacade implements HttpSession {
}
- /**
- * @deprecated As of Version 2.1, this method is deprecated and has no
- * replacement.
- */
- @Override
- @Deprecated
- public jakarta.servlet.http.HttpSessionContext getSessionContext() {
- return session.getSessionContext();
- }
-
-
@Override
public Object getAttribute(String name) {
return session.getAttribute(name);
}
- /**
- * @deprecated As of Version 2.2, this method is replaced by
- * {@link #getAttribute}.
- */
- @Override
- @Deprecated
- public Object getValue(String name) {
- return session.getAttribute(name);
- }
-
-
@Override
public Enumeration<String> getAttributeNames() {
return session.getAttributeNames();
}
- /**
- * @deprecated As of Version 2.2, this method is replaced by
- * {@link #getAttributeNames}
- */
- @Override
- @Deprecated
- public String[] getValueNames() {
- return session.getValueNames();
- }
-
-
@Override
public void setAttribute(String name, Object value) {
session.setAttribute(name, value);
}
- /**
- * @deprecated As of Version 2.2, this method is replaced by
- * {@link #setAttribute}
- */
- @Override
- @Deprecated
- public void putValue(String name, Object value) {
- session.setAttribute(name, value);
- }
-
-
@Override
public void removeAttribute(String name) {
session.removeAttribute(name);
}
- /**
- * @deprecated As of Version 2.2, this method is replaced by
- * {@link #removeAttribute}
- */
- @Override
- @Deprecated
- public void removeValue(String name) {
- session.removeAttribute(name);
- }
-
-
@Override
public void invalidate() {
session.invalidate();
diff --git a/java/org/apache/catalina/startup/Tomcat.java b/java/org/apache/catalina/startup/Tomcat.java
index ffcef38..cdae77d 100644
--- a/java/org/apache/catalina/startup/Tomcat.java
+++ b/java/org/apache/catalina/startup/Tomcat.java
@@ -31,7 +31,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.Stack;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.logging.Level;
@@ -1199,13 +1198,8 @@ public class Tomcat {
public static class ExistingStandardWrapper extends StandardWrapper {
private final Servlet existing;
- @SuppressWarnings("deprecation")
public ExistingStandardWrapper( Servlet existing ) {
this.existing = existing;
- if (existing instanceof jakarta.servlet.SingleThreadModel) {
- singleThreadModel = true;
- instancePool = new Stack<>();
- }
this.asyncSupported = hasAsync(existing);
}
diff --git a/java/org/apache/jasper/servlet/JspCServletContext.java b/java/org/apache/jasper/servlet/JspCServletContext.java
index a31ccfe..70bb6ed 100644
--- a/java/org/apache/jasper/servlet/JspCServletContext.java
+++ b/java/org/apache/jasper/servlet/JspCServletContext.java
@@ -34,7 +34,6 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import jakarta.servlet.Filter;
@@ -502,20 +501,6 @@ public class JspCServletContext implements ServletContext {
/**
- * Return a null reference for the specified servlet name.
- *
- * @param name Name of the requested servlet
- *
- * @deprecated This method has been deprecated with no replacement
- */
- @Override
- @Deprecated
- public Servlet getServlet(String name) throws ServletException {
- return null;
- }
-
-
- /**
* Return the name of this servlet context.
*/
@Override
@@ -525,30 +510,6 @@ public class JspCServletContext implements ServletContext {
/**
- * Return an empty enumeration of servlet names.
- *
- * @deprecated This method has been deprecated with no replacement
- */
- @Override
- @Deprecated
- public Enumeration<String> getServletNames() {
- return new Vector<String>().elements();
- }
-
-
- /**
- * Return an empty enumeration of servlets.
- *
- * @deprecated This method has been deprecated with no replacement
- */
- @Override
- @Deprecated
- public Enumeration<Servlet> getServlets() {
- return new Vector<Servlet>().elements();
- }
-
-
- /**
* Log the specified message.
*
* @param message The message to be logged
@@ -562,21 +523,6 @@ public class JspCServletContext implements ServletContext {
/**
* Log the specified message and exception.
*
- * @param exception The exception to be logged
- * @param message The message to be logged
- *
- * @deprecated Use log(String,Throwable) instead
- */
- @Override
- @Deprecated
- public void log(Exception exception, String message) {
- log(message, exception);
- }
-
-
- /**
- * Log the specified message and exception.
- *
* @param message The message to be logged
* @param exception The exception to be logged
*/
diff --git a/java/org/apache/jasper/servlet/JspServletWrapper.java b/java/org/apache/jasper/servlet/JspServletWrapper.java
index 4af54e1..1687a1e 100644
--- a/java/org/apache/jasper/servlet/JspServletWrapper.java
+++ b/java/org/apache/jasper/servlet/JspServletWrapper.java
@@ -26,7 +26,6 @@ import jakarta.servlet.Servlet;
import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
-import jakarta.servlet.SingleThreadModel;
import jakarta.servlet.UnavailableException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@@ -66,8 +65,6 @@ import org.apache.tomcat.Jar;
* @author Glenn Nielsen
* @author Tim Fennell
*/
-
-@SuppressWarnings("deprecation") // Have to support SingleThreadModel
public class JspServletWrapper {
private static final Map<String,Long> ALWAYS_OUTDATED_DEPENDENCIES =
@@ -456,15 +453,7 @@ public class JspServletWrapper {
/*
* (4) Service request
*/
- if (servlet instanceof SingleThreadModel) {
- // sync on the wrapper so that the freshness
- // of the page is determined right before servicing
- synchronized (this) {
- servlet.service(request, response);
- }
- } else {
- servlet.service(request, response);
- }
+ servlet.service(request, response);
} catch (UnavailableException ex) {
String includeRequestUri = (String)
request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI);
diff --git a/test/org/apache/catalina/core/TestStandardWrapper.java b/test/org/apache/catalina/core/TestStandardWrapper.java
index 6a68f30..4018134 100644
--- a/test/org/apache/catalina/core/TestStandardWrapper.java
+++ b/test/org/apache/catalina/core/TestStandardWrapper.java
@@ -21,16 +21,11 @@ import java.io.IOException;
import java.security.Principal;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
import jakarta.servlet.Servlet;
-import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletContainerInitializer;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
@@ -487,177 +482,4 @@ public class TestStandardWrapper extends TomcatBaseTest {
r.addMapping("/");
}
}
-
-
- public static final int BUG51445_THREAD_COUNT = 5;
-
- public static CountDownLatch latch = null;
- public static final AtomicInteger counter = new AtomicInteger(0);
-
- public static void initLatch() {
- latch = new CountDownLatch(BUG51445_THREAD_COUNT);
- }
-
- @Test
- public void testBug51445AddServlet() throws Exception {
-
- initLatch();
-
- Tomcat tomcat = getTomcatInstance();
-
- // No file system docBase required
- Context ctx = tomcat.addContext("", null);
-
- Tomcat.addServlet(ctx, "Bug51445", new Bug51445Servlet());
- ctx.addServletMappingDecoded("/", "Bug51445");
-
- tomcat.start();
-
- // Start the threads
- Bug51445Thread[] threads = new Bug51445Thread[5];
- for (int i = 0; i < BUG51445_THREAD_COUNT; i ++) {
- threads[i] = new Bug51445Thread(getPort());
- threads[i].start();
- }
-
- // Wait for threads to finish
- for (int i = 0; i < BUG51445_THREAD_COUNT; i ++) {
- threads[i].join();
- }
-
- Set<String> servlets = new HashSet<>();
- // Output the result
- for (int i = 0; i < BUG51445_THREAD_COUNT; i ++) {
- System.out.println(threads[i].getResult());
- }
-
- // Check the result
- for (int i = 0; i < BUG51445_THREAD_COUNT; i ++) {
- String[] results = threads[i].getResult().split(",");
- Assert.assertEquals(2, results.length);
- Assert.assertEquals("10", results[0]);
- Assert.assertFalse(servlets.contains(results[1]));
- servlets.add(results[1]);
- }
- }
-
- @Test
- public void testBug51445AddChild() throws Exception {
-
- initLatch();
-
- Tomcat tomcat = getTomcatInstance();
-
- // No file system docBase required
- Context ctx = tomcat.addContext("", null);
-
- StandardWrapper wrapper = new StandardWrapper();
- wrapper.setServletName("Bug51445");
- wrapper.setServletClass(Bug51445Servlet.class.getName());
- ctx.addChild(wrapper);
- ctx.addServletMappingDecoded("/", "Bug51445");
-
- tomcat.start();
-
- // Start the threads
- Bug51445Thread[] threads = new Bug51445Thread[5];
- for (int i = 0; i < BUG51445_THREAD_COUNT; i ++) {
- threads[i] = new Bug51445Thread(getPort());
- threads[i].start();
- }
-
- // Wait for threads to finish
- for (int i = 0; i < BUG51445_THREAD_COUNT; i ++) {
- threads[i].join();
- }
-
- Set<String> servlets = new HashSet<>();
- // Output the result
- for (int i = 0; i < BUG51445_THREAD_COUNT; i ++) {
- System.out.println(threads[i].getResult());
- }
- // Check the result
- for (int i = 0; i < BUG51445_THREAD_COUNT; i ++) {
- String[] results = threads[i].getResult().split(",");
- Assert.assertEquals(2, results.length);
- Assert.assertEquals("10", results[0]);
- Assert.assertFalse(servlets.contains(results[1]));
- servlets.add(results[1]);
- }
- }
-
- private static class Bug51445Thread extends Thread {
-
- private int port;
- private String result;
-
- public Bug51445Thread(int port) {
- this.port = port;
- }
-
- @Override
- public void run() {
- try {
- ByteChunk res = getUrl("http://localhost:" + port + "/");
- result = res.toString();
- } catch (IOException ioe) {
- result = ioe.getMessage();
- }
- }
-
- public String getResult() {
- return result;
- }
- }
-
- /**
- * SingleThreadModel servlet that sets a value in the init() method.
- */
- @SuppressWarnings("deprecation")
- public static class Bug51445Servlet extends HttpServlet
- implements jakarta.servlet.SingleThreadModel {
-
- private static final long serialVersionUID = 1L;
- private static final long LATCH_TIMEOUT = 60;
-
- private int data = 0;
- private int counter;
-
- public Bug51445Servlet() {
- // Use this rather than hashCode since in some environments,
- // multiple instances of this object were created with the same
- // hashCode
- counter = TestStandardWrapper.counter.incrementAndGet();
- }
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
-
- boolean latchAwaitResult = false;
-
- // Ensure all threads have their own instance of the servlet
- latch.countDown();
- try {
- latchAwaitResult = latch.await(LATCH_TIMEOUT, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- // Ignore
- }
-
- resp.setContentType("text/plain");
- if (latchAwaitResult) {
- resp.getWriter().print(data);
- } else {
- resp.getWriter().print("Latch await failed");
- }
- resp.getWriter().print(",");
- resp.getWriter().print(counter);
- }
-
- @Override
- public void init(ServletConfig config) throws ServletException {
- super.init(config);
- data = 10;
- }
- }
}
diff --git a/test/org/apache/catalina/filters/TestCsrfPreventionFilter.java b/test/org/apache/catalina/filters/TestCsrfPreventionFilter.java
index 737fefa..c625637 100644
--- a/test/org/apache/catalina/filters/TestCsrfPreventionFilter.java
+++ b/test/org/apache/catalina/filters/TestCsrfPreventionFilter.java
@@ -107,18 +107,8 @@ public class TestCsrfPreventionFilter extends TomcatBaseTest {
}
@Override
- public String encodeRedirectUrl(String url) {
- return url;
- }
-
- @Override
public String encodeURL(String url) {
return url;
}
-
- @Override
- public String encodeUrl(String url) {
- return url;
- }
}
}
diff --git a/test/org/apache/catalina/filters/TesterHttpServletRequest.java b/test/org/apache/catalina/filters/TesterHttpServletRequest.java
index c7e555a..e66d2e9 100644
--- a/test/org/apache/catalina/filters/TesterHttpServletRequest.java
+++ b/test/org/apache/catalina/filters/TesterHttpServletRequest.java
@@ -194,11 +194,6 @@ public class TesterHttpServletRequest implements HttpServletRequest {
}
@Override
- public String getRealPath(String path) {
- throw new RuntimeException("Not implemented");
- }
-
- @Override
public int getRemotePort() {
throw new RuntimeException("Not implemented");
}
@@ -359,11 +354,6 @@ public class TesterHttpServletRequest implements HttpServletRequest {
}
@Override
- public boolean isRequestedSessionIdFromUrl() {
- throw new RuntimeException("Not implemented");
- }
-
- @Override
public long getContentLengthLong() {
throw new RuntimeException("Not implemented");
}
diff --git a/test/org/apache/catalina/filters/TesterHttpServletResponse.java b/test/org/apache/catalina/filters/TesterHttpServletResponse.java
index 7e3321a..10ef3aa 100644
--- a/test/org/apache/catalina/filters/TesterHttpServletResponse.java
+++ b/test/org/apache/catalina/filters/TesterHttpServletResponse.java
@@ -217,16 +217,8 @@ public class TesterHttpServletResponse implements HttpServletResponse {
public boolean containsHeader(String name) { return false; }
@Override
public String encodeRedirectURL(String url) { return null; }
- /** @deprecated Do not use */
- @Override
- @Deprecated
- public String encodeRedirectUrl(String url) { return null; }
@Override
public String encodeURL(String url) { return null; }
- /** @deprecated Do not use */
- @Override
- @Deprecated
- public String encodeUrl(String url) { return null; }
/**
*
* @throws IOException Never happens
@@ -244,10 +236,6 @@ public class TesterHttpServletResponse implements HttpServletResponse {
public void setDateHeader(String name, long value) {/* NOOP */}
@Override
public void setIntHeader(String name, int value) {/* NOOP */}
- /** @deprecated Do not use */
- @Override
- @Deprecated
- public void setStatus(int status, String message) {/* NOOP */}
@Override
public void setContentLengthLong(long length) {/* NOOP */}
@Override
diff --git a/test/org/apache/catalina/startup/TomcatBaseTest.java b/test/org/apache/catalina/startup/TomcatBaseTest.java
index 638a191..9dab366 100644
--- a/test/org/apache/catalina/startup/TomcatBaseTest.java
+++ b/test/org/apache/catalina/startup/TomcatBaseTest.java
@@ -442,7 +442,6 @@ public abstract class TomcatBaseTest extends LoggingBaseTest {
private static final long serialVersionUID = 1L;
- @SuppressWarnings("deprecation")
@Override
public void service(HttpServletRequest request,
HttpServletResponse response)
@@ -549,7 +548,7 @@ public abstract class TomcatBaseTest extends LoggingBaseTest {
out.println("SESSION-REQUESTED-ID-COOKIE: " +
request.isRequestedSessionIdFromCookie());
out.println("SESSION-REQUESTED-ID-URL: " +
- request.isRequestedSessionIdFromUrl());
+ request.isRequestedSessionIdFromURL());
out.println("SESSION-REQUESTED-ID-VALID: " +
request.isRequestedSessionIdValid());
diff --git a/test/org/apache/tomcat/unittest/TesterServletContext.java b/test/org/apache/tomcat/unittest/TesterServletContext.java
index 5e81571..dd80d27 100644
--- a/test/org/apache/tomcat/unittest/TesterServletContext.java
+++ b/test/org/apache/tomcat/unittest/TesterServletContext.java
@@ -117,34 +117,11 @@ public class TesterServletContext implements ServletContext {
}
@Override
- public Servlet getServlet(String name) throws ServletException {
-
- throw new RuntimeException("Not implemented");
- }
-
- @Override
- public Enumeration<Servlet> getServlets() {
-
- throw new RuntimeException("Not implemented");
- }
-
- @Override
- public Enumeration<String> getServletNames() {
-
- throw new RuntimeException("Not implemented");
- }
-
- @Override
public void log(String msg) {
// NOOP
}
@Override
- public void log(Exception exception, String msg) {
- // NOOP
- }
-
- @Override
public void log(String message, Throwable throwable) {
// NOOP
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org