Skip to content

Commit

Permalink
Merge branch 'master' into faces_issue_1713
Browse files Browse the repository at this point in the history
  • Loading branch information
BalusC committed Oct 14, 2023
2 parents 0a88f91 + b0733a2 commit 05991b5
Show file tree
Hide file tree
Showing 105 changed files with 3,186 additions and 3,028 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@
[//]: # " SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 "
-->

# Mojarra 4.0
# Eclipse Mojarra

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

For Mojarra / JSF 2.3 please have a look at https://github.com/eclipse-ee4j/mojarra/blob/2.3/README.md.
For Mojarra / JSF 3.0 please have a look at https://github.com/eclipse-ee4j/mojarra/blob/3.0/README.md.
* Mojarra 5.0 - under development
* [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

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

## Minimum Requirements

Expand Down
36 changes: 20 additions & 16 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
# Releasing a new Mojarra version

In below example we assume 3.0.3.
In below example we assume 4.0.3.

1. Check beforehand that this version does NOT exist in [staging](https://jakarta.oss.sonatype.org/content/repositories/staging/org/glassfish/jakarta.faces/) else bump the version
2. Go to [Mojarra CI](https://ci.eclipse.org/mojarra/)
3. [Log in](https://ci.eclipse.org/mojarra/login?from=%2Fmojarra%2F)
4. Open [1_mojarra_build_and_stage](https://ci.eclipse.org/mojarra/job/1_mojarra-build-and-stage/)
5. Click [Build with parameters](https://ci.eclipse.org/mojarra/job/1_mojarra-build-and-stage/build) in menu
- `BRANCH` = `3.0`
- `RELEASE_VERSION` = `3.0.3`
- `JDK` = `JDK8`
- `BRANCH` = `4.0`
- `RELEASE_VERSION` = `4.0.3`
- `JDK` = `JDK11`
- click [Build] button
6. Wait for it to finish successfully
7. Drill down into this build e.g. [build 95](https://ci.eclipse.org/mojarra/job/1_mojarra-build-and-stage/95)
8. Click [Console Output](https://ci.eclipse.org/mojarra/job/1_mojarra-build-and-stage/95/console) in menu
9. Ctrl+F 'orgglassfish', to find release ID, e.g. `Created staging repository with ID "orgglassfish-1230"`, remember this for `STAGING_RELEASE_ID` in a later step
7. Drill down into this build e.g. [build 106](https://ci.eclipse.org/mojarra/job/1_mojarra-build-and-stage/106)
8. Click [Console Output](https://ci.eclipse.org/mojarra/job/1_mojarra-build-and-stage/106/console) in menu
9. Ctrl+F 'orgglassfish', to find release ID, e.g. `Created staging repository with ID "orgglassfish-1273"`, remember this for `STAGING_RELEASE_ID` in a later step
10. Verify that it's present in [staging](https://jakarta.oss.sonatype.org/content/repositories/staging/org/glassfish/jakarta.faces/)
11. Verify that a new [3.0.3](https://github.com/eclipse-ee4j/mojarra/tree/3.0.3) branch is created
12. Verify that a new [3.0.3-RELEASE](https://github.com/eclipse-ee4j/mojarra/releases/tag/3.0.3-RELEASE) tag is created
13. Open [2_mojarra-run-tck-against-staged-build_3_0](https://ci.eclipse.org/mojarra/job/2_mojarra-run-tck-against-staged-build_3_0) (there are separate ones for 2.3 and 4.0)
14. Click [Build with parameters](https://ci.eclipse.org/mojarra/job/2_mojarra-run-tck-against-staged-build_3_0/build) in menu
11. Verify that a new [4.0.3](https://github.com/eclipse-ee4j/mojarra/branches/active) branch is created
12. Verify that a new [4.0.3-RELEASE](https://github.com/eclipse-ee4j/mojarra/tags) tag is created
13. Open [2_mojarra-run-tck-against-staged-build_4_0](https://ci.eclipse.org/mojarra/job/2_mojarra-run-tck-against-staged-build_4_0) (there are separate ones for 2.3 and 3.0)
14. Click [Build with parameters](https://ci.eclipse.org/mojarra/job/2_mojarra-run-tck-against-staged-build_4_0/build) in menu
- `IMPL_SOURCE` = `STAGE`
- `IMPL_VERSION` = `3.0.3`
- `IMPL_BRANCH` = `3.0`
- `IMPL_VERSION` = `4.0.3`
- `IMPL_BRANCH` = `4.0`
- click [Build] button
15. Wait for it to finish successfully
16. Open [3_mojarra-staging-to-release](https://ci.eclipse.org/mojarra/job/3_mojarra-staging-to-release/)
17. Click [Build with parameters](https://ci.eclipse.org/mojarra/job/3_mojarra-staging-to-release/build) in menu
- `STAGING_RELEASE_ID` = `orgglassfish-1230`
- `STAGING_RELEASE_ID` = `orgglassfish-1273`
- click [Build] button
18. Wait for it to finish successfully
19. Verify that it's present in [Maven Central](https://repo1.maven.org/maven2/org/glassfish/jakarta.faces/) (might take up to a hour)
20. If everything is OK, then merge 3.0.3 branch into 3.0 via PR
21. Delete the 3.0.3 branch after merge
20. If everything is OK, then merge 4.0.3 branch into 4.0 via a PR
21. Delete the 4.0.3 branch after merge
22. Manage the [milestones](https://github.com/eclipse-ee4j/mojarra/milestones) page
- make sure all issues/PRs are linked to proper milestone
- close the milestones which were just released
- create new milestones for next releases
11 changes: 5 additions & 6 deletions action/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.glassfish</groupId>
<groupId>org.glassfish.mojarra</groupId>
<artifactId>mojarra-parent</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</parent>

<groupId>org.eclipse.mojarra</groupId>
<artifactId>mojarra-action</artifactId>
<packaging>jar</packaging>

Expand All @@ -45,13 +44,13 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.faces</artifactId>
<groupId>org.glassfish.mojarra</groupId>
<artifactId>mojarra</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.mojarra</groupId>
<groupId>org.glassfish.mojarra</groupId>
<artifactId>mojarra-cdi</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
Expand Down
9 changes: 4 additions & 5 deletions cdi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.glassfish</groupId>
<groupId>org.glassfish.mojarra</groupId>
<artifactId>mojarra-parent</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</parent>

<groupId>org.eclipse.mojarra</groupId>
<artifactId>mojarra-cdi</artifactId>
<packaging>jar</packaging>

Expand All @@ -39,8 +38,8 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.faces</artifactId>
<groupId>org.glassfish.mojarra</groupId>
<artifactId>mojarra</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
Expand Down
6 changes: 3 additions & 3 deletions impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.glassfish</groupId>
<groupId>org.glassfish.mojarra</groupId>
<artifactId>mojarra-parent</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</parent>

<artifactId>jakarta.faces</artifactId>
<artifactId>mojarra</artifactId>
<packaging>jar</packaging>

<name>Mojarra ${project.version}</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import jakarta.faces.FacesException;
import jakarta.faces.application.NavigationHandler;
import jakarta.faces.component.ActionSource;
import jakarta.faces.component.ActionSource2;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.FacesContext;
import jakarta.faces.event.ActionEvent;
Expand Down Expand Up @@ -57,7 +56,7 @@ public void processAction(ActionEvent event) {
UIComponent source = event.getComponent();
FacesContext context = event.getFacesContext();

MethodExpression expression = ((ActionSource2) source).getActionExpression();
MethodExpression expression = ((ActionSource) source).getActionExpression();

invokeNavigationHandling(context, source, expression, getNavigationOutcome(context, expression));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,12 @@ public static ApplicationAssociate getCurrentInstance() {
}

public static ApplicationAssociate getInstance() {
FacesContext facesContext = FacesContext.getCurrentInstance();
return getInstance(FacesContext.getCurrentInstance());
}

public static ApplicationAssociate getInstance(FacesContext facesContext) {
if (facesContext == null) {
return null;
return null;
}

return ApplicationAssociate.getInstance(facesContext.getExternalContext());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import jakarta.faces.application.FacesMessage;
import jakarta.faces.application.ProjectStage;
import jakarta.faces.component.ActionSource;
import jakarta.faces.component.ActionSource2;
import jakarta.faces.component.EditableValueHolder;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIForm;
Expand All @@ -41,8 +40,8 @@

/**
* <p>
* ValidateFormComponentNesting performs component tree validation to assure {@link ActionSource} ,
* {@link ActionSource2} and {@link EditableValueHolder} components are placed inside a form.
* ValidateFormComponentNesting performs component tree validation to assure {@link ActionSource}
* and {@link EditableValueHolder} components are placed inside a form.
* ValidateFormComponentNesting is installed automatically if {@link ProjectStage#Development} is active.
* </p>
*
Expand Down Expand Up @@ -94,12 +93,12 @@ public VisitResult visit(VisitContext context, UIComponent target) {
addOmittedMessage(context.getFacesContext(), target.getClientId(context.getFacesContext()), MessageUtils.MISSING_METADATA_ERROR);
reportedOmittedMetadataOnce = true;

} else if (target instanceof EditableValueHolder || target instanceof ActionSource || target instanceof ActionSource2) {
} else if (target instanceof EditableValueHolder || target instanceof ActionSource) {
if (reportedOmittedFormOnce) {
// report first detected problem only, then stop tree walk
result = VisitResult.COMPLETE;
}
// if we find ActionSource, ActionSource2 or EditableValueHolder, that component
// if we find ActionSource or EditableValueHolder, that component
// must be outside of a form add warning message
addOmittedMessage(context.getFacesContext(), target.getClientId(context.getFacesContext()), MessageUtils.MISSING_FORM_ERROR);
reportedOmittedFormOnce = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static com.sun.faces.RIConstants.FLOW_IN_JAR_PREFIX;
import static com.sun.faces.config.WebConfiguration.META_INF_CONTRACTS_DIR;
import static com.sun.faces.config.WebConfiguration.WebContextInitParameter.FaceletsSuffix;
import static com.sun.faces.config.WebConfiguration.WebContextInitParameter.WebAppContractsDirectory;
import static jakarta.faces.application.ResourceVisitOption.TOP_LEVEL_VIEWS_ONLY;
import static java.util.Spliterator.DISTINCT;
import static java.util.Spliterators.spliteratorUnknownSize;
Expand Down Expand Up @@ -48,12 +47,12 @@ public class FaceletWebappResourceHelper extends ResourceHelper {

private static final String[] RESTRICTED_DIRECTORIES = { "/WEB-INF/", "/META-INF/" };

private final String webAppContractsDirectory;
private final ResourceHelper webappResourceHelper;
private final String[] configuredExtensions;

public FaceletWebappResourceHelper() {
public FaceletWebappResourceHelper(WebappResourceHelper webappResourceHelper) {
this.webappResourceHelper = webappResourceHelper;
WebConfiguration webConfig = WebConfiguration.getInstance();
webAppContractsDirectory = webConfig.getOptionValue(WebAppContractsDirectory);
configuredExtensions = webConfig.getOptionValue(FaceletsSuffix, " ");
}

Expand Down Expand Up @@ -150,9 +149,9 @@ private URL findResourceInfoConsideringContracts(FacesContext ctx, String baseRe

for (String contract : contracts) {
if (baseResourceName.startsWith("/")) {
resourceName = webAppContractsDirectory + "/" + contract + baseResourceName;
resourceName = getBaseContractsPath() + "/" + contract + baseResourceName;
} else {
resourceName = webAppContractsDirectory + "/" + contract + "/" + baseResourceName;
resourceName = getBaseContractsPath() + "/" + contract + "/" + baseResourceName;
}

url = Resource.getResourceUrl(ctx, resourceName);
Expand Down Expand Up @@ -226,7 +225,7 @@ public String getBaseResourcePath() {

@Override
public String getBaseContractsPath() {
return webAppContractsDirectory;
return webappResourceHelper.getBaseContractsPath();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.sun.faces.application.resource;

import static com.sun.faces.util.Util.ensureLeadingSlash;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -57,12 +59,15 @@ public class ResourceManager {
*/
private static final Pattern CONFIG_MIMETYPE_PATTERN = Pattern.compile("[a-z-]*/[a-z0-9.\\*-]*");

private final FaceletWebappResourceHelper faceletWebappResourceHelper = new FaceletWebappResourceHelper();

/**
* {@link ResourceHelper} used for looking up webapp-based resources.
*/
private final ResourceHelper webappResourceHelper = new WebappResourceHelper();
private final WebappResourceHelper webappResourceHelper = new WebappResourceHelper();

/**
* {@link ResourceHelper} used for looking up webapp-based facelets resources.
*/
private final FaceletWebappResourceHelper faceletWebappResourceHelper = new FaceletWebappResourceHelper(webappResourceHelper);

/**
* {@link ResourceHelper} used for looking up classpath-based resources.
Expand Down Expand Up @@ -175,6 +180,14 @@ public ResourceInfo findResource(String libraryName, String resourceName, String
public Stream<String> getViewResources(FacesContext facesContext, String path, int maxDepth, ResourceVisitOption... options) {
return faceletWebappResourceHelper.getViewResources(facesContext, path, maxDepth, options);
}

public String getBaseContractsPath() {
return faceletWebappResourceHelper.getBaseContractsPath();
}

public boolean isContractsResource(String path) {
return ensureLeadingSlash(path).startsWith(getBaseContractsPath());
}

// ----------------------------------------------------- Private Methods

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
import jakarta.faces.application.Resource;
import jakarta.faces.application.ViewHandler;
import jakarta.faces.application.ViewVisitOption;
import jakarta.faces.component.ActionSource2;
import jakarta.faces.component.ActionSource;
import jakarta.faces.component.Doctype;
import jakarta.faces.component.EditableValueHolder;
import jakarta.faces.component.UIComponent;
Expand All @@ -127,8 +127,8 @@
import jakarta.faces.event.ValueChangeEvent;
import jakarta.faces.render.RenderKit;
import jakarta.faces.validator.MethodExpressionValidator;
import jakarta.faces.view.ActionSource2AttachedObjectHandler;
import jakarta.faces.view.ActionSource2AttachedObjectTarget;
import jakarta.faces.view.ActionSourceAttachedObjectHandler;
import jakarta.faces.view.ActionSourceAttachedObjectTarget;
import jakarta.faces.view.AttachedObjectHandler;
import jakarta.faces.view.AttachedObjectTarget;
import jakarta.faces.view.BehaviorHolderAttachedObjectHandler;
Expand Down Expand Up @@ -573,7 +573,7 @@ public void retargetAttachedObjects(FacesContext context, UIComponent topLevelCo
curTargetName = curTarget.getName();
targetComponents = curTarget.getTargets(topLevelComponent);

if (curHandler instanceof ActionSource2AttachedObjectHandler && curTarget instanceof ActionSource2AttachedObjectTarget) {
if (curHandler instanceof ActionSourceAttachedObjectHandler && curTarget instanceof ActionSourceAttachedObjectTarget) {
if (forAttributeValue.equals(curTargetName)) {
for (UIComponent curTargetComponent : targetComponents) {
retargetHandler(context, curHandler, curTargetComponent);
Expand Down Expand Up @@ -1470,7 +1470,7 @@ public void retarget(FacesContext ctx, CompCompInterfaceMethodMetadata metadata,
String expr = sourceValue instanceof ValueExpression ? ((ValueExpression) sourceValue).getExpressionString() : sourceValue.toString();
ExpressionFactory f = ctx.getApplication().getExpressionFactory();
MethodExpression me = f.createMethodExpression(ctx.getELContext(), expr, Object.class, NO_ARGS);
((ActionSource2) target).setActionExpression(
((ActionSource) target).setActionExpression(
new ContextualCompositeMethodExpression(sourceValue instanceof ValueExpression ? (ValueExpression) sourceValue : null, me));

}
Expand Down Expand Up @@ -1500,7 +1500,7 @@ public void retarget(FacesContext ctx, CompCompInterfaceMethodMetadata metadata,
MethodExpression me = f.createMethodExpression(ctx.getELContext(), ve.getExpressionString(), Void.TYPE, ACTION_LISTENER_ARGS);
MethodExpression noArg = f.createMethodExpression(ctx.getELContext(), ve.getExpressionString(), Void.TYPE, NO_ARGS);

((ActionSource2) target).addActionListener(new MethodExpressionActionListener(new ContextualCompositeMethodExpression(ve, me),
((ActionSource) target).addActionListener(new MethodExpressionActionListener(new ContextualCompositeMethodExpression(ve, me),
new ContextualCompositeMethodExpression(ve, noArg)));

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import jakarta.faces.application.FacesMessage;
import jakarta.faces.component.ActionSource;
import jakarta.faces.component.ActionSource2;
import jakarta.faces.component.EditableValueHolder;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIForm;
Expand Down Expand Up @@ -105,7 +104,7 @@ private static boolean isForm(UIComponent component) {
* @return true if the component is in need of a form, false otherwise.
*/
private static boolean isInNeedOfForm(UIComponent component) {
return component instanceof ActionSource || component instanceof ActionSource2 || component instanceof EditableValueHolder;
return component instanceof ActionSource || component instanceof EditableValueHolder;
}

/**
Expand Down
Loading

0 comments on commit 05991b5

Please sign in to comment.