Update primefaces-showcase to Jakarta EE
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -11,8 +11,8 @@
|
||||
<modules>
|
||||
<module>booking-mvc</module>
|
||||
<module>booking-faces</module>
|
||||
<!--
|
||||
<module>primefaces-showcase</module>
|
||||
<!--
|
||||
<module>webflow-showcase</module>
|
||||
-->
|
||||
</modules>
|
||||
|
||||
@@ -20,6 +20,16 @@
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.webflow</groupId>
|
||||
<artifactId>spring-binding</artifactId>
|
||||
<version>${webflow.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.webflow</groupId>
|
||||
<artifactId>spring-webflow</artifactId>
|
||||
<version>${webflow.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.webflow</groupId>
|
||||
<artifactId>spring-faces</artifactId>
|
||||
@@ -39,28 +49,19 @@
|
||||
</dependency>
|
||||
<!-- Servlet -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>${servlet.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Sun Mojarra JSF 2 runtime -->
|
||||
<dependency>
|
||||
<groupId>com.sun.faces</groupId>
|
||||
<artifactId>jsf-api</artifactId>
|
||||
<groupId>org.glassfish</groupId>
|
||||
<artifactId>jakarta.faces</artifactId>
|
||||
<version>${mojarra.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.faces</groupId>
|
||||
<artifactId>jsf-impl</artifactId>
|
||||
<version>${mojarra.version}</version>
|
||||
</dependency>
|
||||
<!-- Apache MyFaces JSF 2 runtime
|
||||
<dependency>
|
||||
<groupId>org.apache.myfaces.core</groupId>
|
||||
<artifactId>myfaces-api</artifactId>
|
||||
<version>${myfaces.version}</version>
|
||||
</dependency>
|
||||
<!-- JSF implementation: MyFaces (also change DispatcherServletInitializer)
|
||||
<dependency>
|
||||
<groupId>org.apache.myfaces.core</groupId>
|
||||
<artifactId>myfaces-impl</artifactId>
|
||||
@@ -68,10 +69,23 @@
|
||||
</dependency>
|
||||
-->
|
||||
<!-- PrimeFaces component library -->
|
||||
<dependency>
|
||||
<groupId>jakarta.enterprise</groupId>
|
||||
<artifactId>jakarta.enterprise.cdi-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
<version>${cdi-api}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.weld.servlet</groupId>
|
||||
<artifactId>weld-servlet-shaded</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<version>${weld.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.primefaces</groupId>
|
||||
<artifactId>primefaces</artifactId>
|
||||
<version>${primefaces.version}</version>
|
||||
<classifier>jakarta</classifier>
|
||||
</dependency>
|
||||
<!-- JSF-303 Dependency Injection -->
|
||||
<dependency>
|
||||
@@ -79,20 +93,9 @@
|
||||
<artifactId>javax.inject</artifactId>
|
||||
<version>1</version>
|
||||
</dependency>
|
||||
<!-- File uploads -->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>[1.3.3,)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>[2.7,)</version>
|
||||
</dependency>
|
||||
<!-- JSR 303 validation -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<groupId>org.hibernate.validator</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>${hibernate-validator.version}</version>
|
||||
</dependency>
|
||||
|
||||
@@ -3,10 +3,10 @@ package org.springframework.samples.webflow.autocomplete;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.component.UIComponent;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.convert.Converter;
|
||||
import javax.faces.convert.FacesConverter;
|
||||
import jakarta.faces.component.UIComponent;
|
||||
import jakarta.faces.context.FacesContext;
|
||||
import jakarta.faces.convert.Converter;
|
||||
import jakarta.faces.convert.FacesConverter;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.springframework.samples.webflow.jsf;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import jakarta.faces.context.FacesContext;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.springframework.samples.webflow.modal;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
import jakarta.faces.application.FacesMessage;
|
||||
import jakarta.faces.context.FacesContext;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@@ -1,22 +1,15 @@
|
||||
package org.springframework.samples.webflow.upload;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import jakarta.faces.application.FacesMessage;
|
||||
import jakarta.faces.context.FacesContext;
|
||||
import org.primefaces.event.FileUploadEvent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class FileUploadController {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(FileUploadController.class);
|
||||
|
||||
|
||||
public void handleFileUpload(FileUploadEvent event) {
|
||||
logger.info("Uploaded: {}", event.getFile().getFileName());
|
||||
FacesMessage msg = new FacesMessage("Successful", event.getFile().getFileName() + " is uploaded.");
|
||||
FacesContext.getCurrentInstance().addMessage(null, msg);
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package org.springframework.samples.webflow.validation;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Past;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Past;
|
||||
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
# the {0} is the Bean Validation constraint message (e.g. "may not be empty") and {1} is the
|
||||
# field name or the field label if defined (e.g. "First name").
|
||||
#
|
||||
javax.faces.validator.BeanValidator.MESSAGE={1} {0}
|
||||
jakarta.faces.validator.BeanValidator.MESSAGE={1} {0}
|
||||
@@ -1,4 +1,4 @@
|
||||
#
|
||||
# Overrides the default message for the @NotNull constraint.
|
||||
#
|
||||
javax.validation.constraints.NotNull.message=must be provided
|
||||
jakarta.validation.constraints.NotNull.message=must be provided
|
||||
@@ -7,6 +7,8 @@
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Logger name="org.springframework.samples" level="debug" />
|
||||
<Logger name="org.springframework.security" level="trace" />
|
||||
<Logger name="org.springframework.web" level="debug" />
|
||||
<Root level="info">
|
||||
<AppenderRef ref="Console" />
|
||||
</Root>
|
||||
|
||||
8
primefaces-showcase/src/main/webapp/WEB-INF/beans.xml
Normal file
8
primefaces-showcase/src/main/webapp/WEB-INF/beans.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd"
|
||||
version="3.0"
|
||||
bean-discovery-mode="all">
|
||||
|
||||
</beans>
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
<ui:define name="content">
|
||||
<h:form enctype="multipart/form-data">
|
||||
<p:fileUpload fileUploadListener="#{fileUploadController.handleFileUpload}"
|
||||
<p:fileUpload listener="#{fileUploadController.handleFileUpload}"
|
||||
mode="advanced" dragDropSupport="false"
|
||||
update="messages" sizeLimit="100000" allowTypes="/(\.|\/)(gif|jpe?g|png)$/" />
|
||||
<p:growl id="messages" showDetail="true" />
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:c="http://java.sun.com/jsp/jstl/core"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:p="http://primefaces.org/ui"
|
||||
xmlns:sec="http://www.springframework.org/security/tags"
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
<mvc:view-controller path="/login" />
|
||||
|
||||
<mvc:view-controller path="/home" />
|
||||
|
||||
|
||||
<bean name="mvcHandlerMappingIntrospector"
|
||||
class="org.springframework.web.servlet.handler.HandlerMappingIntrospector"/>
|
||||
|
||||
<context:component-scan base-package="org.springframework.samples.webflow" />
|
||||
|
||||
</beans>
|
||||
@@ -5,5 +5,6 @@
|
||||
|
||||
<!-- Root Context: defines shared resources visible to all other web components -->
|
||||
<import resource="security-config.xml"/>
|
||||
<import resource="servlet-context.xml"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -5,12 +5,16 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/security https://www.springframework.org/schema/security/spring-security.xsd">
|
||||
|
||||
<http auto-config="true" use-expressions="true">
|
||||
<b:bean id="expressionHandler"
|
||||
class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler" />
|
||||
|
||||
<http auto-config="true">
|
||||
<form-login login-page="/app/login" login-processing-url="/app/loginProcess"
|
||||
default-target-url="/app/home" authentication-failure-url="/app/login?login_error=1" />
|
||||
<logout logout-url="/app/logout" logout-success-url="/app/home" />
|
||||
<intercept-url pattern="/secured/appleUser" method="POST" access="hasRole('ROLE_APPLE_USER')" />
|
||||
<intercept-url pattern="/secured/androidUser" method="POST" access="hasRole('ROLE_ANDROID_USER')" />
|
||||
<intercept-url pattern="/**" access="permitAll"/>
|
||||
<csrf disabled="true" />
|
||||
</http>
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
<!--
|
||||
Enable processing of JSF 2 resource requests. For example:
|
||||
/webflow-primefaces-showcase/app/javax.faces.resource/jsf.js?ln=javax.faces
|
||||
/webflow-primefaces-showcase/app/jakarta.faces.resource/jsf.js?ln=javax.faces
|
||||
-->
|
||||
<faces:resources />
|
||||
|
||||
@@ -9,7 +9,10 @@
|
||||
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>/WEB-INF/spring/root-context.xml</param-value>
|
||||
<param-value>
|
||||
/WEB-INF/spring/root-context.xml,
|
||||
/WEB-INF/spring/servlet-context.xml
|
||||
</param-value>
|
||||
</context-param>
|
||||
|
||||
<listener>
|
||||
@@ -36,27 +39,28 @@
|
||||
|
||||
<!-- Use JSF view templates saved as *.xhtml, for use with Facelets -->
|
||||
<context-param>
|
||||
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
|
||||
<param-name>jakarta.faces.DEFAULT_SUFFIX</param-name>
|
||||
<param-value>.xhtml</param-value>
|
||||
</context-param>
|
||||
|
||||
<!-- Enables special Facelets debug output during development -->
|
||||
<context-param>
|
||||
<param-name>javax.faces.PROJECT_STAGE</param-name>
|
||||
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
|
||||
<param-value>Development</param-value>
|
||||
</context-param>
|
||||
|
||||
<!-- Causes Facelets to refresh templates during development -->
|
||||
<context-param>
|
||||
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
|
||||
<param-name>jakarta.faces.FACELETS_REFRESH_PERIOD</param-name>
|
||||
<param-value>1</param-value>
|
||||
</context-param>
|
||||
|
||||
<!-- Just here so the JSF implementation can initialize, *not* used at runtime -->
|
||||
<servlet>
|
||||
<servlet-name>Faces Servlet</servlet-name>
|
||||
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
|
||||
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
<multipart-config/>
|
||||
</servlet>
|
||||
|
||||
<!-- Just here so the JSF implementation can initialize -->
|
||||
@@ -74,9 +78,10 @@
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<init-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
|
||||
<param-value/>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
<multipart-config/>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
@@ -86,28 +91,18 @@
|
||||
|
||||
<context-param>
|
||||
<param-name>primefaces.UPLOADER</param-name>
|
||||
<param-value>commons</param-value>
|
||||
<param-value>native</param-value>
|
||||
</context-param>
|
||||
|
||||
<filter>
|
||||
<filter-name>PrimeFaces FileUpload Filter</filter-name>
|
||||
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>PrimeFaces FileUpload Filter</filter-name>
|
||||
<servlet-name>Spring MVC Servlet</servlet-name>
|
||||
</filter-mapping>
|
||||
<!--
|
||||
Spring Security Facelets tag library declaration
|
||||
-->
|
||||
<context-param>
|
||||
<param-name>jakarta.faces.FACELETS_LIBRARIES</param-name>
|
||||
<param-value>/WEB-INF/springsecurity.taglib.xml</param-value>
|
||||
</context-param>
|
||||
|
||||
<!--
|
||||
Spring Security Facelets tag library declaration
|
||||
-->
|
||||
<context-param>
|
||||
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
|
||||
<param-value>/WEB-INF/springsecurity.taglib.xml</param-value>
|
||||
</context-param>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DEFAULT PAGE
|
||||
-->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user