File tree Expand file tree Collapse file tree 16 files changed +278
-15
lines changed
java/org/javaee8/cdi/dynamic/bean
java/org/javaee8/cdi/dynamic/bean Expand file tree Collapse file tree 16 files changed +278
-15
lines changed Original file line number Diff line number Diff line change 22<project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > <modelVersion >4.0.0</modelVersion >
33
44 <parent >
5- <groupId >org.javaee8.cdi </groupId >
6- <artifactId >cdi-samples </artifactId >
5+ <groupId >org.javaee8</groupId >
6+ <artifactId >cdi</artifactId >
77 <version >1.0-SNAPSHOT</version >
88 </parent >
99
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" UTF-8" ?>
22<project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" ><modelVersion >4.0.0</modelVersion >
33
4- <parent >
5- <groupId >org.javaee8.cdi </groupId >
6- <artifactId >cdi-samples </artifactId >
4+ <parent >
5+ <groupId >org.javaee8</groupId >
6+ <artifactId >cdi</artifactId >
77 <version >1.0-SNAPSHOT</version >
88 </parent >
99
Original file line number Diff line number Diff line change 22<project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" ><modelVersion >4.0.0</modelVersion >
33
44 <parent >
5- <groupId >org.javaee8.cdi </groupId >
6- <artifactId >cdi-samples </artifactId >
5+ <groupId >org.javaee8</groupId >
6+ <artifactId >cdi</artifactId >
77 <version >1.0-SNAPSHOT</version >
88 </parent >
99
Original file line number Diff line number Diff line change 22<project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > <modelVersion >4.0.0</modelVersion >
33
44 <parent >
5- <groupId >org.javaee8.cdi </groupId >
6- <artifactId >cdi-samples </artifactId >
5+ <groupId >org.javaee8</groupId >
6+ <artifactId >cdi</artifactId >
77 <version >1.0-SNAPSHOT</version >
88 </parent >
99
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" UTF-8" ?>
2- <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
3- < modelVersion >4.0.0</ modelVersion >
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > < modelVersion >4.0.0</ modelVersion >
3+
44 <parent >
55 <groupId >org.javaee8</groupId >
66 <artifactId >samples-parent</artifactId >
77 <version >1.0-SNAPSHOT</version >
88 </parent >
99
10- <groupId >org.javaee8.cdi</groupId >
11- <artifactId >cdi-samples</artifactId >
10+ <artifactId >cdi</artifactId >
1211 <packaging >pom</packaging >
1312 <name >Java EE 8 Samples: CDI</name >
1413
Original file line number Diff line number Diff line change 1+ # Java EE 8 Samples: JSF 2.3#
2+
3+ The [ JSR 372] ( https://jcp.org/en/jsr/detail?id=372 ) specifies the next version of JavaServer Faces - JSF 2.3.
4+
5+ ## Samples ##
6+
7+ - extensionless-mapping shows how to configure JSF so that views can be requested without using an extension
8+
9+
10+
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > <modelVersion >4.0.0</modelVersion >
3+
4+ <parent >
5+ <groupId >org.javaee8</groupId >
6+ <artifactId >jsf</artifactId >
7+ <version >1.0-SNAPSHOT</version >
8+ </parent >
9+
10+ <artifactId >extensionless-mapping</artifactId >
11+ <name >Java EE 8 Samples: JSF - Extensionless Mapping</name >
12+
13+ </project >
Original file line number Diff line number Diff line change 1+ package org .javaee8 .cdi .dynamic .bean ;
2+
3+ import static javax .faces .annotation .FacesConfig .Version .JSF_2_3 ;
4+
5+ import javax .enterprise .context .ApplicationScoped ;
6+ import javax .faces .annotation .FacesConfig ;
7+
8+ /**
9+ * This class is needed to activate JSF and configure it to be the
10+ * right version. Without this being present an explicit mapping
11+ * of the FacesServlet in web.xml would be required, but JSF 2.3
12+ * would then run in a JSF 2.2 compatibility mode.
13+ *
14+ * @author Arjan Tijms
15+ */
16+ @ FacesConfig (version = JSF_2_3 )
17+ @ ApplicationScoped
18+ public class ApplicationInit {
19+
20+ }
Original file line number Diff line number Diff line change 1+ package org .javaee8 .cdi .dynamic .bean ;
2+
3+ import static javax .faces .application .ViewVisitOption .RETURN_AS_MINIMAL_IMPLICIT_OUTCOME ;
4+
5+ import javax .faces .context .FacesContext ;
6+ import javax .faces .webapp .FacesServlet ;
7+ import javax .servlet .ServletContextEvent ;
8+ import javax .servlet .ServletContextListener ;
9+ import javax .servlet .annotation .WebListener ;
10+
11+ /**
12+ *
13+ * @author Arjan Tijms
14+ */
15+ @ WebListener
16+ public class MappingInit implements ServletContextListener {
17+
18+ @ Override
19+ public void contextInitialized (ServletContextEvent sce ) {
20+ FacesContext context = FacesContext .getCurrentInstance ();
21+
22+ sce .getServletContext ()
23+ .getServletRegistrations ()
24+ .values ()
25+ .stream ()
26+ .filter (e -> e .getClassName ().equals (FacesServlet .class .getName ()))
27+ .findAny ()
28+ .ifPresent (
29+ reg -> context .getApplication ()
30+ .getViewHandler ()
31+ .getViews (context , "/" , RETURN_AS_MINIMAL_IMPLICIT_OUTCOME )
32+ .forEach (e -> reg .addMapping (e )));
33+ }
34+
35+ }
Original file line number Diff line number Diff line change 1+ < ?xml version='1.0' encoding='UTF-8' ?>
2+ <!DOCTYPE html>
3+ < html xmlns ="http://www.w3.org/1999/xhtml "
4+ xmlns:h ="http://xmlns.jcp.org/jsf/html "
5+ xmlns:ui ="http://xmlns.jcp.org/jsf/facelets "
6+ xmlns:f ="http://xmlns.jcp.org/jsf/core ">
7+
8+ < h:head >
9+ < title > Bar page</ title >
10+ </ h:head >
11+
12+ < h:body >
13+ This is page bar
14+ </ h:body >
15+ </ html >
16+
You can’t perform that action at this time.
0 commit comments