Skip to content

Commit

Permalink
Merge pull request #1627 from lat-lon/feature/migrateToServlet6.0-1401
Browse files Browse the repository at this point in the history
Upgrade dependencies to Servlet 6.0  and Faces 4.0 (Jakarta EE 10)
  • Loading branch information
stephanr authored Feb 7, 2024
2 parents 932a602 + 5bd9b74 commit 39c7bba
Show file tree
Hide file tree
Showing 151 changed files with 810 additions and 796 deletions.
38 changes: 20 additions & 18 deletions deegree-client/deegree-jsf-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,40 +60,42 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>javax.faces-api</artifactId>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
</dependency>
<!--
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<groupId>jakarta.faces</groupId>
<artifactId>jakarta.faces-api</artifactId>
</dependency>
-->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.faces</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-fileupload2-jakarta-servlet6</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
----------------------------------------------------------------------------*/
package org.deegree.client.core.component;

import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.FacesComponent;
import javax.faces.component.UIComponentBase;
import jakarta.faces.application.ResourceDependencies;
import jakarta.faces.application.ResourceDependency;
import jakarta.faces.component.FacesComponent;
import jakarta.faces.component.UIComponentBase;

import org.deegree.client.core.utils.MessageUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
----------------------------------------------------------------------------*/
package org.deegree.client.core.component;

import javax.faces.component.FacesComponent;
import javax.faces.component.UICommand;
import jakarta.faces.component.FacesComponent;
import jakarta.faces.component.UICommand;

/**
* <code>HtmlExternalLink</code> a link component ignoring the JSF navigation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
----------------------------------------------------------------------------*/
package org.deegree.client.core.component;

import javax.faces.component.FacesComponent;
import javax.faces.component.UIPanel;
import jakarta.faces.component.FacesComponent;
import jakarta.faces.component.UIPanel;

/**
* TODO add class documentation here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
----------------------------------------------------------------------------*/
package org.deegree.client.core.component;

import javax.faces.FacesException;
import javax.faces.application.FacesMessage;
import javax.faces.component.FacesComponent;
import javax.faces.component.UISelectOne;
import javax.faces.context.FacesContext;
import jakarta.faces.FacesException;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.component.FacesComponent;
import jakarta.faces.component.UISelectOne;
import jakarta.faces.context.FacesContext;

import org.deegree.client.core.model.BBox;
import org.deegree.client.core.utils.MessageUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
import java.util.ArrayList;
import java.util.List;

import javax.faces.application.FacesMessage;
import javax.faces.component.FacesComponent;
import javax.faces.component.html.HtmlInputTextarea;
import javax.faces.context.FacesContext;
import javax.faces.convert.ConverterException;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.component.FacesComponent;
import jakarta.faces.component.html.HtmlInputTextarea;
import jakarta.faces.context.FacesContext;
import jakarta.faces.convert.ConverterException;

import org.deegree.client.core.utils.MessageUtils;
import org.deegree.commons.xml.schema.SchemaValidationEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
----------------------------------------------------------------------------*/
package org.deegree.client.core.component;

import javax.faces.application.FacesMessage;
import javax.faces.component.FacesComponent;
import javax.faces.component.UIInput;
import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.faces.context.FacesContext;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.component.FacesComponent;
import jakarta.faces.component.UIInput;
import jakarta.faces.component.behavior.ClientBehaviorHolder;
import jakarta.faces.context.FacesContext;

import org.deegree.client.core.model.UploadedFile;
import org.deegree.client.core.utils.MessageUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
import java.util.ArrayList;
import java.util.List;

import javax.faces.FacesException;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.FacesComponent;
import javax.faces.component.UIInput;
import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.faces.component.html.HtmlInputText;
import jakarta.faces.FacesException;
import jakarta.faces.application.ResourceDependencies;
import jakarta.faces.application.ResourceDependency;
import jakarta.faces.component.FacesComponent;
import jakarta.faces.component.UIInput;
import jakarta.faces.component.behavior.ClientBehaviorHolder;
import jakarta.faces.component.html.HtmlInputText;

import com.sun.faces.util.Util;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@

import java.util.List;

import javax.faces.FacesException;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.FacesComponent;
import javax.faces.component.UIInput;
import jakarta.faces.FacesException;
import jakarta.faces.application.ResourceDependencies;
import jakarta.faces.application.ResourceDependency;
import jakarta.faces.component.FacesComponent;
import jakarta.faces.component.UIInput;

