From f17c78259b31bea6ed26ad0b44643fb65ebfeeda Mon Sep 17 00:00:00 2001 From: bhagyashriSawkar Date: Thu, 24 Oct 2024 18:00:39 +0530 Subject: [PATCH 1/3] Updated pom.xml to use jakarta instead of javax, upgraded few other jakarta packages as well --- pom.xml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 4b86e806..a7d09034 100644 --- a/pom.xml +++ b/pom.xml @@ -98,21 +98,27 @@ provided - javax.servlet - javax.servlet-api - 3.0.1 + jakarta.servlet + jakarta.servlet-api + 5.0.0 provided jakarta.servlet.jsp jakarta.servlet.jsp-api - 2.3.6 + 4.0.0 provided jakarta.jms jakarta.jms-api - 2.0.3 + 3.0.0 + provided + + + jakarta.el + jakarta.el-api + 4.0.0 provided @@ -139,12 +145,6 @@ 3.2.18.RELEASE test - - jakarta.el - jakarta.el-api - 3.0.3 - test - From 8db4e872f26f54536263174c9a21b86fa00b269c Mon Sep 17 00:00:00 2001 From: bhagyashriSawkar Date: Thu, 24 Oct 2024 18:02:10 +0530 Subject: [PATCH 2/3] Added java 17 to build platforms --- Gemfile.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile.lock b/Gemfile.lock index 442a6001..1965343c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -24,6 +24,7 @@ GEM PLATFORMS universal-java-1.8 universal-java-11 + universal-java-17 DEPENDENCIES appraisal (< 1.0) From 9724ecaee9ae563a49786a1db79b508910db27ed Mon Sep 17 00:00:00 2001 From: bhagyashriSawkar Date: Thu, 24 Oct 2024 18:02:21 +0530 Subject: [PATCH 3/3] Updated package namespace from javax.* to jakarta.* whereever used. Added few required override methods --- .../java/org/jruby/rack/AbstractFilter.java | 14 +-- .../java/org/jruby/rack/AbstractServlet.java | 12 +-- .../java/org/jruby/rack/RackDispatcher.java | 2 +- .../java/org/jruby/rack/RackEnvironment.java | 38 ++++---- src/main/java/org/jruby/rack/RackFilter.java | 12 +-- .../jruby/rack/RackResponseEnvironment.java | 18 ++-- src/main/java/org/jruby/rack/RackServlet.java | 2 +- .../rack/RackServletContextListener.java | 6 +- src/main/java/org/jruby/rack/RackTag.java | 10 +- .../org/jruby/rack/UnmappedRackFilter.java | 8 +- .../java/org/jruby/rack/embed/Filter.java | 4 +- .../java/org/jruby/rack/embed/Servlet.java | 2 +- src/main/java/org/jruby/rack/ext/Logger.java | 2 +- .../jruby/rack/jms/DefaultQueueManager.java | 14 +-- .../jruby/rack/jms/QueueContextListener.java | 6 +- .../java/org/jruby/rack/jms/QueueManager.java | 2 +- .../rack/logging/ServletContextLogger.java | 2 +- .../servlet/DefaultServletRackContext.java | 61 ++++++++++-- .../jruby/rack/servlet/RequestCapture.java | 6 +- .../jruby/rack/servlet/ResponseCapture.java | 25 ++--- .../rack/servlet/RewindableInputStream.java | 18 +++- .../jruby/rack/servlet/ServletRackConfig.java | 2 +- .../rack/servlet/ServletRackContext.java | 2 +- .../rack/servlet/ServletRackEnvironment.java | 8 +- .../servlet/ServletRackIncludedResponse.java | 18 +++- .../ServletRackResponseEnvironment.java | 4 +- src/main/ruby/jruby/rack/queues.rb | 2 +- src/main/ruby/jruby/rack/servlet_ext.rb | 6 +- .../ruby/rack/handler/servlet/default_env.rb | 2 +- .../ruby/rack/handler/servlet/servlet_env.rb | 6 +- .../org/jruby/rack/fake/FakeJspWriter.java | 2 +- .../org/jruby/rack/fake/FakePageContext.java | 32 +++---- .../mock/DelegatingServletInputStream.java | 4 +- .../mock/DelegatingServletOutputStream.java | 4 +- .../org/jruby/rack/mock/MockAsyncContext.java | 18 ++-- .../rack/mock/MockHttpServletRequest.java | 28 +++--- .../rack/mock/MockHttpServletResponse.java | 8 +- .../org/jruby/rack/mock/MockHttpSession.java | 12 +-- .../rack/mock/MockRequestDispatcher.java | 10 +- .../jruby/rack/mock/MockServletConfig.java | 6 +- .../jruby/rack/mock/MockServletContext.java | 24 ++--- .../rack/mock/MockSessionCookieConfig.java | 6 +- .../java/org/jruby/rack/mock/WebUtils.java | 92 +++++++++---------- src/spec/ruby/jruby/rack/booter_spec.rb | 4 +- src/spec/ruby/jruby/rack/integration_spec.rb | 10 +- src/spec/ruby/jruby/rack/response_spec.rb | 2 +- src/spec/ruby/jruby/rack/servlet_ext_spec.rb | 12 +-- src/spec/ruby/rack/embed/filter_spec.rb | 4 +- src/spec/ruby/rack/filter_spec.rb | 8 +- src/spec/ruby/rack/handler/servlet_spec.rb | 16 ++-- src/spec/ruby/rack/jms_spec.rb | 6 +- .../rack/servlet/response_capture_spec.rb | 2 +- .../rack/servlet_context_listener_spec.rb | 2 +- src/spec/ruby/rack/servlet_spec.rb | 4 +- src/spec/ruby/rack/tag_spec.rb | 2 +- src/spec/ruby/spec_helper.rb | 12 +-- 56 files changed, 357 insertions(+), 287 deletions(-) diff --git a/src/main/java/org/jruby/rack/AbstractFilter.java b/src/main/java/org/jruby/rack/AbstractFilter.java index 47c95de1..e1623fcd 100644 --- a/src/main/java/org/jruby/rack/AbstractFilter.java +++ b/src/main/java/org/jruby/rack/AbstractFilter.java @@ -9,13 +9,13 @@ import java.io.IOException; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.jruby.rack.servlet.RequestCapture; import org.jruby.rack.servlet.ResponseCapture; diff --git a/src/main/java/org/jruby/rack/AbstractServlet.java b/src/main/java/org/jruby/rack/AbstractServlet.java index 79b575e7..838e0883 100644 --- a/src/main/java/org/jruby/rack/AbstractServlet.java +++ b/src/main/java/org/jruby/rack/AbstractServlet.java @@ -9,12 +9,12 @@ import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.jruby.rack.servlet.ServletRackEnvironment; import org.jruby.rack.servlet.ServletRackResponseEnvironment; diff --git a/src/main/java/org/jruby/rack/RackDispatcher.java b/src/main/java/org/jruby/rack/RackDispatcher.java index 664855ed..9b793492 100644 --- a/src/main/java/org/jruby/rack/RackDispatcher.java +++ b/src/main/java/org/jruby/rack/RackDispatcher.java @@ -7,7 +7,7 @@ package org.jruby.rack; -import javax.servlet.ServletException; +import jakarta.servlet.ServletException; import java.io.IOException; /** diff --git a/src/main/java/org/jruby/rack/RackEnvironment.java b/src/main/java/org/jruby/rack/RackEnvironment.java index 9f910abc..3546bb71 100644 --- a/src/main/java/org/jruby/rack/RackEnvironment.java +++ b/src/main/java/org/jruby/rack/RackEnvironment.java @@ -14,7 +14,7 @@ /** * Represent a Rack environment (that will most likely by wrapping a - * {@link javax.servlet.http.HttpServletRequest}). + * {@link jakarta.servlet.http.HttpServletRequest}). * Allows Rack applications to be loaded outside of JEE servlet environments. * * @see org.jruby.rack.servlet.ServletRackEnvironment @@ -38,7 +38,7 @@ public interface RackEnvironment { // The following methods are specific to the rack environment /** - * @see javax.servlet.ServletRequest#getInputStream() + * @see jakarta.servlet.ServletRequest#getInputStream() * @return the input as a stream * @throws IOException if there's an IO exception */ @@ -54,107 +54,107 @@ public interface RackEnvironment { // The following methods are usually inherited from the servlet request /** - * @see javax.servlet.http.HttpServletRequest#getPathInfo() + * @see jakarta.servlet.http.HttpServletRequest#getPathInfo() * @return the request path info */ public String getPathInfo(); /** * Request URI should include the query string if available. - * @see javax.servlet.http.HttpServletRequest#getRequestURI() + * @see jakarta.servlet.http.HttpServletRequest#getRequestURI() * @return the request URI */ public String getRequestURI(); /** - * @see javax.servlet.http.HttpServletRequest#getAttributeNames() + * @see jakarta.servlet.http.HttpServletRequest#getAttributeNames() * @return an enumeration of all attribute names */ public Enumeration getAttributeNames(); /** - * @see javax.servlet.http.HttpServletRequest#getAttribute(String) + * @see jakarta.servlet.http.HttpServletRequest#getAttribute(String) * @param key the attribute key * @return the attribute value */ public Object getAttribute(String key); /** - * @see javax.servlet.http.HttpServletRequest#setAttribute(String, Object) + * @see jakarta.servlet.http.HttpServletRequest#setAttribute(String, Object) * @param key the key * @param value the value */ public void setAttribute(String key, Object value); /** - * @see javax.servlet.http.HttpServletRequest#getHeaderNames() + * @see jakarta.servlet.http.HttpServletRequest#getHeaderNames() * @return an enumeration of all header names */ public Enumeration getHeaderNames(); /** - * @see javax.servlet.http.HttpServletRequest#getHeader(String) + * @see jakarta.servlet.http.HttpServletRequest#getHeader(String) * @param name the header name * @return the header value */ public String getHeader(String name); /** - * @see javax.servlet.http.HttpServletRequest#getScheme() + * @see jakarta.servlet.http.HttpServletRequest#getScheme() * @return the request scheme */ public String getScheme(); /** - * @see javax.servlet.http.HttpServletRequest#getContentType() + * @see jakarta.servlet.http.HttpServletRequest#getContentType() * @return the content type */ public String getContentType(); /** - * @see javax.servlet.http.HttpServletRequest#getContentLength() + * @see jakarta.servlet.http.HttpServletRequest#getContentLength() * @return the content length */ public int getContentLength(); /** - * @see javax.servlet.http.HttpServletRequest#getMethod() + * @see jakarta.servlet.http.HttpServletRequest#getMethod() * @return the request method */ public String getMethod(); /** - * @see javax.servlet.http.HttpServletRequest#getQueryString() + * @see jakarta.servlet.http.HttpServletRequest#getQueryString() * @return the query string */ public String getQueryString(); /** - * @see javax.servlet.http.HttpServletRequest#getServerName() + * @see jakarta.servlet.http.HttpServletRequest#getServerName() * @return the server name */ public String getServerName(); /** - * @see javax.servlet.http.HttpServletRequest#getServerPort() + * @see jakarta.servlet.http.HttpServletRequest#getServerPort() * @return the server port */ public int getServerPort(); /** - * @see javax.servlet.ServletRequest#getRemoteHost() + * @see jakarta.servlet.ServletRequest#getRemoteHost() * @return the remote host */ public String getRemoteHost(); /** - * @see javax.servlet.ServletRequest#getRemoteAddr() + * @see jakarta.servlet.ServletRequest#getRemoteAddr() * @return the remote address */ public String getRemoteAddr(); /** - * @see javax.servlet.http.HttpServletRequest#getRemoteUser() + * @see jakarta.servlet.http.HttpServletRequest#getRemoteUser() * @return the remote user */ public String getRemoteUser(); diff --git a/src/main/java/org/jruby/rack/RackFilter.java b/src/main/java/org/jruby/rack/RackFilter.java index b4494cac..87981fd1 100644 --- a/src/main/java/org/jruby/rack/RackFilter.java +++ b/src/main/java/org/jruby/rack/RackFilter.java @@ -9,12 +9,12 @@ import java.io.IOException; import java.net.MalformedURLException; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; import org.jruby.rack.servlet.RequestCapture; import org.jruby.rack.servlet.ResponseCapture; diff --git a/src/main/java/org/jruby/rack/RackResponseEnvironment.java b/src/main/java/org/jruby/rack/RackResponseEnvironment.java index 48da1b58..57eb093a 100644 --- a/src/main/java/org/jruby/rack/RackResponseEnvironment.java +++ b/src/main/java/org/jruby/rack/RackResponseEnvironment.java @@ -16,8 +16,8 @@ * handle and return the Rack response) interface. * It is likely to be (only) implemented as a HTTP servlet response. * - * @see javax.servlet.ServletResponse - * @see javax.servlet.http.HttpServletResponse + * @see jakarta.servlet.ServletResponse + * @see jakarta.servlet.http.HttpServletResponse * @see RackResponse * * @author nicksieger @@ -26,30 +26,30 @@ public interface RackResponseEnvironment { /** * @return whether the underlying response has been committed. - * @see javax.servlet.ServletResponse#isCommitted() + * @see jakarta.servlet.ServletResponse#isCommitted() */ boolean isCommitted(); /** * Reset the response (buffer) so we can begin a new response. - * @see javax.servlet.ServletResponse#reset() + * @see jakarta.servlet.ServletResponse#reset() */ void reset(); /** - * @see javax.servlet.ServletResponse#setContentType(String) + * @see jakarta.servlet.ServletResponse#setContentType(String) * @param type the content type */ void setContentType(String type) ; /** - * @see javax.servlet.ServletResponse#setContentLength(int) + * @see jakarta.servlet.ServletResponse#setContentLength(int) * @param length the content length */ void setContentLength(int length) ; /** - * @see javax.servlet.ServletResponse#setCharacterEncoding(String) + * @see jakarta.servlet.ServletResponse#setCharacterEncoding(String) * @param charset the charset */ void setCharacterEncoding(String charset) ; @@ -107,14 +107,14 @@ public interface RackResponseEnvironment { void sendError(int code) throws IOException ; /** - * @see javax.servlet.ServletResponse#getOutputStream() + * @see jakarta.servlet.ServletResponse#getOutputStream() * @return the output stream * @throws IOException if there's an IO exception */ OutputStream getOutputStream() throws IOException ; /** - * @see javax.servlet.ServletResponse#getWriter() + * @see jakarta.servlet.ServletResponse#getWriter() * @return the writer * @throws IOException if there's an IO exception */ diff --git a/src/main/java/org/jruby/rack/RackServlet.java b/src/main/java/org/jruby/rack/RackServlet.java index e5bf4944..a67c78ff 100644 --- a/src/main/java/org/jruby/rack/RackServlet.java +++ b/src/main/java/org/jruby/rack/RackServlet.java @@ -7,7 +7,7 @@ package org.jruby.rack; -import javax.servlet.ServletConfig; +import jakarta.servlet.ServletConfig; @SuppressWarnings("serial") public class RackServlet extends AbstractServlet { diff --git a/src/main/java/org/jruby/rack/RackServletContextListener.java b/src/main/java/org/jruby/rack/RackServletContextListener.java index ace26b20..2249c0fe 100644 --- a/src/main/java/org/jruby/rack/RackServletContextListener.java +++ b/src/main/java/org/jruby/rack/RackServletContextListener.java @@ -7,9 +7,9 @@ package org.jruby.rack; -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; import org.jruby.rack.servlet.DefaultServletRackContext; import org.jruby.rack.servlet.ServletRackConfig; diff --git a/src/main/java/org/jruby/rack/RackTag.java b/src/main/java/org/jruby/rack/RackTag.java index 7ce32754..8b269b70 100644 --- a/src/main/java/org/jruby/rack/RackTag.java +++ b/src/main/java/org/jruby/rack/RackTag.java @@ -9,11 +9,11 @@ import org.jruby.rack.servlet.ServletRackEnvironment; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.tagext.TagSupport; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.jsp.JspException; +import jakarta.servlet.jsp.tagext.TagSupport; @SuppressWarnings("serial") public class RackTag extends TagSupport { diff --git a/src/main/java/org/jruby/rack/UnmappedRackFilter.java b/src/main/java/org/jruby/rack/UnmappedRackFilter.java index 96044f18..6be026f6 100644 --- a/src/main/java/org/jruby/rack/UnmappedRackFilter.java +++ b/src/main/java/org/jruby/rack/UnmappedRackFilter.java @@ -12,10 +12,10 @@ import java.util.Collections; import java.util.HashSet; import java.util.Set; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletResponse; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletResponse; import org.jruby.rack.servlet.RequestCapture; import org.jruby.rack.servlet.ResponseCapture; diff --git a/src/main/java/org/jruby/rack/embed/Filter.java b/src/main/java/org/jruby/rack/embed/Filter.java index 682e91d1..64ad9997 100644 --- a/src/main/java/org/jruby/rack/embed/Filter.java +++ b/src/main/java/org/jruby/rack/embed/Filter.java @@ -7,8 +7,8 @@ */ package org.jruby.rack.embed; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; import org.jruby.rack.AbstractFilter; import org.jruby.rack.RackContext; diff --git a/src/main/java/org/jruby/rack/embed/Servlet.java b/src/main/java/org/jruby/rack/embed/Servlet.java index 69974537..b8bddced 100644 --- a/src/main/java/org/jruby/rack/embed/Servlet.java +++ b/src/main/java/org/jruby/rack/embed/Servlet.java @@ -7,7 +7,7 @@ */ package org.jruby.rack.embed; -import javax.servlet.ServletConfig; +import jakarta.servlet.ServletConfig; import org.jruby.rack.AbstractServlet; import org.jruby.rack.RackContext; diff --git a/src/main/java/org/jruby/rack/ext/Logger.java b/src/main/java/org/jruby/rack/ext/Logger.java index 318e6945..171e30a4 100644 --- a/src/main/java/org/jruby/rack/ext/Logger.java +++ b/src/main/java/org/jruby/rack/ext/Logger.java @@ -23,7 +23,7 @@ */ package org.jruby.rack.ext; -import javax.servlet.ServletContext; +import jakarta.servlet.ServletContext; import org.jruby.Ruby; import org.jruby.RubyClass; diff --git a/src/main/java/org/jruby/rack/jms/DefaultQueueManager.java b/src/main/java/org/jruby/rack/jms/DefaultQueueManager.java index 9396004d..3d76c960 100644 --- a/src/main/java/org/jruby/rack/jms/DefaultQueueManager.java +++ b/src/main/java/org/jruby/rack/jms/DefaultQueueManager.java @@ -17,13 +17,13 @@ import org.jruby.rack.servlet.ServletRackContext; import org.jruby.runtime.builtin.IRubyObject; -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.Destination; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.MessageListener; -import javax.jms.Session; +import jakarta.jms.Connection; +import jakarta.jms.ConnectionFactory; +import jakarta.jms.Destination; +import jakarta.jms.Message; +import jakarta.jms.MessageConsumer; +import jakarta.jms.MessageListener; +import jakarta.jms.Session; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; diff --git a/src/main/java/org/jruby/rack/jms/QueueContextListener.java b/src/main/java/org/jruby/rack/jms/QueueContextListener.java index 1b250fa4..bbc8303c 100644 --- a/src/main/java/org/jruby/rack/jms/QueueContextListener.java +++ b/src/main/java/org/jruby/rack/jms/QueueContextListener.java @@ -10,9 +10,9 @@ import org.jruby.rack.RackApplicationFactory; import org.jruby.rack.RackContext; -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; /** * diff --git a/src/main/java/org/jruby/rack/jms/QueueManager.java b/src/main/java/org/jruby/rack/jms/QueueManager.java index 44c0af3b..916b4b4f 100644 --- a/src/main/java/org/jruby/rack/jms/QueueManager.java +++ b/src/main/java/org/jruby/rack/jms/QueueManager.java @@ -9,7 +9,7 @@ import org.jruby.rack.RackContext; -import javax.jms.ConnectionFactory; +import jakarta.jms.ConnectionFactory; /** * diff --git a/src/main/java/org/jruby/rack/logging/ServletContextLogger.java b/src/main/java/org/jruby/rack/logging/ServletContextLogger.java index 8054fb45..58eff1ea 100644 --- a/src/main/java/org/jruby/rack/logging/ServletContextLogger.java +++ b/src/main/java/org/jruby/rack/logging/ServletContextLogger.java @@ -9,7 +9,7 @@ import org.jruby.rack.RackLogger; -import javax.servlet.ServletContext; +import jakarta.servlet.ServletContext; public class ServletContextLogger extends RackLogger.Base { diff --git a/src/main/java/org/jruby/rack/servlet/DefaultServletRackContext.java b/src/main/java/org/jruby/rack/servlet/DefaultServletRackContext.java index 5c2f05be..6b8a7fcd 100644 --- a/src/main/java/org/jruby/rack/servlet/DefaultServletRackContext.java +++ b/src/main/java/org/jruby/rack/servlet/DefaultServletRackContext.java @@ -11,17 +11,17 @@ import org.jruby.rack.RackConfig; import org.jruby.rack.RackLogger; -import javax.servlet.Filter; -import javax.servlet.RequestDispatcher; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; +import jakarta.servlet.Filter; +import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; // 3.0 -import javax.servlet.FilterRegistration; -import javax.servlet.ServletRegistration; -import javax.servlet.SessionCookieConfig; -import javax.servlet.SessionTrackingMode; -import javax.servlet.descriptor.JspConfigDescriptor; +import jakarta.servlet.FilterRegistration; +import jakarta.servlet.ServletRegistration; +import jakarta.servlet.SessionCookieConfig; +import jakarta.servlet.SessionTrackingMode; +import jakarta.servlet.descriptor.JspConfigDescriptor; import java.io.InputStream; import java.net.MalformedURLException; @@ -375,4 +375,45 @@ public JspConfigDescriptor getJspConfigDescriptor() { return context.getJspConfigDescriptor(); } + @Override + public void setResponseCharacterEncoding(String encoding) { + + } + + @Override + public String getResponseCharacterEncoding() { + return null; + } + + + @Override + public void setRequestCharacterEncoding(String encoding) { + + } + + @Override + public String getRequestCharacterEncoding() { + return null; + } + + @Override + public void setSessionTimeout(int sessionTimeout) { + + } + + @Override + public int getSessionTimeout() throws UnsupportedOperationException { + return 30; + } + + @Override + public String getVirtualServerName() throws UnsupportedOperationException { + return null; + } + + @Override + public ServletRegistration.Dynamic addJspFile(String servletName, String jspFile) + throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException { + return null; + } } diff --git a/src/main/java/org/jruby/rack/servlet/RequestCapture.java b/src/main/java/org/jruby/rack/servlet/RequestCapture.java index d776a3dd..f6198739 100644 --- a/src/main/java/org/jruby/rack/servlet/RequestCapture.java +++ b/src/main/java/org/jruby/rack/servlet/RequestCapture.java @@ -17,9 +17,9 @@ import java.util.Iterator; import java.util.Map; -import javax.servlet.ServletInputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; +import jakarta.servlet.ServletInputStream; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; import org.jruby.rack.RackConfig; diff --git a/src/main/java/org/jruby/rack/servlet/ResponseCapture.java b/src/main/java/org/jruby/rack/servlet/ResponseCapture.java index 3569af15..a8f390be 100644 --- a/src/main/java/org/jruby/rack/servlet/ResponseCapture.java +++ b/src/main/java/org/jruby/rack/servlet/ResponseCapture.java @@ -15,10 +15,11 @@ import java.util.Collection; import java.util.Collections; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpServletResponseWrapper; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.WriteListener; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponseWrapper; /** * Response wrapper passed to filter chain. @@ -82,13 +83,6 @@ public void setStatus(int status) { } } - @Override - public void setStatus(int status, String message) { - if ( handleStatus(status, false) ) { - super.setStatus(status, message); - } - } - @Override public void sendError(int status) throws IOException { if ( handleStatus(status, true) ) { @@ -166,6 +160,15 @@ public ServletOutputStream getOutputStream() throws IOException { public void write(int b) throws IOException { // swallow output, because we're going to discard it } + + @Override + public void setWriteListener(WriteListener writeListener){ + } + + @Override + public boolean isReady(){ + return true; + } }; } } diff --git a/src/main/java/org/jruby/rack/servlet/RewindableInputStream.java b/src/main/java/org/jruby/rack/servlet/RewindableInputStream.java index 54532797..32f8d402 100644 --- a/src/main/java/org/jruby/rack/servlet/RewindableInputStream.java +++ b/src/main/java/org/jruby/rack/servlet/RewindableInputStream.java @@ -13,7 +13,8 @@ import java.io.RandomAccessFile; import java.nio.ByteBuffer; -import javax.servlet.ServletInputStream; +import jakarta.servlet.ServletInputStream; +import jakarta.servlet.ReadListener; /** * Originally inspired by Kirk's RewindableInputStream ... @@ -214,6 +215,21 @@ public synchronized void close() throws IOException { buffer = null; } + @Override + public void setReadListener(ReadListener readListener) throws IllegalStateException, NullPointerException { + + } + + @Override + public boolean isReady(){ + return true; + } + + @Override + public boolean isFinished(){ + return true; + } + /** * Rewind this stream (kindly) to the start. * @throws IOException if there's an IO exception diff --git a/src/main/java/org/jruby/rack/servlet/ServletRackConfig.java b/src/main/java/org/jruby/rack/servlet/ServletRackConfig.java index 06bf64dc..b5b9710f 100644 --- a/src/main/java/org/jruby/rack/servlet/ServletRackConfig.java +++ b/src/main/java/org/jruby/rack/servlet/ServletRackConfig.java @@ -11,7 +11,7 @@ import org.jruby.rack.RackLogger; import org.jruby.rack.logging.ServletContextLogger; -import javax.servlet.ServletContext; +import jakarta.servlet.ServletContext; /** * Servlet environment version of RackConfig. diff --git a/src/main/java/org/jruby/rack/servlet/ServletRackContext.java b/src/main/java/org/jruby/rack/servlet/ServletRackContext.java index 3b721e3b..73c4c161 100644 --- a/src/main/java/org/jruby/rack/servlet/ServletRackContext.java +++ b/src/main/java/org/jruby/rack/servlet/ServletRackContext.java @@ -7,7 +7,7 @@ package org.jruby.rack.servlet; -import javax.servlet.ServletContext; +import jakarta.servlet.ServletContext; import org.jruby.rack.RackApplicationFactory; import org.jruby.rack.RackContext; diff --git a/src/main/java/org/jruby/rack/servlet/ServletRackEnvironment.java b/src/main/java/org/jruby/rack/servlet/ServletRackEnvironment.java index 4cb7c313..c44eb62a 100644 --- a/src/main/java/org/jruby/rack/servlet/ServletRackEnvironment.java +++ b/src/main/java/org/jruby/rack/servlet/ServletRackEnvironment.java @@ -9,10 +9,10 @@ import java.io.IOException; -import javax.servlet.ServletInputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletInputStream; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; +import jakarta.servlet.http.HttpServletResponse; import org.jruby.rack.RackContext; import org.jruby.rack.RackEnvironment; diff --git a/src/main/java/org/jruby/rack/servlet/ServletRackIncludedResponse.java b/src/main/java/org/jruby/rack/servlet/ServletRackIncludedResponse.java index 42cebcae..9774f402 100644 --- a/src/main/java/org/jruby/rack/servlet/ServletRackIncludedResponse.java +++ b/src/main/java/org/jruby/rack/servlet/ServletRackIncludedResponse.java @@ -14,10 +14,11 @@ import java.io.PrintWriter; import java.io.UnsupportedEncodingException; -import javax.servlet.ServletOutputStream; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpServletResponseWrapper; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponseWrapper; +import jakarta.servlet.WriteListener; /** * Response wrapper used to buffer the output of a server-side include. @@ -263,5 +264,14 @@ public void write(byte[] b) throws IOException { public void write(int i) throws IOException { dataOutputStream.write(i); } + + @Override + public void setWriteListener(WriteListener writeListener){ + } + + @Override + public boolean isReady(){ + return true; + } } } diff --git a/src/main/java/org/jruby/rack/servlet/ServletRackResponseEnvironment.java b/src/main/java/org/jruby/rack/servlet/ServletRackResponseEnvironment.java index b3dbb215..ad9178a4 100644 --- a/src/main/java/org/jruby/rack/servlet/ServletRackResponseEnvironment.java +++ b/src/main/java/org/jruby/rack/servlet/ServletRackResponseEnvironment.java @@ -13,8 +13,8 @@ import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpServletResponseWrapper; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponseWrapper; /** * The default (servlet) {@link RackResponseEnvironment} implementation. diff --git a/src/main/ruby/jruby/rack/queues.rb b/src/main/ruby/jruby/rack/queues.rb index 1b784401..5f1895e8 100644 --- a/src/main/ruby/jruby/rack/queues.rb +++ b/src/main/ruby/jruby/rack/queues.rb @@ -8,7 +8,7 @@ module JRuby module Rack module Queues - Session = Java::JavaxJms::Session + Session = Java::JakartaJms::Session MARSHAL_PAYLOAD = "ruby_marshal_payload" class QueueRegistry diff --git a/src/main/ruby/jruby/rack/servlet_ext.rb b/src/main/ruby/jruby/rack/servlet_ext.rb index 4df3b62e..bb1e2e41 100644 --- a/src/main/ruby/jruby/rack/servlet_ext.rb +++ b/src/main/ruby/jruby/rack/servlet_ext.rb @@ -9,7 +9,7 @@ # Ruby-friendly extensions to the Servlet API. -module Java::JavaxServlet::ServletContext +module Java::JakartaServlet::ServletContext # Fetch an attribute from the servlet context. def [](key) getAttribute(key.to_s) @@ -38,7 +38,7 @@ def each end end -module Java::JavaxServlet::ServletRequest +module Java::JakartaServlet::ServletRequest # Fetch an attribute from the servlet request. def [](key) getAttribute(key.to_s) @@ -67,7 +67,7 @@ def each end end -module Java::JavaxServletHttp::HttpSession +module Java::JakartaServletHttp::HttpSession # Fetch an attribute from the session. def [](key) getAttribute(key.to_s) diff --git a/src/main/ruby/rack/handler/servlet/default_env.rb b/src/main/ruby/rack/handler/servlet/default_env.rb index 7180b51e..f965476a 100644 --- a/src/main/ruby/rack/handler/servlet/default_env.rb +++ b/src/main/ruby/rack/handler/servlet/default_env.rb @@ -247,7 +247,7 @@ def servlet_context @servlet_env.servlet_context # ServletRequest#getServletContext() else if @servlet_env.respond_to?(:context) && - @servlet_env.context.is_a?(javax.servlet.ServletContext) + @servlet_env.context.is_a?(jakarta.servlet.ServletContext) @servlet_env.context else JRuby::Rack.context || diff --git a/src/main/ruby/rack/handler/servlet/servlet_env.rb b/src/main/ruby/rack/handler/servlet/servlet_env.rb index 0cbb9d34..df80c432 100644 --- a/src/main/ruby/rack/handler/servlet/servlet_env.rb +++ b/src/main/ruby/rack/handler/servlet/servlet_env.rb @@ -57,7 +57,7 @@ def load_env_key(env, key) end # Load parameters into the (Rack) env from the Servlet API. - # using javax.servlet.http.HttpServletRequest#getParameterMap + # using jakarta.servlet.http.HttpServletRequest#getParameterMap def load_parameters get_only = ! POST_PARAM_METHODS.include?( @servlet_env.getMethod ) # we only need to really do this for POSTs but we'll handle all @@ -155,7 +155,7 @@ def store_parameter(key, val, hash) COOKIE_HASH = "rack.request.cookie_hash".freeze # Load cookies into the (Rack) env from the Servlet API. - # using javax.servlet.http.HttpServletRequest#getCookies + # using jakarta.servlet.http.HttpServletRequest#getCookies def load_cookies cookie_hash = {} (@servlet_env.getCookies || []).each do |cookie| @@ -186,7 +186,7 @@ def query_values(key) end def parse_query_string - Java::JavaxServletHttp::HttpUtils.parseQueryString(query_string) + Java::JakartaServletHttp::HttpUtils.parseQueryString(query_string) end def mark_parameter_error(msg) diff --git a/src/spec/java/org/jruby/rack/fake/FakeJspWriter.java b/src/spec/java/org/jruby/rack/fake/FakeJspWriter.java index d35f9518..d0d41cdd 100644 --- a/src/spec/java/org/jruby/rack/fake/FakeJspWriter.java +++ b/src/spec/java/org/jruby/rack/fake/FakeJspWriter.java @@ -8,7 +8,7 @@ package org.jruby.rack.fake; import java.io.IOException; -import javax.servlet.jsp.JspWriter; +import jakarta.servlet.jsp.JspWriter; /** * Currently only used as a mock for testing. diff --git a/src/spec/java/org/jruby/rack/fake/FakePageContext.java b/src/spec/java/org/jruby/rack/fake/FakePageContext.java index 7ce7f02a..f310ea27 100644 --- a/src/spec/java/org/jruby/rack/fake/FakePageContext.java +++ b/src/spec/java/org/jruby/rack/fake/FakePageContext.java @@ -10,20 +10,20 @@ import java.io.IOException; import java.util.Enumeration; -import javax.el.ELContext; -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import javax.servlet.jsp.JspWriter; -import javax.servlet.jsp.PageContext; -import javax.servlet.jsp.el.ExpressionEvaluator; -import javax.servlet.jsp.el.VariableResolver; +import jakarta.el.ELContext; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletConfig; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; +import jakarta.servlet.jsp.JspWriter; +import jakarta.servlet.jsp.PageContext; +import jakarta.el.ExpressionFactory; +import jakarta.el.ELResolver; /** * Currently only used as a mock for testing. @@ -162,12 +162,12 @@ public void include(String arg0, boolean arg1) throws ServletException, IOExcept } @Override - public ExpressionEvaluator getExpressionEvaluator() { + public ExpressionFactory getExpressionFactory() { throw new UnsupportedOperationException("Not supported yet."); } @Override - public VariableResolver getVariableResolver() { + public ELResolver getELResolver() { throw new UnsupportedOperationException("Not supported yet."); } diff --git a/src/spec/java/org/jruby/rack/mock/DelegatingServletInputStream.java b/src/spec/java/org/jruby/rack/mock/DelegatingServletInputStream.java index d8694c00..45b51fdc 100644 --- a/src/spec/java/org/jruby/rack/mock/DelegatingServletInputStream.java +++ b/src/spec/java/org/jruby/rack/mock/DelegatingServletInputStream.java @@ -18,10 +18,10 @@ import java.io.IOException; import java.io.InputStream; -import javax.servlet.ServletInputStream; +import jakarta.servlet.ServletInputStream; /** - * Delegating implementation of {@link javax.servlet.ServletInputStream}. + * Delegating implementation of {@link jakarta.servlet.ServletInputStream}. * *

Used by {@link MockHttpServletRequest}; typically not directly * used for testing application controllers. diff --git a/src/spec/java/org/jruby/rack/mock/DelegatingServletOutputStream.java b/src/spec/java/org/jruby/rack/mock/DelegatingServletOutputStream.java index e4c5feb7..5e5033ad 100644 --- a/src/spec/java/org/jruby/rack/mock/DelegatingServletOutputStream.java +++ b/src/spec/java/org/jruby/rack/mock/DelegatingServletOutputStream.java @@ -18,10 +18,10 @@ import java.io.IOException; import java.io.OutputStream; -import javax.servlet.ServletOutputStream; +import jakarta.servlet.ServletOutputStream; /** - * Delegating implementation of {@link javax.servlet.ServletOutputStream}. + * Delegating implementation of {@link jakarta.servlet.ServletOutputStream}. * *

Used by {@link MockHttpServletResponse}; typically not directly * used for testing application controllers. diff --git a/src/spec/java/org/jruby/rack/mock/MockAsyncContext.java b/src/spec/java/org/jruby/rack/mock/MockAsyncContext.java index ab291817..ec344072 100644 --- a/src/spec/java/org/jruby/rack/mock/MockAsyncContext.java +++ b/src/spec/java/org/jruby/rack/mock/MockAsyncContext.java @@ -18,15 +18,15 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import javax.servlet.AsyncContext; -import javax.servlet.AsyncEvent; -import javax.servlet.AsyncListener; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.AsyncContext; +import jakarta.servlet.AsyncEvent; +import jakarta.servlet.AsyncListener; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; //import org.springframework.beans.BeanUtils; //import org.springframework.web.util.WebUtils; diff --git a/src/spec/java/org/jruby/rack/mock/MockHttpServletRequest.java b/src/spec/java/org/jruby/rack/mock/MockHttpServletRequest.java index c3be6d4a..e4d32d58 100644 --- a/src/spec/java/org/jruby/rack/mock/MockHttpServletRequest.java +++ b/src/spec/java/org/jruby/rack/mock/MockHttpServletRequest.java @@ -37,22 +37,22 @@ import java.util.Set; import java.util.Vector; -import javax.servlet.AsyncContext; -import javax.servlet.DispatcherType; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletInputStream; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import javax.servlet.http.Part; +import jakarta.servlet.AsyncContext; +import jakarta.servlet.DispatcherType; +import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletInputStream; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; +import jakarta.servlet.http.Part; /** - * Mock implementation of the {@link javax.servlet.http.HttpServletRequest} interface. + * Mock implementation of the {@link jakarta.servlet.http.HttpServletRequest} interface. * *

As of Spring 4.0, this set of mocks is designed on a Servlet 3.0 baseline. * diff --git a/src/spec/java/org/jruby/rack/mock/MockHttpServletResponse.java b/src/spec/java/org/jruby/rack/mock/MockHttpServletResponse.java index 286a7fc0..87193f23 100644 --- a/src/spec/java/org/jruby/rack/mock/MockHttpServletResponse.java +++ b/src/spec/java/org/jruby/rack/mock/MockHttpServletResponse.java @@ -32,12 +32,12 @@ import java.util.Locale; import java.util.Map; import java.util.Set; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletOutputStream; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletResponse; /** - * Mock implementation of the {@link javax.servlet.http.HttpServletResponse} interface. + * Mock implementation of the {@link jakarta.servlet.http.HttpServletResponse} interface. * *

Compatible with Servlet 2.5 as well as Servlet 3.0. * diff --git a/src/spec/java/org/jruby/rack/mock/MockHttpSession.java b/src/spec/java/org/jruby/rack/mock/MockHttpSession.java index 9435e257..7b7f4507 100644 --- a/src/spec/java/org/jruby/rack/mock/MockHttpSession.java +++ b/src/spec/java/org/jruby/rack/mock/MockHttpSession.java @@ -26,14 +26,14 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.Vector; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpSession; -import javax.servlet.http.HttpSessionBindingEvent; -import javax.servlet.http.HttpSessionBindingListener; -import javax.servlet.http.HttpSessionContext; +import jakarta.servlet.ServletContext; +import jakarta.servlet.http.HttpSession; +import jakarta.servlet.http.HttpSessionBindingEvent; +import jakarta.servlet.http.HttpSessionBindingListener; +import jakarta.servlet.http.HttpSessionContext; /** - * Mock implementation of the {@link javax.servlet.http.HttpSession} interface. + * Mock implementation of the {@link jakarta.servlet.http.HttpSession} interface. * *

Compatible with Servlet 2.5 as well as Servlet 3.0. * diff --git a/src/spec/java/org/jruby/rack/mock/MockRequestDispatcher.java b/src/spec/java/org/jruby/rack/mock/MockRequestDispatcher.java index 3a1c79dd..c71d987f 100644 --- a/src/spec/java/org/jruby/rack/mock/MockRequestDispatcher.java +++ b/src/spec/java/org/jruby/rack/mock/MockRequestDispatcher.java @@ -19,13 +19,13 @@ package org.jruby.rack.mock; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponseWrapper; +import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletResponseWrapper; /** - * Mock implementation of the {@link javax.servlet.RequestDispatcher} interface. + * Mock implementation of the {@link jakarta.servlet.RequestDispatcher} interface. * *

Used for testing the web framework; typically not necessary for * testing application controllers. diff --git a/src/spec/java/org/jruby/rack/mock/MockServletConfig.java b/src/spec/java/org/jruby/rack/mock/MockServletConfig.java index 3dc31489..88725235 100644 --- a/src/spec/java/org/jruby/rack/mock/MockServletConfig.java +++ b/src/spec/java/org/jruby/rack/mock/MockServletConfig.java @@ -20,11 +20,11 @@ import java.util.Enumeration; import java.util.LinkedHashMap; import java.util.Map; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; +import jakarta.servlet.ServletConfig; +import jakarta.servlet.ServletContext; /** - * Mock implementation of the {@link javax.servlet.ServletConfig} interface. + * Mock implementation of the {@link jakarta.servlet.ServletConfig} interface. * *

Used for testing the web framework; typically not necessary for * testing application controllers. diff --git a/src/spec/java/org/jruby/rack/mock/MockServletContext.java b/src/spec/java/org/jruby/rack/mock/MockServletContext.java index 79c54da0..21e95269 100644 --- a/src/spec/java/org/jruby/rack/mock/MockServletContext.java +++ b/src/spec/java/org/jruby/rack/mock/MockServletContext.java @@ -34,16 +34,16 @@ import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; -import javax.servlet.Filter; -import javax.servlet.FilterRegistration; -import javax.servlet.RequestDispatcher; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRegistration; -import javax.servlet.SessionCookieConfig; -import javax.servlet.SessionTrackingMode; -import javax.servlet.descriptor.JspConfigDescriptor; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterRegistration; +import jakarta.servlet.RequestDispatcher; +import jakarta.servlet.Servlet; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRegistration; +import jakarta.servlet.SessionCookieConfig; +import jakarta.servlet.SessionTrackingMode; +import jakarta.servlet.descriptor.JspConfigDescriptor; import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.Resource; @@ -53,7 +53,7 @@ import static org.jruby.rack.RackLogger.*; /** - * Mock implementation of the {@link javax.servlet.ServletContext} interface. + * Mock implementation of the {@link jakarta.servlet.ServletContext} interface. * *

As of Spring 4.0, this set of mocks is designed on a Servlet 3.0 baseline. * @@ -95,7 +95,7 @@ public class MockServletContext implements ServletContext { private static final String TEMP_DIR_SYSTEM_PROPERTY = "java.io.tmpdir"; - private static final String TEMP_DIR_CONTEXT_ATTRIBUTE = "javax.servlet.context.tempdir"; + private static final String TEMP_DIR_CONTEXT_ATTRIBUTE = "jakarta.servlet.context.tempdir"; private final ResourceLoader resourceLoader; diff --git a/src/spec/java/org/jruby/rack/mock/MockSessionCookieConfig.java b/src/spec/java/org/jruby/rack/mock/MockSessionCookieConfig.java index 55e4fc0b..255f6e67 100644 --- a/src/spec/java/org/jruby/rack/mock/MockSessionCookieConfig.java +++ b/src/spec/java/org/jruby/rack/mock/MockSessionCookieConfig.java @@ -15,14 +15,14 @@ */ package org.jruby.rack.mock; -import javax.servlet.SessionCookieConfig; +import jakarta.servlet.SessionCookieConfig; /** - * Mock implementation of the {@link javax.servlet.SessionCookieConfig} interface. + * Mock implementation of the {@link jakarta.servlet.SessionCookieConfig} interface. * * @author Juergen Hoeller * @since 4.0 - * @see javax.servlet.ServletContext#getSessionCookieConfig() + * @see jakarta.servlet.ServletContext#getSessionCookieConfig() */ public class MockSessionCookieConfig implements SessionCookieConfig { diff --git a/src/spec/java/org/jruby/rack/mock/WebUtils.java b/src/spec/java/org/jruby/rack/mock/WebUtils.java index cafd326e..5a3bce72 100644 --- a/src/spec/java/org/jruby/rack/mock/WebUtils.java +++ b/src/spec/java/org/jruby/rack/mock/WebUtils.java @@ -21,15 +21,15 @@ import java.util.Map; import java.util.StringTokenizer; import java.util.TreeMap; -import javax.servlet.ServletContext; -import javax.servlet.ServletRequest; -import javax.servlet.ServletRequestWrapper; -import javax.servlet.ServletResponse; -import javax.servlet.ServletResponseWrapper; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; +import jakarta.servlet.ServletContext; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletRequestWrapper; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.ServletResponseWrapper; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; import org.springframework.util.Assert; import org.springframework.util.LinkedMultiValueMap; @@ -50,22 +50,22 @@ abstract class WebUtils { *

If included via a RequestDispatcher, the current resource will see the * originating request. Its own URI and paths are exposed as request attributes. */ - public static final String INCLUDE_REQUEST_URI_ATTRIBUTE = "javax.servlet.include.request_uri"; - public static final String INCLUDE_CONTEXT_PATH_ATTRIBUTE = "javax.servlet.include.context_path"; - public static final String INCLUDE_SERVLET_PATH_ATTRIBUTE = "javax.servlet.include.servlet_path"; - public static final String INCLUDE_PATH_INFO_ATTRIBUTE = "javax.servlet.include.path_info"; - public static final String INCLUDE_QUERY_STRING_ATTRIBUTE = "javax.servlet.include.query_string"; + public static final String INCLUDE_REQUEST_URI_ATTRIBUTE = "jakarta.servlet.include.request_uri"; + public static final String INCLUDE_CONTEXT_PATH_ATTRIBUTE = "jakarta.servlet.include.context_path"; + public static final String INCLUDE_SERVLET_PATH_ATTRIBUTE = "jakarta.servlet.include.servlet_path"; + public static final String INCLUDE_PATH_INFO_ATTRIBUTE = "jakarta.servlet.include.path_info"; + public static final String INCLUDE_QUERY_STRING_ATTRIBUTE = "jakarta.servlet.include.query_string"; /** * Standard Servlet 2.4+ spec request attributes for forward URI and paths. *

If forwarded to via a RequestDispatcher, the current resource will see its * own URI and paths. The originating URI and paths are exposed as request attributes. */ - public static final String FORWARD_REQUEST_URI_ATTRIBUTE = "javax.servlet.forward.request_uri"; - public static final String FORWARD_CONTEXT_PATH_ATTRIBUTE = "javax.servlet.forward.context_path"; - public static final String FORWARD_SERVLET_PATH_ATTRIBUTE = "javax.servlet.forward.servlet_path"; - public static final String FORWARD_PATH_INFO_ATTRIBUTE = "javax.servlet.forward.path_info"; - public static final String FORWARD_QUERY_STRING_ATTRIBUTE = "javax.servlet.forward.query_string"; + public static final String FORWARD_REQUEST_URI_ATTRIBUTE = "jakarta.servlet.forward.request_uri"; + public static final String FORWARD_CONTEXT_PATH_ATTRIBUTE = "jakarta.servlet.forward.context_path"; + public static final String FORWARD_SERVLET_PATH_ATTRIBUTE = "jakarta.servlet.forward.servlet_path"; + public static final String FORWARD_PATH_INFO_ATTRIBUTE = "jakarta.servlet.forward.path_info"; + public static final String FORWARD_QUERY_STRING_ATTRIBUTE = "jakarta.servlet.forward.query_string"; /** * Standard Servlet 2.3+ spec request attributes for error pages. @@ -73,12 +73,12 @@ abstract class WebUtils { * to them directly rather than through the servlet container's error page * resolution mechanism. */ - public static final String ERROR_STATUS_CODE_ATTRIBUTE = "javax.servlet.error.status_code"; - public static final String ERROR_EXCEPTION_TYPE_ATTRIBUTE = "javax.servlet.error.exception_type"; - public static final String ERROR_MESSAGE_ATTRIBUTE = "javax.servlet.error.message"; - public static final String ERROR_EXCEPTION_ATTRIBUTE = "javax.servlet.error.exception"; - public static final String ERROR_REQUEST_URI_ATTRIBUTE = "javax.servlet.error.request_uri"; - public static final String ERROR_SERVLET_NAME_ATTRIBUTE = "javax.servlet.error.servlet_name"; + public static final String ERROR_STATUS_CODE_ATTRIBUTE = "jakarta.servlet.error.status_code"; + public static final String ERROR_EXCEPTION_TYPE_ATTRIBUTE = "jakarta.servlet.error.exception_type"; + public static final String ERROR_MESSAGE_ATTRIBUTE = "jakarta.servlet.error.message"; + public static final String ERROR_EXCEPTION_ATTRIBUTE = "jakarta.servlet.error.exception"; + public static final String ERROR_REQUEST_URI_ATTRIBUTE = "jakarta.servlet.error.request_uri"; + public static final String ERROR_SERVLET_NAME_ATTRIBUTE = "jakarta.servlet.error.servlet_name"; /** @@ -97,7 +97,7 @@ abstract class WebUtils { * Standard Servlet spec context attribute that specifies a temporary * directory for the current web application, of type {@code java.io.File}. */ - public static final String TEMP_DIR_CONTEXT_ATTRIBUTE = "javax.servlet.context.tempdir"; + public static final String TEMP_DIR_CONTEXT_ATTRIBUTE = "jakarta.servlet.context.tempdir"; /** * HTML escape parameter at the servlet context level @@ -223,7 +223,7 @@ public static File getTempDir(ServletContext servletContext) { * @param path the path within the web application * @return the corresponding real path * @throws FileNotFoundException if the path cannot be resolved to a resource - * @see javax.servlet.ServletContext#getRealPath + * @see jakarta.servlet.ServletContext#getRealPath */ public static String getRealPath(ServletContext servletContext, String path) throws FileNotFoundException { Assert.notNull(servletContext, "ServletContext must not be null"); @@ -415,7 +415,7 @@ else if (response instanceof ServletResponseWrapper) { /** * Determine whether the given request is an include request, * that is, not a top-level HTTP request coming in from the outside. - *

Checks the presence of the "javax.servlet.include.request_uri" + *

Checks the presence of the "jakarta.servlet.include.request_uri" * request attribute. Could check any request attribute that is only * present in an include request. * @param request current servlet request @@ -426,18 +426,18 @@ public static boolean isIncludeRequest(ServletRequest request) { } /** - * Expose the Servlet spec's error attributes as {@link javax.servlet.http.HttpServletRequest} + * Expose the Servlet spec's error attributes as {@link jakarta.servlet.http.HttpServletRequest} * attributes under the keys defined in the Servlet 2.3 specification, for error pages that * are rendered directly rather than through the Servlet container's error page resolution: - * {@code javax.servlet.error.status_code}, - * {@code javax.servlet.error.exception_type}, - * {@code javax.servlet.error.message}, - * {@code javax.servlet.error.exception}, - * {@code javax.servlet.error.request_uri}, - * {@code javax.servlet.error.servlet_name}. + * {@code jakarta.servlet.error.status_code}, + * {@code jakarta.servlet.error.exception_type}, + * {@code jakarta.servlet.error.message}, + * {@code jakarta.servlet.error.exception}, + * {@code jakarta.servlet.error.request_uri}, + * {@code jakarta.servlet.error.servlet_name}. *

Does not override values if already present, to respect attribute values * that have been exposed explicitly before. - *

Exposes status code 200 by default. Set the "javax.servlet.error.status_code" + *

Exposes status code 200 by default. Set the "jakarta.servlet.error.status_code" * attribute explicitly (before or after) in order to expose a different status code. * @param request current servlet request * @param ex the exception encountered @@ -465,14 +465,14 @@ private static void exposeRequestAttributeIfNotPresent(ServletRequest request, S } /** - * Clear the Servlet spec's error attributes as {@link javax.servlet.http.HttpServletRequest} + * Clear the Servlet spec's error attributes as {@link jakarta.servlet.http.HttpServletRequest} * attributes under the keys defined in the Servlet 2.3 specification: - * {@code javax.servlet.error.status_code}, - * {@code javax.servlet.error.exception_type}, - * {@code javax.servlet.error.message}, - * {@code javax.servlet.error.exception}, - * {@code javax.servlet.error.request_uri}, - * {@code javax.servlet.error.servlet_name}. + * {@code jakarta.servlet.error.status_code}, + * {@code jakarta.servlet.error.exception_type}, + * {@code jakarta.servlet.error.message}, + * {@code jakarta.servlet.error.exception}, + * {@code jakarta.servlet.error.request_uri}, + * {@code jakarta.servlet.error.servlet_name}. * @param request current servlet request */ public static void clearErrorRequestAttributes(HttpServletRequest request) { @@ -613,9 +613,9 @@ else if (value != null) { * (if this is null or the empty string, all parameters will match) * @return map containing request parameters without the prefix, * containing either a String or a String array as values - * @see javax.servlet.ServletRequest#getParameterNames - * @see javax.servlet.ServletRequest#getParameterValues - * @see javax.servlet.ServletRequest#getParameterMap + * @see jakarta.servlet.ServletRequest#getParameterNames + * @see jakarta.servlet.ServletRequest#getParameterValues + * @see jakarta.servlet.ServletRequest#getParameterMap */ public static Map getParametersStartingWith(ServletRequest request, String prefix) { Assert.notNull(request, "Request must not be null"); diff --git a/src/spec/ruby/jruby/rack/booter_spec.rb b/src/spec/ruby/jruby/rack/booter_spec.rb index 0a8c4e3a..f8f4ed36 100644 --- a/src/spec/ruby/jruby/rack/booter_spec.rb +++ b/src/spec/ruby/jruby/rack/booter_spec.rb @@ -235,7 +235,7 @@ before :each do # NOTE: this is obviously poor testing but it's easier to let the factory # setup the runtime for us than to hand copy/stub/mock all code involved - servlet_context = javax.servlet.ServletContext.impl do |name, *args| + servlet_context = jakarta.servlet.ServletContext.impl do |name, *args| case name.to_sym when :getRealPath then case args.first @@ -282,7 +282,7 @@ before :each do # NOTE: this is obviously poor testing but it's easier to let the factory # setup the runtime for us than to hand copy/stub/mock all code involved - servlet_context = javax.servlet.ServletContext.impl do |name, *args| + servlet_context = jakarta.servlet.ServletContext.impl do |name, *args| case name.to_sym when :getRealPath then case args.first diff --git a/src/spec/ruby/jruby/rack/integration_spec.rb b/src/spec/ruby/jruby/rack/integration_spec.rb index 96a1f009..9a4bdcd1 100644 --- a/src/spec/ruby/jruby/rack/integration_spec.rb +++ b/src/spec/ruby/jruby/rack/integration_spec.rb @@ -32,7 +32,7 @@ ) listener = org.jruby.rack.RackServletContextListener.new - listener.contextInitialized javax.servlet.ServletContextEvent.new(@servlet_context) + listener.contextInitialized jakarta.servlet.ServletContextEvent.new(@servlet_context) rack_factory = @servlet_context.getAttribute("rack.factory") rack_factory.should be_a(RackApplicationFactory) @@ -50,7 +50,7 @@ "run lambda { |env| [ 200, {'Via' => 'JRuby-Rack', 'Content-Type' => 'text/plain'}, 'OK' ] }" ) listener = org.jruby.rack.RackServletContextListener.new - listener.contextInitialized javax.servlet.ServletContextEvent.new(@servlet_context) + listener.contextInitialized jakarta.servlet.ServletContextEvent.new(@servlet_context) @rack_context = @servlet_context.getAttribute("rack.context") @rack_factory = @servlet_context.getAttribute("rack.factory") end @@ -93,7 +93,7 @@ it "initializes (pooling by default)" do listener = org.jruby.rack.rails.RailsServletContextListener.new - listener.contextInitialized javax.servlet.ServletContextEvent.new(servlet_context) + listener.contextInitialized jakarta.servlet.ServletContextEvent.new(servlet_context) rack_factory = servlet_context.getAttribute("rack.factory") rack_factory.should be_a(RackApplicationFactory) @@ -111,7 +111,7 @@ servlet_context.addInitParameter('jruby.max.runtimes', '1') listener = org.jruby.rack.rails.RailsServletContextListener.new - listener.contextInitialized javax.servlet.ServletContextEvent.new(servlet_context) + listener.contextInitialized jakarta.servlet.ServletContextEvent.new(servlet_context) rack_factory = servlet_context.getAttribute("rack.factory") rack_factory.should be_a(RackApplicationFactory) @@ -440,7 +440,7 @@ def initialize_rails(env = nil, servlet_context = @servlet_context) servlet_context.addInitParameter("jruby.runtime.env", the_env) yield(servlet_context, listener) if block_given? - listener.contextInitialized javax.servlet.ServletContextEvent.new(servlet_context) + listener.contextInitialized jakarta.servlet.ServletContextEvent.new(servlet_context) @rack_context = servlet_context.getAttribute("rack.context") @rack_factory = servlet_context.getAttribute("rack.factory") @servlet_context ||= servlet_context diff --git a/src/spec/ruby/jruby/rack/response_spec.rb b/src/spec/ruby/jruby/rack/response_spec.rb index c9338230..f0961421 100644 --- a/src/spec/ruby/jruby/rack/response_spec.rb +++ b/src/spec/ruby/jruby/rack/response_spec.rb @@ -16,7 +16,7 @@ JRuby::Rack::Response.new [ status, headers, body ] end - let(:servlet_response) { javax.servlet.http.HttpServletResponse.impl {} } + let(:servlet_response) { jakarta.servlet.http.HttpServletResponse.impl {} } let(:response_environment) { new_response_environment(servlet_response) } diff --git a/src/spec/ruby/jruby/rack/servlet_ext_spec.rb b/src/spec/ruby/jruby/rack/servlet_ext_spec.rb index d51f2c48..cc88c2ca 100644 --- a/src/spec/ruby/jruby/rack/servlet_ext_spec.rb +++ b/src/spec/ruby/jruby/rack/servlet_ext_spec.rb @@ -80,11 +80,11 @@ end - describe Java::JavaxServlet::ServletContext do + describe Java::JakartaServlet::ServletContext do let(:subject) do context = org.jruby.rack.mock.MockServletContext.new - context.removeAttribute("javax.servlet.context.tempdir") + context.removeAttribute("jakarta.servlet.context.tempdir") context end @@ -92,10 +92,10 @@ end - describe Java::JavaxServlet::ServletRequest do + describe Java::JakartaServlet::ServletRequest do before :each do - @request = Java::JavaxServlet::ServletRequest.impl {} + @request = Java::JakartaServlet::ServletRequest.impl {} end it "should allow #[] to access request attributes" do @@ -125,10 +125,10 @@ end - describe Java::JavaxServletHttp::HttpSession do + describe Java::JakartaServletHttp::HttpSession do before :each do - @session = Java::JavaxServletHttp::HttpSession.impl {} + @session = Java::JakartaServletHttp::HttpSession.impl {} end it "should allow #[] to access session attributes" do diff --git a/src/spec/ruby/rack/embed/filter_spec.rb b/src/spec/ruby/rack/embed/filter_spec.rb index e2f8b95d..7db99ada 100644 --- a/src/spec/ruby/rack/embed/filter_spec.rb +++ b/src/spec/ruby/rack/embed/filter_spec.rb @@ -10,11 +10,11 @@ let(:chain) { double "filter chain" } let(:request) do - javax.servlet.http.HttpServletRequest.impl {}.tap do |request| + jakarta.servlet.http.HttpServletRequest.impl {}.tap do |request| request.stub(:getInputStream).and_return(StubServletInputStream.new) end end - let(:response) { javax.servlet.http.HttpServletResponse.impl {} } + let(:response) { jakarta.servlet.http.HttpServletResponse.impl {} } it "serves all requests using the given rack application" do rack_response = double "rack response" diff --git a/src/spec/ruby/rack/filter_spec.rb b/src/spec/ruby/rack/filter_spec.rb index e5a99109..1b846a9d 100644 --- a/src/spec/ruby/rack/filter_spec.rb +++ b/src/spec/ruby/rack/filter_spec.rb @@ -14,7 +14,7 @@ let(:chain) { double "filter chain" } def stub_request(path_info) - @request = javax.servlet.http.HttpServletRequest.impl {} + @request = jakarta.servlet.http.HttpServletRequest.impl {} @request.stub(:setAttribute) if block_given? yield @request, path_info @@ -27,7 +27,7 @@ def stub_request(path_info) before :each do stub_request("/index") - @response = javax.servlet.http.HttpServletResponse.impl {} + @response = jakarta.servlet.http.HttpServletResponse.impl {} @rack_context.stub(:getResource).and_return nil @rack_config.stub(:getProperty) do |key, default| ( key || raise("missing key") ) && default @@ -337,7 +337,7 @@ def isHandled(arg); getStatus < 400; end end it "configures not handled statuses on init" do - servlet_context = javax.servlet.ServletContext.impl do |name, *args| + servlet_context = jakarta.servlet.ServletContext.impl do |name, *args| case name.to_sym when :getAttribute if args[0] == "rack.context" @@ -347,7 +347,7 @@ def isHandled(arg); getStatus < 400; end nil end end - config = javax.servlet.FilterConfig.impl do |name, *args| + config = jakarta.servlet.FilterConfig.impl do |name, *args| case name.to_sym when :getServletContext then servlet_context when :getInitParameter diff --git a/src/spec/ruby/rack/handler/servlet_spec.rb b/src/spec/ruby/rack/handler/servlet_spec.rb index 5d3c4f66..a40fc1d9 100644 --- a/src/spec/ruby/rack/handler/servlet_spec.rb +++ b/src/spec/ruby/rack/handler/servlet_spec.rb @@ -324,7 +324,7 @@ def _env; @_env end it "exposes the servlet context xxxx" do env = servlet.create_env @servlet_env - expect( env['java.servlet_context'] ).to be_a javax.servlet.ServletContext + expect( env['java.servlet_context'] ).to be_a jakarta.servlet.ServletContext # Failure/Error: env['java.servlet_context'].should == @servlet_context # NoMethodError: # private method `pretty_print' called for # @@ -1082,9 +1082,9 @@ def servlet.create_env(servlet_env) it "sets cookies from servlet requests" do cookies = [] - cookies << javax.servlet.http.Cookie.new('foo', 'bar') - cookies << javax.servlet.http.Cookie.new('bar', '142') - servlet_request.setCookies cookies.to_java :'javax.servlet.http.Cookie' + cookies << jakarta.servlet.http.Cookie.new('foo', 'bar') + cookies << jakarta.servlet.http.Cookie.new('bar', '142') + servlet_request.setCookies cookies.to_java :'jakarta.servlet.http.Cookie' env = servlet.create_env(servlet_env) rack_request = Rack::Request.new(env) rack_request.cookies.should == { 'foo' => 'bar', 'bar' => '142' } @@ -1096,7 +1096,7 @@ def servlet.create_env(servlet_env) rack_request = Rack::Request.new(env) rack_request.cookies.should == {} - servlet_request.setCookies [].to_java :'javax.servlet.http.Cookie' + servlet_request.setCookies [].to_java :'jakarta.servlet.http.Cookie' env = servlet.create_env(servlet_env) rack_request = Rack::Request.new(env) rack_request.cookies.should == {} @@ -1104,9 +1104,9 @@ def servlet.create_env(servlet_env) it "sets a single cookie from servlet requests" do cookies = [] - cookies << javax.servlet.http.Cookie.new('foo', 'bar') - cookies << javax.servlet.http.Cookie.new('foo', '142') - servlet_request.setCookies cookies.to_java :'javax.servlet.http.Cookie' + cookies << jakarta.servlet.http.Cookie.new('foo', 'bar') + cookies << jakarta.servlet.http.Cookie.new('foo', '142') + servlet_request.setCookies cookies.to_java :'jakarta.servlet.http.Cookie' env = servlet.create_env(servlet_env) rack_request = Rack::Request.new(env) rack_request.cookies.should == { 'foo' => 'bar' } diff --git a/src/spec/ruby/rack/jms_spec.rb b/src/spec/ruby/rack/jms_spec.rb index e94c999d..0b386545 100644 --- a/src/spec/ruby/rack/jms_spec.rb +++ b/src/spec/ruby/rack/jms_spec.rb @@ -15,7 +15,7 @@ before :each do @qmf = double "queue manager factory" @qm = QueueManager.impl {} - @listener_event = javax.servlet.ServletContextEvent.new @servlet_context + @listener_event = jakarta.servlet.ServletContextEvent.new @servlet_context @listener = QueueContextListener.new @qmf end @@ -56,7 +56,7 @@ @connection_factory.should_receive(:createConnection).and_return conn session = double "session" conn.should_receive(:createSession).and_return session - dest = javax.jms.Destination.impl {} + dest = jakarta.jms.Destination.impl {} @context.should_receive(:lookup).with("myqueue").and_return dest consumer = double "consumer" session.should_receive(:createConsumer).and_return consumer @@ -72,7 +72,7 @@ @connection_factory.stub(:createConnection).and_return conn session = double "session" conn.stub(:createSession).and_return session - dest = javax.jms.Destination.impl {} + dest = jakarta.jms.Destination.impl {} @context.stub(:lookup).with("myqueue").and_return dest consumer = double "consumer" session.stub(:createConsumer).and_return consumer diff --git a/src/spec/ruby/rack/servlet/response_capture_spec.rb b/src/spec/ruby/rack/servlet/response_capture_spec.rb index 606dff43..8d5ce946 100644 --- a/src/spec/ruby/rack/servlet/response_capture_spec.rb +++ b/src/spec/ruby/rack/servlet/response_capture_spec.rb @@ -97,7 +97,7 @@ private def servlet_30? - Java::JavaClass.for_name('javax.servlet.AsyncContext') rescue nil + Java::JavaClass.for_name('jakarta.servlet.AsyncContext') rescue nil end end \ No newline at end of file diff --git a/src/spec/ruby/rack/servlet_context_listener_spec.rb b/src/spec/ruby/rack/servlet_context_listener_spec.rb index 9c2a57dc..5c2c5135 100644 --- a/src/spec/ruby/rack/servlet_context_listener_spec.rb +++ b/src/spec/ruby/rack/servlet_context_listener_spec.rb @@ -16,7 +16,7 @@ end let(:servlet_context_event) do - javax.servlet.ServletContextEvent.new @servlet_context + jakarta.servlet.ServletContextEvent.new @servlet_context end describe "contextInitialized" do diff --git a/src/spec/ruby/rack/servlet_spec.rb b/src/spec/ruby/rack/servlet_spec.rb index 8b0f7cd3..5c867da5 100644 --- a/src/spec/ruby/rack/servlet_spec.rb +++ b/src/spec/ruby/rack/servlet_spec.rb @@ -10,8 +10,8 @@ describe org.jruby.rack.RackServlet, "service" do it "should delegate to process" do - request = javax.servlet.http.HttpServletRequest.impl {} - response = javax.servlet.http.HttpServletResponse.impl {} + request = jakarta.servlet.http.HttpServletRequest.impl {} + response = jakarta.servlet.http.HttpServletResponse.impl {} dispatcher = double "dispatcher" dispatcher.should_receive(:process) servlet = org.jruby.rack.RackServlet.new dispatcher, @rack_context diff --git a/src/spec/ruby/rack/tag_spec.rb b/src/spec/ruby/rack/tag_spec.rb index 704a6303..97813fe7 100644 --- a/src/spec/ruby/rack/tag_spec.rb +++ b/src/spec/ruby/rack/tag_spec.rb @@ -58,7 +58,7 @@ def call(request) begin @tag.doEndTag - rescue Java::JavaxServletJsp::JspException + rescue Java::JakartaServletJsp::JspException #noop end end diff --git a/src/spec/ruby/spec_helper.rb b/src/spec/ruby/spec_helper.rb index 650afbdf..c86fdc32 100644 --- a/src/spec/ruby/spec_helper.rb +++ b/src/spec/ruby/spec_helper.rb @@ -10,8 +10,8 @@ puts "using JRuby #{JRUBY_VERSION} (#{RUBY_VERSION})" -java_import 'javax.servlet.http.HttpServletRequest' -java_import 'javax.servlet.http.HttpServletResponse' +java_import 'jakarta.servlet.http.HttpServletRequest' +java_import 'jakarta.servlet.http.HttpServletResponse' java_import 'org.jruby.rack.RackApplicationFactory' java_import 'org.jruby.rack.DefaultRackApplicationFactory' @@ -29,8 +29,8 @@ module SharedHelpers java_import 'org.jruby.rack.RackContext' java_import 'org.jruby.rack.RackConfig' java_import 'org.jruby.rack.servlet.ServletRackContext' - java_import 'javax.servlet.ServletContext' - java_import 'javax.servlet.ServletConfig' + java_import 'jakarta.servlet.ServletContext' + java_import 'jakarta.servlet.ServletConfig' def mock_servlet_context @servlet_context = ServletContext.impl {} @@ -61,7 +61,7 @@ def silence_warnings(&block) def servlet_30? return @@servlet_30 unless @@servlet_30.nil? - @@servlet_30 = !! ( Java::JavaClass.for_name('javax.servlet.AsyncContext') rescue nil ) + @@servlet_30 = !! ( Java::JavaClass.for_name('jakarta.servlet.AsyncContext') rescue nil ) end private :servlet_30? @@ -253,7 +253,7 @@ def flush; end end -class StubServletInputStream < javax.servlet.ServletInputStream +class StubServletInputStream < jakarta.servlet.ServletInputStream def initialize(val = "") @delegate = StubInputStream.new(val)