Skip to content

Commit

Permalink
Merge branch 'master' into faces_issue_1507_automatically_pass_throug…
Browse files Browse the repository at this point in the history
…h_all_on-event_attributes
  • Loading branch information
BalusC committed Sep 2, 2024
2 parents 12e79cd + ed6577f commit 26237e1
Show file tree
Hide file tree
Showing 77 changed files with 574 additions and 3,026 deletions.
55 changes: 24 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,28 @@
[//]: # " SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 "
-->

# Eclipse Mojarra
# Mojarra 5.0

Eclipse's implementation of the Jakarta Faces specification
Eclipse's implementation of the Jakarta Faces 5.0 specification

* Mojarra 5.0 - under development
* Mojarra 5.0 - this branch, under development
* [Mojarra 4.1](https://github.com/eclipse-ee4j/mojarra/blob/4.1/README.md) - stable release
* [Mojarra 4.0](https://github.com/eclipse-ee4j/mojarra/blob/4.0/README.md) - stable release
* [Mojarra 3.0](https://github.com/eclipse-ee4j/mojarra/blob/3.0/README.md) - legacy release
* [Mojarra 2.3](https://github.com/eclipse-ee4j/mojarra/blob/2.3/README.md) - legacy release

For Mojarra 2.3 and earlier please contact your vendor for support (RedHat, IBM,
For support on Mojarra 2.3 and earlier please contact your vendor for support (RedHat, IBM,
Oracle, Omnifish, Payara, etceteras)

## Minimum Requirements

- Java 11
- Jakarta Servlet 6.0
- Jakarta Expression Language 5.0
- CDI 4.0
- Jakarta Standard Tag Library 2.0
- Jakarta Web Socket 2.0 (optional, only when `<f:websocket>` is used)
- Jakarta JSON Processing 2.0 (optional, only when `<f:websocket>` is used)
- Jakarta Validation 3.0 (optional, only when `<f:validateBean>` or `<f:validateWholeBean>` is used)

CDI is explicitly required because since Jakarta Faces 2.3 the `javax.faces.bean.*` annotations such as `@ManagedBean` are deprecated, and in 4.0 these have been removed. Several implicit Jakarta Expression Language objects are produced via CDI producers, and `<f:websocket>` manages the Jakarta WebSocket sessions and events via CDI.
- Java 17
- Jakarta Servlet 6.1
- Jakarta Expression Language 6.0
- Jakarta CDI 4.1
- Jakarta Web Socket 2.2 (optional, only when `<f:websocket>` is used)
- Jakarta JSON Processing 2.1 (optional, only when `<f:websocket>` is used)
- Jakarta Validation 3.1 (optional, only when `<f:validateBean>` or `<f:validateWholeBean>` is used)


## Installation
Expand All @@ -56,12 +55,11 @@ In case you're manually carrying around JARs:

Add below JARs to `/WEB-INF/lib`:

- [`jakarta.faces.4.0.x.jar`][9]
- [`weld-servlet-shaded-4.0.0.Final.jar`][10]
- [`jstl-2.0.jar`][11]
- [`jakarta.json-api-2.0.jar`][12] (optional, only when `<f:websocket>` is used)
- [`jakarta.json-2.0.jar`][12a] (optional, only when `<f:websocket>` is used)
- [`validation-api-3.0.0.Final.jar`][13] (optional, only when `<f:validateBean|validateWholeBean>` is used)
- [`jakarta.faces.4.1.x.jar`][9]
- [`weld-servlet-shaded-4.1.0.Final.jar`][10]
- [`jakarta.json-api-2.1.0.jar`][12] (optional, only when `<f:websocket>` is used)
- [`jakarta.json-2.1.0.jar`][12a] (optional, only when `<f:websocket>` is used)
- [`jakarta.validation-api-3.1.0.jar`][13] (optional, only when `<f:validateBean|validateWholeBean>` is used)
- [`hibernate-validator-8.0.x.Final.jar`][14] (optional, only when `<f:validateBean|validateWholeBean>` is used)

Substitute `x` with latest version number available.
Expand All @@ -76,7 +74,7 @@ In case you're using Maven, you can find below the necessary coordinates:
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>10.0.0</version>
<version>11.0.0</version>
<scope>provided</scope>
</dependency>
```
Expand All @@ -94,17 +92,12 @@ In case of WildFly/JBoss EAP, [you need to manually package `jsf-api.jar` and `j
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet-shaded</artifactId>
<version>4.0.0.Final</version>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>2.0.0</version>
<version>4.1.0.Final</version>
</dependency>
<dependency> <!-- Optional, only when <f:websocket> is used. -->
<groupId>org.glassfish</groupId>
<artifactId>jakarta.json</artifactId>
<version>2.0.0</version>
<version>2.1.0</version>
</dependency>
<dependency> <!-- Optional, only when <f:validateBean> or <f:validateWholeBean> is used. -->
<groupId>org.hibernate.validator</groupId>
Expand Down Expand Up @@ -232,9 +225,9 @@ Finally create a [Facelets][20] file `/hello.xhtml` as below:

Start the server and open it by `http://localhost:8080/contextname/hello.xhtml`.

## Activating CDI in Jakarta Faces 4.0
## Activating CDI in Jakarta Faces 4.1

CDI is activated by default in Jakarta Faces 4.0 and can´t be deactivated.
CDI is activated by default in Jakarta Faces 4.1 and can´t be deactivated.
It´s not required anymore to add `@FacesConfig` to a CDI managed bean to accomplish this.
As of Jakarta Faces 4.0 `@FacesConfig` still removes the need to explicitly add a `FacesServlet` entry to `web.xml`.

Expand All @@ -244,7 +237,7 @@ In case you want to checkout this repository and manually build from source your

### Jakarta Faces.Next

1. Make sure that you have JDK 11, Ant and Maven installed.
1. Make sure that you have JDK 17, Ant and Maven installed.
2. Checkout branch [`master`][28].
3. Run the following commands from the root directory of the project:

Expand Down
12 changes: 6 additions & 6 deletions impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,20 @@
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.1.0-M2</version>
<version>6.1.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>jakarta.websocket</groupId>
<artifactId>jakarta.websocket-api</artifactId>
<version>2.2.0-M1</version>
<version>2.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.websocket</groupId>
<artifactId>jakarta.websocket-client-api</artifactId>
<version>2.2.0-M1</version>
<version>2.2.0</version>
<scope>provided</scope>
</dependency>

Expand Down Expand Up @@ -96,7 +96,7 @@
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>3.1.0-M1</version>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>

Expand Down Expand Up @@ -130,7 +130,7 @@
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>3.2.0-M2</version>
<version>3.2.0</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
Expand Down Expand Up @@ -226,7 +226,7 @@
<plugin>
<groupId>com.github.blutorange</groupId>
<artifactId>closure-compiler-maven-plugin</artifactId>
<version>2.28.0</version>
<version>2.30.0</version>
<executions>
<!-- Process all files in the "includes" directory individually-->
<execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Contributors to Eclipse Foundation.
* Copyright (c) 2021, 2024 Contributors to Eclipse Foundation.
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -71,8 +71,8 @@
import com.sun.faces.facelets.util.FunctionLibrary;
import com.sun.faces.spi.InjectionProvider;
import com.sun.faces.util.FacesLogger;

import jakarta.el.CompositeELResolver;

import jakarta.el.ELResolver;
import jakarta.el.ExpressionFactory;
import jakarta.faces.FacesException;
Expand Down Expand Up @@ -167,7 +167,6 @@ public class ApplicationAssociate {

Map<String, ApplicationResourceBundle> resourceBundles = new HashMap<>();


public static void setCurrentInstance(ApplicationAssociate associate) {
if (associate == null) {
instance.remove();
Expand Down Expand Up @@ -457,6 +456,10 @@ public InjectionProvider getInjectionProvider() {
return injectionProvider;
}

public ResolversRegistry getGlobalResolversRegistry() {
return applicationImpl.getGlobalResolversRegistry();
}

public void setContextName(String contextName) {
this.contextName = contextName;
}
Expand Down Expand Up @@ -553,6 +556,14 @@ public ResourceBundle getResourceBundle(FacesContext context, String var) {
return bundle.getResourceBundle(locale);
}

/**
* Returns a container with EL resolvers global to this application associate
* @return global EL resolvers for the current application
*/
public ResolversRegistry getApplicationResolvers() {
return applicationImpl.getGlobalResolversRegistry();
}

/**
* keys: element from faces-config
* <p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to Eclipse Foundation.
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -81,6 +82,7 @@ public class ApplicationImpl extends Application {
private final InstanceFactory instanceFactory;
private final SearchExpression searchExpression;
private final Stage stage;
private final ResolversRegistry globalResolversRegistry = new ResolversRegistry();

/**
* Constructor
Expand Down Expand Up @@ -212,6 +214,10 @@ public CompositeELResolver getApplicationELResolvers() {
return expressionLanguage.getApplicationELResolvers();
}

public ResolversRegistry getGlobalResolversRegistry() {
return globalResolversRegistry;
}

public FacesCompositeELResolver getCompositeELResolver() {
return expressionLanguage.getCompositeELResolver();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
import jakarta.el.MethodExpression;
import jakarta.el.ValueExpression;
import jakarta.faces.FacesException;
import jakarta.faces.application.ConfigurableNavigationHandler;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.application.NavigationCase;
import jakarta.faces.application.NavigationHandler;
import jakarta.faces.application.ViewHandler;
import jakarta.faces.component.UIViewRoot;
import jakarta.faces.context.ExternalContext;
Expand All @@ -83,7 +83,7 @@
* 7.4.2 of the specification for more details. PENDING: Make independent of ApplicationAssociate.
*/

public class NavigationHandlerImpl extends ConfigurableNavigationHandler {
public class NavigationHandlerImpl extends NavigationHandler {

// Private Constants
private static final String RESET_FLOW_HANDLER_STATE_KEY = NavigationHandlerImpl.class.getName() + "_RESET_FLOW_HANDLER_STATE_KEY";
Expand Down Expand Up @@ -142,10 +142,8 @@ public NavigationHandlerImpl() {

}

// ------------------------------ Methods from ConfigurableNavigationHandler

/**
* @see jakarta.faces.application.ConfigurableNavigationHandler#getNavigationCase(jakarta.faces.context.FacesContext,
* @see jakarta.faces.application.NavigationHandler#getNavigationCase(jakarta.faces.context.FacesContext,
* String, String)
*/
@Override
Expand All @@ -172,7 +170,7 @@ public NavigationCase getNavigationCase(FacesContext context, String fromAction,
}

/**
* @see jakarta.faces.application.ConfigurableNavigationHandler#getNavigationCases()
* @see jakarta.faces.application.NavigationHandler#getNavigationCases()
*/
@Override
public Map<String, Set<NavigationCase>> getNavigationCases() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2024 Contributors to Eclipse Foundation.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package com.sun.faces.application;

import com.sun.faces.context.flash.FlashELResolver;
import com.sun.faces.el.CompositeComponentAttributesELResolver;
import com.sun.faces.el.EmptyStringToNullELResolver;
import com.sun.faces.el.FacesResourceBundleELResolver;
import com.sun.faces.el.ResourceELResolver;
import com.sun.faces.el.ScopedAttributeELResolver;
import jakarta.el.ArrayELResolver;
import jakarta.el.BeanELResolver;
import jakarta.el.ListELResolver;
import jakarta.el.MapELResolver;
import jakarta.el.ResourceBundleELResolver;

public class ResolversRegistry {
public final BeanELResolver BEAN_RESOLVER = new BeanELResolver();
public final ArrayELResolver ARRAY_RESOLVER = new ArrayELResolver();
public final FacesResourceBundleELResolver FACES_BUNDLE_RESOLVER = new FacesResourceBundleELResolver();
public final FlashELResolver FLASH_RESOLVER = new FlashELResolver();
public final ListELResolver LIST_RESOLVER = new ListELResolver();
public final MapELResolver MAP_RESOLVER = new MapELResolver();
public final ResourceBundleELResolver BUNDLE_RESOLVER = new ResourceBundleELResolver();
public final ScopedAttributeELResolver SCOPED_RESOLVER = new ScopedAttributeELResolver();
public final ResourceELResolver RESOURCE_RESOLVER = new ResourceELResolver();
public final CompositeComponentAttributesELResolver COMPOSITE_COMPONENT_ATTRIBUTES_EL_RESOLVER = new CompositeComponentAttributesELResolver();
public final EmptyStringToNullELResolver EMPTY_STRING_TO_NULL_RESOLVER = new EmptyStringToNullELResolver();

}

This file was deleted.

Loading

0 comments on commit 26237e1

Please sign in to comment.