/**
* Input component which allows multiple insert.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
----------------------------------------------------------------------------*/
package org.deegree.client.core.component;

import javax.faces.application.ResourceDependency;
import javax.faces.component.FacesComponent;
import javax.faces.component.UIOutput;
import jakarta.faces.application.ResourceDependency;
import jakarta.faces.component.FacesComponent;
import jakarta.faces.component.UIOutput;

import org.deegree.client.core.utils.MessageUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@

import static org.slf4j.LoggerFactory.getLogger;

import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
import jakarta.faces.event.PhaseEvent;
import jakarta.faces.event.PhaseId;
import jakarta.faces.event.PhaseListener;

import org.slf4j.Logger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@

import java.util.Map;

import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
import jakarta.faces.context.FacesContext;
import jakarta.faces.event.PhaseEvent;
import jakarta.faces.event.PhaseId;
import jakarta.faces.event.PhaseListener;

import org.slf4j.Logger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;

import org.slf4j.Logger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.http.HttpServletRequest;

import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.fileupload2.jakarta.servlet6.JakartaServletFileUpload;

/**
*
Expand All @@ -63,7 +63,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
throws IOException, ServletException {
if ((request instanceof HttpServletRequest)) {
HttpServletRequest httpRequest = (HttpServletRequest) request;
if (ServletFileUpload.isMultipartContent(httpRequest)) {
if (JakartaServletFileUpload.isMultipartContent(httpRequest)) {
request = new InputFileWrapper(httpRequest);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,23 @@
----------------------------------------------------------------------------*/
package org.deegree.client.core.filter;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequestWrapper;

import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.fileupload2.core.FileItem;
import org.apache.commons.fileupload2.core.FileUploadException;
import org.apache.commons.fileupload2.jakarta.servlet6.JakartaServletDiskFileUpload;
import org.apache.commons.fileupload2.jakarta.servlet6.JakartaServletFileUpload;

/**
* TODO add class documentation here
Expand All @@ -63,9 +65,7 @@ public class InputFileWrapper extends HttpServletRequestWrapper {
public InputFileWrapper(HttpServletRequest request) throws ServletException {
super(request);
try {
ServletFileUpload upload = new ServletFileUpload();
DiskFileItemFactory factory = new DiskFileItemFactory();
upload.setFileItemFactory(factory);
JakartaServletFileUpload upload = new JakartaServletDiskFileUpload();
String encoding = request.getCharacterEncoding();
List<FileItem> fileItems = upload.parseRequest(request);
formParameters = new HashMap<String, String[]>();
Expand All @@ -75,7 +75,7 @@ public InputFileWrapper(HttpServletRequest request) throws ServletException {
String[] values;
String v;
if (encoding != null) {
v = item.getString(encoding);
v = item.getString(Charset.forName(encoding));
}
else {
v = item.getString();
Expand All @@ -99,13 +99,15 @@ else if (item.getName() != null && item.getName().length() > 0 && item.getSize()
}
}
catch (FileUploadException fe) {
ServletException servletEx = new ServletException();
servletEx.initCause(fe);
ServletException servletEx = new ServletException(fe);
throw servletEx;
}
catch (UnsupportedEncodingException e) {
ServletException servletEx = new ServletException();
servletEx.initCause(e);
ServletException servletEx = new ServletException(e);
throw servletEx;
}
catch (IOException e) {
ServletException servletEx = new ServletException(e);
throw servletEx;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import java.io.Serializable;
import java.net.URL;

import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload2.core.FileItem;

/**
* <code>UploadedFile</code> wraps the uploaded file item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@

import java.io.IOException;

import javax.faces.application.Resource;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.render.FacesRenderer;
import jakarta.faces.application.Resource;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.FacesContext;
import jakarta.faces.context.ResponseWriter;
import jakarta.faces.render.FacesRenderer;

import org.deegree.client.core.component.HtmlAjaxStatus;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@

import java.io.IOException;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.render.FacesRenderer;
import javax.faces.render.Renderer;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.FacesContext;
import jakarta.faces.context.ResponseWriter;
import jakarta.faces.render.FacesRenderer;
import jakarta.faces.render.Renderer;

import org.deegree.client.core.component.HtmlExternalLink;

Expand Down
Loading

0 comments on commit 39c7bba

Please sign in to comment.