[ 
https://issues.apache.org/jira/browse/VELTOOLS-202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17876729#comment-17876729
 ] 

Charles Parker commented on VELTOOLS-202:
-----------------------------------------

I want to voice my support for this issue. The lack of Servlet API 6.0 support 
is holding back a lot of projects, and I believe it was in part responsible for 
the retirement of Apache Tiles.

I recently ported *velocity-tools-view-3.1* to Servlet API 6.0, and found that 
only the following changes were needed:

Change "import javax.servlet." to "import jakarta.servlet." for the following 
files/lines:
 * org.apache.velocity.tools.view.AbstractSearchTool.java [line 24]
 * org.apache.velocity.tools.view.BreadcrumbTool.java [line 28]
 * org.apache.velocity.tools.view.BrowserTool.java [line 34]
 * org.apache.velocity.tools.view.CookieTool.java [line 24-26]
 * org.apache.velocity.tools.view.IncludeTool.java [line 25]
 * org.apache.velocity.tools.view.JeeConfig.java [line 23]
 * org.apache.velocity.tools.view.JeeContextConfig.java [line 23]
 * org.apache.velocity.tools.view.JeeFilterConfig.java [line 23-24]
 * org.apache.velocity.tools.view.JeeServletConfig.java [line 23-24]
 * org.apache.velocity.tools.view.JsonTool.java [line 22]
 * org.apache.velocity.tools.view.LinkTool.java [line 25-26]
 * org.apache.velocity.tools.view.LinkTool.java [line 25-26]
 * org.apache.velocity.tools.view.ParameterTool.java [line 25]
 * org.apache.velocity.tools.view.ServletUtils.java [lines 28-32]
 * org.apache.velocity.tools.view.UiDependencyTool.java [lines 29-30]
 * org.apache.velocity.tools.view.VelocityLayoutServlet.java [lines 24-27]
 * org.apache.velocity.tools.view.VelocityView.java [lines 28-32]
 * org.apache.velocity.tools.view.VelocityViewFilter.java [lines 22-29]
 * org.apache.velocity.tools.view.VelocityViewServlet.java [lines 27-32]
 * org.apache.velocity.tools.view.ViewContext.java [lines 22-24]
 * org.apache.velocity.tools.view.ViewContextTool.java [lines 24-26]
 * org.apache.velocity.tools.view.ViewImportSupport.java [lines 36-43]
 * org.apache.velocity.tools.view.ViewToolContext.java [lines 23-26]
 * org.apache.velocity.tools.view.ViewToolManager.java [lines 23-27]
 * org.apache.velocity.tools.view.WebappResourceLoader.java [line 28]
 * org.apache.velocity.tools.view.WebappUberspector.java [lines 22-24]
 * org.apache.velocity.tools.view.XmlTool.java [line 25]

The above lines are simply imports for the following classes:
 * javax.servlet.Filter
 * javax.servlet.FilterChain
 * javax.servlet.FilterConfig
 * javax.servlet.ServletRequest
 * javax.servlet.RequestDispatcher
 * javax.servlet.ServletConfig
 * javax.servlet.ServletContext
 * javax.servlet.ServletException
 * javax.servlet.ServletOutputStream
 * javax.servlet.WriteListener
 * javax.servlet.http.HttpSession
 * javax.servlet.http.HttpServletRequest
 * javax.servlet.http.HttpServletResponse
 * javax.servlet.http.Cookie

None of the above changes are affected by other API changes in Servlet API 6.0. 
This is simply changing the package namespace for imports from "javax" to 
"jakarta". I have a clean build of this project that works in Tomcat 10.1, and 
I was also able to successfully port Apache Tiles 3 (which relies on this 
project) over to Servlet API 6.0. Everything works perfectly.

Instead of creating a separate branch (which is a solution, but not the best, 
IMO), I would also like to direct your attention to the approach that Apache 
freemarker-2.3.33, which recently took a "yes, and" approach to support Servlet 
API 3.0 through Servlet API 6.0 (inclusively) {*}in the same build{*}. That 
project created an additional jakarta package, and depending on which runtime 
dependency the developer uses, they have the option of using the original 
package or the jakarta package. The solution is backwards and forward 
compatible.

See Issue FREEMARKER-218 https://issues.apache.org/jira/browse/FREEMARKER-218

I believe the approach the FreeMarker team took is a fantastic solution that 
cuts through all of the arguments against supporting a modern Servlet API.

> VelocityViewServlet extending from jakarta.servlet instead of javax.servlet
> ---------------------------------------------------------------------------
>
>                 Key: VELTOOLS-202
>                 URL: https://issues.apache.org/jira/browse/VELTOOLS-202
>             Project: Velocity Tools
>          Issue Type: New Feature
>          Components: VelocityView
>            Reporter: David Ruiz de Azua
>            Priority: Trivial
>
> To whom may concern, 
> Currently VelocityViewServlet extends from javax rather than jakarta.
> Due the cutover from Java to Jakarta, *is there any plan to make Apache 
> Velocity compatible with Servlet 5.0?*
> Not sure if there are any plans to make the transition to Jakarta namespace 
> and if there is any ETA for it. 
> [https://jakarta.ee/specifications/servlet/5.0/apidocs/jakarta/servlet/http/httpservlet]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org

Reply via email to