You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2021/09/19 14:05:25 UTC
[myfaces] branch master updated: Renormalize line endings (#223)
This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/master by this push:
new 99ed35d Renormalize line endings (#223)
99ed35d is described below
commit 99ed35db749cb6c8bae7f04b884532df98c4fe8e
Author: Melloware <me...@gmail.com>
AuthorDate: Sun Sep 19 10:05:20 2021 -0400
Renormalize line endings (#223)
---
.github/workflows/myfaces-ci.yml | 158 +-
CI.md | 80 +-
.../jakarta/faces/annotation/ApplicationMap.java | 84 +-
.../java/jakarta/faces/annotation/FacesConfig.java | 114 +-
.../java/jakarta/faces/annotation/FlowMap.java | 84 +-
.../java/jakarta/faces/annotation/HeaderMap.java | 84 +-
.../jakarta/faces/annotation/HeaderValuesMap.java | 84 +-
.../jakarta/faces/annotation/InitParameterMap.java | 84 +-
.../jakarta/faces/annotation/ManagedProperty.java | 126 +-
.../jakarta/faces/annotation/RequestCookieMap.java | 84 +-
.../java/jakarta/faces/annotation/RequestMap.java | 84 +-
.../faces/annotation/RequestParameterMap.java | 84 +-
.../annotation/RequestParameterValuesMap.java | 86 +-
.../java/jakarta/faces/annotation/SessionMap.java | 84 +-
.../main/java/jakarta/faces/annotation/View.java | 184 +-
.../java/jakarta/faces/annotation/ViewMap.java | 84 +-
.../jakarta/faces/application/StateManager.java | 416 +-
.../META-INF/resources/myfaces/api/faces.js | 972 ++--
.../java/org/apache/myfaces/cdi/util/CDIUtils.java | 350 +-
.../org/apache/myfaces/config/MyfacesConfig.java | 3492 ++++++-------
.../myfaces/push/WebsocketComponentRenderer.java | 546 +-
.../myfaces/view/ViewDeclarationLanguageBase.java | 404 +-
.../facelets/FaceletViewDeclarationLanguage.java | 5304 ++++++++++----------
.../view/facelets/FullStateManagementStrategy.java | 556 +-
.../myfaces/view/facelets/impl/DefaultFacelet.java | 1356 ++---
.../view/facelets/impl/DefaultFaceletFactory.java | 1190 ++---
.../view/facelets/tag/faces/ComponentSupport.java | 1546 +++---
27 files changed, 8860 insertions(+), 8860 deletions(-)
diff --git a/.github/workflows/myfaces-ci.yml b/.github/workflows/myfaces-ci.yml
index 3f5edff..b82f05d 100644
--- a/.github/workflows/myfaces-ci.yml
+++ b/.github/workflows/myfaces-ci.yml
@@ -1,80 +1,80 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# NOTE https://infra.apache.org/github-actions-secrets.html
-
-name: MyFaces CI
-
-on:
- push:
- branches:
- - master
- - 3.0.x
- - 2.3-next
- - 2.3.x
- paths-ignore:
- - '**.md'
- - '.travis.yml'
- - 'Jenkinsfile'
- pull_request:
- branches:
- - master
- - 3.0.x
- - 2.3-next
- - 2.3.x
- paths-ignore:
- - '**.md'
- - '.travis.yml'
- - 'Jenkinsfile'
- workflow_dispatch:
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v2.3.4
- with:
- persist-credentials: false
- - name: Set up JDK 11
- uses: actions/setup-java@v2
- with:
- distribution: 'adopt'
- java-version: 11
- - name: Cache Maven packages
- uses: actions/cache@v2.1.6
- with:
- path: ~/.m2
- key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
- restore-keys: ${{ runner.os }}-m2
- - name: Build with Maven
- run: |
- if ! mvn -B clean verify -Dformats=XML -f pom.xml; then
- find . \( -path '*/target/surefire-reports/*.xml' -o -path '*/target/failsafe-reports/*.xml' -o -path '*/target/rat.txt' -o -path '*/target/checkstyle-result.xml' -o -path '*/target/dependency-check-report.xml' \) | zip -q reports.zip -@
- exit 1
- fi
-
- - name: Reports
- uses: actions/upload-artifact@v2
- if: failure()
- with:
- name: reports
- retention-days: 14
- path: reports.zip
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# NOTE https://infra.apache.org/github-actions-secrets.html
+
+name: MyFaces CI
+
+on:
+ push:
+ branches:
+ - master
+ - 3.0.x
+ - 2.3-next
+ - 2.3.x
+ paths-ignore:
+ - '**.md'
+ - '.travis.yml'
+ - 'Jenkinsfile'
+ pull_request:
+ branches:
+ - master
+ - 3.0.x
+ - 2.3-next
+ - 2.3.x
+ paths-ignore:
+ - '**.md'
+ - '.travis.yml'
+ - 'Jenkinsfile'
+ workflow_dispatch:
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2.3.4
+ with:
+ persist-credentials: false
+ - name: Set up JDK 11
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'adopt'
+ java-version: 11
+ - name: Cache Maven packages
+ uses: actions/cache@v2.1.6
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
+ - name: Build with Maven
+ run: |
+ if ! mvn -B clean verify -Dformats=XML -f pom.xml; then
+ find . \( -path '*/target/surefire-reports/*.xml' -o -path '*/target/failsafe-reports/*.xml' -o -path '*/target/rat.txt' -o -path '*/target/checkstyle-result.xml' -o -path '*/target/dependency-check-report.xml' \) | zip -q reports.zip -@
+ exit 1
+ fi
+
+ - name: Reports
+ uses: actions/upload-artifact@v2
+ if: failure()
+ with:
+ name: reports
+ retention-days: 14
+ path: reports.zip
if-no-files-found: ignore
\ No newline at end of file
diff --git a/CI.md b/CI.md
index 9ec61a2..80d8904 100644
--- a/CI.md
+++ b/CI.md
@@ -1,41 +1,41 @@
-# Apache MyFaces Core CI
-
-## Apache Jenkins Build Service
-
-MyFaces Core is using the Multi-Branch Pipeline Plugin for the ci builds.
-
-The Plugin is checking all branches for a `Jenkinsfile` containing the build instructions.
-
-[Jenkinsfile](Jenkinsfile)
-
-[MyFaces Core Pipeline][1]
-
-[ASF Jenkins Build Service][2]
-
-[Multibranch Pipeline recipes][3]
-
-## Github Actions
-
-For a quick build Github Actions are configured.
-
-[.github/workflow/myfaces-ci.yml](.github/workflows/myfaces-ci.yml)
-
-ASF Infra has some restrictions and objections about Github Actions.
-
-[GitHub Actions and Secrets][4]
-
-[GitHub Actions status][5]
-
-
-
-[1]: https://ci-builds.apache.org/job/MyFaces/job/MyFaces%20Pipeline/
-
-[2]: https://cwiki.apache.org/confluence/display/INFRA/Jenkins
-
-[3]: https://cwiki.apache.org/confluence/display/INFRA/Multibranch+Pipeline+recipes
-
-[4]: https://infra.apache.org/github-actions-secrets.html
-
-[5]: https://cwiki.apache.org/confluence/display/BUILDS/GitHub+Actions+status
-
+# Apache MyFaces Core CI
+
+## Apache Jenkins Build Service
+
+MyFaces Core is using the Multi-Branch Pipeline Plugin for the ci builds.
+
+The Plugin is checking all branches for a `Jenkinsfile` containing the build instructions.
+
+[Jenkinsfile](Jenkinsfile)
+
+[MyFaces Core Pipeline][1]
+
+[ASF Jenkins Build Service][2]
+
+[Multibranch Pipeline recipes][3]
+
+## Github Actions
+
+For a quick build Github Actions are configured.
+
+[.github/workflow/myfaces-ci.yml](.github/workflows/myfaces-ci.yml)
+
+ASF Infra has some restrictions and objections about Github Actions.
+
+[GitHub Actions and Secrets][4]
+
+[GitHub Actions status][5]
+
+
+
+[1]: https://ci-builds.apache.org/job/MyFaces/job/MyFaces%20Pipeline/
+
+[2]: https://cwiki.apache.org/confluence/display/INFRA/Jenkins
+
+[3]: https://cwiki.apache.org/confluence/display/INFRA/Multibranch+Pipeline+recipes
+
+[4]: https://infra.apache.org/github-actions-secrets.html
+
+[5]: https://cwiki.apache.org/confluence/display/BUILDS/GitHub+Actions+status
+
[6]: https://travis-ci.com/github/apache/myfaces
\ No newline at end of file
diff --git a/api/src/main/java/jakarta/faces/annotation/ApplicationMap.java b/api/src/main/java/jakarta/faces/annotation/ApplicationMap.java
index 79fbcb5..fa0504b 100644
--- a/api/src/main/java/jakarta/faces/annotation/ApplicationMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/ApplicationMap.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package jakarta.faces.annotation;
-
-import jakarta.enterprise.util.AnnotationLiteral;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import jakarta.inject.Qualifier;
-
-/**
- *
- */
-@Qualifier
-@Retention(value=RUNTIME)
-@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
-public @interface ApplicationMap
-{
- public static final class Literal extends AnnotationLiteral<ApplicationMap> implements ApplicationMap
- {
- private static final long serialVersionUID = 1L;
-
- public static final Literal INSTANCE = new Literal();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.faces.annotation;
+
+import jakarta.enterprise.util.AnnotationLiteral;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import jakarta.inject.Qualifier;
+
+/**
+ *
+ */
+@Qualifier
+@Retention(value=RUNTIME)
+@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
+public @interface ApplicationMap
+{
+ public static final class Literal extends AnnotationLiteral<ApplicationMap> implements ApplicationMap
+ {
+ private static final long serialVersionUID = 1L;
+
+ public static final Literal INSTANCE = new Literal();
+ }
+}
diff --git a/api/src/main/java/jakarta/faces/annotation/FacesConfig.java b/api/src/main/java/jakarta/faces/annotation/FacesConfig.java
index b956a7c..1c8b956 100644
--- a/api/src/main/java/jakarta/faces/annotation/FacesConfig.java
+++ b/api/src/main/java/jakarta/faces/annotation/FacesConfig.java
@@ -1,57 +1,57 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package jakarta.faces.annotation;
-
-import jakarta.enterprise.util.AnnotationLiteral;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import jakarta.enterprise.util.Nonbinding;
-import jakarta.inject.Qualifier;
-
-/**
- *
- */
-@Qualifier
-@Target(value=ElementType.TYPE)
-@Retention(value=RetentionPolicy.RUNTIME)
-public @interface FacesConfig
-{
-
- @Nonbinding Version version() default Version.JSF_2_3;
-
- public static enum Version
- {
- JSF_2_3
- }
-
- public static final class Literal extends AnnotationLiteral<FacesConfig> implements FacesConfig
- {
- private static final long serialVersionUID = 1L;
-
- public static final Literal INSTANCE = new Literal();
-
- @Override
- public Version version()
- {
- return null; // non binding, so not used
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.faces.annotation;
+
+import jakarta.enterprise.util.AnnotationLiteral;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import jakarta.enterprise.util.Nonbinding;
+import jakarta.inject.Qualifier;
+
+/**
+ *
+ */
+@Qualifier
+@Target(value=ElementType.TYPE)
+@Retention(value=RetentionPolicy.RUNTIME)
+public @interface FacesConfig
+{
+
+ @Nonbinding Version version() default Version.JSF_2_3;
+
+ public static enum Version
+ {
+ JSF_2_3
+ }
+
+ public static final class Literal extends AnnotationLiteral<FacesConfig> implements FacesConfig
+ {
+ private static final long serialVersionUID = 1L;
+
+ public static final Literal INSTANCE = new Literal();
+
+ @Override
+ public Version version()
+ {
+ return null; // non binding, so not used
+ }
+ }
+}
diff --git a/api/src/main/java/jakarta/faces/annotation/FlowMap.java b/api/src/main/java/jakarta/faces/annotation/FlowMap.java
index 1d5db8a..3f7670c 100644
--- a/api/src/main/java/jakarta/faces/annotation/FlowMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/FlowMap.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package jakarta.faces.annotation;
-
-import jakarta.enterprise.util.AnnotationLiteral;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import jakarta.inject.Qualifier;
-
-/**
- *
- */
-@Qualifier
-@Retention(value=RUNTIME)
-@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
-public @interface FlowMap
-{
- public static final class Literal extends AnnotationLiteral<FlowMap> implements FlowMap
- {
- private static final long serialVersionUID = 1L;
-
- public static final Literal INSTANCE = new Literal();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.faces.annotation;
+
+import jakarta.enterprise.util.AnnotationLiteral;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import jakarta.inject.Qualifier;
+
+/**
+ *
+ */
+@Qualifier
+@Retention(value=RUNTIME)
+@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
+public @interface FlowMap
+{
+ public static final class Literal extends AnnotationLiteral<FlowMap> implements FlowMap
+ {
+ private static final long serialVersionUID = 1L;
+
+ public static final Literal INSTANCE = new Literal();
+ }
+}
diff --git a/api/src/main/java/jakarta/faces/annotation/HeaderMap.java b/api/src/main/java/jakarta/faces/annotation/HeaderMap.java
index 4f8fc0e..d821c4f 100644
--- a/api/src/main/java/jakarta/faces/annotation/HeaderMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/HeaderMap.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package jakarta.faces.annotation;
-
-import jakarta.enterprise.util.AnnotationLiteral;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import jakarta.inject.Qualifier;
-
-/**
- *
- */
-@Qualifier
-@Retention(value=RUNTIME)
-@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
-public @interface HeaderMap
-{
- public static final class Literal extends AnnotationLiteral<HeaderMap> implements HeaderMap
- {
- private static final long serialVersionUID = 1L;
-
- public static final Literal INSTANCE = new Literal();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.faces.annotation;
+
+import jakarta.enterprise.util.AnnotationLiteral;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import jakarta.inject.Qualifier;
+
+/**
+ *
+ */
+@Qualifier
+@Retention(value=RUNTIME)
+@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
+public @interface HeaderMap
+{
+ public static final class Literal extends AnnotationLiteral<HeaderMap> implements HeaderMap
+ {
+ private static final long serialVersionUID = 1L;
+
+ public static final Literal INSTANCE = new Literal();
+ }
+}
diff --git a/api/src/main/java/jakarta/faces/annotation/HeaderValuesMap.java b/api/src/main/java/jakarta/faces/annotation/HeaderValuesMap.java
index 27e04d8..4568a72 100644
--- a/api/src/main/java/jakarta/faces/annotation/HeaderValuesMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/HeaderValuesMap.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package jakarta.faces.annotation;
-
-import jakarta.enterprise.util.AnnotationLiteral;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import jakarta.inject.Qualifier;
-
-/**
- *
- */
-@Qualifier
-@Retention(value=RUNTIME)
-@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
-public @interface HeaderValuesMap
-{
- public static final class Literal extends AnnotationLiteral<HeaderValuesMap> implements HeaderValuesMap
- {
- private static final long serialVersionUID = 1L;
-
- public static final Literal INSTANCE = new Literal();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.faces.annotation;
+
+import jakarta.enterprise.util.AnnotationLiteral;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import jakarta.inject.Qualifier;
+
+/**
+ *
+ */
+@Qualifier
+@Retention(value=RUNTIME)
+@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
+public @interface HeaderValuesMap
+{
+ public static final class Literal extends AnnotationLiteral<HeaderValuesMap> implements HeaderValuesMap
+ {
+ private static final long serialVersionUID = 1L;
+
+ public static final Literal INSTANCE = new Literal();
+ }
+}
diff --git a/api/src/main/java/jakarta/faces/annotation/InitParameterMap.java b/api/src/main/java/jakarta/faces/annotation/InitParameterMap.java
index 21427ef..f62e430 100644
--- a/api/src/main/java/jakarta/faces/annotation/InitParameterMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/InitParameterMap.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package jakarta.faces.annotation;
-
-import jakarta.enterprise.util.AnnotationLiteral;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import jakarta.inject.Qualifier;
-
-/**
- *
- */
-@Qualifier
-@Retention(value=RUNTIME)
-@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
-public @interface InitParameterMap
-{
- public static final class Literal extends AnnotationLiteral<InitParameterMap> implements InitParameterMap
- {
- private static final long serialVersionUID = 1L;
-
- public static final Literal INSTANCE = new Literal();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.faces.annotation;
+
+import jakarta.enterprise.util.AnnotationLiteral;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import jakarta.inject.Qualifier;
+
+/**
+ *
+ */
+@Qualifier
+@Retention(value=RUNTIME)
+@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
+public @interface InitParameterMap
+{
+ public static final class Literal extends AnnotationLiteral<InitParameterMap> implements InitParameterMap
+ {
+ private static final long serialVersionUID = 1L;
+
+ public static final Literal INSTANCE = new Literal();
+ }
+}
diff --git a/api/src/main/java/jakarta/faces/annotation/ManagedProperty.java b/api/src/main/java/jakarta/faces/annotation/ManagedProperty.java
index 8536a57..8904560 100644
--- a/api/src/main/java/jakarta/faces/annotation/ManagedProperty.java
+++ b/api/src/main/java/jakarta/faces/annotation/ManagedProperty.java
@@ -1,63 +1,63 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package jakarta.faces.annotation;
-
-import jakarta.enterprise.util.AnnotationLiteral;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import jakarta.inject.Qualifier;
-
-/**
- *
- */
-@Qualifier
-@Target(value=ElementType.FIELD)
-@Retention(value=RetentionPolicy.RUNTIME)
-public @interface ManagedProperty
-{
- public String value();
-
-
- public static final class Literal extends AnnotationLiteral<ManagedProperty> implements ManagedProperty
- {
- private static final long serialVersionUID = 1L;
-
- public static final Literal INSTANCE = of("");
-
- private final String value;
-
- public static Literal of(String value)
- {
- return new Literal(value);
- }
-
- private Literal(String value)
- {
- this.value = value;
- }
-
- @Override
- public String value()
- {
- return value;
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.faces.annotation;
+
+import jakarta.enterprise.util.AnnotationLiteral;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import jakarta.inject.Qualifier;
+
+/**
+ *
+ */
+@Qualifier
+@Target(value=ElementType.FIELD)
+@Retention(value=RetentionPolicy.RUNTIME)
+public @interface ManagedProperty
+{
+ public String value();
+
+
+ public static final class Literal extends AnnotationLiteral<ManagedProperty> implements ManagedProperty
+ {
+ private static final long serialVersionUID = 1L;
+
+ public static final Literal INSTANCE = of("");
+
+ private final String value;
+
+ public static Literal of(String value)
+ {
+ return new Literal(value);
+ }
+
+ private Literal(String value)
+ {
+ this.value = value;
+ }
+
+ @Override
+ public String value()
+ {
+ return value;
+ }
+ }
+}
diff --git a/api/src/main/java/jakarta/faces/annotation/RequestCookieMap.java b/api/src/main/java/jakarta/faces/annotation/RequestCookieMap.java
index face100..ce509ae 100644
--- a/api/src/main/java/jakarta/faces/annotation/RequestCookieMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/RequestCookieMap.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package jakarta.faces.annotation;
-
-import jakarta.enterprise.util.AnnotationLiteral;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import jakarta.inject.Qualifier;
-
-/**
- *
- */
-@Qualifier
-@Retention(value=RUNTIME)
-@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
-public @interface RequestCookieMap
-{
- public static final class Literal extends AnnotationLiteral<RequestCookieMap> implements RequestCookieMap
- {
- private static final long serialVersionUID = 1L;
-
- public static final Literal INSTANCE = new Literal();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.faces.annotation;
+
+import jakarta.enterprise.util.AnnotationLiteral;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import jakarta.inject.Qualifier;
+
+/**
+ *
+ */
+@Qualifier
+@Retention(value=RUNTIME)
+@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
+public @interface RequestCookieMap
+{
+ public static final class Literal extends AnnotationLiteral<RequestCookieMap> implements RequestCookieMap
+ {
+ private static final long serialVersionUID = 1L;
+
+ public static final Literal INSTANCE = new Literal();
+ }
+}
diff --git a/api/src/main/java/jakarta/faces/annotation/RequestMap.java b/api/src/main/java/jakarta/faces/annotation/RequestMap.java
index cd823dd..5fef021 100644
--- a/api/src/main/java/jakarta/faces/annotation/RequestMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/RequestMap.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package jakarta.faces.annotation;
-
-import jakarta.enterprise.util.AnnotationLiteral;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import jakarta.inject.Qualifier;
-
-/**
- *
- */
-@Qualifier
-@Retention(value=RUNTIME)
-@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
-public @interface RequestMap
-{
- public static final class Literal extends AnnotationLiteral<RequestMap> implements RequestMap
- {
- private static final long serialVersionUID = 1L;
-
- public static final Literal INSTANCE = new Literal();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.faces.annotation;
+
+import jakarta.enterprise.util.AnnotationLiteral;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import jakarta.inject.Qualifier;
+
+/**
+ *
+ */
+@Qualifier
+@Retention(value=RUNTIME)
+@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
+public @interface RequestMap
+{
+ public static final class Literal extends AnnotationLiteral<RequestMap> implements RequestMap
+ {
+ private static final long serialVersionUID = 1L;
+
+ public static final Literal INSTANCE = new Literal();
+ }
+}
diff --git a/api/src/main/java/jakarta/faces/annotation/RequestParameterMap.java b/api/src/main/java/jakarta/faces/annotation/RequestParameterMap.java
index 4f748e6..2946029 100644
--- a/api/src/main/java/jakarta/faces/annotation/RequestParameterMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/RequestParameterMap.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package jakarta.faces.annotation;
-
-import jakarta.enterprise.util.AnnotationLiteral;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import jakarta.inject.Qualifier;
-
-/**
- *
- */
-@Qualifier
-@Retention(value=RUNTIME)
-@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
-public @interface RequestParameterMap
-{
- public static final class Literal extends AnnotationLiteral<RequestParameterMap> implements RequestParameterMap
- {
- private static final long serialVersionUID = 1L;
-
- public static final Literal INSTANCE = new Literal();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.faces.annotation;
+
+import jakarta.enterprise.util.AnnotationLiteral;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import jakarta.inject.Qualifier;
+
+/**
+ *
+ */
+@Qualifier
+@Retention(value=RUNTIME)
+@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
+public @interface RequestParameterMap
+{
+ public static final class Literal extends AnnotationLiteral<RequestParameterMap> implements RequestParameterMap
+ {
+ private static final long serialVersionUID = 1L;
+
+ public static final Literal INSTANCE = new Literal();
+ }
+}
diff --git a/api/src/main/java/jakarta/faces/annotation/RequestParameterValuesMap.java b/api/src/main/java/jakarta/faces/annotation/RequestParameterValuesMap.java
index f1f1bab..e85b073 100644
--- a/api/src/main/java/jakarta/faces/annotation/RequestParameterValuesMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/RequestParameterValuesMap.java
@@ -1,43 +1,43 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package jakarta.faces.annotation;
-
-import jakarta.enterprise.util.AnnotationLiteral;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import jakarta.inject.Qualifier;
-
-/**
- *
- */
-@Qualifier
-@Retention(value=RUNTIME)
-@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
-public @interface RequestParameterValuesMap
-{
- public static final class Literal extends AnnotationLiteral<RequestParameterValuesMap>
- implements RequestParameterValuesMap
- {
- private static final long serialVersionUID = 1L;
-
- public static final Literal INSTANCE = new Literal();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.faces.annotation;
+
+import jakarta.enterprise.util.AnnotationLiteral;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import jakarta.inject.Qualifier;
+
+/**
+ *
+ */
+@Qualifier
+@Retention(value=RUNTIME)
+@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
+public @interface RequestParameterValuesMap
+{
+ public static final class Literal extends AnnotationLiteral<RequestParameterValuesMap>
+ implements RequestParameterValuesMap
+ {
+ private static final long serialVersionUID = 1L;
+
+ public static final Literal INSTANCE = new Literal();
+ }
+}
diff --git a/api/src/main/java/jakarta/faces/annotation/SessionMap.java b/api/src/main/java/jakarta/faces/annotation/SessionMap.java
index 1d50af9..165a5c8 100644
--- a/api/src/main/java/jakarta/faces/annotation/SessionMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/SessionMap.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package jakarta.faces.annotation;
-
-import jakarta.enterprise.util.AnnotationLiteral;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import jakarta.inject.Qualifier;
-
-/**
- *
- */
-@Qualifier
-@Retention(value=RUNTIME)
-@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
-public @interface SessionMap
-{
- public static final class Literal extends AnnotationLiteral<SessionMap> implements SessionMap
- {
- private static final long serialVersionUID = 1L;
-
- public static final Literal INSTANCE = new Literal();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.faces.annotation;
+
+import jakarta.enterprise.util.AnnotationLiteral;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import jakarta.inject.Qualifier;
+
+/**
+ *
+ */
+@Qualifier
+@Retention(value=RUNTIME)
+@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
+public @interface SessionMap
+{
+ public static final class Literal extends AnnotationLiteral<SessionMap> implements SessionMap
+ {
+ private static final long serialVersionUID = 1L;
+
+ public static final Literal INSTANCE = new Literal();
+ }
+}
diff --git a/api/src/main/java/jakarta/faces/annotation/View.java b/api/src/main/java/jakarta/faces/annotation/View.java
index d1d353f..f153790 100644
--- a/api/src/main/java/jakarta/faces/annotation/View.java
+++ b/api/src/main/java/jakarta/faces/annotation/View.java
@@ -1,92 +1,92 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package jakarta.faces.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.RetentionPolicy;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import jakarta.enterprise.util.AnnotationLiteral;
-import jakarta.inject.Qualifier;
-
-/**
- * <p class="changed_added_4_0">
- * The presence of this annotation on a target (type, method, parameter or field) within anapplication
- * is used to indicate that this target is somehow handling a Faces View Id or Ids.
- * </p>
- *
- * <p>
- * The exact way in which such view is handled depends on the annotated element in question.
- *
- * @since 4.0
- *
- */
-@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD })
-@Retention(RetentionPolicy.RUNTIME)
-@Qualifier
-@Documented
-public @interface View
-{
- /**
- * <p>
- * Set the Faces View Id pattern.
- * </p>
- *
- * The Faces View Id pattern can represent a single view, such as "/index.xhtml",
- * or a pattern like "/foo/bar/*". Though the exact interpretation of the Faces View Id
- * for a single view is ultimately defined by the annotated element, in general it should
- * align with the return value from an action expression
- * (see {@link jakarta.faces.component.ActionSource2#setActionExpression(jakarta.el.MethodExpression)}
- *
- * @return the Faces View Id pattern
- */
- String value() default "";
-
- /**
- * Supports inline instantiation of the {@link View} annotation.
- *
- */
- public final static class Literal extends AnnotationLiteral<View> implements View
- {
- public static final Literal INSTANCE = of("");
-
- private static final long serialVersionUID = 1L;
-
- private final String value;
-
- public static Literal of(String value)
- {
- return new Literal(value);
- }
-
- private Literal(String value)
- {
- this.value = value;
- }
-
- @Override
- public String value()
- {
- return value;
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.faces.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import jakarta.enterprise.util.AnnotationLiteral;
+import jakarta.inject.Qualifier;
+
+/**
+ * <p class="changed_added_4_0">
+ * The presence of this annotation on a target (type, method, parameter or field) within anapplication
+ * is used to indicate that this target is somehow handling a Faces View Id or Ids.
+ * </p>
+ *
+ * <p>
+ * The exact way in which such view is handled depends on the annotated element in question.
+ *
+ * @since 4.0
+ *
+ */
+@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD })
+@Retention(RetentionPolicy.RUNTIME)
+@Qualifier
+@Documented
+public @interface View
+{
+ /**
+ * <p>
+ * Set the Faces View Id pattern.
+ * </p>
+ *
+ * The Faces View Id pattern can represent a single view, such as "/index.xhtml",
+ * or a pattern like "/foo/bar/*". Though the exact interpretation of the Faces View Id
+ * for a single view is ultimately defined by the annotated element, in general it should
+ * align with the return value from an action expression
+ * (see {@link jakarta.faces.component.ActionSource2#setActionExpression(jakarta.el.MethodExpression)}
+ *
+ * @return the Faces View Id pattern
+ */
+ String value() default "";
+
+ /**
+ * Supports inline instantiation of the {@link View} annotation.
+ *
+ */
+ public final static class Literal extends AnnotationLiteral<View> implements View
+ {
+ public static final Literal INSTANCE = of("");
+
+ private static final long serialVersionUID = 1L;
+
+ private final String value;
+
+ public static Literal of(String value)
+ {
+ return new Literal(value);
+ }
+
+ private Literal(String value)
+ {
+ this.value = value;
+ }
+
+ @Override
+ public String value()
+ {
+ return value;
+ }
+ }
+}
diff --git a/api/src/main/java/jakarta/faces/annotation/ViewMap.java b/api/src/main/java/jakarta/faces/annotation/ViewMap.java
index f0d4ce1..a1fe3bb 100644
--- a/api/src/main/java/jakarta/faces/annotation/ViewMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/ViewMap.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package jakarta.faces.annotation;
-
-import jakarta.enterprise.util.AnnotationLiteral;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import jakarta.inject.Qualifier;
-
-/**
- *
- */
-@Qualifier
-@Retention(value=RUNTIME)
-@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
-public @interface ViewMap
-{
- public static final class Literal extends AnnotationLiteral<ViewMap> implements ViewMap
- {
- private static final long serialVersionUID = 1L;
-
- public static final Literal INSTANCE = new Literal();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.faces.annotation;
+
+import jakarta.enterprise.util.AnnotationLiteral;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import jakarta.inject.Qualifier;
+
+/**
+ *
+ */
+@Qualifier
+@Retention(value=RUNTIME)
+@Target(value={ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
+public @interface ViewMap
+{
+ public static final class Literal extends AnnotationLiteral<ViewMap> implements ViewMap
+ {
+ private static final long serialVersionUID = 1L;
+
+ public static final Literal INSTANCE = new Literal();
+ }
+}
diff --git a/api/src/main/java/jakarta/faces/application/StateManager.java b/api/src/main/java/jakarta/faces/application/StateManager.java
index 68b8d68..6118645 100755
--- a/api/src/main/java/jakarta/faces/application/StateManager.java
+++ b/api/src/main/java/jakarta/faces/application/StateManager.java
@@ -1,208 +1,208 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package jakarta.faces.application;
-
-
-import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
-
-import jakarta.faces.context.FacesContext;
-import jakarta.faces.view.ViewDeclarationLanguage;
-import java.io.IOException;
-import java.util.Map;
-import org.apache.myfaces.core.api.shared.lang.Assert;
-
-/**
- * Responsible for storing sufficient information about a component tree so that an identical tree can later be
- * recreated.
- * <p>
- * It is up to the concrete implementation to decide whether to use information from the "view template" that was used
- * to first create the view, or whether to store sufficient information to enable the view to be restored without any
- * reference to the original template. However as JSF components have mutable fields that can be set by code, and
- * affected by user input, at least some state does need to be kept in order to recreate a previously-existing component
- * tree.
- * <p>
- * There are two different options defined by the specification: "client" and "server" state.
- * <p>
- * When "client" state is configured, all state information required to create the tree is embedded within the data
- * rendered to the client. Note that because data received from a remote client must always be treated as "tainted",
- * care must be taken when using such data. Some StateManager implementations may use encryption to ensure that clients
- * cannot modify the data, and that the data received on postback is therefore trustworthy.
- * <p>
- * When "server" state is configured, the data is saved somewhere "on the back end", and (at most) a token is embedded
- * in the data rendered to the user.
- * <p>
- * This class is usually invoked by a concrete implementation of ViewHandler.
- * <p>
- * Note that class ViewHandler isolates JSF components from the details of the request format. This class isolates JSF
- * components from the details of the response format. Because request and response are usually tightly coupled, the
- * StateManager and ViewHandler implementations are also usually fairly tightly coupled (ie the ViewHandler/StateManager
- * implementations come as pairs).
- * <p>
- * See also the <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a>
- */
-public abstract class StateManager
-{
- /**
- * Define the state method to be used. There are two different options defined by the
- * specification: "client" and "server" state.
- * <p>
- * When "client" state is configured, all state information required to create the tree is embedded within
- * the data rendered to the client. Note that because data received from a remote client must always be
- * treated as "tainted", care must be taken when using such data. Some StateManager implementations may
- * use encryption to ensure that clients cannot modify the data, and that the data received on postback
- * is therefore trustworthy.
- * </p>
- * <p>
- * When "server" state is configured, the data is saved somewhere "on the back end", and (at most) a
- * token is embedded in the data rendered to the user.
- * </p>
- */
- @JSFWebConfigParam(defaultValue="server", expectedValues="server,client",
- since="1.1", group="state", tags="performance", ignoreUpperLowerCase = true,
- desc="Define the state method to be used. There are two different options "
- + "defined by the specification: 'client' and 'server' state.")
- public static final String STATE_SAVING_METHOD_PARAM_NAME = "jakarta.faces.STATE_SAVING_METHOD";
- public static final String STATE_SAVING_METHOD_CLIENT = "client";
- public static final String STATE_SAVING_METHOD_SERVER = "server";
-
- /**
- * Indicate the viewId(s) separated by commas that should be saved and restored fully,
- * without use Partial State Saving (PSS).
- */
- @JSFWebConfigParam(since="2.0", group="state")
- public static final String FULL_STATE_SAVING_VIEW_IDS_PARAM_NAME = "jakarta.faces.FULL_STATE_SAVING_VIEW_IDS";
-
- /**
- * Enable or disable partial state saving algorithm.
- *
- * <p>Partial State Saving algorithm allows to reduce the size of the state required to save a view,
- * keeping track of the "delta" or differences between the view build by first time and the current
- * state of the view.</p>
- * <p>If the webapp faces-config file version is 2.0 or upper the default value is true, otherwise is false.</p>
- */
- @JSFWebConfigParam(expectedValues="true,false", since="2.0", defaultValue="true (false with 1.2 webapps)",
- tags="performance", group="state")
- public static final String PARTIAL_STATE_SAVING_PARAM_NAME = "jakarta.faces.PARTIAL_STATE_SAVING";
- private Boolean _savingStateInClient = null;
-
- public static final String IS_BUILDING_INITIAL_STATE = "jakarta.faces.IS_BUILDING_INITIAL_STATE";
-
- public static final String IS_SAVING_STATE = "jakarta.faces.IS_SAVING_STATE";
-
- /**
- * Indicate if the state should be serialized before save it on the session.
- * <p>
- * Only applicable if state saving method is "server" (= default).
- * If <code>true</code> (default) the state will be serialized to a byte stream before it is
- * written to the session.
- * If <code>false</code> the state will not be serialized to a byte stream.
- * </p>
- */
- @JSFWebConfigParam(since="2.2", group="state", tags="performance",
- defaultValue="false", expectedValues="true,false")
- public static final java.lang.String SERIALIZE_SERVER_STATE_PARAM_NAME = "jakarta.faces.SERIALIZE_SERVER_STATE";
-
- /**
- * This method should be called from somewhere when ajax response is created to update the state saving param
- * on client. The place where this method is called is an implementation detail, so there is no references about
- * from where in the spec javadoc.
- *
- * @since 2.0
- * @param context
- * @return
- */
- public String getViewState(FacesContext context)
- {
- Object savedView = null;
-
- if (context != null && !context.getViewRoot().isTransient())
- {
- String viewId = context.getViewRoot().getViewId();
-
- ViewDeclarationLanguage vdl = context.getApplication().getViewHandler()
- .getViewDeclarationLanguage(context, viewId);
- if (vdl != null)
- {
- Map<Object, Object> contextAttributes = context.getAttributes();
- try
- {
- contextAttributes.put(IS_SAVING_STATE, Boolean.TRUE);
-
- savedView = vdl.getStateManagementStrategy(context, viewId).saveView(context);
- }
- finally
- {
- contextAttributes.remove(IS_SAVING_STATE);
- }
- }
- }
-
- return context.getRenderKit().getResponseStateManager().getViewState(context, savedView);
- }
-
- public boolean isSavingStateInClient(FacesContext context)
- {
- Assert.notNull(context, "context");
- if (_savingStateInClient != null)
- {
- return _savingStateInClient;
- }
-
- String stateSavingMethod = context.getExternalContext().getInitParameter(STATE_SAVING_METHOD_PARAM_NAME);
- if (stateSavingMethod == null)
- {
- _savingStateInClient = Boolean.FALSE; // Specs 10.1.3: default server saving
- context.getExternalContext().log("No state saving method defined, assuming default server state saving");
- }
- else if (stateSavingMethod.equalsIgnoreCase(STATE_SAVING_METHOD_CLIENT))
- {
- _savingStateInClient = Boolean.TRUE;
- }
- else if (stateSavingMethod.equalsIgnoreCase(STATE_SAVING_METHOD_SERVER))
- {
- _savingStateInClient = Boolean.FALSE;
- }
- else
- {
- _savingStateInClient = Boolean.FALSE; // Specs 10.1.3: default server saving
- context.getExternalContext().log(
- "Illegal state saving method '" + stateSavingMethod + "', default server state saving will be used");
- }
- return _savingStateInClient;
- }
-
- /**
- * Associate the provided state object with the current response being generated.
- * <p>
- * When client-side state is enabled, it is expected that method writes the data contained in the state parameter to
- * the response somehow.
- * <p>
- * When server-side state is enabled, at most a "token" is expected to be written.
- * <p>
- * This method should be overridden by subclasses. It is not abstract because a default implementation is provided
- * that forwards to the old writeState method; this allows subclasses of StateManager written using the JSF1.1 API
- * to continue to work.
- * <p>
- *
- * @since 1.2
- */
- public void writeState(FacesContext context, Object state) throws IOException
- {
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.faces.application;
+
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
+
+import jakarta.faces.context.FacesContext;
+import jakarta.faces.view.ViewDeclarationLanguage;
+import java.io.IOException;
+import java.util.Map;
+import org.apache.myfaces.core.api.shared.lang.Assert;
+
+/**
+ * Responsible for storing sufficient information about a component tree so that an identical tree can later be
+ * recreated.
+ * <p>
+ * It is up to the concrete implementation to decide whether to use information from the "view template" that was used
+ * to first create the view, or whether to store sufficient information to enable the view to be restored without any
+ * reference to the original template. However as JSF components have mutable fields that can be set by code, and
+ * affected by user input, at least some state does need to be kept in order to recreate a previously-existing component
+ * tree.
+ * <p>
+ * There are two different options defined by the specification: "client" and "server" state.
+ * <p>
+ * When "client" state is configured, all state information required to create the tree is embedded within the data
+ * rendered to the client. Note that because data received from a remote client must always be treated as "tainted",
+ * care must be taken when using such data. Some StateManager implementations may use encryption to ensure that clients
+ * cannot modify the data, and that the data received on postback is therefore trustworthy.
+ * <p>
+ * When "server" state is configured, the data is saved somewhere "on the back end", and (at most) a token is embedded
+ * in the data rendered to the user.
+ * <p>
+ * This class is usually invoked by a concrete implementation of ViewHandler.
+ * <p>
+ * Note that class ViewHandler isolates JSF components from the details of the request format. This class isolates JSF
+ * components from the details of the response format. Because request and response are usually tightly coupled, the
+ * StateManager and ViewHandler implementations are also usually fairly tightly coupled (ie the ViewHandler/StateManager
+ * implementations come as pairs).
+ * <p>
+ * See also the <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a>
+ */
+public abstract class StateManager
+{
+ /**
+ * Define the state method to be used. There are two different options defined by the
+ * specification: "client" and "server" state.
+ * <p>
+ * When "client" state is configured, all state information required to create the tree is embedded within
+ * the data rendered to the client. Note that because data received from a remote client must always be
+ * treated as "tainted", care must be taken when using such data. Some StateManager implementations may
+ * use encryption to ensure that clients cannot modify the data, and that the data received on postback
+ * is therefore trustworthy.
+ * </p>
+ * <p>
+ * When "server" state is configured, the data is saved somewhere "on the back end", and (at most) a
+ * token is embedded in the data rendered to the user.
+ * </p>
+ */
+ @JSFWebConfigParam(defaultValue="server", expectedValues="server,client",
+ since="1.1", group="state", tags="performance", ignoreUpperLowerCase = true,
+ desc="Define the state method to be used. There are two different options "
+ + "defined by the specification: 'client' and 'server' state.")
+ public static final String STATE_SAVING_METHOD_PARAM_NAME = "jakarta.faces.STATE_SAVING_METHOD";
+ public static final String STATE_SAVING_METHOD_CLIENT = "client";
+ public static final String STATE_SAVING_METHOD_SERVER = "server";
+
+ /**
+ * Indicate the viewId(s) separated by commas that should be saved and restored fully,
+ * without use Partial State Saving (PSS).
+ */
+ @JSFWebConfigParam(since="2.0", group="state")
+ public static final String FULL_STATE_SAVING_VIEW_IDS_PARAM_NAME = "jakarta.faces.FULL_STATE_SAVING_VIEW_IDS";
+
+ /**
+ * Enable or disable partial state saving algorithm.
+ *
+ * <p>Partial State Saving algorithm allows to reduce the size of the state required to save a view,
+ * keeping track of the "delta" or differences between the view build by first time and the current
+ * state of the view.</p>
+ * <p>If the webapp faces-config file version is 2.0 or upper the default value is true, otherwise is false.</p>
+ */
+ @JSFWebConfigParam(expectedValues="true,false", since="2.0", defaultValue="true (false with 1.2 webapps)",
+ tags="performance", group="state")
+ public static final String PARTIAL_STATE_SAVING_PARAM_NAME = "jakarta.faces.PARTIAL_STATE_SAVING";
+ private Boolean _savingStateInClient = null;
+
+ public static final String IS_BUILDING_INITIAL_STATE = "jakarta.faces.IS_BUILDING_INITIAL_STATE";
+
+ public static final String IS_SAVING_STATE = "jakarta.faces.IS_SAVING_STATE";
+
+ /**
+ * Indicate if the state should be serialized before save it on the session.
+ * <p>
+ * Only applicable if state saving method is "server" (= default).
+ * If <code>true</code> (default) the state will be serialized to a byte stream before it is
+ * written to the session.
+ * If <code>false</code> the state will not be serialized to a byte stream.
+ * </p>
+ */
+ @JSFWebConfigParam(since="2.2", group="state", tags="performance",
+ defaultValue="false", expectedValues="true,false")
+ public static final java.lang.String SERIALIZE_SERVER_STATE_PARAM_NAME = "jakarta.faces.SERIALIZE_SERVER_STATE";
+
+ /**
+ * This method should be called from somewhere when ajax response is created to update the state saving param
+ * on client. The place where this method is called is an implementation detail, so there is no references about
+ * from where in the spec javadoc.
+ *
+ * @since 2.0
+ * @param context
+ * @return
+ */
+ public String getViewState(FacesContext context)
+ {
+ Object savedView = null;
+
+ if (context != null && !context.getViewRoot().isTransient())
+ {
+ String viewId = context.getViewRoot().getViewId();
+
+ ViewDeclarationLanguage vdl = context.getApplication().getViewHandler()
+ .getViewDeclarationLanguage(context, viewId);
+ if (vdl != null)
+ {
+ Map<Object, Object> contextAttributes = context.getAttributes();
+ try
+ {
+ contextAttributes.put(IS_SAVING_STATE, Boolean.TRUE);
+
+ savedView = vdl.getStateManagementStrategy(context, viewId).saveView(context);
+ }
+ finally
+ {
+ contextAttributes.remove(IS_SAVING_STATE);
+ }
+ }
+ }
+
+ return context.getRenderKit().getResponseStateManager().getViewState(context, savedView);
+ }
+
+ public boolean isSavingStateInClient(FacesContext context)
+ {
+ Assert.notNull(context, "context");
+ if (_savingStateInClient != null)
+ {
+ return _savingStateInClient;
+ }
+
+ String stateSavingMethod = context.getExternalContext().getInitParameter(STATE_SAVING_METHOD_PARAM_NAME);
+ if (stateSavingMethod == null)
+ {
+ _savingStateInClient = Boolean.FALSE; // Specs 10.1.3: default server saving
+ context.getExternalContext().log("No state saving method defined, assuming default server state saving");
+ }
+ else if (stateSavingMethod.equalsIgnoreCase(STATE_SAVING_METHOD_CLIENT))
+ {
+ _savingStateInClient = Boolean.TRUE;
+ }
+ else if (stateSavingMethod.equalsIgnoreCase(STATE_SAVING_METHOD_SERVER))
+ {
+ _savingStateInClient = Boolean.FALSE;
+ }
+ else
+ {
+ _savingStateInClient = Boolean.FALSE; // Specs 10.1.3: default server saving
+ context.getExternalContext().log(
+ "Illegal state saving method '" + stateSavingMethod + "', default server state saving will be used");
+ }
+ return _savingStateInClient;
+ }
+
+ /**
+ * Associate the provided state object with the current response being generated.
+ * <p>
+ * When client-side state is enabled, it is expected that method writes the data contained in the state parameter to
+ * the response somehow.
+ * <p>
+ * When server-side state is enabled, at most a "token" is expected to be written.
+ * <p>
+ * This method should be overridden by subclasses. It is not abstract because a default implementation is provided
+ * that forwards to the old writeState method; this allows subclasses of StateManager written using the JSF1.1 API
+ * to continue to work.
+ * <p>
+ *
+ * @since 1.2
+ */
+ public void writeState(FacesContext context, Object state) throws IOException
+ {
+ }
+}
diff --git a/api/src/main/javascript/META-INF/resources/myfaces/api/faces.js b/api/src/main/javascript/META-INF/resources/myfaces/api/faces.js
index 658d1f1..55eba84 100644
--- a/api/src/main/javascript/META-INF/resources/myfaces/api/faces.js
+++ b/api/src/main/javascript/META-INF/resources/myfaces/api/faces.js
@@ -1,487 +1,487 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-/**
- * MyFaces core javascripting libraries
- *
- * Those are the central public API functions in the Faces2
- * Ajax API! They handle the entire form submit and ajax send
- * and resolve cycle!
- */
-
-/**
-* @ignore
-*/
-if (!window.faces) {
- /**
- * @namespace faces
- */
- var faces = new function() {
- /*
- * Version of the implementation for the faces.js.
- * <p />
- * as specified within the faces specifications:
- * <ul>
- * <li>left two digits major release number</li>
- * <li>middle two digits minor spec release number</li>
- * <li>right two digits bug release number</li>
- * </ul>
- * @constant
- */
- this.specversion = 220000;
- /**
- * Implementation version as specified within the faces specification.
- * <p />
- * A number increased with every implementation version
- * and reset by moving to a new spec release number
- *
- * @constant
- */
- this.implversion = 0;
-
- /**
- * SeparatorChar as defined by UINamingContainer.getNamingContainerSeparatorChar()
- * @type {Char}
- */
- this.separatorchar = getSeparatorChar();
-
- /**
- * This method is responsible for the return of a given project stage as defined
- * by the faces specification.
- * <p/>
- * Valid return values are:
- * <ul>
- * <li>"Production"</li>
- * <li>"Development"</li>
- * <li>"SystemTest"</li>
- * <li>"UnitTest"</li>
- * </li>
- *
- * @return {String} the current project state emitted by the server side method:
- * <i>jakarta.faces.application.Application.getProjectStage()</i>
- */
- this.getProjectStage = function() {
- var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
- return impl.getProjectStage();
- };
-
- /**
- * collect and encode data for a given form element (must be of type form)
- * find the jakarta.faces.ViewState element and encode its value as well!
- * return a concatenated string of the encoded values!
- *
- * @throws an exception in case of the given element not being of type form!
- * https://issues.apache.org/jira/browse/MYFACES-2110
- */
- this.getViewState = function(formElement) {
- /*we are not allowed to add the impl on a global scope so we have to inline the code*/
- var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
- return impl.getViewState(formElement);
- };
-
- /**
- * returns the window identifier for the given node / window
- * @param {optional String | DomNode} the node for which the client identifier has to be determined
- * @return the window identifier or null if none is found
- */
- this.getClientWindow = function() {
- /*we are not allowed to add the impl on a global scope so we have to inline the code*/
- var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
- return (arguments.length)? impl.getClientWindow(arguments[0]) : impl.getClientWindow();
- }
-
- //private helper functions
- function getSeparatorChar() {
- var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
- return impl.getSeparatorChar();
- }
-
- };
-
- //jsdoc helper to avoid warnings, we map later
- window.faces = faces;
-}
-
-/**
- * just to make sure no questions arise, I simply prefer here a weak
- * typeless comparison just in case some frameworks try to interfere
- * by overriding null or fiddeling around with undefined or typeof in some ways
- * it is safer in this case than the standard way of doing a strong comparison
- **/
-if (!faces.ajax) {
- /**
- * @namespace faces.ajax
- */
- faces.ajax = new function() {
-
-
- /**
- * this function has to send the ajax requests
- *
- * following request conditions must be met:
- * <ul>
- * <li> the request must be sent asynchronously! </li>
- * <li> the request must be a POST!!! request </li>
- * <li> the request url must be the form action attribute </li>
- * <li> all requests must be queued with a client side request queue to ensure the request ordering!</li>
- * </ul>
- *
- * @param {String|Node} element: any dom element no matter being it html or faces, from which the event is emitted
- * @param {EVENT} event: any javascript event supported by that object
- * @param {Map} options : map of options being pushed into the ajax cycle
- */
- this.request = function(element, event, options) {
- if (!options) {
- options = {};
- }
- /*we are not allowed to add the impl on a global scope so we have to inline the code*/
- var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
- return impl.request(element, event, options);
- };
-
- /**
- * Adds an error handler to our global error queue.
- * the error handler must be of the format <i>function errorListener(<errorData>)</i>
- * with errorData being of following format:
- * <ul>
- * <li> errorData.type : "error"</li>
- * <li> errorData.status : the error status message</li>
- * <li> errorData.errorName : the server error name in case of a server error</li>
- * <li> errorData.errorMessage : the server error message in case of a server error</li>
- * <li> errorData.source : the issuing source element which triggered the request </li>
- * <li> eventData.responseCode: the response code (aka http request response code, 401 etc...) </li>
- * <li> eventData.responseText: the request response text </li>
- * <li> eventData.responseXML: the request response xml </li>
- * </ul>
- *
- * @param {function} errorListener error handler must be of the format <i>function errorListener(<errorData>)</i>
- */
- this.addOnError = function(/*function*/errorListener) {
- var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
- return impl.addOnError(errorListener);
- };
-
- /**
- * Adds a global event listener to the ajax event queue. The event listener must be a function
- * of following format: <i>function eventListener(<eventData>)</i>
- *
- * @param {function} eventListener event must be of the format <i>function eventListener(<eventData>)</i>
- */
- this.addOnEvent = function(/*function*/eventListener) {
- var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
- return impl.addOnEvent(eventListener);
- };
-
- /**
- * processes the ajax response if the ajax request completes successfully
- * @param request the ajax request!
- * @param context the ajax context!
- */
- this.response = function(/*xhr request object*/request, context) {
- var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
- return impl.response(request, context);
- };
- };
-}
-
-if (!faces.util) {
- /**
- * @namespace faces.util
- */
- faces.util = new function() {
-
- /**
- * varargs function which executes a chain of code (functions or any other code)
- *
- * if any of the code returns false, the execution
- * is terminated prematurely skipping the rest of the code!
- *
- * @param {DomNode} source, the callee object
- * @param {Event} event, the event object of the callee event triggering this function
- * @param {optional} functions to be chained, if any of those return false the chain is broken
- */
- this.chain = function(source, event) {
- var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
- return impl.chain.apply(impl, arguments);
- };
- };
-}
-
-if (!faces.push) {
-
- /**
- * @namespace faces.push
- */
- faces.push = new function() {
-
- // "Constant" fields ----------------------------------------------------------------------------------------------
- var URL_PROTOCOL = window.location.protocol.replace("http", "ws") + "//";
- var RECONNECT_INTERVAL = 500;
- var MAX_RECONNECT_ATTEMPTS = 25;
- var REASON_EXPIRED = "Expired";
-
- // Private static fields ------------------------------------------------------------------------------------------
-
- /* socket map by token */
- var sockets = {};
- /* component attributes by clientId */
- var components = {};
- /* client ids by token (share websocket connection) */
- var clientIdsByTokens = {};
- var self = {};
-
- // Private constructor functions ----------------------------------------------------------------------------------
- /**
- * Creates a reconnecting web socket. When the web socket successfully connects on first attempt, then it will
- * automatically reconnect on timeout with cumulative intervals of 500ms with a maximum of 25 attempts (~3 minutes).
- * The <code>onclose</code> function will be called with the error code of the last attempt.
- * @constructor
- * @param {string} channelToken the channel token associated with this websocket connection
- * @param {string} url The URL of the web socket
- * @param {string} channel The name of the web socket channel.
- */
- function Socket(channelToken, url, channel) {
-
- // Private fields -----------------------------------------------------------------------------------------
-
- var socket;
- var reconnectAttempts = 0;
- var self = this;
-
- // Public functions ---------------------------------------------------------------------------------------
-
- /**
- * Opens the reconnecting web socket.
- */
- self.open = function() {
- if (socket && socket.readyState == 1) {
- return;
- }
-
- socket = new WebSocket(url);
-
- socket.onopen = function(event) {
- if (!reconnectAttempts) {
- var clientIds = clientIdsByTokens[channelToken];
- for (var i = clientIds.length - 1; i >= 0; i--){
- var socketClientId = clientIds[i];
- components[socketClientId]['onopen'](channel);
- }
- }
- reconnectAttempts = 0;
- };
-
- socket.onmessage = function(event) {
- var message = JSON.parse(event.data);
- for (var i = clientIdsByTokens[channelToken].length - 1; i >= 0; i--){
- var socketClientId = clientIdsByTokens[channelToken][i];
- if(document.getElementById(socketClientId)) {
- try{
- components[socketClientId]['onmessage'](message, channel, event);
- }catch(e){
- //Ignore
- }
- var behaviors = components[socketClientId]['behaviors'];
- var functions = behaviors[message];
- if (functions && functions.length) {
- for (var j = 0; j < functions.length; j++) {
- try{
- functions[j](null);
- }catch(e){
- //Ignore
- }
- }
- }
- } else {
- clientIdsByTokens[channelToken].splice(i,1);
- }
- }
- if (clientIdsByTokens[channelToken].length == 0){
- //tag dissapeared
- self.close();
- }
-
- };
-
- socket.onclose = function(event) {
- if (!socket
- || (event.code == 1000 && event.reason == REASON_EXPIRED)
- || (event.code == 1008)
- || (!reconnectAttempts)
- || (reconnectAttempts >= MAX_RECONNECT_ATTEMPTS))
- {
- var clientIds = clientIdsByTokens[channelToken];
- for (var i = clientIds.length - 1; i >= 0; i--){
- var socketClientId = clientIds[i];
- components[socketClientId]['onclose'](event.code, channel, event);
- }
- }
- else {
- setTimeout(self.open, RECONNECT_INTERVAL * reconnectAttempts++);
- }
- };
- };
-
- socket.onerror = function(event) {
- var clientIds = clientIdsByTokens[channelToken];
- for (var i = clientIds.length - 1; i >= 0; i--){
- var socketClientId = clientIds[i];
- components[socketClientId]['onerror'](channel);
- }
- };
-
- /**
- * Closes the reconnecting web socket.
- */
- self.close = function() {
- if (socket) {
- var s = socket;
- socket = null;
- s.close();
- }
- };
-
- }
-
- // Public static functions ----------------------------------------------------------------------------------------
-
- /**
- *
- * @param {function} onopen The function to be invoked when the web socket is opened.
- * @param {function} onmessage The function to be invoked when a message is received.
- * @param {function} onerror The function to be invoked when the web socket throws a error.
- * @param {function} onclose The function to be invoked when the web socket is closed.
- * @param {boolean} autoconnect Whether or not to immediately open the socket. Defaults to <code>false</code>.
- */
- this.init = function(socketClientId, uri, channel, onopen, onmessage, onerror, onclose, behaviorScripts, autoconnect) {
-
- onclose = resolveFunction(onclose);
-
- if (!window.WebSocket) { // IE6-9.
- onclose(-1, channel);
- return;
- }
-
- var channelToken = uri.substr(uri.indexOf('?')+1);
-
- if (!components[socketClientId]) {
- components[socketClientId] = {
- 'channelToken': channelToken,
- 'onopen': resolveFunction(onopen),
- 'onmessage' : resolveFunction(onmessage),
- 'onerror' : resolveFunction(onerror),
- 'onclose': onclose,
- 'behaviors': behaviorScripts,
- 'autoconnect': autoconnect};
- if (!clientIdsByTokens[channelToken]) {
- clientIdsByTokens[channelToken] = [];
- }
- clientIdsByTokens[channelToken].push(socketClientId);
- if (!sockets[channelToken]){
- sockets[channelToken] = new Socket(channelToken,
- getBaseURL(uri), channel);
- }
- }
-
- if (autoconnect) {
- this.open(socketClientId);
- }
- };
-
- /**
- * Open the web socket on the given channel.
- * @param {string} channel The name of the web socket channel.
- * @throws {Error} When channel is unknown.
- */
- this.open = function(socketClientId) {
- getSocket(components[socketClientId]['channelToken']).open();
- };
-
- /**
- * Close the web socket on the given channel.
- * @param {string} channel The name of the web socket channel.
- * @throws {Error} When channel is unknown.
- */
- this.close = function(socketClientId) {
- getSocket(components[socketClientId]['channelToken']).close();
- };
-
- // Private static functions ---------------------------------------------------------------------------------------
-
- /**
- *
- */
- function getBaseURL(url) {
- if (url.indexOf("://") < 0)
- {
- var base = window.location.hostname+":"+window.location.port
- return URL_PROTOCOL + base + url;
- }else
- {
- return url;
- }
- }
-
- /**
- * Get socket associated with given channelToken.
- * @param {string} channelToken The name of the web socket channelToken.
- * @return {Socket} Socket associated with given channelToken.
- * @throws {Error} When channelToken is unknown, you may need to initialize
- * it first via <code>init()</code> function.
- */
- function getSocket(channelToken) {
- var socket = sockets[channelToken];
- if (socket) {
- return socket;
- } else {
- throw new Error("Unknown channelToken: " + channelToken);
- }
- }
-
- function resolveFunction(fn) {
- return (typeof fn !== "function") && (fn = window[fn] || function(){}), fn;
- }
- // Expose self to public ------------------------------------------------------------------------------------------
-
- //return self;
- };
-}
-
-
-(!window.myfaces) ? window.myfaces = {} : null;
-if (!myfaces.ab) {
- /*
- * Shortcut of the faces.ajax.request, to shorten the rendered JS.
- */
- myfaces.ab = function(source, event, eventName, execute, render, options) {
- if (!options) {
- options = {};
- }
-
- if (eventName) {
- options["jakarta.faces.behavior.event"] = eventName;
- }
- if (execute) {
- options["execute"] = execute;
- }
- if (render) {
- options["render"] = render;
- }
-
- faces.ajax.request(source, event, options);
- };
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * MyFaces core javascripting libraries
+ *
+ * Those are the central public API functions in the Faces2
+ * Ajax API! They handle the entire form submit and ajax send
+ * and resolve cycle!
+ */
+
+/**
+* @ignore
+*/
+if (!window.faces) {
+ /**
+ * @namespace faces
+ */
+ var faces = new function() {
+ /*
+ * Version of the implementation for the faces.js.
+ * <p />
+ * as specified within the faces specifications:
+ * <ul>
+ * <li>left two digits major release number</li>
+ * <li>middle two digits minor spec release number</li>
+ * <li>right two digits bug release number</li>
+ * </ul>
+ * @constant
+ */
+ this.specversion = 220000;
+ /**
+ * Implementation version as specified within the faces specification.
+ * <p />
+ * A number increased with every implementation version
+ * and reset by moving to a new spec release number
+ *
+ * @constant
+ */
+ this.implversion = 0;
+
+ /**
+ * SeparatorChar as defined by UINamingContainer.getNamingContainerSeparatorChar()
+ * @type {Char}
+ */
+ this.separatorchar = getSeparatorChar();
+
+ /**
+ * This method is responsible for the return of a given project stage as defined
+ * by the faces specification.
+ * <p/>
+ * Valid return values are:
+ * <ul>
+ * <li>"Production"</li>
+ * <li>"Development"</li>
+ * <li>"SystemTest"</li>
+ * <li>"UnitTest"</li>
+ * </li>
+ *
+ * @return {String} the current project state emitted by the server side method:
+ * <i>jakarta.faces.application.Application.getProjectStage()</i>
+ */
+ this.getProjectStage = function() {
+ var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
+ return impl.getProjectStage();
+ };
+
+ /**
+ * collect and encode data for a given form element (must be of type form)
+ * find the jakarta.faces.ViewState element and encode its value as well!
+ * return a concatenated string of the encoded values!
+ *
+ * @throws an exception in case of the given element not being of type form!
+ * https://issues.apache.org/jira/browse/MYFACES-2110
+ */
+ this.getViewState = function(formElement) {
+ /*we are not allowed to add the impl on a global scope so we have to inline the code*/
+ var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
+ return impl.getViewState(formElement);
+ };
+
+ /**
+ * returns the window identifier for the given node / window
+ * @param {optional String | DomNode} the node for which the client identifier has to be determined
+ * @return the window identifier or null if none is found
+ */
+ this.getClientWindow = function() {
+ /*we are not allowed to add the impl on a global scope so we have to inline the code*/
+ var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
+ return (arguments.length)? impl.getClientWindow(arguments[0]) : impl.getClientWindow();
+ }
+
+ //private helper functions
+ function getSeparatorChar() {
+ var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
+ return impl.getSeparatorChar();
+ }
+
+ };
+
+ //jsdoc helper to avoid warnings, we map later
+ window.faces = faces;
+}
+
+/**
+ * just to make sure no questions arise, I simply prefer here a weak
+ * typeless comparison just in case some frameworks try to interfere
+ * by overriding null or fiddeling around with undefined or typeof in some ways
+ * it is safer in this case than the standard way of doing a strong comparison
+ **/
+if (!faces.ajax) {
+ /**
+ * @namespace faces.ajax
+ */
+ faces.ajax = new function() {
+
+
+ /**
+ * this function has to send the ajax requests
+ *
+ * following request conditions must be met:
+ * <ul>
+ * <li> the request must be sent asynchronously! </li>
+ * <li> the request must be a POST!!! request </li>
+ * <li> the request url must be the form action attribute </li>
+ * <li> all requests must be queued with a client side request queue to ensure the request ordering!</li>
+ * </ul>
+ *
+ * @param {String|Node} element: any dom element no matter being it html or faces, from which the event is emitted
+ * @param {EVENT} event: any javascript event supported by that object
+ * @param {Map} options : map of options being pushed into the ajax cycle
+ */
+ this.request = function(element, event, options) {
+ if (!options) {
+ options = {};
+ }
+ /*we are not allowed to add the impl on a global scope so we have to inline the code*/
+ var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
+ return impl.request(element, event, options);
+ };
+
+ /**
+ * Adds an error handler to our global error queue.
+ * the error handler must be of the format <i>function errorListener(<errorData>)</i>
+ * with errorData being of following format:
+ * <ul>
+ * <li> errorData.type : "error"</li>
+ * <li> errorData.status : the error status message</li>
+ * <li> errorData.errorName : the server error name in case of a server error</li>
+ * <li> errorData.errorMessage : the server error message in case of a server error</li>
+ * <li> errorData.source : the issuing source element which triggered the request </li>
+ * <li> eventData.responseCode: the response code (aka http request response code, 401 etc...) </li>
+ * <li> eventData.responseText: the request response text </li>
+ * <li> eventData.responseXML: the request response xml </li>
+ * </ul>
+ *
+ * @param {function} errorListener error handler must be of the format <i>function errorListener(<errorData>)</i>
+ */
+ this.addOnError = function(/*function*/errorListener) {
+ var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
+ return impl.addOnError(errorListener);
+ };
+
+ /**
+ * Adds a global event listener to the ajax event queue. The event listener must be a function
+ * of following format: <i>function eventListener(<eventData>)</i>
+ *
+ * @param {function} eventListener event must be of the format <i>function eventListener(<eventData>)</i>
+ */
+ this.addOnEvent = function(/*function*/eventListener) {
+ var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
+ return impl.addOnEvent(eventListener);
+ };
+
+ /**
+ * processes the ajax response if the ajax request completes successfully
+ * @param request the ajax request!
+ * @param context the ajax context!
+ */
+ this.response = function(/*xhr request object*/request, context) {
+ var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
+ return impl.response(request, context);
+ };
+ };
+}
+
+if (!faces.util) {
+ /**
+ * @namespace faces.util
+ */
+ faces.util = new function() {
+
+ /**
+ * varargs function which executes a chain of code (functions or any other code)
+ *
+ * if any of the code returns false, the execution
+ * is terminated prematurely skipping the rest of the code!
+ *
+ * @param {DomNode} source, the callee object
+ * @param {Event} event, the event object of the callee event triggering this function
+ * @param {optional} functions to be chained, if any of those return false the chain is broken
+ */
+ this.chain = function(source, event) {
+ var impl = myfaces._impl.core._Runtime.getGlobalConfig("facesAjaxImpl", myfaces._impl.core.Impl);
+ return impl.chain.apply(impl, arguments);
+ };
+ };
+}
+
+if (!faces.push) {
+
+ /**
+ * @namespace faces.push
+ */
+ faces.push = new function() {
+
+ // "Constant" fields ----------------------------------------------------------------------------------------------
+ var URL_PROTOCOL = window.location.protocol.replace("http", "ws") + "//";
+ var RECONNECT_INTERVAL = 500;
+ var MAX_RECONNECT_ATTEMPTS = 25;
+ var REASON_EXPIRED = "Expired";
+
+ // Private static fields ------------------------------------------------------------------------------------------
+
+ /* socket map by token */
+ var sockets = {};
+ /* component attributes by clientId */
+ var components = {};
+ /* client ids by token (share websocket connection) */
+ var clientIdsByTokens = {};
+ var self = {};
+
+ // Private constructor functions ----------------------------------------------------------------------------------
+ /**
+ * Creates a reconnecting web socket. When the web socket successfully connects on first attempt, then it will
+ * automatically reconnect on timeout with cumulative intervals of 500ms with a maximum of 25 attempts (~3 minutes).
+ * The <code>onclose</code> function will be called with the error code of the last attempt.
+ * @constructor
+ * @param {string} channelToken the channel token associated with this websocket connection
+ * @param {string} url The URL of the web socket
+ * @param {string} channel The name of the web socket channel.
+ */
+ function Socket(channelToken, url, channel) {
+
+ // Private fields -----------------------------------------------------------------------------------------
+
+ var socket;
+ var reconnectAttempts = 0;
+ var self = this;
+
+ // Public functions ---------------------------------------------------------------------------------------
+
+ /**
+ * Opens the reconnecting web socket.
+ */
+ self.open = function() {
+ if (socket && socket.readyState == 1) {
+ return;
+ }
+
+ socket = new WebSocket(url);
+
+ socket.onopen = function(event) {
+ if (!reconnectAttempts) {
+ var clientIds = clientIdsByTokens[channelToken];
+ for (var i = clientIds.length - 1; i >= 0; i--){
+ var socketClientId = clientIds[i];
+ components[socketClientId]['onopen'](channel);
+ }
+ }
+ reconnectAttempts = 0;
+ };
+
+ socket.onmessage = function(event) {
+ var message = JSON.parse(event.data);
+ for (var i = clientIdsByTokens[channelToken].length - 1; i >= 0; i--){
+ var socketClientId = clientIdsByTokens[channelToken][i];
+ if(document.getElementById(socketClientId)) {
+ try{
+ components[socketClientId]['onmessage'](message, channel, event);
+ }catch(e){
+ //Ignore
+ }
+ var behaviors = components[socketClientId]['behaviors'];
+ var functions = behaviors[message];
+ if (functions && functions.length) {
+ for (var j = 0; j < functions.length; j++) {
+ try{
+ functions[j](null);
+ }catch(e){
+ //Ignore
+ }
+ }
+ }
+ } else {
+ clientIdsByTokens[channelToken].splice(i,1);
+ }
+ }
+ if (clientIdsByTokens[channelToken].length == 0){
+ //tag dissapeared
+ self.close();
+ }
+
+ };
+
+ socket.onclose = function(event) {
+ if (!socket
+ || (event.code == 1000 && event.reason == REASON_EXPIRED)
+ || (event.code == 1008)
+ || (!reconnectAttempts)
+ || (reconnectAttempts >= MAX_RECONNECT_ATTEMPTS))
+ {
+ var clientIds = clientIdsByTokens[channelToken];
+ for (var i = clientIds.length - 1; i >= 0; i--){
+ var socketClientId = clientIds[i];
+ components[socketClientId]['onclose'](event.code, channel, event);
+ }
+ }
+ else {
+ setTimeout(self.open, RECONNECT_INTERVAL * reconnectAttempts++);
+ }
+ };
+ };
+
+ socket.onerror = function(event) {
+ var clientIds = clientIdsByTokens[channelToken];
+ for (var i = clientIds.length - 1; i >= 0; i--){
+ var socketClientId = clientIds[i];
+ components[socketClientId]['onerror'](channel);
+ }
+ };
+
+ /**
+ * Closes the reconnecting web socket.
+ */
+ self.close = function() {
+ if (socket) {
+ var s = socket;
+ socket = null;
+ s.close();
+ }
+ };
+
+ }
+
+ // Public static functions ----------------------------------------------------------------------------------------
+
+ /**
+ *
+ * @param {function} onopen The function to be invoked when the web socket is opened.
+ * @param {function} onmessage The function to be invoked when a message is received.
+ * @param {function} onerror The function to be invoked when the web socket throws a error.
+ * @param {function} onclose The function to be invoked when the web socket is closed.
+ * @param {boolean} autoconnect Whether or not to immediately open the socket. Defaults to <code>false</code>.
+ */
+ this.init = function(socketClientId, uri, channel, onopen, onmessage, onerror, onclose, behaviorScripts, autoconnect) {
+
+ onclose = resolveFunction(onclose);
+
+ if (!window.WebSocket) { // IE6-9.
+ onclose(-1, channel);
+ return;
+ }
+
+ var channelToken = uri.substr(uri.indexOf('?')+1);
+
+ if (!components[socketClientId]) {
+ components[socketClientId] = {
+ 'channelToken': channelToken,
+ 'onopen': resolveFunction(onopen),
+ 'onmessage' : resolveFunction(onmessage),
+ 'onerror' : resolveFunction(onerror),
+ 'onclose': onclose,
+ 'behaviors': behaviorScripts,
+ 'autoconnect': autoconnect};
+ if (!clientIdsByTokens[channelToken]) {
+ clientIdsByTokens[channelToken] = [];
+ }
+ clientIdsByTokens[channelToken].push(socketClientId);
+ if (!sockets[channelToken]){
+ sockets[channelToken] = new Socket(channelToken,
+ getBaseURL(uri), channel);
+ }
+ }
+
+ if (autoconnect) {
+ this.open(socketClientId);
+ }
+ };
+
+ /**
+ * Open the web socket on the given channel.
+ * @param {string} channel The name of the web socket channel.
+ * @throws {Error} When channel is unknown.
+ */
+ this.open = function(socketClientId) {
+ getSocket(components[socketClientId]['channelToken']).open();
+ };
+
+ /**
+ * Close the web socket on the given channel.
+ * @param {string} channel The name of the web socket channel.
+ * @throws {Error} When channel is unknown.
+ */
+ this.close = function(socketClientId) {
+ getSocket(components[socketClientId]['channelToken']).close();
+ };
+
+ // Private static functions ---------------------------------------------------------------------------------------
+
+ /**
+ *
+ */
+ function getBaseURL(url) {
+ if (url.indexOf("://") < 0)
+ {
+ var base = window.location.hostname+":"+window.location.port
+ return URL_PROTOCOL + base + url;
+ }else
+ {
+ return url;
+ }
+ }
+
+ /**
+ * Get socket associated with given channelToken.
+ * @param {string} channelToken The name of the web socket channelToken.
+ * @return {Socket} Socket associated with given channelToken.
+ * @throws {Error} When channelToken is unknown, you may need to initialize
+ * it first via <code>init()</code> function.
+ */
+ function getSocket(channelToken) {
+ var socket = sockets[channelToken];
+ if (socket) {
+ return socket;
+ } else {
+ throw new Error("Unknown channelToken: " + channelToken);
+ }
+ }
+
+ function resolveFunction(fn) {
+ return (typeof fn !== "function") && (fn = window[fn] || function(){}), fn;
+ }
+ // Expose self to public ------------------------------------------------------------------------------------------
+
+ //return self;
+ };
+}
+
+
+(!window.myfaces) ? window.myfaces = {} : null;
+if (!myfaces.ab) {
+ /*
+ * Shortcut of the faces.ajax.request, to shorten the rendered JS.
+ */
+ myfaces.ab = function(source, event, eventName, execute, render, options) {
+ if (!options) {
+ options = {};
+ }
+
+ if (eventName) {
+ options["jakarta.faces.behavior.event"] = eventName;
+ }
+ if (execute) {
+ options["execute"] = execute;
+ }
+ if (render) {
+ options["render"] = render;
+ }
+
+ faces.ajax.request(source, event, options);
+ };
}
\ No newline at end of file
diff --git a/impl/src/main/java/org/apache/myfaces/cdi/util/CDIUtils.java b/impl/src/main/java/org/apache/myfaces/cdi/util/CDIUtils.java
index 94a5e9d..f6d29da 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/util/CDIUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/util/CDIUtils.java
@@ -1,176 +1,176 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.cdi.util;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.Set;
-import jakarta.enterprise.context.ContextNotActiveException;
-import jakarta.enterprise.context.SessionScoped;
-import jakarta.enterprise.context.spi.Context;
-
-import jakarta.enterprise.context.spi.CreationalContext;
-import jakarta.enterprise.inject.spi.Bean;
-import jakarta.enterprise.inject.spi.BeanManager;
-import jakarta.faces.context.ExternalContext;
-import jakarta.faces.context.FacesContext;
-import jakarta.faces.view.ViewScoped;
-import org.apache.myfaces.webapp.FacesInitializerImpl;
-
-/**
- * Lookup code for Contextual Instances.
- */
-public class CDIUtils
-{
- public static BeanManager getBeanManager(FacesContext facesContext)
- {
- return getBeanManager(facesContext.getExternalContext());
- }
-
- public static BeanManager getBeanManager(ExternalContext externalContext)
- {
- return (BeanManager) externalContext.getApplicationMap().get(FacesInitializerImpl.CDI_BEAN_MANAGER_INSTANCE);
- }
-
- public static <T> T get(BeanManager bm, Class<T> clazz)
- {
- Set<Bean<?>> beans = bm.getBeans(clazz);
- return resolveInstance(bm, beans, clazz);
- }
-
- public static <T> T getOptional(BeanManager bm, Class<T> clazz)
- {
- Set<Bean<?>> beans = bm.getBeans(clazz);
- if (beans == null || beans.isEmpty())
- {
- return null;
- }
- return resolveInstance(bm, beans, clazz);
- }
-
- private static <T> T resolveInstance(BeanManager bm, Set<Bean<?>> beans, Type type)
- {
- Bean<?> bean = bm.resolve(beans);
- CreationalContext<?> cc = bm.createCreationalContext(bean);
- T instance = (T) bm.getReference(bean, type, cc);
- return instance;
-
- }
-
- @SuppressWarnings("unchecked")
- public static <T> Bean<T> get(BeanManager beanManager, Class<T> beanClass, Annotation... qualifiers)
- {
- Set<Bean<?>> beans = beanManager.getBeans(beanClass, qualifiers);
-
- for (Bean<?> bean : beans)
- {
- if (bean.getBeanClass() == beanClass)
- {
- return (Bean<T>) beanManager.resolve(Collections.<Bean<?>>singleton(bean));
- }
- }
-
- return (Bean<T>) beanManager.resolve(beans);
- }
-
- public static <T> T get(BeanManager beanManager, Class<T> beanClass,
- boolean create, Annotation... qualifiers)
- {
- try
- {
- Bean<T> bean = get(beanManager, beanClass, qualifiers);
- return bean == null ? null : get(beanManager, bean, beanClass, create);
- }
- catch (ContextNotActiveException e)
- {
- return null;
- }
- }
-
- public static <T> T get(BeanManager beanManager, Type type, boolean create, Annotation... qualifiers)
- {
- try
- {
- Set<Bean<?>> beans = beanManager.getBeans(type, qualifiers);
- Bean<T> bean = (Bean<T>) beanManager.resolve(beans);
-
- return bean == null ? null : get(beanManager, bean, type, create);
- }
- catch (ContextNotActiveException e)
- {
- return null;
- }
- }
-
- public static <T> T get(BeanManager beanManager, Bean<T> bean, Type type, boolean create)
- {
- if (create)
- {
- CreationalContext<?> creationalContext = beanManager.createCreationalContext(bean);
- return (T) beanManager.getReference(bean, type, creationalContext);
- }
- else
- {
- Context context = beanManager.getContext(bean.getScope());
- return context.get(bean);
- }
- }
-
- public static boolean isSessionScopeActive(BeanManager beanManager)
- {
- try
- {
- Context ctx = beanManager.getContext(SessionScoped.class);
- return ctx != null;
- }
- catch (ContextNotActiveException ex)
- {
- //No op
- }
- catch (Exception ex)
- {
- // Sometimes on startup time, since there is no active request context, trying to grab session scope
- // throws NullPointerException.
- //No op
- }
- return false;
- }
-
- public static boolean isViewScopeActive(BeanManager beanManager)
- {
- try
- {
- Context ctx = beanManager.getContext(ViewScoped.class);
- return ctx != null;
- }
- catch (ContextNotActiveException ex)
- {
- //No op
- }
- catch (Exception ex)
- {
- // Sometimes on startup time, since there is no active request context, trying to grab session scope
- // throws NullPointerException.
- //No op
- }
- return false;
- }
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.cdi.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.Set;
+import jakarta.enterprise.context.ContextNotActiveException;
+import jakarta.enterprise.context.SessionScoped;
+import jakarta.enterprise.context.spi.Context;
+
+import jakarta.enterprise.context.spi.CreationalContext;
+import jakarta.enterprise.inject.spi.Bean;
+import jakarta.enterprise.inject.spi.BeanManager;
+import jakarta.faces.context.ExternalContext;
+import jakarta.faces.context.FacesContext;
+import jakarta.faces.view.ViewScoped;
+import org.apache.myfaces.webapp.FacesInitializerImpl;
+
+/**
+ * Lookup code for Contextual Instances.
+ */
+public class CDIUtils
+{
+ public static BeanManager getBeanManager(FacesContext facesContext)
+ {
+ return getBeanManager(facesContext.getExternalContext());
+ }
+
+ public static BeanManager getBeanManager(ExternalContext externalContext)
+ {
+ return (BeanManager) externalContext.getApplicationMap().get(FacesInitializerImpl.CDI_BEAN_MANAGER_INSTANCE);
+ }
+
+ public static <T> T get(BeanManager bm, Class<T> clazz)
+ {
+ Set<Bean<?>> beans = bm.getBeans(clazz);
+ return resolveInstance(bm, beans, clazz);
+ }
+
+ public static <T> T getOptional(BeanManager bm, Class<T> clazz)
+ {
+ Set<Bean<?>> beans = bm.getBeans(clazz);
+ if (beans == null || beans.isEmpty())
+ {
+ return null;
+ }
+ return resolveInstance(bm, beans, clazz);
+ }
+
+ private static <T> T resolveInstance(BeanManager bm, Set<Bean<?>> beans, Type type)
+ {
+ Bean<?> bean = bm.resolve(beans);
+ CreationalContext<?> cc = bm.createCreationalContext(bean);
+ T instance = (T) bm.getReference(bean, type, cc);
+ return instance;
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> Bean<T> get(BeanManager beanManager, Class<T> beanClass, Annotation... qualifiers)
+ {
+ Set<Bean<?>> beans = beanManager.getBeans(beanClass, qualifiers);
+
+ for (Bean<?> bean : beans)
+ {
+ if (bean.getBeanClass() == beanClass)
+ {
+ return (Bean<T>) beanManager.resolve(Collections.<Bean<?>>singleton(bean));
+ }
+ }
+
+ return (Bean<T>) beanManager.resolve(beans);
+ }
+
+ public static <T> T get(BeanManager beanManager, Class<T> beanClass,
+ boolean create, Annotation... qualifiers)
+ {
+ try
+ {
+ Bean<T> bean = get(beanManager, beanClass, qualifiers);
+ return bean == null ? null : get(beanManager, bean, beanClass, create);
+ }
+ catch (ContextNotActiveException e)
+ {
+ return null;
+ }
+ }
+
+ public static <T> T get(BeanManager beanManager, Type type, boolean create, Annotation... qualifiers)
+ {
+ try
+ {
+ Set<Bean<?>> beans = beanManager.getBeans(type, qualifiers);
+ Bean<T> bean = (Bean<T>) beanManager.resolve(beans);
+
+ return bean == null ? null : get(beanManager, bean, type, create);
+ }
+ catch (ContextNotActiveException e)
+ {
+ return null;
+ }
+ }
+
+ public static <T> T get(BeanManager beanManager, Bean<T> bean, Type type, boolean create)
+ {
+ if (create)
+ {
+ CreationalContext<?> creationalContext = beanManager.createCreationalContext(bean);
+ return (T) beanManager.getReference(bean, type, creationalContext);
+ }
+ else
+ {
+ Context context = beanManager.getContext(bean.getScope());
+ return context.get(bean);
+ }
+ }
+
+ public static boolean isSessionScopeActive(BeanManager beanManager)
+ {
+ try
+ {
+ Context ctx = beanManager.getContext(SessionScoped.class);
+ return ctx != null;
+ }
+ catch (ContextNotActiveException ex)
+ {
+ //No op
+ }
+ catch (Exception ex)
+ {
+ // Sometimes on startup time, since there is no active request context, trying to grab session scope
+ // throws NullPointerException.
+ //No op
+ }
+ return false;
+ }
+
+ public static boolean isViewScopeActive(BeanManager beanManager)
+ {
+ try
+ {
+ Context ctx = beanManager.getContext(ViewScoped.class);
+ return ctx != null;
+ }
+ catch (ContextNotActiveException ex)
+ {
+ //No op
+ }
+ catch (Exception ex)
+ {
+ // Sometimes on startup time, since there is no active request context, trying to grab session scope
+ // throws NullPointerException.
+ //No op
+ }
+ return false;
+ }
+
}
\ No newline at end of file
diff --git a/impl/src/main/java/org/apache/myfaces/config/MyfacesConfig.java b/impl/src/main/java/org/apache/myfaces/config/MyfacesConfig.java
index 0a3cc34..6db7564 100755
--- a/impl/src/main/java/org/apache/myfaces/config/MyfacesConfig.java
+++ b/impl/src/main/java/org/apache/myfaces/config/MyfacesConfig.java
@@ -1,1746 +1,1746 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.config;
-
-import java.util.ResourceBundle;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import jakarta.faces.application.ProjectStage;
-import jakarta.faces.application.StateManager;
-import jakarta.faces.application.ViewHandler;
-import jakarta.faces.context.ExternalContext;
-import jakarta.faces.context.FacesContext;
-import jakarta.faces.lifecycle.ClientWindow;
-
-import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
-import org.apache.myfaces.spi.InjectionProvider;
-import org.apache.myfaces.util.lang.ClassUtils;
-import org.apache.myfaces.util.lang.StringUtils;
-import org.apache.myfaces.view.facelets.ELExpressionCacheMode;
-
-/**
- * Holds all configuration init parameters (from web.xml) that are independent
- * from the core implementation. The parameters in this class are available to
- * all shared, component and implementation classes.
- * See RuntimeConfig for configuration infos that come from the faces-config
- * files and are needed by the core implementation.
- *
- * MyfacesConfig is meant for components that implement some of the extended features
- * of MyFaces. Anyhow, using the MyFaces JSF implementation is no precondition for using
- * MyfacesConfig in custom components. Upon using another JSF implementation
- * (or omitting the extended init parameters) all config properties will simply have
- * their default values.
- */
-//CHECKSTYLE:OFF
-public class MyfacesConfig
-{
- private static final String APPLICATION_MAP_PARAM_NAME = MyfacesConfig.class.getName();
-
- /**
- * Set the time in seconds that check for updates of web.xml and faces-config descriptors and
- * refresh the configuration.
- * This param is valid only if project stage is not production. Set this param to 0 disable this feature.
- */
- @JSFWebConfigParam(defaultValue="2",since="1.1", classType="java.lang.Long")
- public static final String CONFIG_REFRESH_PERIOD = "org.apache.myfaces.CONFIG_REFRESH_PERIOD";
- private static final long CONFIG_REFRESH_PERIOD_DEFAULT = 2;
-
- /**
- * Define if the input field that should store the state (jakarta.faces.ViewState) should render
- * id="jakarta.faces.ViewState".
- *
- * JSF API 1.2 defines a "jakarta.faces.ViewState" client parameter, that must be rendered as both the "name"
- * and the "id" attribute of the hidden input that is rendered for the purpose of state saving
- * (see ResponseStateManager.VIEW_STATE_PARAM).
- * Actually this causes duplicate id attributes and thus invalid XHTML pages when multiple forms are rendered on
- * one page. With the org.apache.myfaces.RENDER_VIEWSTATE_ID context parameter you can tune this behaviour.
- * <br/>Set it to
- * <ul><li>true - to render JSF 1.2 compliant id attributes (that might cause invalid XHTML), or</li>
- * <li>false - to omit rendering of the id attribute (which is only needed for very special
- * AJAX/Javascript components)</li></ul>
- * Default value is: true (for backwards compatibility and JSF 1.2 compliancy)
- */
- @JSFWebConfigParam(defaultValue="true", expectedValues="true, false, on, off, yes, no",since="1.1",
- ignoreUpperLowerCase=true, group="state")
- public static final String RENDER_VIEWSTATE_ID = "org.apache.myfaces.RENDER_VIEWSTATE_ID";
- private static final boolean RENDER_VIEWSTATE_ID_DEFAULT = true;
-
- /**
- * Use "&amp;" entity instead a plain "&" character within HTML.
- * <p>W3C recommends to use the "&amp;" entity instead of a plain "&" character within HTML.
- * This also applies to attribute values and thus to the "href" attribute of <a> elements as well.
- * Even more, when XHTML is used as output the usage of plain "&" characters is forbidden and would lead to
- * invalid XML code.
- * Therefore, since version 1.1.6 MyFaces renders the correct "&amp;" entity for links.</p>
- * <p>The init parameter
- * org.apache.myfaces.STRICT_XHTML_LINKS makes it possible to restore the old behaviour and to make MyFaces
- * "bug compatible" to the Sun RI which renders plain "&" chars in links as well.</p>
- * <p>
- * See: <a href="http://www.w3.org/TR/html401/charset.html#h-5.3.2">HTML 4.01 Specification</a>
- * See: <a href="http://issues.apache.org/jira/browse/MYFACES-1774">Jira: MYFACES-1774</a>
- * </p>
- */
- @JSFWebConfigParam(defaultValue="true", expectedValues="true, false, on, off, yes, no",since="1.1.6",
- ignoreUpperLowerCase=true, group="render")
- public static final String STRICT_XHTML_LINKS = "org.apache.myfaces.STRICT_XHTML_LINKS";
- private static final boolean STRICT_XHTML_LINKS_DEFAULT = true;
-
- /**
- * This param renders the clear javascript on button necessary only for
- * compatibility with hidden fields feature of myfaces. This is done
- * because jsf ri does not render javascript on onclick method for button,
- * so myfaces should do this.
- */
- @JSFWebConfigParam(defaultValue="false", expectedValues="true, false, on, off, yes, no",since="1.2.3",
- ignoreUpperLowerCase=true, group="render")
- public static final String RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON =
- "org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON";
- private static final boolean RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON_DEFAULT= false;
-
- /**
- * Define an alternate class name that will be used to initialize MyFaces, instead the default
- * jakarta.faces.webapp.FacesServlet.
- *
- * <p>This helps MyFaces to detect the mappings and other additional configuration used to setup the
- * environment, and prevent abort initialization if no FacesServlet config is detected.
- * </p>
- */
- @JSFWebConfigParam(since="1.2.7")
- public static final String DELEGATE_FACES_SERVLET = "org.apache.myfaces.DELEGATE_FACES_SERVLET";
-
- /**
- * Indicate if the facelet associated to the view should be reapplied when the view is refreshed.
- * Default mode is "auto".
- *
- * <p>This param is only valid when partial state saving is on.
- * If this is set as true, the tag-handlers are always reapplied before render view, like in facelets 1.1.x,
- * allowing c:if work correctly to "toggle" components based on a value changed on invoke application phase.
- * If the param is set as "auto", the implementation check if c:if, c:forEach,
- * c:choose and ui:include with src=ELExpression is used on the page and if that so, mark the view
- * to be refreshed.</p>
- */
- @JSFWebConfigParam(since="2.0", defaultValue="auto", expectedValues="true,false,auto", tags="performance",
- ignoreUpperLowerCase=true, group="state")
- public final static String REFRESH_TRANSIENT_BUILD_ON_PSS =
- "org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS";
- private final static String REFRESH_TRANSIENT_BUILD_ON_PSS_DEFAULT = "auto";
-
- /**
- * Enable or disable a special mode that enable full state for parent components containing c:if, c:forEach,
- * c:choose and ui:include with src=ELExpression. By default is disabled(false).
- *
- * <p>This param is only valid when partial state saving is on.
- * If this is set as true, parent components containing c:if, c:forEach,
- * c:choose and ui:include with src=ELExpression are marked to be restored fully, so state
- * is preserved between request.</p>
- */
- @JSFWebConfigParam(since="2.0", defaultValue="false", expectedValues="true, false, on, off, yes, no",
- tags="performance", ignoreUpperLowerCase=true, group="state")
- public final static String REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE =
- "org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE";
- private final static boolean REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE_DEFAULT = false;
-
- /**
- * If set to <code>true</code>, tag library XML files and faces config XML files using schema
- * will be validated during application start up
- */
- @JSFWebConfigParam(since="2.0", expectedValues="true, false, on, off, yes, no", ignoreUpperLowerCase=true)
- public final static String VALIDATE_XML = "org.apache.myfaces.VALIDATE_XML";
- private final static boolean VALIDATE_XML_DEFAULT = false;
-
- /**
- * Wrap content inside script with xml comment to prevent old browsers to display it. By default it is true.
- */
- @JSFWebConfigParam(since="2.0.1", expectedValues="true, false, on, off, yes, no", defaultValue="false",
- ignoreUpperLowerCase=true, group="render")
- public final static String WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG =
- "org.apache.myfaces.WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG";
- private final static boolean WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT = false;
-
- /**
- * Enable/disable DebugPhaseListener feature, with provide useful information about ValueHolder
- * variables (submittedValue, localValue, value).
- * Note evaluate those getters for each component could cause some unwanted side effects when
- * using "access" type scopes like on MyFaces CODI.
- * This param only has effect when project stage is Development.
- */
- @JSFWebConfigParam(since="2.0.8")
- public final static String DEBUG_PHASE_LISTENER = "org.apache.myfaces.DEBUG_PHASE_LISTENER";
- private final static boolean DEBUG_PHASE_LISTENER_DEFAULT = false;
-
- /**
- * Change default getType() behavior for composite component EL resolver, from return null
- * (see JSF 2_0 spec section 5_6_2_2) to
- * use the metadata information added by composite:attribute, ensuring components working with
- * chained EL expressions to find the
- * right type when a getType() is called over the source EL expression.
- *
- * To ensure strict compatibility with the spec set this param to true (by default is false,
- * so the change is enabled by default).
- */
- @JSFWebConfigParam(since="2.0.10", expectedValues="true, false", defaultValue="false", group="EL")
- public final static String STRICT_JSF_2_CC_EL_RESOLVER =
- "org.apache.myfaces.STRICT_JSF_2_CC_EL_RESOLVER";
- private final static boolean STRICT_JSF_2_CC_EL_RESOLVER_DEFAULT = false;
-
- /**
- * Define the default content type that the default ResponseWriter generates, when no match can be derived from
- * HTTP Accept Header.
- */
- @JSFWebConfigParam(since="2.0.11,2.1.5", expectedValues="text/html, application/xhtml+xml",
- defaultValue="text/html", group="render")
- public final static String DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE =
- "org.apache.myfaces.DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE";
- private final static String DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE_DEFAULT = "text/html";
-
- /**
- * Enable or disable a cache used to "remember" the generated facelets unique ids and reduce
- * the impact on memory usage, only active if jakarta.faces.FACELETS_REFRESH_PERIOD is -1 (no refresh).
- */
- @JSFWebConfigParam(defaultValue = "true", since = "2.0.13, 2.1.7", expectedValues="true, false",
- group="viewhandler", tags="performance",
- desc="Enable or disable a cache used to 'remember' the generated facelets unique ids " +
- "and reduce the impact over memory usage.")
- public static final String VIEW_UNIQUE_IDS_CACHE_ENABLED =
- "org.apache.myfaces.VIEW_UNIQUE_IDS_CACHE_ENABLED";
- private static final boolean VIEW_UNIQUE_IDS_CACHE_ENABLED_DEFAULT = true;
-
- /**
- * Set the size of the cache used to store strings generated using SectionUniqueIdCounter
- * for component ids. If this is set to 0, no cache is used. By default is set to 200.
- */
- @JSFWebConfigParam(defaultValue = "100", since = "2.0.13, 2.1.7",
- group="viewhandler", tags="performance")
- public static final String COMPONENT_UNIQUE_IDS_CACHE_SIZE =
- "org.apache.myfaces.COMPONENT_UNIQUE_IDS_CACHE_SIZE";
- private static final int COMPONENT_UNIQUE_IDS_CACHE_SIZE_DEFAULT = 200;
-
- /**
- * If this param is set to true, a check will be done in Restore View Phase to check
- * if the viewId exists or not and if it does not exists, a 404 response will be thrown.
- *
- * This is applicable in cases where all the views in the application are generated by a
- * ViewDeclarationLanguage implementation.
- */
- @JSFWebConfigParam(since = "2.1.13", defaultValue="false", expectedValues="true,false",
- group="viewhandler")
- public static final String STRICT_JSF_2_VIEW_NOT_FOUND =
- "org.apache.myfaces.STRICT_JSF_2_VIEW_NOT_FOUND";
- private final static boolean STRICT_JSF_2_VIEW_NOT_FOUND_DEFAULT = false;
-
- @JSFWebConfigParam(defaultValue = "false", since = "2.2.0", expectedValues="true, false", group="render",
- tags="performance",
- desc="Enable or disable an early flush which allows to send e.g. the HTML-Head to the client " +
- "while the rest gets rendered. It's a well known technique to reduce the time for loading a page.")
- public static final String EARLY_FLUSH_ENABLED =
- "org.apache.myfaces.EARLY_FLUSH_ENABLED";
- private static final boolean EARLY_FLUSH_ENABLED_DEFAULT = false;
-
- /**
- * This param makes components like c:set, ui:param and templating components like ui:decorate,
- * ui:composition and ui:include to behave like the ones provided originally in facelets 1_1_x.
- * See MYFACES-3810 for details.
- */
- @JSFWebConfigParam(since = "2.2.0", defaultValue="false", expectedValues="true,false",
- group="viewhandler")
- public static final String STRICT_JSF_2_FACELETS_COMPATIBILITY =
- "org.apache.myfaces.STRICT_JSF_2_FACELETS_COMPATIBILITY";
- private final static boolean STRICT_JSF_2_FACELETS_COMPATIBILITY_DEFAULT = false;
-
- /**
- * This param makes h:form component to render the view state and other hidden fields
- * at the beginning of the form. This also includes component resources with target="form",
- * but it does not include legacy 1.1 myfaces specific hidden field adition.
- */
- @JSFWebConfigParam(since = "2.2.4", defaultValue = "false", expectedValues = "true,false",
- group="render")
- public static final String RENDER_FORM_VIEW_STATE_AT_BEGIN =
- "org.apache.myfaces.RENDER_FORM_VIEW_STATE_AT_BEGIN";
- private final static boolean RENDER_FORM_VIEW_STATE_AT_BEGIN_DEFAULT = false;
-
- /**
- * Defines whether flash scope is disabled, preventing add the Flash cookie to the response.
- *
- * <p>This is useful for applications that does not require to use flash scope, and instead uses other scopes.</p>
- */
- @JSFWebConfigParam(defaultValue="false",since="2.0.5")
- public static final String FLASH_SCOPE_DISABLED = "org.apache.myfaces.FLASH_SCOPE_DISABLED";
- private static final boolean FLASH_SCOPE_DISABLED_DEFAULT = false;
-
- /**
- * Defines the amount (default = 20) of the latest views are stored in session.
- *
- * <p>Only applicable if state saving method is "server" (= default).
- * </p>
- *
- */
- @JSFWebConfigParam(defaultValue="20",since="1.1", classType="java.lang.Integer", group="state", tags="performance")
- public static final String NUMBER_OF_VIEWS_IN_SESSION = "org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION";
- /**
- * Default value for <code>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</code> context parameter.
- */
- public static final int NUMBER_OF_VIEWS_IN_SESSION_DEFAULT = 20;
-
- /**
- * Indicates the amount of views (default is not active) that should be stored in session between sequential
- * POST or POST-REDIRECT-GET if org.apache.myfaces.USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION is true.
- *
- * <p>Only applicable if state saving method is "server" (= default). For example, if this param has value = 2 and
- * in your custom webapp there is a form that is clicked 3 times, only 2 views
- * will be stored and the third one (the one stored the first time) will be
- * removed from session, even if the view can
- * store more sessions org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION.
- * This feature becomes useful for multi-window applications.
- * where without this feature a window can swallow all view slots so
- * the other ones will throw ViewExpiredException.</p>
- */
- @JSFWebConfigParam(since="2.0.6", classType="java.lang.Integer", group="state", tags="performance",
- defaultValue = "4")
- public static final String NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION
- = "org.apache.myfaces.NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION";
- public static final Integer NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION_DEFAULT = 4;
-
- /**
- * Indicate the max number of flash tokens stored into session. It is only active when
- * jakarta.faces.CLIENT_WINDOW_MODE is enabled and jakarta.faces.STATE_SAVING_METHOD is set
- * to "server". Each flash token is associated to one client window id at
- * the same time, so this param is related to the limit of active client windows per session.
- * By default is the same number as in
- * (org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION /
- * org.apache.myfaces.NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION) + 1 = 6.
- */
- @JSFWebConfigParam(since="2.2.6", group="state", tags="performance")
- public static final String NUMBER_OF_FLASH_TOKENS_IN_SESSION =
- "org.apache.myfaces.NUMBER_OF_FLASH_TOKENS_IN_SESSION";
-
- /**
- * This parameter specifies whether or not the ImportHandler will be supported
- */
- @JSFWebConfigParam(since="2.2.9", defaultValue="false", expectedValues="true,false", group="EL")
- public static final String SUPPORT_EL_3_IMPORT_HANDLER = "org.apache.myfaces.SUPPORT_EL_3_IMPORT_HANDLER";
- private final static boolean SUPPORT_EL_3_IMPORT_HANDLER_DEFAULT = false;
-
- /**
- * This parameter specifies whether or not the Origin header app path should be checked
- */
- @JSFWebConfigParam(since="2.3", defaultValue="false", expectedValues="true,false")
- public static final String STRICT_JSF_2_ORIGIN_HEADER_APP_PATH =
- "org.apache.myfaces.STRICT_JSF_2_ORIGIN_HEADER_APP_PATH";
- private final static boolean STRICT_JSF_2_ORIGIN_HEADER_APP_PATH_DEFAULT = false;
-
- /**
- * Allow slash in the library name of a Resource.
- */
- @JSFWebConfigParam(since="2.1.6, 2.0.12", defaultValue="false",
- expectedValues="true, false", group="resources")
- public static final String STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME =
- "org.apache.myfaces.STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME";
- private static final boolean STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME_DEFAULT = false;
-
- /**
- * Define the default buffer size that is used between Resource.getInputStream() and
- * httpServletResponse.getOutputStream() when rendering resources using the default
- * ResourceHandler.
- */
- @JSFWebConfigParam(since="2.1.10, 2.0.16", defaultValue="2048", group="resources")
- public static final String RESOURCE_BUFFER_SIZE = "org.apache.myfaces.RESOURCE_BUFFER_SIZE";
- private static final int RESOURCE_BUFFER_SIZE_DEFAULT = 2048;
-
- /**
- * Validate if the managed beans and navigations rules are correct.
- *
- * <p>For example, it checks if the managed bean classes really exists, or if the
- * navigation rules points to existing view files.</p>
- */
- @JSFWebConfigParam(since="2.0", defaultValue="false", expectedValues="true, false")
- public static final String VALIDATE = "org.apache.myfaces.VALIDATE";
-
- /**
- * Defines if CDI should be used for annotation scanning to improve the startup performance.
- */
- @JSFWebConfigParam(since="2.2.9", tags = "performance", defaultValue = "false")
- public static final String USE_CDI_FOR_ANNOTATION_SCANNING
- = "org.apache.myfaces.annotation.USE_CDI_FOR_ANNOTATION_SCANNING";
- private static final boolean USE_CDI_FOR_ANNOTATION_SCANNING_DEFAULT = false;
-
-
- /**
- * Controls the size of the cache used to check if a resource exists or not.
- *
- * <p>See org.apache.myfaces.RESOURCE_HANDLER_CACHE_ENABLED for details.</p>
- */
- @JSFWebConfigParam(defaultValue = "500", since = "2.0.2", group="resources",
- classType="java.lang.Integer", tags="performance")
- public static final String RESOURCE_HANDLER_CACHE_SIZE =
- "org.apache.myfaces.RESOURCE_HANDLER_CACHE_SIZE";
- private static final int RESOURCE_HANDLER_CACHE_SIZE_DEFAULT = 500;
-
- /**
- * Enable or disable the cache used to "remember" if a resource handled by
- * the default ResourceHandler exists or not.
- *
- */
- @JSFWebConfigParam(defaultValue = "true", since = "2.0.2", group="resources",
- expectedValues="true,false", tags="performance")
- public static final String RESOURCE_HANDLER_CACHE_ENABLED =
- "org.apache.myfaces.RESOURCE_HANDLER_CACHE_ENABLED";
- private static final boolean RESOURCE_HANDLER_CACHE_ENABLED_DEFAULT = true;
-
- /**
- * Servlet context init parameter which defines which packages to scan
- * for beans, separated by commas.
- */
- @JSFWebConfigParam(since="2.0")
- public static final String SCAN_PACKAGES = "org.apache.myfaces.annotation.SCAN_PACKAGES";
-
- /**
- * Indicates the port used for websocket connections.
- */
- @JSFWebConfigParam(since = "2.3")
- public static final java.lang.String WEBSOCKET_ENDPOINT_PORT = "jakarta.faces.WEBSOCKET_ENDPOINT_PORT";
-
- @JSFWebConfigParam(defaultValue = "300000")
- public static final String WEBSOCKET_MAX_IDLE_TIMEOUT = "org.apache.myfaces.WEBSOCKET_MAX_IDLE_TIMEOUT";
- private static final long WEBSOCKET_MAX_IDLE_TIMEOUT_DEFAULT = 300000L;
-
- /**
- * Defines how to generate the csrf session token.
- */
- @JSFWebConfigParam(since="2.2.0", expectedValues="secureRandom, random",
- defaultValue="secureRandom", group="state")
- public static final String RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN
- = "org.apache.myfaces.RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN";
-
- public static final String RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN_SECURE_RANDOM = "secureRandom";
- public static final String RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN_RANDOM = "random";
- private static final String RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN_DEFAULT = RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN_SECURE_RANDOM;
-
- /**
- * Define the time in minutes where the view state is valid when
- * client side state saving is used. By default it is set to 0
- * (infinite).
- */
- @JSFWebConfigParam(since="2.1.9, 2.0.15", defaultValue="0", group="state")
- public static final String CLIENT_VIEW_STATE_TIMEOUT =
- "org.apache.myfaces.CLIENT_VIEW_STATE_TIMEOUT";
- private static final Long CLIENT_VIEW_STATE_TIMEOUT_DEFAULT = 0L;
-
-
- /**
- * Adds a random key to the generated view state session token.
- */
- @JSFWebConfigParam(since="2.1.9, 2.0.15", expectedValues="secureRandom, random",
- defaultValue="secureRandom", group="state")
- public static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN
- = "org.apache.myfaces.RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN";
- public static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM = "secureRandom";
- public static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_RANDOM = "random";
- private static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_DEFAULT = RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM;
-
- /**
- * Set the default length of the random key added to the view state session token.
- * By default is 8.
- */
- @JSFWebConfigParam(since="2.1.9, 2.0.15", defaultValue="8", group="state")
- public static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_LENGTH
- = "org.apache.myfaces.RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_LENGTH";
- private static final int RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_LENGTH_DEFAULT = 8;
-
- /**
- * Sets the random class to initialize the secure random id generator.
- * By default it uses java.security.SecureRandom
- */
- @JSFWebConfigParam(since="2.1.9, 2.0.15", group="state")
- public static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_CLASS
- = "org.apache.myfaces.RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_CLASS";
-
- /**
- * Sets the random provider to initialize the secure random id generator.
- */
- @JSFWebConfigParam(since="2.1.9, 2.0.15", group="state")
- public static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_PROVIDER
- = "org.apache.myfaces.RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_PROVIDER";
-
- /**
- * Sets the random algorithm to initialize the secure random id generator.
- * By default is SHA1PRNG
- */
- @JSFWebConfigParam(since="2.1.9, 2.0.15", defaultValue="SHA1PRNG", group="state")
- public static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_ALGORITHM
- = "org.apache.myfaces.RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_ALGORITHM";
- private static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_ALGORITHM_DEFAULT = "SHA1PRNG";
-
- public static final String RANDOM_KEY_IN_CSRF_SESSION_TOKEN_SECURE_RANDOM = "secureRandom";
- public static final String RANDOM_KEY_IN_CSRF_SESSION_TOKEN_RANDOM = "random";
-
- /**
- * Defines how to generate the csrf session token.
- */
- @JSFWebConfigParam(since="2.2.0", expectedValues="secureRandom, random", defaultValue="secureRandom", group="state")
- public static final String RANDOM_KEY_IN_CSRF_SESSION_TOKEN
- = "org.apache.myfaces.RANDOM_KEY_IN_CSRF_SESSION_TOKEN";
- private static final String RANDOM_KEY_IN_CSRF_SESSION_TOKEN_DEFAULT = RANDOM_KEY_IN_CSRF_SESSION_TOKEN_SECURE_RANDOM;
-
- /**
- * Indicates that the serialized state will be compressed before it is written to the session. By default true.
- *
- * Only applicable if state saving method is "server" (= default) and if
- * <code>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</code> is <code>true</code> (= default).
- * If <code>true</code> (default) the serialized state will be compressed before it is written to the session.
- * If <code>false</code> the state will not be compressed.
- */
- @JSFWebConfigParam(defaultValue="true",since="1.1", expectedValues="true,false", group="state", tags="performance")
- public static final String COMPRESS_STATE_IN_SESSION = "org.apache.myfaces.COMPRESS_STATE_IN_SESSION";
- private static final boolean COMPRESS_STATE_IN_SESSION_DEFAULT = true;
-
- /**
- * Allow use flash scope to keep track of the views used in session and the previous ones,
- * so server side state saving can delete old views even if POST-REDIRECT-GET pattern is used.
- *
- * <p>
- * Only applicable if state saving method is "server" (= default).
- * The default value is false.</p>
- */
- @JSFWebConfigParam(since="2.0.6", defaultValue="false", expectedValues="true, false", group="state")
- public static final String USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION
- = "org.apache.myfaces.USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION";
- private static final boolean USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION_DEFAULT = false;
-
- /**
- * Add autocomplete="off" to the view state hidden field. Enabled by default.
- */
- @JSFWebConfigParam(since="2.2.8, 2.1.18, 2.0.24", expectedValues="true, false",
- defaultValue="true", group="state")
- public static final String AUTOCOMPLETE_OFF_VIEW_STATE =
- "org.apache.myfaces.AUTOCOMPLETE_OFF_VIEW_STATE";
- private static final boolean AUTOCOMPLETE_OFF_VIEW_STATE_DEFAULT = true;
-
- /**
- * Set the max time in miliseconds set on the "Expires" header for a resource rendered by
- * the default ResourceHandler.
- * (default to one week in miliseconds or 604800000)
- */
- @JSFWebConfigParam(since="2.0", defaultValue="604800000", group="resources", tags="performance")
- public static final String RESOURCE_MAX_TIME_EXPIRES = "org.apache.myfaces.RESOURCE_MAX_TIME_EXPIRES";
- private static final long RESOURCE_MAX_TIME_EXPIRES_DEFAULT = 604800000L;
-
-
- /**
- * Indicate if the classes associated to components, converters, validators or behaviors
- * should be loaded as soon as they are added to the current application instance or instead
- * loaded in a lazy way.
- */
- @JSFWebConfigParam(defaultValue="true",since="2.0",tags="performance")
- public static final String LAZY_LOAD_CONFIG_OBJECTS = "org.apache.myfaces.LAZY_LOAD_CONFIG_OBJECTS";
- private static final boolean LAZY_LOAD_CONFIG_OBJECTS_DEFAULT = true;
-
-
- /**
- * Define a custom comparator class used to sort the ELResolvers.
- *
- * <p>This is useful when it is necessary to put an ELResolver on top of other resolvers. Note set
- * this param override the default ordering described by JSF spec section 5.
- * </p>
- */
- @JSFWebConfigParam(since = "1.2.10, 2.0.2", group="EL",
- desc = "The Class of an Comparator<ELResolver> implementation.")
- public static final String EL_RESOLVER_COMPARATOR = "org.apache.myfaces.EL_RESOLVER_COMPARATOR";
-
- @JSFWebConfigParam(since = "2.1.0", group="EL",
- desc="The Class of an java.util.function.Predicate<ELResolver> implementation."
- + "If used and returns false for a ELResolver instance, such resolver will not be installed in "
- + "ELResolvers chain. Use with caution - can break functionality defined in JSF specification "
- + "'ELResolver Instances Provided by Faces'")
- public static final String EL_RESOLVER_PREDICATE = "org.apache.myfaces.EL_RESOLVER_PREDICATE";
-
- @JSFWebConfigParam(defaultValue = "500", since = "2.0.2", group="viewhandler", tags="performance",
- classType="java.lang.Integer",
- desc="Controls the size of the viewId related caches: " +
- "VIEWID_EXISTS_CACHE_ENABLED, VIEWID_PROTECTED_CACHE_ENABLED, VIEWID_DERIVE_CACHE_ENABLED")
- public static final String VIEWID_CACHE_SIZE = "org.apache.myfaces.VIEWID_CACHE_SIZE";
- private static final int VIEWID_CACHE_SIZE_DEFAULT = 500;
-
- @JSFWebConfigParam(defaultValue = "true", since = "2.0.2", expectedValues="true, false", group="viewhandler",
- tags="performance",
- desc="Enable or disable the cache used to 'remember' if a view exists or not and reduce the impact " +
- "of sucesive calls to ExternalContext.getResource().")
- public static final String VIEWID_EXISTS_CACHE_ENABLED = "org.apache.myfaces.VIEWID_EXISTS_CACHE_ENABLED";
- private static final boolean VIEWID_EXISTS_CACHE_ENABLED_DEFAULT = true;
-
-
- @JSFWebConfigParam(defaultValue = "true", since = "2.3-next", expectedValues="true, false", group="viewhandler",
- tags="performance",
- desc="Enable or disable the cache used to 'remember' if a view is protected or not.")
- public static final String VIEWID_PROTECTED_CACHE_ENABLED = "org.apache.myfaces.VIEWID_PROTECTED_CACHE_ENABLED";
- private static final boolean VIEWID_PROTECTED_CACHE_ENABLED_DEFAULT = true;
-
- @JSFWebConfigParam(defaultValue = "true", since = "2.3-next", expectedValues="true, false", group="viewhandler",
- tags="performance",
- desc="Enable or disable the cache used to 'remember' the derived viewId from the rawViewId.")
- public static final String VIEWID_DERIVE_CACHE_ENABLED = "org.apache.myfaces.VIEWID_DERIVE_CACHE_ENABLED";
- private static final boolean VIEWID_DERIVE_CACHE_ENABLED_DEFAULT = true;
-
- /**
- * Enforce f:validateBean to be called first before any JSF validator.
- */
- @JSFWebConfigParam(defaultValue="false", expectedValues="true, false", since = "2.2.10", group="validation")
- public final static String BEAN_BEFORE_JSF_VALIDATION
- = "org.apache.myfaces.validator.BEAN_BEFORE_JSF_VALIDATION";
- private final static boolean BEAN_BEFORE_JSF_VALIDATION_DEFAULT = false;
-
- /**
- * comma delimited list of plugin classes which can be hooked into myfaces
- */
- @JSFWebConfigParam(since = "2.0")
- public static final String FACES_INIT_PLUGINS = "org.apache.myfaces.FACES_INIT_PLUGINS";
-
- /**
- * If the flag is true, the algoritm skip jar scanning for faces-config files to check if the current
- * application requires FacesServlet to be added dynamically (servlet spec 3). This param can be set using
- * a system property with the same name too.
- */
- @JSFWebConfigParam(since="2.2.10", expectedValues = "true, false", defaultValue = "false",
- tags = "performance")
- public static final String INITIALIZE_SKIP_JAR_FACES_CONFIG_SCAN =
- "org.apache.myfaces.INITIALIZE_SKIP_JAR_FACES_CONFIG_SCAN";
- private static final boolean INITIALIZE_SKIP_JAR_FACES_CONFIG_SCAN_DEFAULT = false;
-
- /**
- * If this param is set to true, the check for faces servlet mapping is not done
- */
- @JSFWebConfigParam(since="2.0.3", defaultValue="false")
- public static final String INITIALIZE_ALWAYS_STANDALONE = "org.apache.myfaces.INITIALIZE_ALWAYS_STANDALONE";
-
- /**
- * This parameter specifies the ExpressionFactory implementation to use.
- */
- @JSFWebConfigParam(since="1.2.7", group="EL")
- public static final String EXPRESSION_FACTORY = "org.apache.myfaces.EXPRESSION_FACTORY";
-
- /**
- * Define how duplicate ids are checked when ProjectStage is Production, by default (auto) it only check ids of
- * components that does not encapsulate markup (like facelets UILeaf).
- *
- * <ul>
- * <li>true: check all ids, including ids for components that are transient and encapsulate markup.</li>
- * <li>auto: (default) check ids of components that does not encapsulate markup (like facelets UILeaf).
- * Note ids of UILeaf instances are generated by facelets vdl, start with "j_id", are never rendered
- * into the response and UILeaf instances are never used as a target for listeners, so in practice
- * there is no need to check such ids. This reduce the overhead associated with generate client ids.</li>
- * <li>false: do not do any check when ProjectStage is Production</li>
- * </ul>
- * <p> According to specification, identifiers must be unique within the scope of the nearest ancestor to
- * the component that is a naming container.</p>
- */
- @JSFWebConfigParam(since="2.0.12, 2.1.6", defaultValue="auto", expectedValues="true, auto, false",
- group="state", tags="performance")
- public static final String CHECK_ID_PRODUCTION_MODE
- = "org.apache.myfaces.CHECK_ID_PRODUCTION_MODE";
- private static final String CHECK_ID_PRODUCTION_MODE_DEFAULT = "auto";
- public static final String CHECK_ID_PRODUCTION_MODE_TRUE = "true";
- public static final String CHECK_ID_PRODUCTION_MODE_AUTO = "auto";
-
- @JSFWebConfigParam(since = "2.1", defaultValue = "false", expectedValues = "true, false", tags = "performance")
- public final static String MARK_INITIAL_STATE_WHEN_APPLY_BUILD_VIEW
- = "org.apache.myfaces.MARK_INITIAL_STATE_WHEN_APPLY_BUILD_VIEW";
- private static final boolean MARK_INITIAL_STATE_WHEN_APPLY_BUILD_VIEW_DEFAULT = false;
-
- /**
- * Indicates if expressions generated by facelets should be cached or not.
- * Default is noCache. There there are four modes:
- *
- * <ul>
- * <li>alwaysRecompile (since 2.1.12): Only does not cache when the expression contains
- * a variable resolved using VariableMapper</li>
- * <li>always: Only does not cache when expressions are inside user tags or the
- * expression contains a variable resolved using VariableMapper</li>
- * <li>allowCset: Like always, but does not allow cache when ui:param
- * was used on the current template context</li>
- * <li>strict: Like allowCset, but does not allow cache when c:set with
- * var and value properties only is used on the current page context</li>
- * <li>noCache: All expression are created each time the view is built</li>
- * </ul>
- *
- */
- @JSFWebConfigParam(since="2.0.8", defaultValue="noCache",
- expectedValues="noCache, strict, allowCset, always, alwaysRecompile",
- group="EL", tags="performance")
- public static final String CACHE_EL_EXPRESSIONS = "org.apache.myfaces.CACHE_EL_EXPRESSIONS";
- private static final String CACHE_EL_EXPRESSIONS_DEFAULT = ELExpressionCacheMode.alwaysRecompile.name();
-
- /**
- * Wrap exception caused by calls to EL expressions, so information like
- * the location, expression string and tag name can be retrieved by
- * the ExceptionHandler implementation and used to output meaningful information about itself.
- *
- * <p>Note in some cases this will wrap the original jakarta.el.ELException,
- * so the information will not be on the stack trace unless ExceptionHandler
- * retrieve checking if the exception implements ContextAware interface and calling getWrapped() method.
- * </p>
- *
- */
- @JSFWebConfigParam(since="2.0.9, 2.1.3" , defaultValue="true", expectedValues="true, false")
- public static final String WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE
- = "org.apache.myfaces.WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE";
- private static final boolean WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE_DEFAULT = true;
-
- /**
- * Defines if the last-modified should be cached of the resources when the ProjectStage is Production.
- * If the cache is disabled, each last-modified request will read the last-modified from the file.
- */
- @JSFWebConfigParam(since="2.3-next" , defaultValue="true", expectedValues="true, false")
- public static final String RESOURCE_CACHE_LAST_MODIFIED
- = "org.apache.myfaces.RESOURCE_CACHE_LAST_MODIFIED";
- private static final boolean RESOURCE_CACHE_LAST_MODIFIED_DEFAULT = true;
-
- /**
- * Indicate if log all web config params should be done before initialize the webapp.
- * <p>
- * If is set in "auto" mode, web config params are only logged on "Development" and "Production" project stages.
- * </p>
- */
- @JSFWebConfigParam(expectedValues="true, auto, false", defaultValue="auto")
- public static final String LOG_WEB_CONTEXT_PARAMS = "org.apache.myfaces.LOG_WEB_CONTEXT_PARAMS";
- private static final String LOG_WEB_CONTEXT_PARAMS_DEFAULT = "auto";
-
- /**
- * This parameter enables automatic extensionless mapping for all JSF views.
- */
- @JSFWebConfigParam(since="2.3", expectedValues = "true, false", defaultValue = "false")
- public static final String AUTOMATIC_EXTENSIONLESS_MAPPING =
- "org.apache.myfaces.AUTOMATIC_EXTENSIONLESS_MAPPING";
- public static final boolean AUTOMATIC_EXTENSIONLESS_MAPPING_DEFAULT = false;
-
- /**
- * Indicate the class implementing FacesInitializer interface that will
- * be used to setup MyFaces Core contexts.
- * <p>This is used when some custom task must be done specifically when
- * a myfaces web context is initialized or destroyed, or when MyFaces should
- * be initialized in some custom environment.
- * </p>
- */
- @JSFWebConfigParam(since = "2.0.1", desc = "Class name of a custom FacesInitializer implementation.")
- public static final String FACES_INITIALIZER = "org.apache.myfaces.FACES_INITIALIZER";
-
-
- /**
- * Define the class implementing InjectionProvider interface to handle dependendy injection,
- * PostConstruct and PreDestroy callbacks.
- *
- * <p>This also can be configured using a SPI entry (/META-INF/services/...).</p>
- */
- @JSFWebConfigParam(name="org.apache.myfaces.spi.InjectionProvider", since="2.2")
- public static final String INJECTION_PROVIDER = InjectionProvider.class.getName();
-
- @JSFWebConfigParam(name="org.apache.myfaces.WEBSOCKET_MAX_CONNECTIONS", since="2.3")
- public static final String WEBSOCKET_MAX_CONNECTIONS = "org.apache.myfaces.WEBSOCKET_MAX_CONNECTIONS";
- public static final Integer WEBSOCKET_MAX_CONNECTIONS_DEFAULT = 5000;
-
-
- /**
- * Defines if the clientbehavior scripts are passed as string or function to the faces.util.chain.
- * "As string" is actually the default behavior of both MyFaces (until 2.3-next) and Mojarra.
- * "As function" is quite usefull for CSP as no string needs to be evaluated as function.
- *
- * Our faces.util.chain supports both of course.
- */
- @JSFWebConfigParam(name="org.apache.myfaces.RENDER_CLIENTBEHAVIOR_SCRIPTS_AS_STRING", since="2.3-next", defaultValue = "false")
- public static final String RENDER_CLIENTBEHAVIOR_SCRIPTS_AS_STRING = "org.apache.myfaces.RENDER_CLIENTBEHAVIOR_SCRIPTS_AS_STRING";
- public static final boolean RENDER_CLIENTBEHAVIOR_SCRIPTS_AS_STRING_DEFAULT = false;
-
- /**
- * Defines if a session should be created (if one does not exist) before response rendering.
- * When this parameter is set to true, a session will be created even when client side state
- * saving or stateless views are used, which can lead to unintended resource consumption.
- * When this parameter is set to false, a session will only be created before response
- * rendering if a view is not transient and server side state saving is in use.
- */
- @JSFWebConfigParam(since="2.3.6", defaultValue="false", expectedValues="true,false")
- public static final String ALWAYS_FORCE_SESSION_CREATION =
- "org.apache.myfaces.ALWAYS_FORCE_SESSION_CREATION";
- protected final static boolean ALWAYS_FORCE_SESSION_CREATION_DEFAULT = false;
-
- /**
- * Defines the {@link java.util.ResourceBundle.Control} to use for all
- * {@link java.util.ResourceBundle#getBundle(java.lang.String)} calls.
- */
- @JSFWebConfigParam(since="2.3-next")
- public static final String RESOURCE_BUNDLE_CONTROL =
- "org.apache.myfaces.RESOURCE_BUNDLE_CONTROL";
-
- // we need it, applicationImpl not ready probably
- private ProjectStage projectStage = ProjectStage.Production;
- private boolean strictJsf2AllowSlashLibraryName;
- private long configRefreshPeriod = CONFIG_REFRESH_PERIOD_DEFAULT;
- private boolean renderViewStateId = RENDER_VIEWSTATE_ID_DEFAULT;
- private boolean strictXhtmlLinks = STRICT_XHTML_LINKS_DEFAULT;
- private boolean renderClearJavascriptOnButton = RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON_DEFAULT;
- private String delegateFacesServlet;
- private boolean refreshTransientBuildOnPSS = true;
- private boolean refreshTransientBuildOnPSSAuto = true;
- private boolean refreshTransientBuildOnPSSPreserveState = REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE_DEFAULT;
- private boolean validateXML = VALIDATE_XML_DEFAULT;
- private boolean wrapScriptContentWithXmlCommentTag = WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT;
- private boolean debugPhaseListenerEnabled = DEBUG_PHASE_LISTENER_DEFAULT;
- private boolean strictJsf2CCELResolver = STRICT_JSF_2_CC_EL_RESOLVER_DEFAULT;
- private String defaultResponseWriterContentTypeMode = DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE_DEFAULT;
- private boolean viewUniqueIdsCacheEnabled = VIEW_UNIQUE_IDS_CACHE_ENABLED_DEFAULT;
- private int componentUniqueIdsCacheSize = COMPONENT_UNIQUE_IDS_CACHE_SIZE_DEFAULT;
- private boolean strictJsf2ViewNotFound = STRICT_JSF_2_VIEW_NOT_FOUND_DEFAULT;
- private boolean earlyFlushEnabled = EARLY_FLUSH_ENABLED_DEFAULT;
- private boolean strictJsf2FaceletsCompatibility = STRICT_JSF_2_FACELETS_COMPATIBILITY_DEFAULT;
- private boolean renderFormViewStateAtBegin = RENDER_FORM_VIEW_STATE_AT_BEGIN_DEFAULT;
- private boolean flashScopeDisabled = FLASH_SCOPE_DISABLED_DEFAULT;
- private Integer numberOfViewsInSession = NUMBER_OF_VIEWS_IN_SESSION_DEFAULT;
- private Integer numberOfSequentialViewsInSession = NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION_DEFAULT;
- private Integer numberOfFlashTokensInSession;
- private Integer numberOfClientWindows;
- private boolean supportEL3ImportHandler = SUPPORT_EL_3_IMPORT_HANDLER_DEFAULT;
- private boolean strictJsf2OriginHeaderAppPath = STRICT_JSF_2_ORIGIN_HEADER_APP_PATH_DEFAULT;
- private int resourceBufferSize = RESOURCE_BUFFER_SIZE_DEFAULT;
- private boolean useCdiForAnnotationScanning = USE_CDI_FOR_ANNOTATION_SCANNING_DEFAULT;
- private boolean resourceHandlerCacheEnabled = RESOURCE_HANDLER_CACHE_ENABLED_DEFAULT;
- private int resourceHandlerCacheSize = RESOURCE_HANDLER_CACHE_SIZE_DEFAULT;
- private String scanPackages;
- private long websocketMaxIdleTimeout = WEBSOCKET_MAX_IDLE_TIMEOUT_DEFAULT;
- private Integer websocketEndpointPort;
- private String randomKeyInWebsocketSessionToken = RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN_DEFAULT;
- private long clientViewStateTimeout = CLIENT_VIEW_STATE_TIMEOUT_DEFAULT;
- private String randomKeyInViewStateSessionToken = RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_DEFAULT;
- private int randomKeyInViewStateSessionTokenLength = RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_LENGTH_DEFAULT;
- private String randomKeyInViewStateSessionTokenSecureRandomClass;
- private String randomKeyInViewStateSessionTokenSecureRandomProvider;
- private String randomKeyInViewStateSessionTokenSecureRandomAlgorithm
- = RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_ALGORITHM_DEFAULT;
- private String randomKeyInCsrfSessionToken = RANDOM_KEY_IN_CSRF_SESSION_TOKEN_DEFAULT;
- private boolean serializeStateInSession = false;
- private boolean compressStateInSession = COMPRESS_STATE_IN_SESSION_DEFAULT;
- private boolean useFlashScopePurgeViewsInSession = USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION_DEFAULT;
- private boolean autocompleteOffViewState = AUTOCOMPLETE_OFF_VIEW_STATE_DEFAULT;
- private long resourceMaxTimeExpires = RESOURCE_MAX_TIME_EXPIRES_DEFAULT;
- private boolean lazyLoadConfigObjects = LAZY_LOAD_CONFIG_OBJECTS_DEFAULT;
- private String elResolverComparator;
- private String elResolverPredicate;
- private boolean viewIdExistsCacheEnabled = VIEWID_EXISTS_CACHE_ENABLED_DEFAULT;
- private boolean viewIdProtectedCacheEnabled = VIEWID_PROTECTED_CACHE_ENABLED_DEFAULT;
- private boolean viewIdDeriveCacheEnabled = VIEWID_DERIVE_CACHE_ENABLED_DEFAULT;
- private int viewIdCacheSize = VIEWID_CACHE_SIZE_DEFAULT;
- private boolean beanBeforeJsfValidation = BEAN_BEFORE_JSF_VALIDATION_DEFAULT;
- private String facesInitPlugins;
- private boolean initializeSkipJarFacesConfigScan = INITIALIZE_SKIP_JAR_FACES_CONFIG_SCAN_DEFAULT;
- private String expressionFactory;
- private String checkIdProductionMode = CHECK_ID_PRODUCTION_MODE_DEFAULT;
- private boolean partialStateSaving = true;
- private String[] fullStateSavingViewIds;
- private int faceletsBufferSize = 1024;
- private boolean markInitialStateWhenApplyBuildView = MARK_INITIAL_STATE_WHEN_APPLY_BUILD_VIEW_DEFAULT;
- private String[] viewSuffix = new String[] { ViewHandler.DEFAULT_SUFFIX };
- private String[] faceletsViewMappings = new String[] {};
- private String faceletsViewSuffix = ViewHandler.DEFAULT_FACELETS_SUFFIX;
- private ELExpressionCacheMode elExpressionCacheMode;
- private boolean wrapTagExceptionsAsContextAware = WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE_DEFAULT;
- private boolean resourceCacheLastModified = RESOURCE_CACHE_LAST_MODIFIED_DEFAULT;
- private boolean logWebContextParams = false;
- private int websocketMaxConnections = WEBSOCKET_MAX_CONNECTIONS_DEFAULT;
- private boolean renderClientBehaviorScriptsAsString = RENDER_CLIENTBEHAVIOR_SCRIPTS_AS_STRING_DEFAULT;
- private boolean alwaysForceSessionCreation = ALWAYS_FORCE_SESSION_CREATION_DEFAULT;
- private ResourceBundle.Control resourceBundleControl;
- private boolean automaticExtensionlessMapping = AUTOMATIC_EXTENSIONLESS_MAPPING_DEFAULT;
-
- private static final boolean MYFACES_IMPL_AVAILABLE;
- private static final boolean RI_IMPL_AVAILABLE;
-
- static
- {
- boolean myfacesImplAvailable;
- try
- {
- ClassUtils.classForName("org.apache.myfaces.application.ApplicationImpl");
- myfacesImplAvailable = true;
- }
- catch (ClassNotFoundException e)
- {
- myfacesImplAvailable = false;
- }
- MYFACES_IMPL_AVAILABLE = myfacesImplAvailable;
-
- boolean riImplAvailable;
- try
- {
- ClassUtils.classForName("com.sun.faces.application.ApplicationImpl");
- riImplAvailable = true;
- }
- catch (ClassNotFoundException e)
- {
- riImplAvailable = false;
- }
- RI_IMPL_AVAILABLE = riImplAvailable;
- }
-
- public static MyfacesConfig getCurrentInstance()
- {
- return getCurrentInstance(FacesContext.getCurrentInstance().getExternalContext());
- }
-
- public static MyfacesConfig getCurrentInstance(FacesContext facesContext)
- {
- return getCurrentInstance(facesContext.getExternalContext());
- }
-
- public static MyfacesConfig getCurrentInstance(ExternalContext extCtx)
- {
- MyfacesConfig config = (MyfacesConfig) extCtx.getApplicationMap().get(APPLICATION_MAP_PARAM_NAME);
- if (config == null)
- {
- config = createAndInitializeMyFacesConfig(extCtx);
- extCtx.getApplicationMap().put(APPLICATION_MAP_PARAM_NAME, config);
- }
-
- return config;
- }
-
- public MyfacesConfig()
- {
- numberOfFlashTokensInSession = (NUMBER_OF_VIEWS_IN_SESSION_DEFAULT
- / NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION_DEFAULT) + 1;
- }
-
- private static MyfacesConfig createAndInitializeMyFacesConfig(ExternalContext extCtx)
- {
- MyfacesConfig cfg = new MyfacesConfig();
-
- try
- {
- cfg.projectStage = ProjectStage.valueOf(getString(extCtx, ProjectStage.PROJECT_STAGE_PARAM_NAME, null));
- }
- catch (Exception e)
- {
- // ignore, it's logged in ApplicationImpl
- }
- if (cfg.projectStage == null)
- {
- cfg.projectStage = ProjectStage.Production;
- }
-
- cfg.renderClearJavascriptOnButton = getBoolean(extCtx, RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON,
- RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON_DEFAULT);
-
- cfg.renderViewStateId = getBoolean(extCtx, RENDER_VIEWSTATE_ID,
- RENDER_VIEWSTATE_ID_DEFAULT);
-
- cfg.strictXhtmlLinks = getBoolean(extCtx, STRICT_XHTML_LINKS,
- STRICT_XHTML_LINKS_DEFAULT);
-
- cfg.configRefreshPeriod = getLong(extCtx, CONFIG_REFRESH_PERIOD,
- CONFIG_REFRESH_PERIOD_DEFAULT);
-
- cfg.delegateFacesServlet = getString(extCtx, DELEGATE_FACES_SERVLET,
- null);
-
- String refreshTransientBuildOnPSS = getString(extCtx, REFRESH_TRANSIENT_BUILD_ON_PSS,
- REFRESH_TRANSIENT_BUILD_ON_PSS_DEFAULT);
- if (refreshTransientBuildOnPSS == null)
- {
- cfg.refreshTransientBuildOnPSS = false;
- cfg.refreshTransientBuildOnPSSAuto = false;
- }
- else if ("auto".equalsIgnoreCase(refreshTransientBuildOnPSS))
- {
- cfg.refreshTransientBuildOnPSS = true;
- cfg.refreshTransientBuildOnPSSAuto = true;
- }
- else if (refreshTransientBuildOnPSS.equalsIgnoreCase("true") ||
- refreshTransientBuildOnPSS.equalsIgnoreCase("on") ||
- refreshTransientBuildOnPSS.equalsIgnoreCase("yes"))
- {
- cfg.refreshTransientBuildOnPSS = true;
- cfg.refreshTransientBuildOnPSSAuto = false;
- }
- else
- {
- cfg.refreshTransientBuildOnPSS = false;
- cfg.refreshTransientBuildOnPSSAuto = false;
- }
-
- cfg.refreshTransientBuildOnPSSPreserveState = getBoolean(extCtx, REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE,
- REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE_DEFAULT);
-
- cfg.validateXML = getBoolean(extCtx, VALIDATE_XML,
- VALIDATE_XML_DEFAULT);
-
- cfg.wrapScriptContentWithXmlCommentTag = getBoolean(extCtx, WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG,
- WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT);
-
- cfg.debugPhaseListenerEnabled = getBoolean(extCtx, DEBUG_PHASE_LISTENER,
- DEBUG_PHASE_LISTENER_DEFAULT);
-
- cfg.strictJsf2CCELResolver = getBoolean(extCtx, STRICT_JSF_2_CC_EL_RESOLVER,
- STRICT_JSF_2_CC_EL_RESOLVER_DEFAULT);
-
- cfg.defaultResponseWriterContentTypeMode = getString(extCtx, DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE,
- DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE_DEFAULT);
-
- cfg.viewUniqueIdsCacheEnabled = getBoolean(extCtx, VIEW_UNIQUE_IDS_CACHE_ENABLED,
- VIEW_UNIQUE_IDS_CACHE_ENABLED_DEFAULT);
-
- cfg.componentUniqueIdsCacheSize = getInt(extCtx, COMPONENT_UNIQUE_IDS_CACHE_SIZE,
- COMPONENT_UNIQUE_IDS_CACHE_SIZE_DEFAULT);
-
- cfg.strictJsf2ViewNotFound = getBoolean(extCtx, STRICT_JSF_2_VIEW_NOT_FOUND,
- STRICT_JSF_2_VIEW_NOT_FOUND_DEFAULT);
-
- cfg.earlyFlushEnabled = getBoolean(extCtx, EARLY_FLUSH_ENABLED,
- EARLY_FLUSH_ENABLED_DEFAULT);
- if (cfg.projectStage != ProjectStage.Production)
- {
- cfg.earlyFlushEnabled = false;
- }
-
- cfg.strictJsf2FaceletsCompatibility = getBoolean(extCtx, STRICT_JSF_2_FACELETS_COMPATIBILITY,
- STRICT_JSF_2_FACELETS_COMPATIBILITY_DEFAULT);
-
- cfg.renderFormViewStateAtBegin = getBoolean(extCtx, RENDER_FORM_VIEW_STATE_AT_BEGIN,
- RENDER_FORM_VIEW_STATE_AT_BEGIN_DEFAULT);
-
- cfg.flashScopeDisabled = getBoolean(extCtx, FLASH_SCOPE_DISABLED,
- FLASH_SCOPE_DISABLED_DEFAULT);
-
- cfg.strictJsf2AllowSlashLibraryName = getBoolean(extCtx, STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME,
- STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME_DEFAULT);
-
- try
- {
- cfg.numberOfSequentialViewsInSession = getInt(extCtx, NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION,
- NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION_DEFAULT);
- if (cfg.numberOfSequentialViewsInSession == null
- || cfg.numberOfSequentialViewsInSession < 0)
- {
- Logger.getLogger(MyfacesConfig.class.getName()).severe(
- "Configured value for " + NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION
- + " is not valid, must be an value >= 0, using default value ("
- + NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION_DEFAULT);
- cfg.numberOfSequentialViewsInSession = NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION_DEFAULT;
- }
- }
- catch (Throwable e)
- {
- Logger.getLogger(MyfacesConfig.class.getName()).log(Level.SEVERE, "Error determining the value for "
- + NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION
- + ", expected an integer value > 0, using default value ("
- + NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION_DEFAULT + "): " + e.getMessage(), e);
- }
- try
- {
- cfg.numberOfViewsInSession = getInt(extCtx, NUMBER_OF_VIEWS_IN_SESSION,
- NUMBER_OF_VIEWS_IN_SESSION_DEFAULT);
- if (cfg.numberOfViewsInSession == null || cfg.numberOfViewsInSession <= 0)
- {
- Logger.getLogger(MyfacesConfig.class.getName()).severe(
- "Configured value for " + NUMBER_OF_VIEWS_IN_SESSION
- + " is not valid, must be an value > 0, using default value ("
- + NUMBER_OF_VIEWS_IN_SESSION_DEFAULT);
- cfg.numberOfViewsInSession = NUMBER_OF_VIEWS_IN_SESSION_DEFAULT;
- }
- }
- catch (Throwable e)
- {
- Logger.getLogger(MyfacesConfig.class.getName()).log(Level.SEVERE, "Error determining the value for "
- + NUMBER_OF_VIEWS_IN_SESSION
- + ", expected an integer value > 0, using default value ("
- + NUMBER_OF_VIEWS_IN_SESSION_DEFAULT + "): " + e.getMessage(), e);
- }
-
- Integer numberOfFlashTokensInSessionDefault;
- if (cfg.numberOfSequentialViewsInSession != null && cfg.numberOfSequentialViewsInSession > 0)
- {
- numberOfFlashTokensInSessionDefault = (cfg.numberOfViewsInSession
- / cfg.numberOfSequentialViewsInSession) + 1;
- }
- else
- {
- numberOfFlashTokensInSessionDefault = cfg.numberOfViewsInSession + 1;
- }
-
- cfg.numberOfFlashTokensInSession = getInt(extCtx, NUMBER_OF_FLASH_TOKENS_IN_SESSION,
- numberOfFlashTokensInSessionDefault);
-
- cfg.numberOfClientWindows = getInt(extCtx,
- ClientWindow.NUMBER_OF_CLIENT_WINDOWS_PARAM_NAME,
- 10);
-
- cfg.supportEL3ImportHandler = getBoolean(extCtx, SUPPORT_EL_3_IMPORT_HANDLER,
- SUPPORT_EL_3_IMPORT_HANDLER_DEFAULT);
-
- cfg.strictJsf2OriginHeaderAppPath = getBoolean(extCtx, STRICT_JSF_2_ORIGIN_HEADER_APP_PATH,
- STRICT_JSF_2_ORIGIN_HEADER_APP_PATH_DEFAULT);
-
- cfg.resourceBufferSize = getInt(extCtx, RESOURCE_BUFFER_SIZE,
- RESOURCE_BUFFER_SIZE_DEFAULT);
-
- cfg.useCdiForAnnotationScanning = getBoolean(extCtx, USE_CDI_FOR_ANNOTATION_SCANNING,
- USE_CDI_FOR_ANNOTATION_SCANNING_DEFAULT);
-
- cfg.resourceHandlerCacheEnabled = getBoolean(extCtx, RESOURCE_HANDLER_CACHE_ENABLED,
- RESOURCE_HANDLER_CACHE_ENABLED_DEFAULT);
- if (cfg.projectStage != ProjectStage.Production)
- {
- cfg.resourceHandlerCacheEnabled = false;
- }
-
- cfg.resourceHandlerCacheSize = getInt(extCtx, RESOURCE_HANDLER_CACHE_SIZE,
- RESOURCE_HANDLER_CACHE_SIZE_DEFAULT);
-
- cfg.scanPackages = getString(extCtx, SCAN_PACKAGES,
- null);
-
- String websocketEndpointPort = extCtx.getInitParameter(WEBSOCKET_ENDPOINT_PORT);
- if (websocketEndpointPort != null && !websocketEndpointPort.isEmpty())
- {
- cfg.websocketEndpointPort = Integer.valueOf(websocketEndpointPort);
- }
-
- cfg.websocketMaxIdleTimeout = getLong(extCtx, WEBSOCKET_MAX_IDLE_TIMEOUT,
- WEBSOCKET_MAX_IDLE_TIMEOUT_DEFAULT);
-
- cfg.randomKeyInWebsocketSessionToken = getString(extCtx, RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN,
- RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN_DEFAULT);
-
- cfg.clientViewStateTimeout = getLong(extCtx, CLIENT_VIEW_STATE_TIMEOUT,
- CLIENT_VIEW_STATE_TIMEOUT_DEFAULT);
- if (cfg.clientViewStateTimeout < 0L)
- {
- cfg.clientViewStateTimeout = 0L;
- }
-
- cfg.randomKeyInViewStateSessionToken = getString(extCtx, RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN,
- RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_DEFAULT);
-
- cfg.randomKeyInViewStateSessionTokenLength = getInt(extCtx, RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_LENGTH,
- RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_LENGTH_DEFAULT);
-
- cfg.randomKeyInViewStateSessionTokenSecureRandomClass = getString(extCtx,
- RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_CLASS,
- null);
-
- cfg.randomKeyInViewStateSessionTokenSecureRandomProvider = getString(extCtx,
- RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_PROVIDER,
- null);
-
- cfg.randomKeyInViewStateSessionTokenSecureRandomAlgorithm = getString(extCtx,
- RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_ALGORITHM,
- RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_ALGORITHM_DEFAULT);
-
- cfg.randomKeyInCsrfSessionToken = getString(extCtx, RANDOM_KEY_IN_CSRF_SESSION_TOKEN,
- RANDOM_KEY_IN_CSRF_SESSION_TOKEN_DEFAULT);
-
- cfg.serializeStateInSession = getBoolean(extCtx, StateManager.SERIALIZE_SERVER_STATE_PARAM_NAME,
- false);
-
- cfg.compressStateInSession = getBoolean(extCtx, COMPRESS_STATE_IN_SESSION,
- COMPRESS_STATE_IN_SESSION_DEFAULT);
-
- cfg.useFlashScopePurgeViewsInSession = getBoolean(extCtx, USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION,
- USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION_DEFAULT);
-
- cfg.autocompleteOffViewState = getBoolean(extCtx, AUTOCOMPLETE_OFF_VIEW_STATE,
- AUTOCOMPLETE_OFF_VIEW_STATE_DEFAULT);
-
- cfg.resourceMaxTimeExpires = getLong(extCtx, RESOURCE_MAX_TIME_EXPIRES,
- RESOURCE_MAX_TIME_EXPIRES_DEFAULT);
-
- cfg.lazyLoadConfigObjects = getBoolean(extCtx, LAZY_LOAD_CONFIG_OBJECTS,
- LAZY_LOAD_CONFIG_OBJECTS_DEFAULT);
-
- cfg.elResolverComparator = getString(extCtx, EL_RESOLVER_COMPARATOR,
- null);
-
- cfg.elResolverPredicate = getString(extCtx, EL_RESOLVER_PREDICATE,
- null);
-
- cfg.viewIdExistsCacheEnabled = getBoolean(extCtx, VIEWID_EXISTS_CACHE_ENABLED,
- VIEWID_EXISTS_CACHE_ENABLED_DEFAULT);
- if (cfg.projectStage == ProjectStage.Development)
- {
- cfg.viewIdExistsCacheEnabled = false;
- }
-
- cfg.viewIdProtectedCacheEnabled = getBoolean(extCtx, VIEWID_PROTECTED_CACHE_ENABLED,
- VIEWID_PROTECTED_CACHE_ENABLED_DEFAULT);
- if (cfg.projectStage == ProjectStage.Development)
- {
- cfg.viewIdProtectedCacheEnabled = false;
- }
-
- cfg.viewIdDeriveCacheEnabled = getBoolean(extCtx, VIEWID_DERIVE_CACHE_ENABLED,
- VIEWID_DERIVE_CACHE_ENABLED_DEFAULT);
- if (cfg.projectStage == ProjectStage.Development)
- {
- cfg.viewIdDeriveCacheEnabled = false;
- }
-
- cfg.viewIdCacheSize = getInt(extCtx, VIEWID_CACHE_SIZE,
- VIEWID_CACHE_SIZE_DEFAULT);
-
- cfg.beanBeforeJsfValidation = getBoolean(extCtx, BEAN_BEFORE_JSF_VALIDATION,
- BEAN_BEFORE_JSF_VALIDATION_DEFAULT);
-
- cfg.facesInitPlugins = getString(extCtx, FACES_INIT_PLUGINS,
- null);
-
- cfg.initializeSkipJarFacesConfigScan = getBoolean(extCtx, INITIALIZE_SKIP_JAR_FACES_CONFIG_SCAN,
- INITIALIZE_SKIP_JAR_FACES_CONFIG_SCAN_DEFAULT);
-
- cfg.expressionFactory = getString(extCtx, EXPRESSION_FACTORY,
- null);
-
- cfg.checkIdProductionMode = getString(extCtx, CHECK_ID_PRODUCTION_MODE,
- CHECK_ID_PRODUCTION_MODE_DEFAULT);
-
- // Per spec section 11.1.3, the default value for the partial state saving feature needs
- // to be true if 2.0, false otherwise.
- // lets ignore this on 3.x
- cfg.partialStateSaving = getBoolean(extCtx, StateManager.PARTIAL_STATE_SAVING_PARAM_NAME,
- true);
-
- cfg.fullStateSavingViewIds = StringUtils.splitShortString(
- getString(extCtx, StateManager.FULL_STATE_SAVING_VIEW_IDS_PARAM_NAME, null),
- ',');
-
- cfg.faceletsBufferSize = getInt(extCtx, ViewHandler.FACELETS_BUFFER_SIZE_PARAM_NAME,
- 1024);
-
- cfg.markInitialStateWhenApplyBuildView = getBoolean(extCtx, MARK_INITIAL_STATE_WHEN_APPLY_BUILD_VIEW,
- MARK_INITIAL_STATE_WHEN_APPLY_BUILD_VIEW_DEFAULT);
-
- cfg.viewSuffix = StringUtils.splitShortString(
- getString(extCtx, ViewHandler.DEFAULT_SUFFIX_PARAM_NAME, ViewHandler.DEFAULT_SUFFIX),
- ' ');
-
- cfg.faceletsViewMappings = StringUtils.splitShortString(
- getString(extCtx, ViewHandler.FACELETS_VIEW_MAPPINGS_PARAM_NAME, null),
- ';');
-
- cfg.faceletsViewSuffix = getString(extCtx, ViewHandler.FACELETS_SUFFIX_PARAM_NAME,
- ViewHandler.DEFAULT_FACELETS_SUFFIX);
-
- String elExpressionCacheMode = getString(extCtx, CACHE_EL_EXPRESSIONS,
- CACHE_EL_EXPRESSIONS_DEFAULT);
- cfg.elExpressionCacheMode = Enum.valueOf(ELExpressionCacheMode.class, elExpressionCacheMode);
-
- cfg.wrapTagExceptionsAsContextAware = getBoolean(extCtx, WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE,
- WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE_DEFAULT);
-
- cfg.resourceCacheLastModified = getBoolean(extCtx, RESOURCE_CACHE_LAST_MODIFIED,
- RESOURCE_CACHE_LAST_MODIFIED_DEFAULT);
- if (cfg.projectStage == ProjectStage.Development)
- {
- cfg.resourceCacheLastModified = false;
- }
-
- String logWebContextParams = getString(extCtx, LOG_WEB_CONTEXT_PARAMS,
- LOG_WEB_CONTEXT_PARAMS_DEFAULT);
- if (logWebContextParams.equals("false") || (logWebContextParams.equals("auto")
- && (cfg.projectStage == ProjectStage.SystemTest || cfg.projectStage == ProjectStage.UnitTest)))
- {
- cfg.logWebContextParams = false;
- }
- else
- {
- cfg.logWebContextParams = true;
- }
-
- cfg.websocketMaxConnections = getInt(extCtx, WEBSOCKET_MAX_CONNECTIONS,
- WEBSOCKET_MAX_CONNECTIONS_DEFAULT);
-
- cfg.renderClientBehaviorScriptsAsString = getBoolean(extCtx, RENDER_CLIENTBEHAVIOR_SCRIPTS_AS_STRING,
- RENDER_CLIENTBEHAVIOR_SCRIPTS_AS_STRING_DEFAULT);
-
- cfg.alwaysForceSessionCreation = getBoolean(extCtx, ALWAYS_FORCE_SESSION_CREATION,
- ALWAYS_FORCE_SESSION_CREATION_DEFAULT);
-
- String resourceBundleControl = getString(extCtx, RESOURCE_BUNDLE_CONTROL, null);
- if (StringUtils.isNotBlank(resourceBundleControl))
- {
- cfg.resourceBundleControl = (ResourceBundle.Control) ClassUtils.newInstance(resourceBundleControl);
- }
-
- cfg.automaticExtensionlessMapping = getBoolean(extCtx, AUTOMATIC_EXTENSIONLESS_MAPPING,
- AUTOMATIC_EXTENSIONLESS_MAPPING_DEFAULT);
-
- return cfg;
- }
-
- private static boolean getBoolean(ExternalContext externalContext, String paramName, boolean defaultValue)
- {
- String value = externalContext.getInitParameter(paramName);
- if (value == null)
- {
- return defaultValue;
- }
-
- if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("on") || value.equalsIgnoreCase("yes"))
- {
- return true;
- }
- else if (value.equalsIgnoreCase("false") || value.equalsIgnoreCase("off") || value.equalsIgnoreCase("no"))
- {
- return false;
- }
-
- return defaultValue;
- }
-
- private static String getString(ExternalContext externalContext, String paramName, String defaultValue)
- {
- String value = externalContext.getInitParameter(paramName);
- if (value == null)
- {
- return defaultValue;
- }
-
- return value;
- }
-
- private static int getInt(ExternalContext externalContext, String paramName, int defaultValue)
- {
- String value = externalContext.getInitParameter(paramName);
- if (value == null)
- {
- return defaultValue;
- }
-
- try
- {
- return Integer.parseInt(value);
- }
- catch (NumberFormatException e)
- {
- }
- return defaultValue;
- }
-
- private static long getLong(ExternalContext externalContext, String paramName, long defaultValue)
- {
- String value = externalContext.getInitParameter(paramName);
- if (value == null)
- {
- return defaultValue;
- }
-
- try
- {
- return Long.parseLong(value);
- }
- catch (NumberFormatException e)
- {
- }
- return defaultValue;
- }
-
- public boolean isMyfacesImplAvailable()
- {
- return MYFACES_IMPL_AVAILABLE;
- }
-
- public boolean isRiImplAvailable()
- {
- return RI_IMPL_AVAILABLE;
- }
-
- public boolean isStrictJsf2AllowSlashLibraryName()
- {
- return strictJsf2AllowSlashLibraryName;
- }
-
- public long getConfigRefreshPeriod()
- {
- return configRefreshPeriod;
- }
-
- public boolean isRenderViewStateId()
- {
- return renderViewStateId;
- }
-
- public boolean isStrictXhtmlLinks()
- {
- return strictXhtmlLinks;
- }
-
- public boolean isRenderClearJavascriptOnButton()
- {
- return renderClearJavascriptOnButton;
- }
-
- public String getDelegateFacesServlet()
- {
- return delegateFacesServlet;
- }
-
- public boolean isRefreshTransientBuildOnPSS()
- {
- return refreshTransientBuildOnPSS;
- }
-
- public boolean isRefreshTransientBuildOnPSSAuto()
- {
- return refreshTransientBuildOnPSSAuto;
- }
-
- public boolean isRefreshTransientBuildOnPSSPreserveState()
- {
- return refreshTransientBuildOnPSSPreserveState;
- }
-
- public boolean isValidateXML()
- {
- return validateXML;
- }
-
- public boolean isWrapScriptContentWithXmlCommentTag()
- {
- return wrapScriptContentWithXmlCommentTag;
- }
-
- public boolean isDebugPhaseListenerEnabled()
- {
- return debugPhaseListenerEnabled;
- }
-
- public boolean isStrictJsf2CCELResolver()
- {
- return strictJsf2CCELResolver;
- }
-
- public String getDefaultResponseWriterContentTypeMode()
- {
- return defaultResponseWriterContentTypeMode;
- }
-
- public boolean isViewUniqueIdsCacheEnabled()
- {
- return viewUniqueIdsCacheEnabled;
- }
-
- public int getComponentUniqueIdsCacheSize()
- {
- return componentUniqueIdsCacheSize;
- }
-
- public boolean isStrictJsf2ViewNotFound()
- {
- return strictJsf2ViewNotFound;
- }
-
- public boolean isEarlyFlushEnabled()
- {
- return earlyFlushEnabled;
- }
-
- public boolean isStrictJsf2FaceletsCompatibility()
- {
- return strictJsf2FaceletsCompatibility;
- }
-
- public boolean isRenderFormViewStateAtBegin()
- {
- return renderFormViewStateAtBegin;
- }
-
- public boolean isFlashScopeDisabled()
- {
- return flashScopeDisabled;
- }
-
- public Integer getNumberOfViewsInSession()
- {
- return numberOfViewsInSession;
- }
-
- public Integer getNumberOfSequentialViewsInSession()
- {
- return numberOfSequentialViewsInSession;
- }
-
- public Integer getNumberOfFlashTokensInSession()
- {
- return numberOfFlashTokensInSession;
- }
-
- public boolean isSupportEL3ImportHandler()
- {
- return supportEL3ImportHandler;
- }
-
- public boolean isStrictJsf2OriginHeaderAppPath()
- {
- return strictJsf2OriginHeaderAppPath;
- }
-
- public int getResourceBufferSize()
- {
- return resourceBufferSize;
- }
-
- public boolean isUseCdiForAnnotationScanning()
- {
- return useCdiForAnnotationScanning;
- }
-
- public boolean isResourceHandlerCacheEnabled()
- {
- return resourceHandlerCacheEnabled;
- }
-
- public int getResourceHandlerCacheSize()
- {
- return resourceHandlerCacheSize;
- }
-
- public String getScanPackages()
- {
- return scanPackages;
- }
-
- public long getWebsocketMaxIdleTimeout()
- {
- return websocketMaxIdleTimeout;
- }
-
- public Integer getWebsocketEndpointPort()
- {
- return websocketEndpointPort;
- }
-
- public long getClientViewStateTimeout()
- {
- return clientViewStateTimeout;
- }
-
- public String getRandomKeyInViewStateSessionToken()
- {
- return randomKeyInViewStateSessionToken;
- }
-
- public int getRandomKeyInViewStateSessionTokenLength()
- {
- return randomKeyInViewStateSessionTokenLength;
- }
-
- public String getRandomKeyInViewStateSessionTokenSecureRandomClass()
- {
- return randomKeyInViewStateSessionTokenSecureRandomClass;
- }
-
- public String getRandomKeyInViewStateSessionTokenSecureRandomProvider()
- {
- return randomKeyInViewStateSessionTokenSecureRandomProvider;
- }
-
- public String getRandomKeyInViewStateSessionTokenSecureRandomAlgorithm()
- {
- return randomKeyInViewStateSessionTokenSecureRandomAlgorithm;
- }
-
- public String getRandomKeyInCsrfSessionToken()
- {
- return randomKeyInCsrfSessionToken;
- }
-
- public boolean isSerializeStateInSession()
- {
- return serializeStateInSession;
- }
-
- public boolean isCompressStateInSession()
- {
- return compressStateInSession;
- }
-
- public boolean isUseFlashScopePurgeViewsInSession()
- {
- return useFlashScopePurgeViewsInSession;
- }
-
- public boolean isAutocompleteOffViewState()
- {
- return autocompleteOffViewState;
- }
-
- public long getResourceMaxTimeExpires()
- {
- return resourceMaxTimeExpires;
- }
-
- public boolean isLazyLoadConfigObjects()
- {
- return lazyLoadConfigObjects;
- }
-
- public String getElResolverComparator()
- {
- return elResolverComparator;
- }
-
- public String getElResolverPredicate()
- {
- return elResolverPredicate;
- }
-
- public int getViewIdCacheSize()
- {
- return viewIdCacheSize;
- }
-
- public boolean isBeanBeforeJsfValidation()
- {
- return beanBeforeJsfValidation;
- }
-
- public String getRandomKeyInWebsocketSessionToken()
- {
- return randomKeyInWebsocketSessionToken;
- }
-
- public String getFacesInitPlugins()
- {
- return facesInitPlugins;
- }
-
- public boolean isInitializeSkipJarFacesConfigScan()
- {
- return initializeSkipJarFacesConfigScan;
- }
-
- public String getExpressionFactory()
- {
- return expressionFactory;
- }
-
- public String getCheckIdProductionMode()
- {
- return checkIdProductionMode;
- }
-
- public boolean isPartialStateSaving()
- {
- return partialStateSaving;
- }
-
- public String[] getFullStateSavingViewIds()
- {
- return fullStateSavingViewIds;
- }
-
- public int getFaceletsBufferSize()
- {
- return faceletsBufferSize;
- }
-
- public boolean isMarkInitialStateWhenApplyBuildView()
- {
- return markInitialStateWhenApplyBuildView;
- }
-
- public String[] getViewSuffix()
- {
- return viewSuffix;
- }
-
- public String[] getFaceletsViewMappings()
- {
- return faceletsViewMappings;
- }
-
- public String getFaceletsViewSuffix()
- {
- return faceletsViewSuffix;
- }
-
- public boolean isViewIdExistsCacheEnabled()
- {
- return viewIdExistsCacheEnabled;
- }
-
- public boolean isViewIdProtectedCacheEnabled()
- {
- return viewIdProtectedCacheEnabled;
- }
-
- public boolean isViewIdDeriveCacheEnabled()
- {
- return viewIdDeriveCacheEnabled;
- }
-
- public ELExpressionCacheMode getELExpressionCacheMode()
- {
- return elExpressionCacheMode;
- }
-
- public boolean isWrapTagExceptionsAsContextAware()
- {
- return wrapTagExceptionsAsContextAware;
- }
-
- public boolean isResourceCacheLastModified()
- {
- return resourceCacheLastModified;
- }
-
- public boolean isLogWebContextParams()
- {
- return logWebContextParams;
- }
-
- public int getWebsocketMaxConnections()
- {
- return websocketMaxConnections;
- }
-
- public boolean isRenderClientBehaviorScriptsAsString()
- {
- return renderClientBehaviorScriptsAsString;
- }
-
- public boolean isAlwaysForceSessionCreation()
- {
- return alwaysForceSessionCreation;
- }
-
- public ProjectStage getProjectStage()
- {
- return projectStage;
- }
-
- public ResourceBundle.Control getResourceBundleControl()
- {
- return resourceBundleControl;
- }
-
- public boolean isAutomaticExtensionlessMapping()
- {
- return automaticExtensionlessMapping;
- }
-
- public Integer getNumberOfClientWindows()
- {
- return numberOfClientWindows;
- }
-}
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.config;
+
+import java.util.ResourceBundle;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import jakarta.faces.application.ProjectStage;
+import jakarta.faces.application.StateManager;
+import jakarta.faces.application.ViewHandler;
+import jakarta.faces.context.ExternalContext;
+import jakarta.faces.context.FacesContext;
+import jakarta.faces.lifecycle.ClientWindow;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
+import org.apache.myfaces.spi.InjectionProvider;
+import org.apache.myfaces.util.lang.ClassUtils;
+import org.apache.myfaces.util.lang.StringUtils;
+import org.apache.myfaces.view.facelets.ELExpressionCacheMode;
+
+/**
+ * Holds all configuration init parameters (from web.xml) that are independent
+ * from the core implementation. The parameters in this class are available to
+ * all shared, component and implementation classes.
+ * See RuntimeConfig for configuration infos that come from the faces-config
+ * files and are needed by the core implementation.
+ *
+ * MyfacesConfig is meant for components that implement some of the extended features
+ * of MyFaces. Anyhow, using the MyFaces JSF implementation is no precondition for using
+ * MyfacesConfig in custom components. Upon using another JSF implementation
+ * (or omitting the extended init parameters) all config properties will simply have
+ * their default values.
+ */
+//CHECKSTYLE:OFF
+public class MyfacesConfig
+{
+ private static final String APPLICATION_MAP_PARAM_NAME = MyfacesConfig.class.getName();
+
+ /**
+ * Set the time in seconds that check for updates of web.xml and faces-config descriptors and
+ * refresh the configuration.
+ * This param is valid only if project stage is not production. Set this param to 0 disable this feature.
+ */
+ @JSFWebConfigParam(defaultValue="2",since="1.1", classType="java.lang.Long")
+ public static final String CONFIG_REFRESH_PERIOD = "org.apache.myfaces.CONFIG_REFRESH_PERIOD";
+ private static final long CONFIG_REFRESH_PERIOD_DEFAULT = 2;
+
+ /**
+ * Define if the input field that should store the state (jakarta.faces.ViewState) should render
+ * id="jakarta.faces.ViewState".
+ *
+ * JSF API 1.2 defines a "jakarta.faces.ViewState" client parameter, that must be rendered as both the "name"
+ * and the "id" attribute of the hidden input that is rendered for the purpose of state saving
+ * (see ResponseStateManager.VIEW_STATE_PARAM).
+ * Actually this causes duplicate id attributes and thus invalid XHTML pages when multiple forms are rendered on
+ * one page. With the org.apache.myfaces.RENDER_VIEWSTATE_ID context parameter you can tune this behaviour.
+ * <br/>Set it to
+ * <ul><li>true - to render JSF 1.2 compliant id attributes (that might cause invalid XHTML), or</li>
+ * <li>false - to omit rendering of the id attribute (which is only needed for very special
+ * AJAX/Javascript components)</li></ul>
+ * Default value is: true (for backwards compatibility and JSF 1.2 compliancy)
+ */
+ @JSFWebConfigParam(defaultValue="true", expectedValues="true, false, on, off, yes, no",since="1.1",
+ ignoreUpperLowerCase=true, group="state")
+ public static final String RENDER_VIEWSTATE_ID = "org.apache.myfaces.RENDER_VIEWSTATE_ID";
+ private static final boolean RENDER_VIEWSTATE_ID_DEFAULT = true;
+
+ /**
+ * Use "&amp;" entity instead a plain "&" character within HTML.
+ * <p>W3C recommends to use the "&amp;" entity instead of a plain "&" character within HTML.
+ * This also applies to attribute values and thus to the "href" attribute of <a> elements as well.
+ * Even more, when XHTML is used as output the usage of plain "&" characters is forbidden and would lead to
+ * invalid XML code.
+ * Therefore, since version 1.1.6 MyFaces renders the correct "&amp;" entity for links.</p>
+ * <p>The init parameter
+ * org.apache.myfaces.STRICT_XHTML_LINKS makes it possible to restore the old behaviour and to make MyFaces
+ * "bug compatible" to the Sun RI which renders plain "&" chars in links as well.</p>
+ * <p>
+ * See: <a href="http://www.w3.org/TR/html401/charset.html#h-5.3.2">HTML 4.01 Specification</a>
+ * See: <a href="http://issues.apache.org/jira/browse/MYFACES-1774">Jira: MYFACES-1774</a>
+ * </p>
+ */
+ @JSFWebConfigParam(defaultValue="true", expectedValues="true, false, on, off, yes, no",since="1.1.6",
+ ignoreUpperLowerCase=true, group="render")
+ public static final String STRICT_XHTML_LINKS = "org.apache.myfaces.STRICT_XHTML_LINKS";
+ private static final boolean STRICT_XHTML_LINKS_DEFAULT = true;
+
+ /**
+ * This param renders the clear javascript on button necessary only for
+ * compatibility with hidden fields feature of myfaces. This is done
+ * because jsf ri does not render javascript on onclick method for button,
+ * so myfaces should do this.
+ */
+ @JSFWebConfigParam(defaultValue="false", expectedValues="true, false, on, off, yes, no",since="1.2.3",
+ ignoreUpperLowerCase=true, group="render")
+ public static final String RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON =
+ "org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON";
+ private static final boolean RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON_DEFAULT= false;
+
+ /**
+ * Define an alternate class name that will be used to initialize MyFaces, instead the default
+ * jakarta.faces.webapp.FacesServlet.
+ *
+ * <p>This helps MyFaces to detect the mappings and other additional configuration used to setup the
+ * environment, and prevent abort initialization if no FacesServlet config is detected.
+ * </p>
+ */
+ @JSFWebConfigParam(since="1.2.7")
+ public static final String DELEGATE_FACES_SERVLET = "org.apache.myfaces.DELEGATE_FACES_SERVLET";
+
+ /**
+ * Indicate if the facelet associated to the view should be reapplied when the view is refreshed.
+ * Default mode is "auto".
+ *
+ * <p>This param is only valid when partial state saving is on.
+ * If this is set as true, the tag-handlers are always reapplied before render view, like in facelets 1.1.x,
+ * allowing c:if work correctly to "toggle" components based on a value changed on invoke application phase.
+ * If the param is set as "auto", the implementation check if c:if, c:forEach,
+ * c:choose and ui:include with src=ELExpression is used on the page and if that so, mark the view
+ * to be refreshed.</p>
+ */
+ @JSFWebConfigParam(since="2.0", defaultValue="auto", expectedValues="true,false,auto", tags="performance",
+ ignoreUpperLowerCase=true, group="state")
+ public final static String REFRESH_TRANSIENT_BUILD_ON_PSS =
+ "org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS";
+ private final static String REFRESH_TRANSIENT_BUILD_ON_PSS_DEFAULT = "auto";
+
+ /**
+ * Enable or disable a special mode that enable full state for parent components containing c:if, c:forEach,
+ * c:choose and ui:include with src=ELExpression. By default is disabled(false).
+ *
+ * <p>This param is only valid when partial state saving is on.
+ * If this is set as true, parent components containing c:if, c:forEach,
+ * c:choose and ui:include with src=ELExpression are marked to be restored fully, so state
+ * is preserved between request.</p>
+ */
+ @JSFWebConfigParam(since="2.0", defaultValue="false", expectedValues="true, false, on, off, yes, no",
+ tags="performance", ignoreUpperLowerCase=true, group="state")
+ public final static String REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE =
+ "org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE";
+ private final static boolean REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE_DEFAULT = false;
+
+ /**
+ * If set to <code>true</code>, tag library XML files and faces config XML files using schema
+ * will be validated during application start up
+ */
+ @JSFWebConfigParam(since="2.0", expectedValues="true, false, on, off, yes, no", ignoreUpperLowerCase=true)
+ public final static String VALIDATE_XML = "org.apache.myfaces.VALIDATE_XML";
+ private final static boolean VALIDATE_XML_DEFAULT = false;
+
+ /**
+ * Wrap content inside script with xml comment to prevent old browsers to display it. By default it is true.
+ */
+ @JSFWebConfigParam(since="2.0.1", expectedValues="true, false, on, off, yes, no", defaultValue="false",
+ ignoreUpperLowerCase=true, group="render")
+ public final static String WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG =
+ "org.apache.myfaces.WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG";
+ private final static boolean WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT = false;
+
+ /**
+ * Enable/disable DebugPhaseListener feature, with provide useful information about ValueHolder
+ * variables (submittedValue, localValue, value).
+ * Note evaluate those getters for each component could cause some unwanted side effects when
+ * using "access" type scopes like on MyFaces CODI.
+ * This param only has effect when project stage is Development.
+ */
+ @JSFWebConfigParam(since="2.0.8")
+ public final static String DEBUG_PHASE_LISTENER = "org.apache.myfaces.DEBUG_PHASE_LISTENER";
+ private final static boolean DEBUG_PHASE_LISTENER_DEFAULT = false;
+
+ /**
+ * Change default getType() behavior for composite component EL resolver, from return null
+ * (see JSF 2_0 spec section 5_6_2_2) to
+ * use the metadata information added by composite:attribute, ensuring components working with
+ * chained EL expressions to find the
+ * right type when a getType() is called over the source EL expression.
+ *
+ * To ensure strict compatibility with the spec set this param to true (by default is false,
+ * so the change is enabled by default).
+ */
+ @JSFWebConfigParam(since="2.0.10", expectedValues="true, false", defaultValue="false", group="EL")
+ public final static String STRICT_JSF_2_CC_EL_RESOLVER =
+ "org.apache.myfaces.STRICT_JSF_2_CC_EL_RESOLVER";
+ private final static boolean STRICT_JSF_2_CC_EL_RESOLVER_DEFAULT = false;
+
+ /**
+ * Define the default content type that the default ResponseWriter generates, when no match can be derived from
+ * HTTP Accept Header.
+ */
+ @JSFWebConfigParam(since="2.0.11,2.1.5", expectedValues="text/html, application/xhtml+xml",
+ defaultValue="text/html", group="render")
+ public final static String DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE =
+ "org.apache.myfaces.DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE";
+ private final static String DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE_DEFAULT = "text/html";
+
+ /**
+ * Enable or disable a cache used to "remember" the generated facelets unique ids and reduce
+ * the impact on memory usage, only active if jakarta.faces.FACELETS_REFRESH_PERIOD is -1 (no refresh).
+ */
+ @JSFWebConfigParam(defaultValue = "true", since = "2.0.13, 2.1.7", expectedValues="true, false",
+ group="viewhandler", tags="performance",
+ desc="Enable or disable a cache used to 'remember' the generated facelets unique ids " +
+ "and reduce the impact over memory usage.")
+ public static final String VIEW_UNIQUE_IDS_CACHE_ENABLED =
+ "org.apache.myfaces.VIEW_UNIQUE_IDS_CACHE_ENABLED";
+ private static final boolean VIEW_UNIQUE_IDS_CACHE_ENABLED_DEFAULT = true;
+
+ /**
+ * Set the size of the cache used to store strings generated using SectionUniqueIdCounter
+ * for component ids. If this is set to 0, no cache is used. By default is set to 200.
+ */
+ @JSFWebConfigParam(defaultValue = "100", since = "2.0.13, 2.1.7",
+ group="viewhandler", tags="performance")
+ public static final String COMPONENT_UNIQUE_IDS_CACHE_SIZE =
+ "org.apache.myfaces.COMPONENT_UNIQUE_IDS_CACHE_SIZE";
+ private static final int COMPONENT_UNIQUE_IDS_CACHE_SIZE_DEFAULT = 200;
+
+ /**
+ * If this param is set to true, a check will be done in Restore View Phase to check
+ * if the viewId exists or not and if it does not exists, a 404 response will be thrown.
+ *
+ * This is applicable in cases where all the views in the application are generated by a
+ * ViewDeclarationLanguage implementation.
+ */
+ @JSFWebConfigParam(since = "2.1.13", defaultValue="false", expectedValues="true,false",
+ group="viewhandler")
+ public static final String STRICT_JSF_2_VIEW_NOT_FOUND =
+ "org.apache.myfaces.STRICT_JSF_2_VIEW_NOT_FOUND";
+ private final static boolean STRICT_JSF_2_VIEW_NOT_FOUND_DEFAULT = false;
+
+ @JSFWebConfigParam(defaultValue = "false", since = "2.2.0", expectedValues="true, false", group="render",
+ tags="performance",
+ desc="Enable or disable an early flush which allows to send e.g. the HTML-Head to the client " +
+ "while the rest gets rendered. It's a well known technique to reduce the time for loading a page.")
+ public static final String EARLY_FLUSH_ENABLED =
+ "org.apache.myfaces.EARLY_FLUSH_ENABLED";
+ private static final boolean EARLY_FLUSH_ENABLED_DEFAULT = false;
+
+ /**
+ * This param makes components like c:set, ui:param and templating components like ui:decorate,
+ * ui:composition and ui:include to behave like the ones provided originally in facelets 1_1_x.
+ * See MYFACES-3810 for details.
+ */
+ @JSFWebConfigParam(since = "2.2.0", defaultValue="false", expectedValues="true,false",
+ group="viewhandler")
+ public static final String STRICT_JSF_2_FACELETS_COMPATIBILITY =
+ "org.apache.myfaces.STRICT_JSF_2_FACELETS_COMPATIBILITY";
+ private final static boolean STRICT_JSF_2_FACELETS_COMPATIBILITY_DEFAULT = false;
+
+ /**
+ * This param makes h:form component to render the view state and other hidden fields
+ * at the beginning of the form. This also includes component resources with target="form",
+ * but it does not include legacy 1.1 myfaces specific hidden field adition.
+ */
+ @JSFWebConfigParam(since = "2.2.4", defaultValue = "false", expectedValues = "true,false",
+ group="render")
+ public static final String RENDER_FORM_VIEW_STATE_AT_BEGIN =
+ "org.apache.myfaces.RENDER_FORM_VIEW_STATE_AT_BEGIN";
+ private final static boolean RENDER_FORM_VIEW_STATE_AT_BEGIN_DEFAULT = false;
+
+ /**
+ * Defines whether flash scope is disabled, preventing add the Flash cookie to the response.
+ *
+ * <p>This is useful for applications that does not require to use flash scope, and instead uses other scopes.</p>
+ */
+ @JSFWebConfigParam(defaultValue="false",since="2.0.5")
+ public static final String FLASH_SCOPE_DISABLED = "org.apache.myfaces.FLASH_SCOPE_DISABLED";
+ private static final boolean FLASH_SCOPE_DISABLED_DEFAULT = false;
+
+ /**
+ * Defines the amount (default = 20) of the latest views are stored in session.
+ *
+ * <p>Only applicable if state saving method is "server" (= default).
+ * </p>
+ *
+ */
+ @JSFWebConfigParam(defaultValue="20",since="1.1", classType="java.lang.Integer", group="state", tags="performance")
+ public static final String NUMBER_OF_VIEWS_IN_SESSION = "org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION";
+ /**
+ * Default value for <code>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</code> context parameter.
+ */
+ public static final int NUMBER_OF_VIEWS_IN_SESSION_DEFAULT = 20;
+
+ /**
+ * Indicates the amount of views (default is not active) that should be stored in session between sequential
+ * POST or POST-REDIRECT-GET if org.apache.myfaces.USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION is true.
+ *
+ * <p>Only applicable if state saving method is "server" (= default). For example, if this param has value = 2 and
+ * in your custom webapp there is a form that is clicked 3 times, only 2 views
+ * will be stored and the third one (the one stored the first time) will be
+ * removed from session, even if the view can
+ * store more sessions org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION.
+ * This feature becomes useful for multi-window applications.
+ * where without this feature a window can swallow all view slots so
+ * the other ones will throw ViewExpiredException.</p>
+ */
+ @JSFWebConfigParam(since="2.0.6", classType="java.lang.Integer", group="state", tags="performance",
+ defaultValue = "4")
+ public static final String NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION
+ = "org.apache.myfaces.NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION";
+ public static final Integer NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION_DEFAULT = 4;
+
+ /**
+ * Indicate the max number of flash tokens stored into session. It is only active when
+ * jakarta.faces.CLIENT_WINDOW_MODE is enabled and jakarta.faces.STATE_SAVING_METHOD is set
+ * to "server". Each flash token is associated to one client window id at
+ * the same time, so this param is related to the limit of active client windows per session.
+ * By default is the same number as in
+ * (org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION /
+ * org.apache.myfaces.NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION) + 1 = 6.
+ */
+ @JSFWebConfigParam(since="2.2.6", group="state", tags="performance")
+ public static final String NUMBER_OF_FLASH_TOKENS_IN_SESSION =
+ "org.apache.myfaces.NUMBER_OF_FLASH_TOKENS_IN_SESSION";
+
+ /**
+ * This parameter specifies whether or not the ImportHandler will be supported
+ */
+ @JSFWebConfigParam(since="2.2.9", defaultValue="false", expectedValues="true,false", group="EL")
+ public static final String SUPPORT_EL_3_IMPORT_HANDLER = "org.apache.myfaces.SUPPORT_EL_3_IMPORT_HANDLER";
+ private final static boolean SUPPORT_EL_3_IMPORT_HANDLER_DEFAULT = false;
+
+ /**
+ * This parameter specifies whether or not the Origin header app path should be checked
+ */
+ @JSFWebConfigParam(since="2.3", defaultValue="false", expectedValues="true,false")
+ public static final String STRICT_JSF_2_ORIGIN_HEADER_APP_PATH =
+ "org.apache.myfaces.STRICT_JSF_2_ORIGIN_HEADER_APP_PATH";
+ private final static boolean STRICT_JSF_2_ORIGIN_HEADER_APP_PATH_DEFAULT = false;
+
+ /**
+ * Allow slash in the library name of a Resource.
+ */
+ @JSFWebConfigParam(since="2.1.6, 2.0.12", defaultValue="false",
+ expectedValues="true, false", group="resources")
+ public static final String STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME =
+ "org.apache.myfaces.STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME";
+ private static final boolean STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME_DEFAULT = false;
+
+ /**
+ * Define the default buffer size that is used between Resource.getInputStream() and
+ * httpServletResponse.getOutputStream() when rendering resources using the default
+ * ResourceHandler.
+ */
+ @JSFWebConfigParam(since="2.1.10, 2.0.16", defaultValue="2048", group="resources")
+ public static final String RESOURCE_BUFFER_SIZE = "org.apache.myfaces.RESOURCE_BUFFER_SIZE";
+ private static final int RESOURCE_BUFFER_SIZE_DEFAULT = 2048;
+
+ /**
+ * Validate if the managed beans and navigations rules are correct.
+ *
+ * <p>For example, it checks if the managed bean classes really exists, or if the
+ * navigation rules points to existing view files.</p>
+ */
+ @JSFWebConfigParam(since="2.0", defaultValue="false", expectedValues="true, false")
+ public static final String VALIDATE = "org.apache.myfaces.VALIDATE";
+
+ /**
+ * Defines if CDI should be used for annotation scanning to improve the startup performance.
+ */
+ @JSFWebConfigParam(since="2.2.9", tags = "performance", defaultValue = "false")
+ public static final String USE_CDI_FOR_ANNOTATION_SCANNING
+ = "org.apache.myfaces.annotation.USE_CDI_FOR_ANNOTATION_SCANNING";
+ private static final boolean USE_CDI_FOR_ANNOTATION_SCANNING_DEFAULT = false;
+
+
+ /**
+ * Controls the size of the cache used to check if a resource exists or not.
+ *
+ * <p>See org.apache.myfaces.RESOURCE_HANDLER_CACHE_ENABLED for details.</p>
+ */
+ @JSFWebConfigParam(defaultValue = "500", since = "2.0.2", group="resources",
+ classType="java.lang.Integer", tags="performance")
+ public static final String RESOURCE_HANDLER_CACHE_SIZE =
+ "org.apache.myfaces.RESOURCE_HANDLER_CACHE_SIZE";
+ private static final int RESOURCE_HANDLER_CACHE_SIZE_DEFAULT = 500;
+
+ /**
+ * Enable or disable the cache used to "remember" if a resource handled by
+ * the default ResourceHandler exists or not.
+ *
+ */
+ @JSFWebConfigParam(defaultValue = "true", since = "2.0.2", group="resources",
+ expectedValues="true,false", tags="performance")
+ public static final String RESOURCE_HANDLER_CACHE_ENABLED =
+ "org.apache.myfaces.RESOURCE_HANDLER_CACHE_ENABLED";
+ private static final boolean RESOURCE_HANDLER_CACHE_ENABLED_DEFAULT = true;
+
+ /**
+ * Servlet context init parameter which defines which packages to scan
+ * for beans, separated by commas.
+ */
+ @JSFWebConfigParam(since="2.0")
+ public static final String SCAN_PACKAGES = "org.apache.myfaces.annotation.SCAN_PACKAGES";
+
+ /**
+ * Indicates the port used for websocket connections.
+ */
+ @JSFWebConfigParam(since = "2.3")
+ public static final java.lang.String WEBSOCKET_ENDPOINT_PORT = "jakarta.faces.WEBSOCKET_ENDPOINT_PORT";
+
+ @JSFWebConfigParam(defaultValue = "300000")
+ public static final String WEBSOCKET_MAX_IDLE_TIMEOUT = "org.apache.myfaces.WEBSOCKET_MAX_IDLE_TIMEOUT";
+ private static final long WEBSOCKET_MAX_IDLE_TIMEOUT_DEFAULT = 300000L;
+
+ /**
+ * Defines how to generate the csrf session token.
+ */
+ @JSFWebConfigParam(since="2.2.0", expectedValues="secureRandom, random",
+ defaultValue="secureRandom", group="state")
+ public static final String RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN
+ = "org.apache.myfaces.RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN";
+
+ public static final String RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN_SECURE_RANDOM = "secureRandom";
+ public static final String RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN_RANDOM = "random";
+ private static final String RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN_DEFAULT = RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN_SECURE_RANDOM;
+
+ /**
+ * Define the time in minutes where the view state is valid when
+ * client side state saving is used. By default it is set to 0
+ * (infinite).
+ */
+ @JSFWebConfigParam(since="2.1.9, 2.0.15", defaultValue="0", group="state")
+ public static final String CLIENT_VIEW_STATE_TIMEOUT =
+ "org.apache.myfaces.CLIENT_VIEW_STATE_TIMEOUT";
+ private static final Long CLIENT_VIEW_STATE_TIMEOUT_DEFAULT = 0L;
+
+
+ /**
+ * Adds a random key to the generated view state session token.
+ */
+ @JSFWebConfigParam(since="2.1.9, 2.0.15", expectedValues="secureRandom, random",
+ defaultValue="secureRandom", group="state")
+ public static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN
+ = "org.apache.myfaces.RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN";
+ public static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM = "secureRandom";
+ public static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_RANDOM = "random";
+ private static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_DEFAULT = RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM;
+
+ /**
+ * Set the default length of the random key added to the view state session token.
+ * By default is 8.
+ */
+ @JSFWebConfigParam(since="2.1.9, 2.0.15", defaultValue="8", group="state")
+ public static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_LENGTH
+ = "org.apache.myfaces.RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_LENGTH";
+ private static final int RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_LENGTH_DEFAULT = 8;
+
+ /**
+ * Sets the random class to initialize the secure random id generator.
+ * By default it uses java.security.SecureRandom
+ */
+ @JSFWebConfigParam(since="2.1.9, 2.0.15", group="state")
+ public static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_CLASS
+ = "org.apache.myfaces.RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_CLASS";
+
+ /**
+ * Sets the random provider to initialize the secure random id generator.
+ */
+ @JSFWebConfigParam(since="2.1.9, 2.0.15", group="state")
+ public static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_PROVIDER
+ = "org.apache.myfaces.RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_PROVIDER";
+
+ /**
+ * Sets the random algorithm to initialize the secure random id generator.
+ * By default is SHA1PRNG
+ */
+ @JSFWebConfigParam(since="2.1.9, 2.0.15", defaultValue="SHA1PRNG", group="state")
+ public static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_ALGORITHM
+ = "org.apache.myfaces.RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_ALGORITHM";
+ private static final String RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_ALGORITHM_DEFAULT = "SHA1PRNG";
+
+ public static final String RANDOM_KEY_IN_CSRF_SESSION_TOKEN_SECURE_RANDOM = "secureRandom";
+ public static final String RANDOM_KEY_IN_CSRF_SESSION_TOKEN_RANDOM = "random";
+
+ /**
+ * Defines how to generate the csrf session token.
+ */
+ @JSFWebConfigParam(since="2.2.0", expectedValues="secureRandom, random", defaultValue="secureRandom", group="state")
+ public static final String RANDOM_KEY_IN_CSRF_SESSION_TOKEN
+ = "org.apache.myfaces.RANDOM_KEY_IN_CSRF_SESSION_TOKEN";
+ private static final String RANDOM_KEY_IN_CSRF_SESSION_TOKEN_DEFAULT = RANDOM_KEY_IN_CSRF_SESSION_TOKEN_SECURE_RANDOM;
+
+ /**
+ * Indicates that the serialized state will be compressed before it is written to the session. By default true.
+ *
+ * Only applicable if state saving method is "server" (= default) and if
+ * <code>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</code> is <code>true</code> (= default).
+ * If <code>true</code> (default) the serialized state will be compressed before it is written to the session.
+ * If <code>false</code> the state will not be compressed.
+ */
+ @JSFWebConfigParam(defaultValue="true",since="1.1", expectedValues="true,false", group="state", tags="performance")
+ public static final String COMPRESS_STATE_IN_SESSION = "org.apache.myfaces.COMPRESS_STATE_IN_SESSION";
+ private static final boolean COMPRESS_STATE_IN_SESSION_DEFAULT = true;
+
+ /**
+ * Allow use flash scope to keep track of the views used in session and the previous ones,
+ * so server side state saving can delete old views even if POST-REDIRECT-GET pattern is used.
+ *
+ * <p>
+ * Only applicable if state saving method is "server" (= default).
+ * The default value is false.</p>
+ */
+ @JSFWebConfigParam(since="2.0.6", defaultValue="false", expectedValues="true, false", group="state")
+ public static final String USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION
+ = "org.apache.myfaces.USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION";
+ private static final boolean USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION_DEFAULT = false;
+
+ /**
+ * Add autocomplete="off" to the view state hidden field. Enabled by default.
+ */
+ @JSFWebConfigParam(since="2.2.8, 2.1.18, 2.0.24", expectedValues="true, false",
+ defaultValue="true", group="state")
+ public static final String AUTOCOMPLETE_OFF_VIEW_STATE =
+ "org.apache.myfaces.AUTOCOMPLETE_OFF_VIEW_STATE";
+ private static final boolean AUTOCOMPLETE_OFF_VIEW_STATE_DEFAULT = true;
+
+ /**
+ * Set the max time in miliseconds set on the "Expires" header for a resource rendered by
+ * the default ResourceHandler.
+ * (default to one week in miliseconds or 604800000)
+ */
+ @JSFWebConfigParam(since="2.0", defaultValue="604800000", group="resources", tags="performance")
+ public static final String RESOURCE_MAX_TIME_EXPIRES = "org.apache.myfaces.RESOURCE_MAX_TIME_EXPIRES";
+ private static final long RESOURCE_MAX_TIME_EXPIRES_DEFAULT = 604800000L;
+
+
+ /**
+ * Indicate if the classes associated to components, converters, validators or behaviors
+ * should be loaded as soon as they are added to the current application instance or instead
+ * loaded in a lazy way.
+ */
+ @JSFWebConfigParam(defaultValue="true",since="2.0",tags="performance")
+ public static final String LAZY_LOAD_CONFIG_OBJECTS = "org.apache.myfaces.LAZY_LOAD_CONFIG_OBJECTS";
+ private static final boolean LAZY_LOAD_CONFIG_OBJECTS_DEFAULT = true;
+
+
+ /**
+ * Define a custom comparator class used to sort the ELResolvers.
+ *
+ * <p>This is useful when it is necessary to put an ELResolver on top of other resolvers. Note set
+ * this param override the default ordering described by JSF spec section 5.
+ * </p>
+ */
+ @JSFWebConfigParam(since = "1.2.10, 2.0.2", group="EL",
+ desc = "The Class of an Comparator<ELResolver> implementation.")
+ public static final String EL_RESOLVER_COMPARATOR = "org.apache.myfaces.EL_RESOLVER_COMPARATOR";
+
+ @JSFWebConfigParam(since = "2.1.0", group="EL",
+ desc="The Class of an java.util.function.Predicate<ELResolver> implementation."
+ + "If used and returns false for a ELResolver instance, such resolver will not be installed in "
+ + "ELResolvers chain. Use with caution - can break functionality defined in JSF specification "
+ + "'ELResolver Instances Provided by Faces'")
+ public static final String EL_RESOLVER_PREDICATE = "org.apache.myfaces.EL_RESOLVER_PREDICATE";
+
+ @JSFWebConfigParam(defaultValue = "500", since = "2.0.2", group="viewhandler", tags="performance",
+ classType="java.lang.Integer",
+ desc="Controls the size of the viewId related caches: " +
+ "VIEWID_EXISTS_CACHE_ENABLED, VIEWID_PROTECTED_CACHE_ENABLED, VIEWID_DERIVE_CACHE_ENABLED")
+ public static final String VIEWID_CACHE_SIZE = "org.apache.myfaces.VIEWID_CACHE_SIZE";
+ private static final int VIEWID_CACHE_SIZE_DEFAULT = 500;
+
+ @JSFWebConfigParam(defaultValue = "true", since = "2.0.2", expectedValues="true, false", group="viewhandler",
+ tags="performance",
+ desc="Enable or disable the cache used to 'remember' if a view exists or not and reduce the impact " +
+ "of sucesive calls to ExternalContext.getResource().")
+ public static final String VIEWID_EXISTS_CACHE_ENABLED = "org.apache.myfaces.VIEWID_EXISTS_CACHE_ENABLED";
+ private static final boolean VIEWID_EXISTS_CACHE_ENABLED_DEFAULT = true;
+
+
+ @JSFWebConfigParam(defaultValue = "true", since = "2.3-next", expectedValues="true, false", group="viewhandler",
+ tags="performance",
+ desc="Enable or disable the cache used to 'remember' if a view is protected or not.")
+ public static final String VIEWID_PROTECTED_CACHE_ENABLED = "org.apache.myfaces.VIEWID_PROTECTED_CACHE_ENABLED";
+ private static final boolean VIEWID_PROTECTED_CACHE_ENABLED_DEFAULT = true;
+
+ @JSFWebConfigParam(defaultValue = "true", since = "2.3-next", expectedValues="true, false", group="viewhandler",
+ tags="performance",
+ desc="Enable or disable the cache used to 'remember' the derived viewId from the rawViewId.")
+ public static final String VIEWID_DERIVE_CACHE_ENABLED = "org.apache.myfaces.VIEWID_DERIVE_CACHE_ENABLED";
+ private static final boolean VIEWID_DERIVE_CACHE_ENABLED_DEFAULT = true;
+
+ /**
+ * Enforce f:validateBean to be called first before any JSF validator.
+ */
+ @JSFWebConfigParam(defaultValue="false", expectedValues="true, false", since = "2.2.10", group="validation")
+ public final static String BEAN_BEFORE_JSF_VALIDATION
+ = "org.apache.myfaces.validator.BEAN_BEFORE_JSF_VALIDATION";
+ private final static boolean BEAN_BEFORE_JSF_VALIDATION_DEFAULT = false;
+
+ /**
+ * comma delimited list of plugin classes which can be hooked into myfaces
+ */
+ @JSFWebConfigParam(since = "2.0")
+ public static final String FACES_INIT_PLUGINS = "org.apache.myfaces.FACES_INIT_PLUGINS";
+
+ /**
+ * If the flag is true, the algoritm skip jar scanning for faces-config files to check if the current
+ * application requires FacesServlet to be added dynamically (servlet spec 3). This param can be set using
+ * a system property with the same name too.
+ */
+ @JSFWebConfigParam(since="2.2.10", expectedValues = "true, false", defaultValue = "false",
+ tags = "performance")
+ public static final String INITIALIZE_SKIP_JAR_FACES_CONFIG_SCAN =
+ "org.apache.myfaces.INITIALIZE_SKIP_JAR_FACES_CONFIG_SCAN";
+ private static final boolean INITIALIZE_SKIP_JAR_FACES_CONFIG_SCAN_DEFAULT = false;
+
+ /**
+ * If this param is set to true, the check for faces servlet mapping is not done
+ */
+ @JSFWebConfigParam(since="2.0.3", defaultValue="false")
+ public static final String INITIALIZE_ALWAYS_STANDALONE = "org.apache.myfaces.INITIALIZE_ALWAYS_STANDALONE";
+
+ /**
+ * This parameter specifies the ExpressionFactory implementation to use.
+ */
+ @JSFWebConfigParam(since="1.2.7", group="EL")
+ public static final String EXPRESSION_FACTORY = "org.apache.myfaces.EXPRESSION_FACTORY";
+
+ /**
+ * Define how duplicate ids are checked when ProjectStage is Production, by default (auto) it only check ids of
+ * components that does not encapsulate markup (like facelets UILeaf).
+ *
+ * <ul>
+ * <li>true: check all ids, including ids for components that are transient and encapsulate markup.</li>
+ * <li>auto: (default) check ids of components that does not encapsulate markup (like facelets UILeaf).
+ * Note ids of UILeaf instances are generated by facelets vdl, start with "j_id", are never rendered
+ * into the response and UILeaf instances are never used as a target for listeners, so in practice
+ * there is no need to check such ids. This reduce the overhead associated with generate client ids.</li>
+ * <li>false: do not do any check when ProjectStage is Production</li>
+ * </ul>
+ * <p> According to specification, identifiers must be unique within the scope of the nearest ancestor to
+ * the component that is a naming container.</p>
+ */
+ @JSFWebConfigParam(since="2.0.12, 2.1.6", defaultValue="auto", expectedValues="true, auto, false",
+ group="state", tags="performance")
+ public static final String CHECK_ID_PRODUCTION_MODE
+ = "org.apache.myfaces.CHECK_ID_PRODUCTION_MODE";
+ private static final String CHECK_ID_PRODUCTION_MODE_DEFAULT = "auto";
+ public static final String CHECK_ID_PRODUCTION_MODE_TRUE = "true";
+ public static final String CHECK_ID_PRODUCTION_MODE_AUTO = "auto";
+
+ @JSFWebConfigParam(since = "2.1", defaultValue = "false", expectedValues = "true, false", tags = "performance")
+ public final static String MARK_INITIAL_STATE_WHEN_APPLY_BUILD_VIEW
+ = "org.apache.myfaces.MARK_INITIAL_STATE_WHEN_APPLY_BUILD_VIEW";
+ private static final boolean MARK_INITIAL_STATE_WHEN_APPLY_BUILD_VIEW_DEFAULT = false;
+
+ /**
+ * Indicates if expressions generated by facelets should be cached or not.
+ * Default is noCache. There there are four modes:
+ *
+ * <ul>
+ * <li>alwaysRecompile (since 2.1.12): Only does not cache when the expression contains
+ * a variable resolved using VariableMapper</li>
+ * <li>always: Only does not cache when expressions are inside user tags or the
+ * expression contains a variable resolved using VariableMapper</li>
+ * <li>allowCset: Like always, but does not allow cache when ui:param
+ * was used on the current template context</li>
+ * <li>strict: Like allowCset, but does not allow cache when c:set with
+ * var and value properties only is used on the current page context</li>
+ * <li>noCache: All expression are created each time the view is built</li>
+ * </ul>
+ *
+ */
+ @JSFWebConfigParam(since="2.0.8", defaultValue="noCache",
+ expectedValues="noCache, strict, allowCset, always, alwaysRecompile",
+ group="EL", tags="performance")
+ public static final String CACHE_EL_EXPRESSIONS = "org.apache.myfaces.CACHE_EL_EXPRESSIONS";
+ private static final String CACHE_EL_EXPRESSIONS_DEFAULT = ELExpressionCacheMode.alwaysRecompile.name();
+
+ /**
+ * Wrap exception caused by calls to EL expressions, so information like
+ * the location, expression string and tag name can be retrieved by
+ * the ExceptionHandler implementation and used to output meaningful information about itself.
+ *
+ * <p>Note in some cases this will wrap the original jakarta.el.ELException,
+ * so the information will not be on the stack trace unless ExceptionHandler
+ * retrieve checking if the exception implements ContextAware interface and calling getWrapped() method.
+ * </p>
+ *
+ */
+ @JSFWebConfigParam(since="2.0.9, 2.1.3" , defaultValue="true", expectedValues="true, false")
+ public static final String WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE
+ = "org.apache.myfaces.WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE";
+ private static final boolean WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE_DEFAULT = true;
+
+ /**
+ * Defines if the last-modified should be cached of the resources when the ProjectStage is Production.
+ * If the cache is disabled, each last-modified request will read the last-modified from the file.
+ */
+ @JSFWebConfigParam(since="2.3-next" , defaultValue="true", expectedValues="true, false")
+ public static final String RESOURCE_CACHE_LAST_MODIFIED
+ = "org.apache.myfaces.RESOURCE_CACHE_LAST_MODIFIED";
+ private static final boolean RESOURCE_CACHE_LAST_MODIFIED_DEFAULT = true;
+
+ /**
+ * Indicate if log all web config params should be done before initialize the webapp.
+ * <p>
+ * If is set in "auto" mode, web config params are only logged on "Development" and "Production" project stages.
+ * </p>
+ */
+ @JSFWebConfigParam(expectedValues="true, auto, false", defaultValue="auto")
+ public static final String LOG_WEB_CONTEXT_PARAMS = "org.apache.myfaces.LOG_WEB_CONTEXT_PARAMS";
+ private static final String LOG_WEB_CONTEXT_PARAMS_DEFAULT = "auto";
+
+ /**
+ * This parameter enables automatic extensionless mapping for all JSF views.
+ */
+ @JSFWebConfigParam(since="2.3", expectedValues = "true, false", defaultValue = "false")
+ public static final String AUTOMATIC_EXTENSIONLESS_MAPPING =
+ "org.apache.myfaces.AUTOMATIC_EXTENSIONLESS_MAPPING";
+ public static final boolean AUTOMATIC_EXTENSIONLESS_MAPPING_DEFAULT = false;
+
+ /**
+ * Indicate the class implementing FacesInitializer interface that will
+ * be used to setup MyFaces Core contexts.
+ * <p>This is used when some custom task must be done specifically when
+ * a myfaces web context is initialized or destroyed, or when MyFaces should
+ * be initialized in some custom environment.
+ * </p>
+ */
+ @JSFWebConfigParam(since = "2.0.1", desc = "Class name of a custom FacesInitializer implementation.")
+ public static final String FACES_INITIALIZER = "org.apache.myfaces.FACES_INITIALIZER";
+
+
+ /**
+ * Define the class implementing InjectionProvider interface to handle dependendy injection,
+ * PostConstruct and PreDestroy callbacks.
+ *
+ * <p>This also can be configured using a SPI entry (/META-INF/services/...).</p>
+ */
+ @JSFWebConfigParam(name="org.apache.myfaces.spi.InjectionProvider", since="2.2")
+ public static final String INJECTION_PROVIDER = InjectionProvider.class.getName();
+
+ @JSFWebConfigParam(name="org.apache.myfaces.WEBSOCKET_MAX_CONNECTIONS", since="2.3")
+ public static final String WEBSOCKET_MAX_CONNECTIONS = "org.apache.myfaces.WEBSOCKET_MAX_CONNECTIONS";
+ public static final Integer WEBSOCKET_MAX_CONNECTIONS_DEFAULT = 5000;
+
+
+ /**
+ * Defines if the clientbehavior scripts are passed as string or function to the faces.util.chain.
+ * "As string" is actually the default behavior of both MyFaces (until 2.3-next) and Mojarra.
+ * "As function" is quite usefull for CSP as no string needs to be evaluated as function.
+ *
+ * Our faces.util.chain supports both of course.
+ */
+ @JSFWebConfigParam(name="org.apache.myfaces.RENDER_CLIENTBEHAVIOR_SCRIPTS_AS_STRING", since="2.3-next", defaultValue = "false")
+ public static final String RENDER_CLIENTBEHAVIOR_SCRIPTS_AS_STRING = "org.apache.myfaces.RENDER_CLIENTBEHAVIOR_SCRIPTS_AS_STRING";
+ public static final boolean RENDER_CLIENTBEHAVIOR_SCRIPTS_AS_STRING_DEFAULT = false;
+
+ /**
+ * Defines if a session should be created (if one does not exist) before response rendering.
+ * When this parameter is set to true, a session will be created even when client side state
+ * saving or stateless views are used, which can lead to unintended resource consumption.
+ * When this parameter is set to false, a session will only be created before response
+ * rendering if a view is not transient and server side state saving is in use.
+ */
+ @JSFWebConfigParam(since="2.3.6", defaultValue="false", expectedValues="true,false")
+ public static final String ALWAYS_FORCE_SESSION_CREATION =
+ "org.apache.myfaces.ALWAYS_FORCE_SESSION_CREATION";
+ protected final static boolean ALWAYS_FORCE_SESSION_CREATION_DEFAULT = false;
+
+ /**
+ * Defines the {@link java.util.ResourceBundle.Control} to use for all
+ * {@link java.util.ResourceBundle#getBundle(java.lang.String)} calls.
+ */
+ @JSFWebConfigParam(since="2.3-next")
+ public static final String RESOURCE_BUNDLE_CONTROL =
+ "org.apache.myfaces.RESOURCE_BUNDLE_CONTROL";
+
+ // we need it, applicationImpl not ready probably
+ private ProjectStage projectStage = ProjectStage.Production;
+ private boolean strictJsf2AllowSlashLibraryName;
+ private long configRefreshPeriod = CONFIG_REFRESH_PERIOD_DEFAULT;
+ private boolean renderViewStateId = RENDER_VIEWSTATE_ID_DEFAULT;
+ private boolean strictXhtmlLinks = STRICT_XHTML_LINKS_DEFAULT;
+ private boolean renderClearJavascriptOnButton = RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON_DEFAULT;
+ private String delegateFacesServlet;
+ private boolean refreshTransientBuildOnPSS = true;
+ private boolean refreshTransientBuildOnPSSAuto = true;
+ private boolean refreshTransientBuildOnPSSPreserveState = REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE_DEFAULT;
+ private boolean validateXML = VALIDATE_XML_DEFAULT;
+ private boolean wrapScriptContentWithXmlCommentTag = WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT;
+ private boolean debugPhaseListenerEnabled = DEBUG_PHASE_LISTENER_DEFAULT;
+ private boolean strictJsf2CCELResolver = STRICT_JSF_2_CC_EL_RESOLVER_DEFAULT;
+ private String defaultResponseWriterContentTypeMode = DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE_DEFAULT;
+ private boolean viewUniqueIdsCacheEnabled = VIEW_UNIQUE_IDS_CACHE_ENABLED_DEFAULT;
+ private int componentUniqueIdsCacheSize = COMPONENT_UNIQUE_IDS_CACHE_SIZE_DEFAULT;
+ private boolean strictJsf2ViewNotFound = STRICT_JSF_2_VIEW_NOT_FOUND_DEFAULT;
+ private boolean earlyFlushEnabled = EARLY_FLUSH_ENABLED_DEFAULT;
+ private boolean strictJsf2FaceletsCompatibility = STRICT_JSF_2_FACELETS_COMPATIBILITY_DEFAULT;
+ private boolean renderFormViewStateAtBegin = RENDER_FORM_VIEW_STATE_AT_BEGIN_DEFAULT;
+ private boolean flashScopeDisabled = FLASH_SCOPE_DISABLED_DEFAULT;
+ private Integer numberOfViewsInSession = NUMBER_OF_VIEWS_IN_SESSION_DEFAULT;
+ private Integer numberOfSequentialViewsInSession = NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION_DEFAULT;
+ private Integer numberOfFlashTokensInSession;
+ private Integer numberOfClientWindows;
+ private boolean supportEL3ImportHandler = SUPPORT_EL_3_IMPORT_HANDLER_DEFAULT;
+ private boolean strictJsf2OriginHeaderAppPath = STRICT_JSF_2_ORIGIN_HEADER_APP_PATH_DEFAULT;
+ private int resourceBufferSize = RESOURCE_BUFFER_SIZE_DEFAULT;
+ private boolean useCdiForAnnotationScanning = USE_CDI_FOR_ANNOTATION_SCANNING_DEFAULT;
+ private boolean resourceHandlerCacheEnabled = RESOURCE_HANDLER_CACHE_ENABLED_DEFAULT;
+ private int resourceHandlerCacheSize = RESOURCE_HANDLER_CACHE_SIZE_DEFAULT;
+ private String scanPackages;
+ private long websocketMaxIdleTimeout = WEBSOCKET_MAX_IDLE_TIMEOUT_DEFAULT;
+ private Integer websocketEndpointPort;
+ private String randomKeyInWebsocketSessionToken = RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN_DEFAULT;
+ private long clientViewStateTimeout = CLIENT_VIEW_STATE_TIMEOUT_DEFAULT;
+ private String randomKeyInViewStateSessionToken = RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_DEFAULT;
+ private int randomKeyInViewStateSessionTokenLength = RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_LENGTH_DEFAULT;
+ private String randomKeyInViewStateSessionTokenSecureRandomClass;
+ private String randomKeyInViewStateSessionTokenSecureRandomProvider;
+ private String randomKeyInViewStateSessionTokenSecureRandomAlgorithm
+ = RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_ALGORITHM_DEFAULT;
+ private String randomKeyInCsrfSessionToken = RANDOM_KEY_IN_CSRF_SESSION_TOKEN_DEFAULT;
+ private boolean serializeStateInSession = false;
+ private boolean compressStateInSession = COMPRESS_STATE_IN_SESSION_DEFAULT;
+ private boolean useFlashScopePurgeViewsInSession = USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION_DEFAULT;
+ private boolean autocompleteOffViewState = AUTOCOMPLETE_OFF_VIEW_STATE_DEFAULT;
+ private long resourceMaxTimeExpires = RESOURCE_MAX_TIME_EXPIRES_DEFAULT;
+ private boolean lazyLoadConfigObjects = LAZY_LOAD_CONFIG_OBJECTS_DEFAULT;
+ private String elResolverComparator;
+ private String elResolverPredicate;
+ private boolean viewIdExistsCacheEnabled = VIEWID_EXISTS_CACHE_ENABLED_DEFAULT;
+ private boolean viewIdProtectedCacheEnabled = VIEWID_PROTECTED_CACHE_ENABLED_DEFAULT;
+ private boolean viewIdDeriveCacheEnabled = VIEWID_DERIVE_CACHE_ENABLED_DEFAULT;
+ private int viewIdCacheSize = VIEWID_CACHE_SIZE_DEFAULT;
+ private boolean beanBeforeJsfValidation = BEAN_BEFORE_JSF_VALIDATION_DEFAULT;
+ private String facesInitPlugins;
+ private boolean initializeSkipJarFacesConfigScan = INITIALIZE_SKIP_JAR_FACES_CONFIG_SCAN_DEFAULT;
+ private String expressionFactory;
+ private String checkIdProductionMode = CHECK_ID_PRODUCTION_MODE_DEFAULT;
+ private boolean partialStateSaving = true;
+ private String[] fullStateSavingViewIds;
+ private int faceletsBufferSize = 1024;
+ private boolean markInitialStateWhenApplyBuildView = MARK_INITIAL_STATE_WHEN_APPLY_BUILD_VIEW_DEFAULT;
+ private String[] viewSuffix = new String[] { ViewHandler.DEFAULT_SUFFIX };
+ private String[] faceletsViewMappings = new String[] {};
+ private String faceletsViewSuffix = ViewHandler.DEFAULT_FACELETS_SUFFIX;
+ private ELExpressionCacheMode elExpressionCacheMode;
+ private boolean wrapTagExceptionsAsContextAware = WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE_DEFAULT;
+ private boolean resourceCacheLastModified = RESOURCE_CACHE_LAST_MODIFIED_DEFAULT;
+ private boolean logWebContextParams = false;
+ private int websocketMaxConnections = WEBSOCKET_MAX_CONNECTIONS_DEFAULT;
+ private boolean renderClientBehaviorScriptsAsString = RENDER_CLIENTBEHAVIOR_SCRIPTS_AS_STRING_DEFAULT;
+ private boolean alwaysForceSessionCreation = ALWAYS_FORCE_SESSION_CREATION_DEFAULT;
+ private ResourceBundle.Control resourceBundleControl;
+ private boolean automaticExtensionlessMapping = AUTOMATIC_EXTENSIONLESS_MAPPING_DEFAULT;
+
+ private static final boolean MYFACES_IMPL_AVAILABLE;
+ private static final boolean RI_IMPL_AVAILABLE;
+
+ static
+ {
+ boolean myfacesImplAvailable;
+ try
+ {
+ ClassUtils.classForName("org.apache.myfaces.application.ApplicationImpl");
+ myfacesImplAvailable = true;
+ }
+ catch (ClassNotFoundException e)
+ {
+ myfacesImplAvailable = false;
+ }
+ MYFACES_IMPL_AVAILABLE = myfacesImplAvailable;
+
+ boolean riImplAvailable;
+ try
+ {
+ ClassUtils.classForName("com.sun.faces.application.ApplicationImpl");
+ riImplAvailable = true;
+ }
+ catch (ClassNotFoundException e)
+ {
+ riImplAvailable = false;
+ }
+ RI_IMPL_AVAILABLE = riImplAvailable;
+ }
+
+ public static MyfacesConfig getCurrentInstance()
+ {
+ return getCurrentInstance(FacesContext.getCurrentInstance().getExternalContext());
+ }
+
+ public static MyfacesConfig getCurrentInstance(FacesContext facesContext)
+ {
+ return getCurrentInstance(facesContext.getExternalContext());
+ }
+
+ public static MyfacesConfig getCurrentInstance(ExternalContext extCtx)
+ {
+ MyfacesConfig config = (MyfacesConfig) extCtx.getApplicationMap().get(APPLICATION_MAP_PARAM_NAME);
+ if (config == null)
+ {
+ config = createAndInitializeMyFacesConfig(extCtx);
+ extCtx.getApplicationMap().put(APPLICATION_MAP_PARAM_NAME, config);
+ }
+
+ return config;
+ }
+
+ public MyfacesConfig()
+ {
+ numberOfFlashTokensInSession = (NUMBER_OF_VIEWS_IN_SESSION_DEFAULT
+ / NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION_DEFAULT) + 1;
+ }
+
+ private static MyfacesConfig createAndInitializeMyFacesConfig(ExternalContext extCtx)
+ {
+ MyfacesConfig cfg = new MyfacesConfig();
+
+ try
+ {
+ cfg.projectStage = ProjectStage.valueOf(getString(extCtx, ProjectStage.PROJECT_STAGE_PARAM_NAME, null));
+ }
+ catch (Exception e)
+ {
+ // ignore, it's logged in ApplicationImpl
+ }
+ if (cfg.projectStage == null)
+ {
+ cfg.projectStage = ProjectStage.Production;
+ }
+
+ cfg.renderClearJavascriptOnButton = getBoolean(extCtx, RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON,
+ RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON_DEFAULT);
+
+ cfg.renderViewStateId = getBoolean(extCtx, RENDER_VIEWSTATE_ID,
+ RENDER_VIEWSTATE_ID_DEFAULT);
+
+ cfg.strictXhtmlLinks = getBoolean(extCtx, STRICT_XHTML_LINKS,
+ STRICT_XHTML_LINKS_DEFAULT);
+
+ cfg.configRefreshPeriod = getLong(extCtx, CONFIG_REFRESH_PERIOD,
+ CONFIG_REFRESH_PERIOD_DEFAULT);
+
+ cfg.delegateFacesServlet = getString(extCtx, DELEGATE_FACES_SERVLET,
+ null);
+
+ String refreshTransientBuildOnPSS = getString(extCtx, REFRESH_TRANSIENT_BUILD_ON_PSS,
+ REFRESH_TRANSIENT_BUILD_ON_PSS_DEFAULT);
+ if (refreshTransientBuildOnPSS == null)
+ {
+ cfg.refreshTransientBuildOnPSS = false;
+ cfg.refreshTransientBuildOnPSSAuto = false;
+ }
+ else if ("auto".equalsIgnoreCase(refreshTransientBuildOnPSS))
+ {
+ cfg.refreshTransientBuildOnPSS = true;
+ cfg.refreshTransientBuildOnPSSAuto = true;
+ }
+ else if (refreshTransientBuildOnPSS.equalsIgnoreCase("true") ||
+ refreshTransientBuildOnPSS.equalsIgnoreCase("on") ||
+ refreshTransientBuildOnPSS.equalsIgnoreCase("yes"))
+ {
+ cfg.refreshTransientBuildOnPSS = true;
+ cfg.refreshTransientBuildOnPSSAuto = false;
+ }
+ else
+ {
+ cfg.refreshTransientBuildOnPSS = false;
+ cfg.refreshTransientBuildOnPSSAuto = false;
+ }
+
+ cfg.refreshTransientBuildOnPSSPreserveState = getBoolean(extCtx, REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE,
+ REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE_DEFAULT);
+
+ cfg.validateXML = getBoolean(extCtx, VALIDATE_XML,
+ VALIDATE_XML_DEFAULT);
+
+ cfg.wrapScriptContentWithXmlCommentTag = getBoolean(extCtx, WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG,
+ WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT);
+
+ cfg.debugPhaseListenerEnabled = getBoolean(extCtx, DEBUG_PHASE_LISTENER,
+ DEBUG_PHASE_LISTENER_DEFAULT);
+
+ cfg.strictJsf2CCELResolver = getBoolean(extCtx, STRICT_JSF_2_CC_EL_RESOLVER,
+ STRICT_JSF_2_CC_EL_RESOLVER_DEFAULT);
+
+ cfg.defaultResponseWriterContentTypeMode = getString(extCtx, DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE,
+ DEFAULT_RESPONSE_WRITER_CONTENT_TYPE_MODE_DEFAULT);
+
+ cfg.viewUniqueIdsCacheEnabled = getBoolean(extCtx, VIEW_UNIQUE_IDS_CACHE_ENABLED,
+ VIEW_UNIQUE_IDS_CACHE_ENABLED_DEFAULT);
+
+ cfg.componentUniqueIdsCacheSize = getInt(extCtx, COMPONENT_UNIQUE_IDS_CACHE_SIZE,
+ COMPONENT_UNIQUE_IDS_CACHE_SIZE_DEFAULT);
+
+ cfg.strictJsf2ViewNotFound = getBoolean(extCtx, STRICT_JSF_2_VIEW_NOT_FOUND,
+ STRICT_JSF_2_VIEW_NOT_FOUND_DEFAULT);
+
+ cfg.earlyFlushEnabled = getBoolean(extCtx, EARLY_FLUSH_ENABLED,
+ EARLY_FLUSH_ENABLED_DEFAULT);
+ if (cfg.projectStage != ProjectStage.Production)
+ {
+ cfg.earlyFlushEnabled = false;
+ }
+
+ cfg.strictJsf2FaceletsCompatibility = getBoolean(extCtx, STRICT_JSF_2_FACELETS_COMPATIBILITY,
+ STRICT_JSF_2_FACELETS_COMPATIBILITY_DEFAULT);
+
+ cfg.renderFormViewStateAtBegin = getBoolean(extCtx, RENDER_FORM_VIEW_STATE_AT_BEGIN,
+ RENDER_FORM_VIEW_STATE_AT_BEGIN_DEFAULT);
+
+ cfg.flashScopeDisabled = getBoolean(extCtx, FLASH_SCOPE_DISABLED,
+ FLASH_SCOPE_DISABLED_DEFAULT);
+
+ cfg.strictJsf2AllowSlashLibraryName = getBoolean(extCtx, STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME,
+ STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME_DEFAULT);
+
+ try
+ {
+ cfg.numberOfSequentialViewsInSession = getInt(extCtx, NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION,
+ NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION_DEFAULT);
+ if (cfg.numberOfSequentialViewsInSession == null
+ || cfg.numberOfSequentialViewsInSession < 0)
+ {
+ Logger.getLogger(MyfacesConfig.class.getName()).severe(
+ "Configured value for " + NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION
+ + " is not valid, must be an value >= 0, using default value ("
+ + NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION_DEFAULT);
+ cfg.numberOfSequentialViewsInSession = NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION_DEFAULT;
+ }
+ }
+ catch (Throwable e)
+ {
+ Logger.getLogger(MyfacesConfig.class.getName()).log(Level.SEVERE, "Error determining the value for "
+ + NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION
+ + ", expected an integer value > 0, using default value ("
+ + NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION_DEFAULT + "): " + e.getMessage(), e);
+ }
+ try
+ {
+ cfg.numberOfViewsInSession = getInt(extCtx, NUMBER_OF_VIEWS_IN_SESSION,
+ NUMBER_OF_VIEWS_IN_SESSION_DEFAULT);
+ if (cfg.numberOfViewsInSession == null || cfg.numberOfViewsInSession <= 0)
+ {
+ Logger.getLogger(MyfacesConfig.class.getName()).severe(
+ "Configured value for " + NUMBER_OF_VIEWS_IN_SESSION
+ + " is not valid, must be an value > 0, using default value ("
+ + NUMBER_OF_VIEWS_IN_SESSION_DEFAULT);
+ cfg.numberOfViewsInSession = NUMBER_OF_VIEWS_IN_SESSION_DEFAULT;
+ }
+ }
+ catch (Throwable e)
+ {
+ Logger.getLogger(MyfacesConfig.class.getName()).log(Level.SEVERE, "Error determining the value for "
+ + NUMBER_OF_VIEWS_IN_SESSION
+ + ", expected an integer value > 0, using default value ("
+ + NUMBER_OF_VIEWS_IN_SESSION_DEFAULT + "): " + e.getMessage(), e);
+ }
+
+ Integer numberOfFlashTokensInSessionDefault;
+ if (cfg.numberOfSequentialViewsInSession != null && cfg.numberOfSequentialViewsInSession > 0)
+ {
+ numberOfFlashTokensInSessionDefault = (cfg.numberOfViewsInSession
+ / cfg.numberOfSequentialViewsInSession) + 1;
+ }
+ else
+ {
+ numberOfFlashTokensInSessionDefault = cfg.numberOfViewsInSession + 1;
+ }
+
+ cfg.numberOfFlashTokensInSession = getInt(extCtx, NUMBER_OF_FLASH_TOKENS_IN_SESSION,
+ numberOfFlashTokensInSessionDefault);
+
+ cfg.numberOfClientWindows = getInt(extCtx,
+ ClientWindow.NUMBER_OF_CLIENT_WINDOWS_PARAM_NAME,
+ 10);
+
+ cfg.supportEL3ImportHandler = getBoolean(extCtx, SUPPORT_EL_3_IMPORT_HANDLER,
+ SUPPORT_EL_3_IMPORT_HANDLER_DEFAULT);
+
+ cfg.strictJsf2OriginHeaderAppPath = getBoolean(extCtx, STRICT_JSF_2_ORIGIN_HEADER_APP_PATH,
+ STRICT_JSF_2_ORIGIN_HEADER_APP_PATH_DEFAULT);
+
+ cfg.resourceBufferSize = getInt(extCtx, RESOURCE_BUFFER_SIZE,
+ RESOURCE_BUFFER_SIZE_DEFAULT);
+
+ cfg.useCdiForAnnotationScanning = getBoolean(extCtx, USE_CDI_FOR_ANNOTATION_SCANNING,
+ USE_CDI_FOR_ANNOTATION_SCANNING_DEFAULT);
+
+ cfg.resourceHandlerCacheEnabled = getBoolean(extCtx, RESOURCE_HANDLER_CACHE_ENABLED,
+ RESOURCE_HANDLER_CACHE_ENABLED_DEFAULT);
+ if (cfg.projectStage != ProjectStage.Production)
+ {
+ cfg.resourceHandlerCacheEnabled = false;
+ }
+
+ cfg.resourceHandlerCacheSize = getInt(extCtx, RESOURCE_HANDLER_CACHE_SIZE,
+ RESOURCE_HANDLER_CACHE_SIZE_DEFAULT);
+
+ cfg.scanPackages = getString(extCtx, SCAN_PACKAGES,
+ null);
+
+ String websocketEndpointPort = extCtx.getInitParameter(WEBSOCKET_ENDPOINT_PORT);
+ if (websocketEndpointPort != null && !websocketEndpointPort.isEmpty())
+ {
+ cfg.websocketEndpointPort = Integer.valueOf(websocketEndpointPort);
+ }
+
+ cfg.websocketMaxIdleTimeout = getLong(extCtx, WEBSOCKET_MAX_IDLE_TIMEOUT,
+ WEBSOCKET_MAX_IDLE_TIMEOUT_DEFAULT);
+
+ cfg.randomKeyInWebsocketSessionToken = getString(extCtx, RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN,
+ RANDOM_KEY_IN_WEBSOCKET_SESSION_TOKEN_DEFAULT);
+
+ cfg.clientViewStateTimeout = getLong(extCtx, CLIENT_VIEW_STATE_TIMEOUT,
+ CLIENT_VIEW_STATE_TIMEOUT_DEFAULT);
+ if (cfg.clientViewStateTimeout < 0L)
+ {
+ cfg.clientViewStateTimeout = 0L;
+ }
+
+ cfg.randomKeyInViewStateSessionToken = getString(extCtx, RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN,
+ RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_DEFAULT);
+
+ cfg.randomKeyInViewStateSessionTokenLength = getInt(extCtx, RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_LENGTH,
+ RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_LENGTH_DEFAULT);
+
+ cfg.randomKeyInViewStateSessionTokenSecureRandomClass = getString(extCtx,
+ RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_CLASS,
+ null);
+
+ cfg.randomKeyInViewStateSessionTokenSecureRandomProvider = getString(extCtx,
+ RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_PROVIDER,
+ null);
+
+ cfg.randomKeyInViewStateSessionTokenSecureRandomAlgorithm = getString(extCtx,
+ RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_ALGORITHM,
+ RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM_ALGORITHM_DEFAULT);
+
+ cfg.randomKeyInCsrfSessionToken = getString(extCtx, RANDOM_KEY_IN_CSRF_SESSION_TOKEN,
+ RANDOM_KEY_IN_CSRF_SESSION_TOKEN_DEFAULT);
+
+ cfg.serializeStateInSession = getBoolean(extCtx, StateManager.SERIALIZE_SERVER_STATE_PARAM_NAME,
+ false);
+
+ cfg.compressStateInSession = getBoolean(extCtx, COMPRESS_STATE_IN_SESSION,
+ COMPRESS_STATE_IN_SESSION_DEFAULT);
+
+ cfg.useFlashScopePurgeViewsInSession = getBoolean(extCtx, USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION,
+ USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION_DEFAULT);
+
+ cfg.autocompleteOffViewState = getBoolean(extCtx, AUTOCOMPLETE_OFF_VIEW_STATE,
+ AUTOCOMPLETE_OFF_VIEW_STATE_DEFAULT);
+
+ cfg.resourceMaxTimeExpires = getLong(extCtx, RESOURCE_MAX_TIME_EXPIRES,
+ RESOURCE_MAX_TIME_EXPIRES_DEFAULT);
+
+ cfg.lazyLoadConfigObjects = getBoolean(extCtx, LAZY_LOAD_CONFIG_OBJECTS,
+ LAZY_LOAD_CONFIG_OBJECTS_DEFAULT);
+
+ cfg.elResolverComparator = getString(extCtx, EL_RESOLVER_COMPARATOR,
+ null);
+
+ cfg.elResolverPredicate = getString(extCtx, EL_RESOLVER_PREDICATE,
+ null);
+
+ cfg.viewIdExistsCacheEnabled = getBoolean(extCtx, VIEWID_EXISTS_CACHE_ENABLED,
+ VIEWID_EXISTS_CACHE_ENABLED_DEFAULT);
+ if (cfg.projectStage == ProjectStage.Development)
+ {
+ cfg.viewIdExistsCacheEnabled = false;
+ }
+
+ cfg.viewIdProtectedCacheEnabled = getBoolean(extCtx, VIEWID_PROTECTED_CACHE_ENABLED,
+ VIEWID_PROTECTED_CACHE_ENABLED_DEFAULT);
+ if (cfg.projectStage == ProjectStage.Development)
+ {
+ cfg.viewIdProtectedCacheEnabled = false;
+ }
+
+ cfg.viewIdDeriveCacheEnabled = getBoolean(extCtx, VIEWID_DERIVE_CACHE_ENABLED,
+ VIEWID_DERIVE_CACHE_ENABLED_DEFAULT);
+ if (cfg.projectStage == ProjectStage.Development)
+ {
+ cfg.viewIdDeriveCacheEnabled = false;
+ }
+
+ cfg.viewIdCacheSize = getInt(extCtx, VIEWID_CACHE_SIZE,
+ VIEWID_CACHE_SIZE_DEFAULT);
+
+ cfg.beanBeforeJsfValidation = getBoolean(extCtx, BEAN_BEFORE_JSF_VALIDATION,
+ BEAN_BEFORE_JSF_VALIDATION_DEFAULT);
+
+ cfg.facesInitPlugins = getString(extCtx, FACES_INIT_PLUGINS,
+ null);
+
+ cfg.initializeSkipJarFacesConfigScan = getBoolean(extCtx, INITIALIZE_SKIP_JAR_FACES_CONFIG_SCAN,
+ INITIALIZE_SKIP_JAR_FACES_CONFIG_SCAN_DEFAULT);
+
+ cfg.expressionFactory = getString(extCtx, EXPRESSION_FACTORY,
+ null);
+
+ cfg.checkIdProductionMode = getString(extCtx, CHECK_ID_PRODUCTION_MODE,
+ CHECK_ID_PRODUCTION_MODE_DEFAULT);
+
+ // Per spec section 11.1.3, the default value for the partial state saving feature needs
+ // to be true if 2.0, false otherwise.
+ // lets ignore this on 3.x
+ cfg.partialStateSaving = getBoolean(extCtx, StateManager.PARTIAL_STATE_SAVING_PARAM_NAME,
+ true);
+
+ cfg.fullStateSavingViewIds = StringUtils.splitShortString(
+ getString(extCtx, StateManager.FULL_STATE_SAVING_VIEW_IDS_PARAM_NAME, null),
+ ',');
+
+ cfg.faceletsBufferSize = getInt(extCtx, ViewHandler.FACELETS_BUFFER_SIZE_PARAM_NAME,
+ 1024);
+
+ cfg.markInitialStateWhenApplyBuildView = getBoolean(extCtx, MARK_INITIAL_STATE_WHEN_APPLY_BUILD_VIEW,
+ MARK_INITIAL_STATE_WHEN_APPLY_BUILD_VIEW_DEFAULT);
+
+ cfg.viewSuffix = StringUtils.splitShortString(
+ getString(extCtx, ViewHandler.DEFAULT_SUFFIX_PARAM_NAME, ViewHandler.DEFAULT_SUFFIX),
+ ' ');
+
+ cfg.faceletsViewMappings = StringUtils.splitShortString(
+ getString(extCtx, ViewHandler.FACELETS_VIEW_MAPPINGS_PARAM_NAME, null),
+ ';');
+
+ cfg.faceletsViewSuffix = getString(extCtx, ViewHandler.FACELETS_SUFFIX_PARAM_NAME,
+ ViewHandler.DEFAULT_FACELETS_SUFFIX);
+
+ String elExpressionCacheMode = getString(extCtx, CACHE_EL_EXPRESSIONS,
+ CACHE_EL_EXPRESSIONS_DEFAULT);
+ cfg.elExpressionCacheMode = Enum.valueOf(ELExpressionCacheMode.class, elExpressionCacheMode);
+
+ cfg.wrapTagExceptionsAsContextAware = getBoolean(extCtx, WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE,
+ WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE_DEFAULT);
+
+ cfg.resourceCacheLastModified = getBoolean(extCtx, RESOURCE_CACHE_LAST_MODIFIED,
+ RESOURCE_CACHE_LAST_MODIFIED_DEFAULT);
+ if (cfg.projectStage == ProjectStage.Development)
+ {
+ cfg.resourceCacheLastModified = false;
+ }
+
+ String logWebContextParams = getString(extCtx, LOG_WEB_CONTEXT_PARAMS,
+ LOG_WEB_CONTEXT_PARAMS_DEFAULT);
+ if (logWebContextParams.equals("false") || (logWebContextParams.equals("auto")
+ && (cfg.projectStage == ProjectStage.SystemTest || cfg.projectStage == ProjectStage.UnitTest)))
+ {
+ cfg.logWebContextParams = false;
+ }
+ else
+ {
+ cfg.logWebContextParams = true;
+ }
+
+ cfg.websocketMaxConnections = getInt(extCtx, WEBSOCKET_MAX_CONNECTIONS,
+ WEBSOCKET_MAX_CONNECTIONS_DEFAULT);
+
+ cfg.renderClientBehaviorScriptsAsString = getBoolean(extCtx, RENDER_CLIENTBEHAVIOR_SCRIPTS_AS_STRING,
+ RENDER_CLIENTBEHAVIOR_SCRIPTS_AS_STRING_DEFAULT);
+
+ cfg.alwaysForceSessionCreation = getBoolean(extCtx, ALWAYS_FORCE_SESSION_CREATION,
+ ALWAYS_FORCE_SESSION_CREATION_DEFAULT);
+
+ String resourceBundleControl = getString(extCtx, RESOURCE_BUNDLE_CONTROL, null);
+ if (StringUtils.isNotBlank(resourceBundleControl))
+ {
+ cfg.resourceBundleControl = (ResourceBundle.Control) ClassUtils.newInstance(resourceBundleControl);
+ }
+
+ cfg.automaticExtensionlessMapping = getBoolean(extCtx, AUTOMATIC_EXTENSIONLESS_MAPPING,
+ AUTOMATIC_EXTENSIONLESS_MAPPING_DEFAULT);
+
+ return cfg;
+ }
+
+ private static boolean getBoolean(ExternalContext externalContext, String paramName, boolean defaultValue)
+ {
+ String value = externalContext.getInitParameter(paramName);
+ if (value == null)
+ {
+ return defaultValue;
+ }
+
+ if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("on") || value.equalsIgnoreCase("yes"))
+ {
+ return true;
+ }
+ else if (value.equalsIgnoreCase("false") || value.equalsIgnoreCase("off") || value.equalsIgnoreCase("no"))
+ {
+ return false;
+ }
+
+ return defaultValue;
+ }
+
+ private static String getString(ExternalContext externalContext, String paramName, String defaultValue)
+ {
+ String value = externalContext.getInitParameter(paramName);
+ if (value == null)
+ {
+ return defaultValue;
+ }
+
+ return value;
+ }
+
+ private static int getInt(ExternalContext externalContext, String paramName, int defaultValue)
+ {
+ String value = externalContext.getInitParameter(paramName);
+ if (value == null)
+ {
+ return defaultValue;
+ }
+
+ try
+ {
+ return Integer.parseInt(value);
+ }
+ catch (NumberFormatException e)
+ {
+ }
+ return defaultValue;
+ }
+
+ private static long getLong(ExternalContext externalContext, String paramName, long defaultValue)
+ {
+ String value = externalContext.getInitParameter(paramName);
+ if (value == null)
+ {
+ return defaultValue;
+ }
+
+ try
+ {
+ return Long.parseLong(value);
+ }
+ catch (NumberFormatException e)
+ {
+ }
+ return defaultValue;
+ }
+
+ public boolean isMyfacesImplAvailable()
+ {
+ return MYFACES_IMPL_AVAILABLE;
+ }
+
+ public boolean isRiImplAvailable()
+ {
+ return RI_IMPL_AVAILABLE;
+ }
+
+ public boolean isStrictJsf2AllowSlashLibraryName()
+ {
+ return strictJsf2AllowSlashLibraryName;
+ }
+
+ public long getConfigRefreshPeriod()
+ {
+ return configRefreshPeriod;
+ }
+
+ public boolean isRenderViewStateId()
+ {
+ return renderViewStateId;
+ }
+
+ public boolean isStrictXhtmlLinks()
+ {
+ return strictXhtmlLinks;
+ }
+
+ public boolean isRenderClearJavascriptOnButton()
+ {
+ return renderClearJavascriptOnButton;
+ }
+
+ public String getDelegateFacesServlet()
+ {
+ return delegateFacesServlet;
+ }
+
+ public boolean isRefreshTransientBuildOnPSS()
+ {
+ return refreshTransientBuildOnPSS;
+ }
+
+ public boolean isRefreshTransientBuildOnPSSAuto()
+ {
+ return refreshTransientBuildOnPSSAuto;
+ }
+
+ public boolean isRefreshTransientBuildOnPSSPreserveState()
+ {
+ return refreshTransientBuildOnPSSPreserveState;
+ }
+
+ public boolean isValidateXML()
+ {
+ return validateXML;
+ }
+
+ public boolean isWrapScriptContentWithXmlCommentTag()
+ {
+ return wrapScriptContentWithXmlCommentTag;
+ }
+
+ public boolean isDebugPhaseListenerEnabled()
+ {
+ return debugPhaseListenerEnabled;
+ }
+
+ public boolean isStrictJsf2CCELResolver()
+ {
+ return strictJsf2CCELResolver;
+ }
+
+ public String getDefaultResponseWriterContentTypeMode()
+ {
+ return defaultResponseWriterContentTypeMode;
+ }
+
+ public boolean isViewUniqueIdsCacheEnabled()
+ {
+ return viewUniqueIdsCacheEnabled;
+ }
+
+ public int getComponentUniqueIdsCacheSize()
+ {
+ return componentUniqueIdsCacheSize;
+ }
+
+ public boolean isStrictJsf2ViewNotFound()
+ {
+ return strictJsf2ViewNotFound;
+ }
+
+ public boolean isEarlyFlushEnabled()
+ {
+ return earlyFlushEnabled;
+ }
+
+ public boolean isStrictJsf2FaceletsCompatibility()
+ {
+ return strictJsf2FaceletsCompatibility;
+ }
+
+ public boolean isRenderFormViewStateAtBegin()
+ {
+ return renderFormViewStateAtBegin;
+ }
+
+ public boolean isFlashScopeDisabled()
+ {
+ return flashScopeDisabled;
+ }
+
+ public Integer getNumberOfViewsInSession()
+ {
+ return numberOfViewsInSession;
+ }
+
+ public Integer getNumberOfSequentialViewsInSession()
+ {
+ return numberOfSequentialViewsInSession;
+ }
+
+ public Integer getNumberOfFlashTokensInSession()
+ {
+ return numberOfFlashTokensInSession;
+ }
+
+ public boolean isSupportEL3ImportHandler()
+ {
+ return supportEL3ImportHandler;
+ }
+
+ public boolean isStrictJsf2OriginHeaderAppPath()
+ {
+ return strictJsf2OriginHeaderAppPath;
+ }
+
+ public int getResourceBufferSize()
+ {
+ return resourceBufferSize;
+ }
+
+ public boolean isUseCdiForAnnotationScanning()
+ {
+ return useCdiForAnnotationScanning;
+ }
+
+ public boolean isResourceHandlerCacheEnabled()
+ {
+ return resourceHandlerCacheEnabled;
+ }
+
+ public int getResourceHandlerCacheSize()
+ {
+ return resourceHandlerCacheSize;
+ }
+
+ public String getScanPackages()
+ {
+ return scanPackages;
+ }
+
+ public long getWebsocketMaxIdleTimeout()
+ {
+ return websocketMaxIdleTimeout;
+ }
+
+ public Integer getWebsocketEndpointPort()
+ {
+ return websocketEndpointPort;
+ }
+
+ public long getClientViewStateTimeout()
+ {
+ return clientViewStateTimeout;
+ }
+
+ public String getRandomKeyInViewStateSessionToken()
+ {
+ return randomKeyInViewStateSessionToken;
+ }
+
+ public int getRandomKeyInViewStateSessionTokenLength()
+ {
+ return randomKeyInViewStateSessionTokenLength;
+ }
+
+ public String getRandomKeyInViewStateSessionTokenSecureRandomClass()
+ {
+ return randomKeyInViewStateSessionTokenSecureRandomClass;
+ }
+
+ public String getRandomKeyInViewStateSessionTokenSecureRandomProvider()
+ {
+ return randomKeyInViewStateSessionTokenSecureRandomProvider;
+ }
+
+ public String getRandomKeyInViewStateSessionTokenSecureRandomAlgorithm()
+ {
+ return randomKeyInViewStateSessionTokenSecureRandomAlgorithm;
+ }
+
+ public String getRandomKeyInCsrfSessionToken()
+ {
+ return randomKeyInCsrfSessionToken;
+ }
+
+ public boolean isSerializeStateInSession()
+ {
+ return serializeStateInSession;
+ }
+
+ public boolean isCompressStateInSession()
+ {
+ return compressStateInSession;
+ }
+
+ public boolean isUseFlashScopePurgeViewsInSession()
+ {
+ return useFlashScopePurgeViewsInSession;
+ }
+
+ public boolean isAutocompleteOffViewState()
+ {
+ return autocompleteOffViewState;
+ }
+
+ public long getResourceMaxTimeExpires()
+ {
+ return resourceMaxTimeExpires;
+ }
+
+ public boolean isLazyLoadConfigObjects()
+ {
+ return lazyLoadConfigObjects;
+ }
+
+ public String getElResolverComparator()
+ {
+ return elResolverComparator;
+ }
+
+ public String getElResolverPredicate()
+ {
+ return elResolverPredicate;
+ }
+
+ public int getViewIdCacheSize()
+ {
+ return viewIdCacheSize;
+ }
+
+ public boolean isBeanBeforeJsfValidation()
+ {
+ return beanBeforeJsfValidation;
+ }
+
+ public String getRandomKeyInWebsocketSessionToken()
+ {
+ return randomKeyInWebsocketSessionToken;
+ }
+
+ public String getFacesInitPlugins()
+ {
+ return facesInitPlugins;
+ }
+
+ public boolean isInitializeSkipJarFacesConfigScan()
+ {
+ return initializeSkipJarFacesConfigScan;
+ }
+
+ public String getExpressionFactory()
+ {
+ return expressionFactory;
+ }
+
+ public String getCheckIdProductionMode()
+ {
+ return checkIdProductionMode;
+ }
+
+ public boolean isPartialStateSaving()
+ {
+ return partialStateSaving;
+ }
+
+ public String[] getFullStateSavingViewIds()
+ {
+ return fullStateSavingViewIds;
+ }
+
+ public int getFaceletsBufferSize()
+ {
+ return faceletsBufferSize;
+ }
+
+ public boolean isMarkInitialStateWhenApplyBuildView()
+ {
+ return markInitialStateWhenApplyBuildView;
+ }
+
+ public String[] getViewSuffix()
+ {
+ return viewSuffix;
+ }
+
+ public String[] getFaceletsViewMappings()
+ {
+ return faceletsViewMappings;
+ }
+
+ public String getFaceletsViewSuffix()
+ {
+ return faceletsViewSuffix;
+ }
+
+ public boolean isViewIdExistsCacheEnabled()
+ {
+ return viewIdExistsCacheEnabled;
+ }
+
+ public boolean isViewIdProtectedCacheEnabled()
+ {
+ return viewIdProtectedCacheEnabled;
+ }
+
+ public boolean isViewIdDeriveCacheEnabled()
+ {
+ return viewIdDeriveCacheEnabled;
+ }
+
+ public ELExpressionCacheMode getELExpressionCacheMode()
+ {
+ return elExpressionCacheMode;
+ }
+
+ public boolean isWrapTagExceptionsAsContextAware()
+ {
+ return wrapTagExceptionsAsContextAware;
+ }
+
+ public boolean isResourceCacheLastModified()
+ {
+ return resourceCacheLastModified;
+ }
+
+ public boolean isLogWebContextParams()
+ {
+ return logWebContextParams;
+ }
+
+ public int getWebsocketMaxConnections()
+ {
+ return websocketMaxConnections;
+ }
+
+ public boolean isRenderClientBehaviorScriptsAsString()
+ {
+ return renderClientBehaviorScriptsAsString;
+ }
+
+ public boolean isAlwaysForceSessionCreation()
+ {
+ return alwaysForceSessionCreation;
+ }
+
+ public ProjectStage getProjectStage()
+ {
+ return projectStage;
+ }
+
+ public ResourceBundle.Control getResourceBundleControl()
+ {
+ return resourceBundleControl;
+ }
+
+ public boolean isAutomaticExtensionlessMapping()
+ {
+ return automaticExtensionlessMapping;
+ }
+
+ public Integer getNumberOfClientWindows()
+ {
+ return numberOfClientWindows;
+ }
+}
+
diff --git a/impl/src/main/java/org/apache/myfaces/push/WebsocketComponentRenderer.java b/impl/src/main/java/org/apache/myfaces/push/WebsocketComponentRenderer.java
index 4bf300c..e7ad86e 100644
--- a/impl/src/main/java/org/apache/myfaces/push/WebsocketComponentRenderer.java
+++ b/impl/src/main/java/org/apache/myfaces/push/WebsocketComponentRenderer.java
@@ -1,273 +1,273 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.push;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import jakarta.enterprise.inject.spi.BeanManager;
-import jakarta.faces.FacesWrapper;
-import jakarta.faces.component.UIComponent;
-import jakarta.faces.component.UIWebsocket;
-import jakarta.faces.component.behavior.ClientBehavior;
-import jakarta.faces.component.behavior.ClientBehaviorContext;
-import jakarta.faces.context.FacesContext;
-import jakarta.faces.context.ResponseWriter;
-import jakarta.faces.event.ComponentSystemEvent;
-import jakarta.faces.event.ComponentSystemEventListener;
-import jakarta.faces.event.ListenerFor;
-import jakarta.faces.event.PostAddToViewEvent;
-import jakarta.faces.render.Renderer;
-import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
-import org.apache.myfaces.cdi.util.CDIUtils;
-import org.apache.myfaces.push.cdi.WebsocketApplicationBean;
-import org.apache.myfaces.push.cdi.WebsocketChannelMetadata;
-import org.apache.myfaces.push.cdi.WebsocketChannelTokenBuilderBean;
-import org.apache.myfaces.push.cdi.WebsocketSessionBean;
-import org.apache.myfaces.push.cdi.WebsocketViewBean;
-import org.apache.myfaces.renderkit.html.util.ClientBehaviorRendererUtils;
-import org.apache.myfaces.renderkit.html.util.HTML;
-import org.apache.myfaces.renderkit.html.util.HtmlRendererUtils;
-import org.apache.myfaces.renderkit.html.util.ResourceUtils;
-
-@JSFRenderer(renderKitId = "HTML_BASIC",
- family = "jakarta.faces.Script",
- type = "jakarta.faces.Websocket")
-@ListenerFor(systemEventClass = PostAddToViewEvent.class)
-public class WebsocketComponentRenderer extends Renderer implements ComponentSystemEventListener
-{
-
- @Override
- public void processEvent(ComponentSystemEvent event)
- {
- if (event instanceof PostAddToViewEvent)
- {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- UIWebsocket component = (UIWebsocket) event.getComponent();
- WebsocketInit initComponent = (WebsocketInit) facesContext.getViewRoot().findComponent(
- (String) component.getAttributes().get(_WebsocketInit.ATTRIBUTE_COMPONENT_ID));
- if (initComponent == null)
- {
- initComponent = (WebsocketInit) facesContext.getApplication().createComponent(facesContext,
- WebsocketInit.COMPONENT_TYPE, WebsocketInit.COMPONENT_TYPE);
- initComponent.setId((String) component.getAttributes().get(_WebsocketInit.ATTRIBUTE_COMPONENT_ID));
- facesContext.getViewRoot().addComponentResource(facesContext,
- initComponent, "body");
- }
- }
- }
-
- private HtmlBufferResponseWriterWrapper getResponseWriter(FacesContext context)
- {
- return HtmlBufferResponseWriterWrapper.getInstance(context.getResponseWriter());
- }
-
- @Override
- public void decode(FacesContext facesContext, UIComponent component)
- {
- ClientBehaviorRendererUtils.decodeClientBehaviors(facesContext, component);
- }
-
- @Override
- public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException
- {
- ResponseWriter writer = facesContext.getResponseWriter();
-
- ResourceUtils.renderDefaultJsfJsInlineIfNecessary(facesContext, writer);
-
- // Render the tag that will be embedded into the DOM tree that helps to detect if the message
- // must be processed or not and if the connection must be closed.
- writer.startElement(HTML.DIV_ELEM, component);
- writer.writeAttribute(HTML.ID_ATTR, component.getClientId() ,null);
- writer.writeAttribute(HTML.STYLE_ATTR, "display:none", null);
- writer.endElement(HTML.DIV_ELEM);
-
- if (!facesContext.getPartialViewContext().isAjaxRequest())
- {
- facesContext.setResponseWriter(getResponseWriter(facesContext));
- }
- }
-
- @Override
- public void encodeEnd(FacesContext facesContext, UIComponent c) throws IOException
- {
- super.encodeEnd(facesContext, c); //check for NP
-
- UIWebsocket component = (UIWebsocket) c;
-
- WebsocketInit init = (WebsocketInit) facesContext.getViewRoot().findComponent(
- (String) component.getAttributes().get(_WebsocketInit.ATTRIBUTE_COMPONENT_ID));
-
- ResponseWriter writer = facesContext.getResponseWriter();
-
- String channel = component.getChannel();
-
- // TODO: use a single bean and entry point for this algorithm.
- BeanManager beanManager = CDIUtils.getBeanManager(facesContext);
-
- WebsocketChannelTokenBuilderBean channelTokenBean = CDIUtils.get(
- beanManager,
- WebsocketChannelTokenBuilderBean.class);
-
- // This bean is required because you always need to register the token, so it can be properly destroyed
- WebsocketViewBean viewTokenBean = CDIUtils.get(
- beanManager,
- WebsocketViewBean.class);
- WebsocketSessionBean sessionTokenBean = CDIUtils.get(
- beanManager, WebsocketSessionBean.class);
-
- // Create channel token
- // TODO: Use ResponseStateManager to create the token
- String scope = component.getScope() == null ? "application" : component.getScope();
- WebsocketChannelMetadata metadata = new WebsocketChannelMetadata(
- channel, scope, component.getUser(), component.isConnected());
-
- String channelToken = null;
- // Force a new channelToken if "connected" property is set to false, because in that case websocket
- // creation
- if (!component.isConnected())
- {
- channelToken = viewTokenBean.getChannelToken(metadata);
- }
- if (channelToken == null)
- {
- // No channel token found for that combination, create a new token for this view
- channelToken = channelTokenBean.createChannelToken(facesContext, channel);
-
- // Register channel in view scope to chain discard view algorithm using @PreDestroy
- viewTokenBean.registerToken(channelToken, metadata);
-
- // Register channel in session scope to allow validation on handshake ( WebsocketConfigurator )
- sessionTokenBean.registerToken(channelToken, metadata);
- }
-
- // Ask these two scopes
- WebsocketApplicationBean appTokenBean = CDIUtils.get(
- beanManager, WebsocketApplicationBean.class, false);
-
- // Register token and metadata in the proper bean
- if (scope.equals("view"))
- {
- viewTokenBean.registerWebsocketSession(channelToken, metadata);
- }
- else if (scope.equals("session"))
- {
- sessionTokenBean = (sessionTokenBean != null) ? sessionTokenBean : CDIUtils.get(
- CDIUtils.getBeanManager(facesContext),
- WebsocketSessionBean.class);
-
- sessionTokenBean.registerWebsocketSession(channelToken, metadata);
- }
- else
- {
- //Default application
- appTokenBean = (appTokenBean != null) ? appTokenBean : CDIUtils.get(
- CDIUtils.getBeanManager(facesContext),
- WebsocketApplicationBean.class);
-
- appTokenBean.registerWebsocketSession(channelToken, metadata);
- }
- writer.startElement(HTML.SCRIPT_ELEM, component);
- HtmlRendererUtils.renderScriptType(facesContext, writer);
-
- StringBuilder sb = new StringBuilder(50);
- sb.append("faces.push.init(");
- sb.append('\'');
- sb.append(component.getClientId());
- sb.append('\'');
- sb.append(',');
- sb.append('\'');
- sb.append(facesContext.getExternalContext().encodeWebsocketURL(
- facesContext.getApplication().getViewHandler().getWebsocketURL(
- facesContext, component.getChannel()+ '?' +channelToken)));
- sb.append('\'');
- sb.append(',');
- sb.append('\'');
- sb.append(component.getChannel());
- sb.append('\'');
- sb.append(',');
- sb.append(component.getOnopen());
- sb.append(',');
- sb.append(component.getOnmessage());
- sb.append(',');
- sb.append(component.getOnerror());
- sb.append(',');
- sb.append(component.getOnclose());
- sb.append(',');
- sb.append(getBehaviorScripts(facesContext, component));
- sb.append(',');
- sb.append(component.isConnected());
- sb.append(");");
-
- writer.write(sb.toString());
-
- writer.endElement(HTML.SCRIPT_ELEM);
-
- if (!facesContext.getPartialViewContext().isAjaxRequest())
- {
- ResponseWriter responseWriter = facesContext.getResponseWriter();
- while (!(responseWriter instanceof HtmlBufferResponseWriterWrapper)
- && responseWriter instanceof FacesWrapper)
- {
- responseWriter = (ResponseWriter) ((FacesWrapper) responseWriter).getWrapped();
- }
-
- HtmlBufferResponseWriterWrapper htmlBufferResponseWritter =
- (HtmlBufferResponseWriterWrapper) responseWriter;
- init.getUIWebsocketMarkupList().add(htmlBufferResponseWritter.toString());
-
- facesContext.setResponseWriter(htmlBufferResponseWritter.getInitialWriter());
- }
- }
-
- private String getBehaviorScripts(FacesContext facesContext, UIWebsocket component)
- {
- Map<String, List<ClientBehavior>> clientBehaviorsByEvent = component.getClientBehaviors();
-
- if (clientBehaviorsByEvent.isEmpty())
- {
- return "{}";
- }
-
- String clientId = component.getClientId(facesContext);
- StringBuilder scripts = new StringBuilder("{");
-
- for (Entry<String, List<ClientBehavior>> entry : clientBehaviorsByEvent.entrySet())
- {
- String event = entry.getKey();
- List<ClientBehavior> clientBehaviors = entry.getValue();
- scripts.append(scripts.length() > 1 ? ',' : "").append(event).append(":[");
-
- for (int i = 0; i < clientBehaviors.size(); i++)
- {
- scripts.append(i > 0 ? ',' : "").append("function(event){");
- scripts.append(clientBehaviors.get(i).getScript(
- ClientBehaviorContext.createClientBehaviorContext(
- facesContext, component, event, clientId, null)));
- scripts.append('}');
- }
-
- scripts.append(']');
- }
-
- return scripts.append('}').toString();
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.push;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import jakarta.enterprise.inject.spi.BeanManager;
+import jakarta.faces.FacesWrapper;
+import jakarta.faces.component.UIComponent;
+import jakarta.faces.component.UIWebsocket;
+import jakarta.faces.component.behavior.ClientBehavior;
+import jakarta.faces.component.behavior.ClientBehaviorContext;
+import jakarta.faces.context.FacesContext;
+import jakarta.faces.context.ResponseWriter;
+import jakarta.faces.event.ComponentSystemEvent;
+import jakarta.faces.event.ComponentSystemEventListener;
+import jakarta.faces.event.ListenerFor;
+import jakarta.faces.event.PostAddToViewEvent;
+import jakarta.faces.render.Renderer;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
+import org.apache.myfaces.cdi.util.CDIUtils;
+import org.apache.myfaces.push.cdi.WebsocketApplicationBean;
+import org.apache.myfaces.push.cdi.WebsocketChannelMetadata;
+import org.apache.myfaces.push.cdi.WebsocketChannelTokenBuilderBean;
+import org.apache.myfaces.push.cdi.WebsocketSessionBean;
+import org.apache.myfaces.push.cdi.WebsocketViewBean;
+import org.apache.myfaces.renderkit.html.util.ClientBehaviorRendererUtils;
+import org.apache.myfaces.renderkit.html.util.HTML;
+import org.apache.myfaces.renderkit.html.util.HtmlRendererUtils;
+import org.apache.myfaces.renderkit.html.util.ResourceUtils;
+
+@JSFRenderer(renderKitId = "HTML_BASIC",
+ family = "jakarta.faces.Script",
+ type = "jakarta.faces.Websocket")
+@ListenerFor(systemEventClass = PostAddToViewEvent.class)
+public class WebsocketComponentRenderer extends Renderer implements ComponentSystemEventListener
+{
+
+ @Override
+ public void processEvent(ComponentSystemEvent event)
+ {
+ if (event instanceof PostAddToViewEvent)
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIWebsocket component = (UIWebsocket) event.getComponent();
+ WebsocketInit initComponent = (WebsocketInit) facesContext.getViewRoot().findComponent(
+ (String) component.getAttributes().get(_WebsocketInit.ATTRIBUTE_COMPONENT_ID));
+ if (initComponent == null)
+ {
+ initComponent = (WebsocketInit) facesContext.getApplication().createComponent(facesContext,
+ WebsocketInit.COMPONENT_TYPE, WebsocketInit.COMPONENT_TYPE);
+ initComponent.setId((String) component.getAttributes().get(_WebsocketInit.ATTRIBUTE_COMPONENT_ID));
+ facesContext.getViewRoot().addComponentResource(facesContext,
+ initComponent, "body");
+ }
+ }
+ }
+
+ private HtmlBufferResponseWriterWrapper getResponseWriter(FacesContext context)
+ {
+ return HtmlBufferResponseWriterWrapper.getInstance(context.getResponseWriter());
+ }
+
+ @Override
+ public void decode(FacesContext facesContext, UIComponent component)
+ {
+ ClientBehaviorRendererUtils.decodeClientBehaviors(facesContext, component);
+ }
+
+ @Override
+ public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException
+ {
+ ResponseWriter writer = facesContext.getResponseWriter();
+
+ ResourceUtils.renderDefaultJsfJsInlineIfNecessary(facesContext, writer);
+
+ // Render the tag that will be embedded into the DOM tree that helps to detect if the message
+ // must be processed or not and if the connection must be closed.
+ writer.startElement(HTML.DIV_ELEM, component);
+ writer.writeAttribute(HTML.ID_ATTR, component.getClientId() ,null);
+ writer.writeAttribute(HTML.STYLE_ATTR, "display:none", null);
+ writer.endElement(HTML.DIV_ELEM);
+
+ if (!facesContext.getPartialViewContext().isAjaxRequest())
+ {
+ facesContext.setResponseWriter(getResponseWriter(facesContext));
+ }
+ }
+
+ @Override
+ public void encodeEnd(FacesContext facesContext, UIComponent c) throws IOException
+ {
+ super.encodeEnd(facesContext, c); //check for NP
+
+ UIWebsocket component = (UIWebsocket) c;
+
+ WebsocketInit init = (WebsocketInit) facesContext.getViewRoot().findComponent(
+ (String) component.getAttributes().get(_WebsocketInit.ATTRIBUTE_COMPONENT_ID));
+
+ ResponseWriter writer = facesContext.getResponseWriter();
+
+ String channel = component.getChannel();
+
+ // TODO: use a single bean and entry point for this algorithm.
+ BeanManager beanManager = CDIUtils.getBeanManager(facesContext);
+
+ WebsocketChannelTokenBuilderBean channelTokenBean = CDIUtils.get(
+ beanManager,
+ WebsocketChannelTokenBuilderBean.class);
+
+ // This bean is required because you always need to register the token, so it can be properly destroyed
+ WebsocketViewBean viewTokenBean = CDIUtils.get(
+ beanManager,
+ WebsocketViewBean.class);
+ WebsocketSessionBean sessionTokenBean = CDIUtils.get(
+ beanManager, WebsocketSessionBean.class);
+
+ // Create channel token
+ // TODO: Use ResponseStateManager to create the token
+ String scope = component.getScope() == null ? "application" : component.getScope();
+ WebsocketChannelMetadata metadata = new WebsocketChannelMetadata(
+ channel, scope, component.getUser(), component.isConnected());
+
+ String channelToken = null;
+ // Force a new channelToken if "connected" property is set to false, because in that case websocket
+ // creation
+ if (!component.isConnected())
+ {
+ channelToken = viewTokenBean.getChannelToken(metadata);
+ }
+ if (channelToken == null)
+ {
+ // No channel token found for that combination, create a new token for this view
+ channelToken = channelTokenBean.createChannelToken(facesContext, channel);
+
+ // Register channel in view scope to chain discard view algorithm using @PreDestroy
+ viewTokenBean.registerToken(channelToken, metadata);
+
+ // Register channel in session scope to allow validation on handshake ( WebsocketConfigurator )
+ sessionTokenBean.registerToken(channelToken, metadata);
+ }
+
+ // Ask these two scopes
+ WebsocketApplicationBean appTokenBean = CDIUtils.get(
+ beanManager, WebsocketApplicationBean.class, false);
+
+ // Register token and metadata in the proper bean
+ if (scope.equals("view"))
+ {
+ viewTokenBean.registerWebsocketSession(channelToken, metadata);
+ }
+ else if (scope.equals("session"))
+ {
+ sessionTokenBean = (sessionTokenBean != null) ? sessionTokenBean : CDIUtils.get(
+ CDIUtils.getBeanManager(facesContext),
+ WebsocketSessionBean.class);
+
+ sessionTokenBean.registerWebsocketSession(channelToken, metadata);
+ }
+ else
+ {
+ //Default application
+ appTokenBean = (appTokenBean != null) ? appTokenBean : CDIUtils.get(
+ CDIUtils.getBeanManager(facesContext),
+ WebsocketApplicationBean.class);
+
+ appTokenBean.registerWebsocketSession(channelToken, metadata);
+ }
+ writer.startElement(HTML.SCRIPT_ELEM, component);
+ HtmlRendererUtils.renderScriptType(facesContext, writer);
+
+ StringBuilder sb = new StringBuilder(50);
+ sb.append("faces.push.init(");
+ sb.append('\'');
+ sb.append(component.getClientId());
+ sb.append('\'');
+ sb.append(',');
+ sb.append('\'');
+ sb.append(facesContext.getExternalContext().encodeWebsocketURL(
+ facesContext.getApplication().getViewHandler().getWebsocketURL(
+ facesContext, component.getChannel()+ '?' +channelToken)));
+ sb.append('\'');
+ sb.append(',');
+ sb.append('\'');
+ sb.append(component.getChannel());
+ sb.append('\'');
+ sb.append(',');
+ sb.append(component.getOnopen());
+ sb.append(',');
+ sb.append(component.getOnmessage());
+ sb.append(',');
+ sb.append(component.getOnerror());
+ sb.append(',');
+ sb.append(component.getOnclose());
+ sb.append(',');
+ sb.append(getBehaviorScripts(facesContext, component));
+ sb.append(',');
+ sb.append(component.isConnected());
+ sb.append(");");
+
+ writer.write(sb.toString());
+
+ writer.endElement(HTML.SCRIPT_ELEM);
+
+ if (!facesContext.getPartialViewContext().isAjaxRequest())
+ {
+ ResponseWriter responseWriter = facesContext.getResponseWriter();
+ while (!(responseWriter instanceof HtmlBufferResponseWriterWrapper)
+ && responseWriter instanceof FacesWrapper)
+ {
+ responseWriter = (ResponseWriter) ((FacesWrapper) responseWriter).getWrapped();
+ }
+
+ HtmlBufferResponseWriterWrapper htmlBufferResponseWritter =
+ (HtmlBufferResponseWriterWrapper) responseWriter;
+ init.getUIWebsocketMarkupList().add(htmlBufferResponseWritter.toString());
+
+ facesContext.setResponseWriter(htmlBufferResponseWritter.getInitialWriter());
+ }
+ }
+
+ private String getBehaviorScripts(FacesContext facesContext, UIWebsocket component)
+ {
+ Map<String, List<ClientBehavior>> clientBehaviorsByEvent = component.getClientBehaviors();
+
+ if (clientBehaviorsByEvent.isEmpty())
+ {
+ return "{}";
+ }
+
+ String clientId = component.getClientId(facesContext);
+ StringBuilder scripts = new StringBuilder("{");
+
+ for (Entry<String, List<ClientBehavior>> entry : clientBehaviorsByEvent.entrySet())
+ {
+ String event = entry.getKey();
+ List<ClientBehavior> clientBehaviors = entry.getValue();
+ scripts.append(scripts.length() > 1 ? ',' : "").append(event).append(":[");
+
+ for (int i = 0; i < clientBehaviors.size(); i++)
+ {
+ scripts.append(i > 0 ? ',' : "").append("function(event){");
+ scripts.append(clientBehaviors.get(i).getScript(
+ ClientBehaviorContext.createClientBehaviorContext(
+ facesContext, component, event, clientId, null)));
+ scripts.append('}');
+ }
+
+ scripts.append(']');
+ }
+
+ return scripts.append('}').toString();
+ }
+
+}
diff --git a/impl/src/main/java/org/apache/myfaces/view/ViewDeclarationLanguageBase.java b/impl/src/main/java/org/apache/myfaces/view/ViewDeclarationLanguageBase.java
index 69c4b3f..b30e756 100644
--- a/impl/src/main/java/org/apache/myfaces/view/ViewDeclarationLanguageBase.java
+++ b/impl/src/main/java/org/apache/myfaces/view/ViewDeclarationLanguageBase.java
@@ -1,202 +1,202 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.view;
-
-import jakarta.faces.FactoryFinder;
-import jakarta.faces.application.Application;
-import jakarta.faces.application.ViewHandler;
-import jakarta.faces.component.UIComponentBase;
-import jakarta.faces.component.UIViewRoot;
-import jakarta.faces.context.FacesContext;
-import jakarta.faces.render.RenderKit;
-import jakarta.faces.render.RenderKitFactory;
-import jakarta.faces.render.ResponseStateManager;
-import jakarta.faces.view.StateManagementStrategy;
-import jakarta.faces.view.ViewDeclarationLanguage;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.myfaces.application.InvalidViewIdException;
-import org.apache.myfaces.application.TreeStructureManager;
-import org.apache.myfaces.context.RequestViewContext;
-import org.apache.myfaces.core.api.shared.lang.Assert;
-
-/**
- * @since 2.0
- */
-public abstract class ViewDeclarationLanguageBase extends ViewDeclarationLanguage
-{
- private static final Logger log = Logger.getLogger(ViewDeclarationLanguageBase.class.getName());
-
- private RenderKitFactory _renderKitFactory;
-
- /**
- * Process the specification required algorithm that is generic to all PDL.
- *
- * @param context
- * @param viewId
- */
- @Override
- public UIViewRoot createView(FacesContext context, String viewId)
- {
- Assert.notNull(context, "context");
-
- try
- {
- viewId = calculateViewId(context, viewId);
-
- Application application = context.getApplication();
-
- // Create a new UIViewRoot object instance using Application.createComponent(UIViewRoot.COMPONENT_TYPE).
- UIViewRoot newViewRoot = (UIViewRoot) application.createComponent(context,
- UIViewRoot.COMPONENT_TYPE, null);
- UIViewRoot oldViewRoot = context.getViewRoot();
- if (oldViewRoot == null)
- {
- // If not, this method must call calculateLocale() and calculateRenderKitId(), and store the results
- // as the values of the locale and renderKitId, proeprties, respectively, of the newly created
- // UIViewRoot.
- ViewHandler handler = application.getViewHandler();
- newViewRoot.setLocale(handler.calculateLocale(context));
- newViewRoot.setRenderKitId(handler.calculateRenderKitId(context));
- }
- else
- {
- // If there is an existing UIViewRoot available on the FacesContext, this method must copy its locale
- // and renderKitId to this new view root
- newViewRoot.setLocale(oldViewRoot.getLocale());
- newViewRoot.setRenderKitId(oldViewRoot.getRenderKitId());
- }
-
- newViewRoot.setViewId(viewId);
-
- return newViewRoot;
- }
- catch (InvalidViewIdException e)
- {
- // If no viewId could be identified, or the viewId is exactly equal to the servlet mapping,
- // send the response error code SC_NOT_FOUND with a suitable message to the client.
- sendSourceNotFound(context, e.getMessage());
-
- // TODO: VALIDATE - Spec is silent on the return value when an error was sent
- return null;
- }
- }
-
- @Override
- public UIViewRoot restoreView(FacesContext context, String viewId)
- {
- Assert.notNull(context, "context");
-
- Application application = context.getApplication();
-
- ViewHandler applicationViewHandler = application.getViewHandler();
-
- String renderKitId = applicationViewHandler.calculateRenderKitId(context);
-
- if (log.isLoggable(Level.FINEST))
- {
- log.finest("Entering restoreView - viewId: " + viewId + " ; renderKitId: " + renderKitId);
- }
-
- UIViewRoot viewRoot = null;
-
- StateManagementStrategy sms = getStateManagementStrategy(context, viewId);
- if (sms != null)
- {
- if (log.isLoggable(Level.FINEST))
- {
- log.finest("Redirect to StateManagementStrategy: " + sms.getClass().getName());
- }
-
- viewRoot = sms.restoreView(context, viewId, renderKitId);
- }
- else
- {
- RenderKit renderKit = getRenderKitFactory().getRenderKit(context, renderKitId);
- ResponseStateManager responseStateManager = renderKit.getResponseStateManager();
-
- Object state = responseStateManager.getState(context, viewId);
-
- if (state != null)
- {
- Object[] stateArray = (Object[])state;
- viewRoot = TreeStructureManager.restoreTreeStructure(((Object[]) stateArray[0])[0]);
-
- if (viewRoot != null)
- {
- context.setViewRoot(viewRoot);
- viewRoot.processRestoreState(context, stateArray[1]);
-
- RequestViewContext.getCurrentInstance(context).refreshRequestViewContext(
- context, viewRoot);
-
- // If state is saved fully, there outer f:view tag handler will not be executed,
- // so "contracts" attribute will not be set properly. We need to save it and
- // restore it from here. With PSS, the view will always be built so it is not
- // necessary to save it on the state.
- Object rlc = ((Object[]) stateArray[0])[1];
- if (rlc != null)
- {
- context.setResourceLibraryContracts((List<String>) UIComponentBase.
- restoreAttachedState(context, rlc));
- }
- }
- }
- }
- if (log.isLoggable(Level.FINEST))
- {
- log.finest("Exiting restoreView - " + viewId);
- }
-
- return viewRoot;
- }
-
- /**
- * Calculates the effective view identifier for the specified raw view identifier.
- *
- * @param context le current FacesContext
- * @param viewId the raw view identifier
- *
- * @return the effective view identifier
- */
- protected abstract String calculateViewId(FacesContext context, String viewId);
-
- /**
- * Send a source not found to the client. Although it can be considered ok in JSP mode,
- * I think it's pretty lame to have this kind of requirement at VDL level considering VDL
- * represents the page --> JSF tree link, not the transport layer required to send a
- * SC_NOT_FOUND.
- *
- * @param context le current FacesContext
- * @param message the message associated with the error
- */
- protected abstract void sendSourceNotFound(FacesContext context, String message);
-
- protected RenderKitFactory getRenderKitFactory()
- {
- if (_renderKitFactory == null)
- {
- _renderKitFactory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
- }
- return _renderKitFactory;
- }
-}
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view;
+
+import jakarta.faces.FactoryFinder;
+import jakarta.faces.application.Application;
+import jakarta.faces.application.ViewHandler;
+import jakarta.faces.component.UIComponentBase;
+import jakarta.faces.component.UIViewRoot;
+import jakarta.faces.context.FacesContext;
+import jakarta.faces.render.RenderKit;
+import jakarta.faces.render.RenderKitFactory;
+import jakarta.faces.render.ResponseStateManager;
+import jakarta.faces.view.StateManagementStrategy;
+import jakarta.faces.view.ViewDeclarationLanguage;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.myfaces.application.InvalidViewIdException;
+import org.apache.myfaces.application.TreeStructureManager;
+import org.apache.myfaces.context.RequestViewContext;
+import org.apache.myfaces.core.api.shared.lang.Assert;
+
+/**
+ * @since 2.0
+ */
+public abstract class ViewDeclarationLanguageBase extends ViewDeclarationLanguage
+{
+ private static final Logger log = Logger.getLogger(ViewDeclarationLanguageBase.class.getName());
+
+ private RenderKitFactory _renderKitFactory;
+
+ /**
+ * Process the specification required algorithm that is generic to all PDL.
+ *
+ * @param context
+ * @param viewId
+ */
+ @Override
+ public UIViewRoot createView(FacesContext context, String viewId)
+ {
+ Assert.notNull(context, "context");
+
+ try
+ {
+ viewId = calculateViewId(context, viewId);
+
+ Application application = context.getApplication();
+
+ // Create a new UIViewRoot object instance using Application.createComponent(UIViewRoot.COMPONENT_TYPE).
+ UIViewRoot newViewRoot = (UIViewRoot) application.createComponent(context,
+ UIViewRoot.COMPONENT_TYPE, null);
+ UIViewRoot oldViewRoot = context.getViewRoot();
+ if (oldViewRoot == null)
+ {
+ // If not, this method must call calculateLocale() and calculateRenderKitId(), and store the results
+ // as the values of the locale and renderKitId, proeprties, respectively, of the newly created
+ // UIViewRoot.
+ ViewHandler handler = application.getViewHandler();
+ newViewRoot.setLocale(handler.calculateLocale(context));
+ newViewRoot.setRenderKitId(handler.calculateRenderKitId(context));
+ }
+ else
+ {
+ // If there is an existing UIViewRoot available on the FacesContext, this method must copy its locale
+ // and renderKitId to this new view root
+ newViewRoot.setLocale(oldViewRoot.getLocale());
+ newViewRoot.setRenderKitId(oldViewRoot.getRenderKitId());
+ }
+
+ newViewRoot.setViewId(viewId);
+
+ return newViewRoot;
+ }
+ catch (InvalidViewIdException e)
+ {
+ // If no viewId could be identified, or the viewId is exactly equal to the servlet mapping,
+ // send the response error code SC_NOT_FOUND with a suitable message to the client.
+ sendSourceNotFound(context, e.getMessage());
+
+ // TODO: VALIDATE - Spec is silent on the return value when an error was sent
+ return null;
+ }
+ }
+
+ @Override
+ public UIViewRoot restoreView(FacesContext context, String viewId)
+ {
+ Assert.notNull(context, "context");
+
+ Application application = context.getApplication();
+
+ ViewHandler applicationViewHandler = application.getViewHandler();
+
+ String renderKitId = applicationViewHandler.calculateRenderKitId(context);
+
+ if (log.isLoggable(Level.FINEST))
+ {
+ log.finest("Entering restoreView - viewId: " + viewId + " ; renderKitId: " + renderKitId);
+ }
+
+ UIViewRoot viewRoot = null;
+
+ StateManagementStrategy sms = getStateManagementStrategy(context, viewId);
+ if (sms != null)
+ {
+ if (log.isLoggable(Level.FINEST))
+ {
+ log.finest("Redirect to StateManagementStrategy: " + sms.getClass().getName());
+ }
+
+ viewRoot = sms.restoreView(context, viewId, renderKitId);
+ }
+ else
+ {
+ RenderKit renderKit = getRenderKitFactory().getRenderKit(context, renderKitId);
+ ResponseStateManager responseStateManager = renderKit.getResponseStateManager();
+
+ Object state = responseStateManager.getState(context, viewId);
+
+ if (state != null)
+ {
+ Object[] stateArray = (Object[])state;
+ viewRoot = TreeStructureManager.restoreTreeStructure(((Object[]) stateArray[0])[0]);
+
+ if (viewRoot != null)
+ {
+ context.setViewRoot(viewRoot);
+ viewRoot.processRestoreState(context, stateArray[1]);
+
+ RequestViewContext.getCurrentInstance(context).refreshRequestViewContext(
+ context, viewRoot);
+
+ // If state is saved fully, there outer f:view tag handler will not be executed,
+ // so "contracts" attribute will not be set properly. We need to save it and
+ // restore it from here. With PSS, the view will always be built so it is not
+ // necessary to save it on the state.
+ Object rlc = ((Object[]) stateArray[0])[1];
+ if (rlc != null)
+ {
+ context.setResourceLibraryContracts((List<String>) UIComponentBase.
+ restoreAttachedState(context, rlc));
+ }
+ }
+ }
+ }
+ if (log.isLoggable(Level.FINEST))
+ {
+ log.finest("Exiting restoreView - " + viewId);
+ }
+
+ return viewRoot;
+ }
+
+ /**
+ * Calculates the effective view identifier for the specified raw view identifier.
+ *
+ * @param context le current FacesContext
+ * @param viewId the raw view identifier
+ *
+ * @return the effective view identifier
+ */
+ protected abstract String calculateViewId(FacesContext context, String viewId);
+
+ /**
+ * Send a source not found to the client. Although it can be considered ok in JSP mode,
+ * I think it's pretty lame to have this kind of requirement at VDL level considering VDL
+ * represents the page --> JSF tree link, not the transport layer required to send a
+ * SC_NOT_FOUND.
+ *
+ * @param context le current FacesContext
+ * @param message the message associated with the error
+ */
+ protected abstract void sendSourceNotFound(FacesContext context, String message);
+
+ protected RenderKitFactory getRenderKitFactory()
+ {
+ if (_renderKitFactory == null)
+ {
+ _renderKitFactory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ }
+ return _renderKitFactory;
+ }
+}
+
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java b/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
index 8d8518e..41e61e3 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
@@ -1,2652 +1,2652 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.view.facelets;
-
-import java.beans.BeanDescriptor;
-import java.beans.BeanInfo;
-import java.beans.PropertyDescriptor;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.stream.Stream;
-
-import jakarta.el.ELContext;
-import jakarta.el.ELException;
-import jakarta.el.MethodExpression;
-import jakarta.el.ValueExpression;
-import jakarta.el.VariableMapper;
-import jakarta.faces.FacesException;
-import jakarta.faces.FacesWrapper;
-import jakarta.faces.application.Application;
-import jakarta.faces.application.ProjectStage;
-import jakarta.faces.application.Resource;
-import jakarta.faces.application.StateManager;
-import jakarta.faces.application.ViewHandler;
-import jakarta.faces.application.ViewVisitOption;
-import jakarta.faces.component.ActionSource2;
-import jakarta.faces.component.EditableValueHolder;
-import jakarta.faces.component.UIComponent;
-import jakarta.faces.component.UINamingContainer;
-import jakarta.faces.component.UIPanel;
-import jakarta.faces.component.UIViewRoot;
-import jakarta.faces.component.visit.VisitContext;
-import jakarta.faces.context.ExternalContext;
-import jakarta.faces.context.FacesContext;
-import jakarta.faces.context.ResponseWriter;
-import jakarta.faces.event.ActionEvent;
-import jakarta.faces.event.ActionListener;
-import jakarta.faces.event.MethodExpressionActionListener;
-import jakarta.faces.event.MethodExpressionValueChangeListener;
-import jakarta.faces.event.PhaseId;
-import jakarta.faces.event.PostAddToViewEvent;
-import jakarta.faces.event.PostRestoreStateEvent;
-import jakarta.faces.event.ValueChangeEvent;
-import jakarta.faces.event.ValueChangeListener;
-import jakarta.faces.render.RenderKit;
-import jakarta.faces.render.ResponseStateManager;
-import jakarta.faces.validator.MethodExpressionValidator;
-import jakarta.faces.validator.Validator;
-import jakarta.faces.view.ActionSource2AttachedObjectHandler;
-import jakarta.faces.view.ActionSource2AttachedObjectTarget;
-import jakarta.faces.view.AttachedObjectHandler;
-import jakarta.faces.view.AttachedObjectTarget;
-import jakarta.faces.view.BehaviorHolderAttachedObjectHandler;
-import jakarta.faces.view.BehaviorHolderAttachedObjectTarget;
-import jakarta.faces.view.EditableValueHolderAttachedObjectHandler;
-import jakarta.faces.view.EditableValueHolderAttachedObjectTarget;
-import jakarta.faces.view.StateManagementStrategy;
-import jakarta.faces.view.ValueHolderAttachedObjectHandler;
-import jakarta.faces.view.ValueHolderAttachedObjectTarget;
-import jakarta.faces.view.ViewDeclarationLanguage;
-import jakarta.faces.view.ViewMetadata;
-import jakarta.faces.view.facelets.Facelet;
-import jakarta.faces.view.facelets.FaceletContext;
-import jakarta.servlet.http.HttpServletResponse;
-import org.apache.myfaces.application.StateManagerImpl;
-
-import org.apache.myfaces.config.RuntimeConfig;
-import org.apache.myfaces.application.ViewIdSupport;
-import org.apache.myfaces.config.MyfacesConfig;
-import org.apache.myfaces.util.lang.StringUtils;
-import org.apache.myfaces.component.visit.MyFacesVisitHints;
-import org.apache.myfaces.util.WebConfigParamUtils;
-import org.apache.myfaces.core.api.shared.lang.Assert;
-import org.apache.myfaces.view.ViewDeclarationLanguageStrategy;
-import org.apache.myfaces.view.ViewMetadataBase;
-import org.apache.myfaces.view.facelets.compiler.Compiler;
-import org.apache.myfaces.view.facelets.compiler.SAXCompiler;
-import org.apache.myfaces.view.facelets.el.CompositeComponentELUtils;
-import org.apache.myfaces.view.facelets.el.LocationMethodExpression;
-import org.apache.myfaces.view.facelets.el.LocationValueExpression;
-import org.apache.myfaces.view.facelets.el.MethodExpressionMethodExpression;
-import org.apache.myfaces.view.facelets.el.RedirectMethodExpressionValueExpressionActionListener;
-import org.apache.myfaces.view.facelets.el.RedirectMethodExpressionValueExpressionValidator;
-import org.apache.myfaces.view.facelets.el.RedirectMethodExpressionValueExpressionValueChangeListener;
-import org.apache.myfaces.view.facelets.el.ValueExpressionMethodExpression;
-import org.apache.myfaces.view.facelets.el.VariableMapperWrapper;
-import org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory;
-import org.apache.myfaces.view.facelets.tag.composite.ClientBehaviorAttachedObjectTarget;
-import org.apache.myfaces.view.facelets.tag.composite.ClientBehaviorRedirectBehaviorAttachedObjectHandlerWrapper;
-import org.apache.myfaces.view.facelets.tag.composite.ClientBehaviorRedirectEventComponentWrapper;
-import org.apache.myfaces.view.facelets.tag.faces.ComponentSupport;
-import org.apache.myfaces.view.facelets.tag.faces.core.AjaxHandler;
-import org.apache.myfaces.view.facelets.tag.ui.UIDebug;
-
-import static org.apache.myfaces.view.facelets.PartialStateManagementStrategy.*;
-import org.apache.myfaces.view.facelets.compiler.FaceletsCompilerSupport;
-import org.apache.myfaces.view.facelets.compiler.RefreshDynamicComponentListener;
-import org.apache.myfaces.view.facelets.impl.SectionUniqueIdCounter;
-import org.apache.myfaces.view.facelets.pool.RestoreViewFromPoolResult;
-import org.apache.myfaces.view.facelets.pool.ViewEntry;
-import org.apache.myfaces.view.facelets.pool.ViewPool;
-import org.apache.myfaces.view.facelets.pool.ViewStructureMetadata;
-import org.apache.myfaces.view.facelets.tag.composite.CreateDynamicCompositeComponentListener;
-import org.apache.myfaces.view.facelets.tag.faces.PartialMethodExpressionActionListener;
-import org.apache.myfaces.view.facelets.tag.faces.PartialMethodExpressionValidator;
-import org.apache.myfaces.view.facelets.tag.faces.PartialMethodExpressionValueChangeListener;
-import org.apache.myfaces.view.facelets.util.FaceletsTemplateMappingUtils;
-import org.apache.myfaces.view.facelets.util.FaceletsViewDeclarationLanguageUtils;
-
-/**
- * This class represents the abstraction of Facelets as a ViewDeclarationLanguage.
- *
- * @author Simon Lessard (latest modification by $Author$)
- * @version $Revision$ $Date$
- *
- * @since 2.0
- */
-public class FaceletViewDeclarationLanguage extends FaceletViewDeclarationLanguageBase
-{
- private static final Logger log = Logger.getLogger(FaceletViewDeclarationLanguage.class.getName());
-
- private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class<?>[0];
-
- private static final Class<?>[] VALUE_CHANGE_LISTENER_SIGNATURE = new Class[]{ValueChangeEvent.class};
-
- private static final Class<?>[] ACTION_LISTENER_SIGNATURE = new Class[]{ActionEvent.class};
-
- private static final Class<?>[] VALIDATOR_SIGNATURE
- = new Class[]{FacesContext.class, UIComponent.class, Object.class};
-
- public final static long DEFAULT_REFRESH_PERIOD = 0;
- public final static long DEFAULT_REFRESH_PERIOD_PRODUCTION = -1;
-
- public final static String DEFAULT_CHARACTER_ENCODING = "UTF-8";
-
- /**
- * Constant used by EncodingHandler to indicate the current encoding of the page being built,
- * and indicate which one is the response encoding on getResponseEncoding(FacesContext, String) method.
- */
- public final static String PARAM_ENCODING = "facelets.Encoding";
-
-
- //BEGIN CONSTANTS SET ON BUILD VIEW
- public final static String BUILDING_VIEW_METADATA = "org.apache.myfaces.BUILDING_VIEW_METADATA";
-
- public final static String REFRESHING_TRANSIENT_BUILD = "org.apache.myfaces.REFRESHING_TRANSIENT_BUILD";
-
- public final static String REFRESH_TRANSIENT_BUILD_ON_PSS = "org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS";
-
- public final static String USING_PSS_ON_THIS_VIEW = "org.apache.myfaces.USING_PSS_ON_THIS_VIEW";
-
- public final static String REMOVING_COMPONENTS_BUILD = "org.apache.myfaces.REMOVING_COMPONENTS_BUILD";
-
- public final static String DYN_WRAPPER = "oam.vf.DYN_WRAPPER";
-
- public final static String GEN_MARK_ID = "oam.vf.GEN_MARK_ID";
- //END CONSTANTS SET ON BUILD VIEW
-
- /**
- * Marker to indicate tag handlers the view currently being built is using
- * partial state saving and it is necessary to call UIComponent.markInitialState
- * after component instances are populated.
- */
- public final static String MARK_INITIAL_STATE_KEY = "org.apache.myfaces.MARK_INITIAL_STATE";
-
- public final static String IS_BUILDING_INITIAL_STATE_KEY_ALIAS
- = "jakarta.faces.view.ViewDeclarationLanguage.IS_BUILDING_INITIAL_STATE";
-
- public final static String CLEAN_TRANSIENT_BUILD_ON_RESTORE
- = "org.apache.myfaces.CLEAN_TRANSIENT_BUILD_ON_RESTORE";
-
- private final static String STATE_KEY = "<!-...@-->";
-
- private final static int STATE_KEY_LEN = STATE_KEY.length();
-
- private static final String SERIALIZED_VIEW_REQUEST_ATTR =
- StateManagerImpl.class.getName() + ".SERIALIZED_VIEW";
-
- /**
- * Key used to cache component ids for the counter
- */
- public final static String CACHED_COMPONENT_IDS = "oam.CACHED_COMPONENT_IDS";
-
- private static final String ASTERISK = "*";
-
- private final FaceletFactory faceletFactory;
- private final ViewDeclarationLanguageStrategy strategy;
- private final FaceletsCompilerSupport faceletsCompilerSupport;
- private final MyfacesConfig config;
- private final ViewPoolProcessor viewPoolProcessor;
- private final ViewIdSupport viewIdSupport;
-
- private StateManagementStrategy partialSMS;
- private StateManagementStrategy fullSMS;
- private Set<String> fullStateSavingViewIds;
- private Map<String, List<String>> _contractMappings;
- private List<String> _prefixWildcardKeys;
-
- public FaceletViewDeclarationLanguage(FacesContext context)
- {
- this(context, new FaceletViewDeclarationLanguageStrategy());
- }
-
- public FaceletViewDeclarationLanguage(FacesContext context, ViewDeclarationLanguageStrategy strategy)
- {
- log.finest("Initializing");
-
- this.config = MyfacesConfig.getCurrentInstance(context);
- this.strategy = strategy;
- this.viewPoolProcessor = ViewPoolProcessor.getInstance(context);
- this.viewIdSupport = ViewIdSupport.getInstance(context);
- this.faceletsCompilerSupport = new FaceletsCompilerSupport();
-
- Compiler compiler = createCompiler(context);
-
- faceletFactory = createFaceletFactory(context, compiler);
-
- partialSMS = new PartialStateManagementStrategy(context);
- fullSMS = new FullStateManagementStrategy(context);
-
- ExternalContext externalContext = context.getExternalContext();
-
- String[] fullStateSavingViewIds = config.getFullStateSavingViewIds();
- if (fullStateSavingViewIds != null && fullStateSavingViewIds.length > 0)
- {
- this.fullStateSavingViewIds = new HashSet<>(fullStateSavingViewIds.length, 1.0f);
- Collections.addAll(this.fullStateSavingViewIds, fullStateSavingViewIds);
- }
-
- _initializeContractMappings(externalContext);
-
- // Create a component ids cache and store it on application map to
- // reduce the overhead associated with create such ids over and over.
- if (config.getComponentUniqueIdsCacheSize() > 0)
- {
- String[] componentIdsCached = SectionUniqueIdCounter.generateUniqueIdCache("_",
- config.getComponentUniqueIdsCacheSize());
- externalContext.getApplicationMap().put(CACHED_COMPONENT_IDS, componentIdsCached);
- }
-
- log.finest("Initialization Successful");
- }
-
-
- @Override
- public String getId()
- {
- return ViewDeclarationLanguage.FACELETS_VIEW_DECLARATION_LANGUAGE_ID;
- }
-
- @Override
- public boolean viewExists(FacesContext context, String viewId)
- {
- if (strategy.handles(viewId))
- {
- return context.getApplication().getResourceHandler().createViewResource(context, viewId) != null;
- }
- return false;
- }
-
- private RestoreViewFromPoolResult tryRestoreViewFromCache(FacesContext context, UIViewRoot view)
- {
- if (viewPoolProcessor != null)
- {
- ViewPool viewPool = viewPoolProcessor.getViewPool(context, view);
- if (viewPool != null)
- {
- ViewStructureMetadata metadata = viewPool.retrieveStaticViewStructureMetadata(context, view);
- if (metadata != null)
- {
- ViewEntry entry = viewPool.popStaticOrPartialStructureView(context, view);
- if (entry != null)
- {
- viewPoolProcessor.cloneAndRestoreView(context, view, entry, metadata);
- return entry.getResult();
- }
- }
- }
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void buildView(FacesContext context, UIViewRoot view) throws IOException
- {
- if (isFilledView(context, view))
- {
- if (view != null &&
- FaceletViewDeclarationLanguageBase.isDynamicComponentRefreshTransientBuildActive(context, view))
- {
- // don't return
- }
- else
- {
- return;
- }
- }
-
- String viewId = view.getViewId();
-
- if (log.isLoggable(Level.FINEST))
- {
- log.finest("Building View: " + viewId);
- }
-
- boolean usePartialStateSavingOnThisView = _usePartialStateSavingOnThisView(viewId);
- boolean refreshTransientBuild = view.getChildCount() > 0;
- boolean refreshTransientBuildOnPSS = usePartialStateSavingOnThisView && config.isRefreshTransientBuildOnPSS();
- boolean refreshPartialView = false;
-
- if (viewPoolProcessor != null && !refreshTransientBuild)
- {
- RestoreViewFromPoolResult result = tryRestoreViewFromCache(context, view);
- if (result != null)
- {
- // Since all transient stuff has been removed, add listeners that keep
- // track of tree updates.
- if (RestoreViewFromPoolResult.COMPLETE.equals(result))
- {
- if (!PhaseId.RESTORE_VIEW.equals(context.getCurrentPhaseId()))
- {
- ((PartialStateManagementStrategy)
- getStateManagementStrategy(context, view.getViewId())).
- suscribeListeners(view);
- }
- // If the result is complete, the view restored here is static.
- // static views can be marked as filled.
- if (!refreshTransientBuildOnPSS)
- {
- // This option will be true on this cases:
- // -pss is true and refresh is not active
- setFilledView(context, view);
- }
- //At this point refreshTransientBuild = false && refreshTransientBuildOnPSS is true
- else if (config.isRefreshTransientBuildOnPSSAuto() &&
- !context.getAttributes().containsKey(CLEAN_TRANSIENT_BUILD_ON_RESTORE))
- {
- setFilledView(context, view);
- }
- return;
- }
- else
- {
- // We need to refresh a partial view.
- refreshTransientBuild = true;
- refreshPartialView = true;
- }
- }
- }
-
- if (usePartialStateSavingOnThisView)
- {
- // Before apply we need to make sure the current view has
- // a clientId that will be used as a key to save and restore
- // the current view. Note that getClientId is never called (or used)
- // from UIViewRoot.
- if (view.getId() == null)
- {
- view.setId(view.createUniqueId(context, null));
- }
-
- context.getAttributes().put(USING_PSS_ON_THIS_VIEW, Boolean.TRUE);
- //Add a key to indicate ComponentTagHandlerDelegate to
- //call UIComponent.markInitialState after it is populated
- if (!refreshTransientBuild || refreshPartialView)
- {
- context.getAttributes().put(StateManager.IS_BUILDING_INITIAL_STATE, Boolean.TRUE);
- context.getAttributes().put(IS_BUILDING_INITIAL_STATE_KEY_ALIAS, Boolean.TRUE);
- }
- if (!refreshTransientBuild && config.isMarkInitialStateWhenApplyBuildView())
- {
- context.getAttributes().put(MARK_INITIAL_STATE_KEY, Boolean.TRUE);
- }
- if (refreshTransientBuildOnPSS)
- {
- //This value is only set when _refreshTransientBuildOnPSSMode is "auto" or "true"
- context.getAttributes().put(REFRESH_TRANSIENT_BUILD_ON_PSS,
- config.isRefreshTransientBuildOnPSSAuto() ? "auto" : "true");
- }
- }
-
- try
- {
- if (refreshTransientBuild)
- {
- context.getAttributes().put(REFRESHING_TRANSIENT_BUILD, Boolean.TRUE);
-
- // In theory, this should be disabled on ComponentTagHandlerDelegate,
- // otherwise we could lost PostAddToViewEvent / PreRemoveFromViewEvent
- // caused by c:if effect or facelets cleanup algorithm
- //context.setProcessingEvents(false);
- }
- // populate UIViewRoot
- _getFacelet(context, viewId).apply(context, view);
- }
- finally
- {
- if (refreshTransientBuildOnPSS)
- {
- context.getAttributes().remove(REFRESH_TRANSIENT_BUILD_ON_PSS);
- }
- if (refreshTransientBuild)
- {
- //context.setProcessingEvents(true);
- if (FaceletViewDeclarationLanguageBase.isDynamicComponentRefreshTransientBuildActive(context))
- {
- VisitContext visitContext = (VisitContext) getVisitContextFactory().
- getVisitContext(context, null, MyFacesVisitHints.SET_SKIP_ITERATION);
- view.visitTree(visitContext, PublishDynamicComponentRefreshTransientBuildCallback.INSTANCE);
- }
- if (!usePartialStateSavingOnThisView || refreshTransientBuildOnPSS)
- {
- // When the facelet is applied, all components are removed and added from view,
- // but the difference resides in the ordering. Since the view is
- // being refreshed, if we don't do this manually, some tags like
- // cc:insertChildren or cc:insertFacet will not work correctly, because
- // we expect PostAddToViewEvent will be propagated from parent to child, and
- // facelets refreshing algorithm do the opposite.
- //FaceletViewDeclarationLanguage._publishPreRemoveFromViewEvent(context, view);
- //FaceletViewDeclarationLanguage._publishPostAddToViewEvent(context, view);
- }
-
- context.getAttributes().remove(REFRESHING_TRANSIENT_BUILD);
- }
- else
- {
- // Publish PostAddToView over UIViewRoot, because this is not done automatically.
- context.getApplication().publishEvent(context, PostAddToViewEvent.class, UIViewRoot.class, view);
- }
- }
-
- // set this view as filled
- if (refreshTransientBuild)
- {
- //This option will be true on this cases:
- //- pss is false, but we are refreshing
- //- pss is true, and we are refreshing a view already filled
- setFilledView(context, view);
- }
- else if (!refreshTransientBuildOnPSS)
- {
- // This option will be true on this cases:
- // -pss is true and refresh is not active
- setFilledView(context, view);
- }
- //At this point refreshTransientBuild = false && refreshTransientBuildOnPSS is true
- else if (config.isRefreshTransientBuildOnPSSAuto()
- && !context.getAttributes().containsKey(CLEAN_TRANSIENT_BUILD_ON_RESTORE))
- {
- setFilledView(context, view);
- }
-
- // Suscribe listeners if we are using partialStateSaving
- if (usePartialStateSavingOnThisView)
- {
- // UIViewRoot.markInitialState() is not called because it does
- // not have a facelet tag handler class that create it, instead
- // new instances are created programatically.
- if (!refreshTransientBuild || refreshPartialView)
- {
- // Save the state
- if (viewPoolProcessor != null &&
- viewPoolProcessor.isViewPoolEnabledForThisView(context, view))
- {
- viewPoolProcessor.storeViewStructureMetadata(context, view);
- }
- if (config.isMarkInitialStateWhenApplyBuildView())
- {
- if (!refreshTransientBuildOnPSS ||
- !view.getAttributes().containsKey(COMPONENT_ADDED_AFTER_BUILD_VIEW))
- {
- view.markInitialState();
- }
-
- //Remove the key that indicate we need to call UIComponent.markInitialState
- //on the current tree
- context.getAttributes().remove(MARK_INITIAL_STATE_KEY);
- }
- else
- {
- context.getAttributes().put(MARK_INITIAL_STATE_KEY, Boolean.TRUE);
- _markInitialStateOnView(view, refreshTransientBuildOnPSS);
- context.getAttributes().remove(MARK_INITIAL_STATE_KEY);
- }
- context.getAttributes().remove(StateManager.IS_BUILDING_INITIAL_STATE);
- context.getAttributes().remove(IS_BUILDING_INITIAL_STATE_KEY_ALIAS);
- }
-
- // We need to suscribe the listeners of changes in the component tree
- // only the first time here. Later we suscribe this listeners on
- // DefaultFaceletsStateManagement.restoreView, to ensure
- // relocated components are not retrieved later on getClientIdsRemoved().
- if (!(refreshTransientBuild && PhaseId.RESTORE_VIEW.equals(context.getCurrentPhaseId()))
- && !view.isTransient())
- {
- ((PartialStateManagementStrategy) getStateManagementStrategy(context, view.getViewId())).
- suscribeListeners(view);
- }
-
- context.getAttributes().remove(USING_PSS_ON_THIS_VIEW);
- }
-
- // Remove this var from faces context because this one prevent AjaxHandler
- // register the standard script library on Post-Redirect-Get pattern or
- // in the next view
- context.getAttributes().remove(AjaxHandler.FACES_JS_DYNAMICALLY_ADDED);
- }
-
- private void _markInitialStateOnView(final UIViewRoot view, final boolean refreshTransientBuildOnPSS)
- {
- if (!refreshTransientBuildOnPSS ||
- !view.getAttributes().containsKey(COMPONENT_ADDED_AFTER_BUILD_VIEW))
- {
- if (!view.isTransient())
- {
- view.markInitialState();
- }
- }
-
- int childCount = view.getChildCount();
- if (childCount > 0)
- {
- for (int i = 0; i < childCount; i++)
- {
- UIComponent child = view.getChildren().get(i);
- if (!child.isTransient())
- {
- _markInitialState(child);
- }
- }
- }
- if (view.getFacetCount() > 0)
- {
- Map<String, UIComponent> facetMap = view.getFacets();
- for (Map.Entry<String, UIComponent> entry : facetMap.entrySet())
- {
- UIComponent child = entry.getValue();
- if (!child.isTransient())
- {
- _markInitialState(child);
- }
- }
-
- }
- }
-
- private void _markInitialState(final UIComponent component)
- {
- component.markInitialState();
-
- final int childCount = component.getChildCount();
- if (childCount > 0)
- {
- for (int i = 0; i < childCount; i++)
- {
- UIComponent child = component.getChildren().get(i);
- if (!child.isTransient())
- {
- _markInitialState(child);
- }
- }
- }
- if (component.getFacetCount() > 0)
- {
- Map<String, UIComponent> facetMap = component.getFacets();
- for (Map.Entry<String, UIComponent> entry : facetMap.entrySet())
- {
- UIComponent child = entry.getValue();
- if (!child.isTransient())
- {
- _markInitialState(child);
- }
- }
-
- }
- }
-
- private boolean isFilledView(FacesContext context, UIViewRoot view)
- {
- // The view is only built on restoreView or renderView, but if
- // we are not using partial state saving, we need to mark the current
- // view as filled, otherwise it will be filled again on renderView.
- return context.getAttributes().containsKey(view);
- // -= Leonardo Uribe =- save this key on view cause render fail, because the view
- // is built before render view to "restore" the transient components that has
- // facelet markup (facelets UIInstructions ...) This effect is only notice when
- // partial state saving is not used.
- //return view.getAttributes().containsKey(FILLED_VIEW);
- }
-
- private void setFilledView(FacesContext context, UIViewRoot view)
- {
- context.getAttributes().put(view, Boolean.TRUE);
- // -= Leonardo Uribe =- save this key on view cause render fail, because the view
- // is built before render view to "restore" the transient components that has
- // facelet markup (facelets UIInstructions ...) This effect is only notice when
- // partial state saving is not used.
- // view.getAttributes().put(FILLED_VIEW, Boolean.TRUE);
- }
-
- /**
- * retargetMethodExpressions(FacesContext, UIComponent) has some clues about the behavior of this method
- *
- * {@inheritDoc}
- */
- @Override
- public BeanInfo getComponentMetadata(FacesContext context, Resource componentResource)
- {
- BeanInfo beanInfo = null;
-
- Assert.notNull(context, "context");
-
- try
- {
- Facelet compositeComponentFacelet;
- FaceletFactory.setInstance(faceletFactory);
- try
- {
- compositeComponentFacelet
- = faceletFactory.getCompositeComponentMetadataFacelet(componentResource.getURL());
- }
- finally
- {
- FaceletFactory.setInstance(null);
- }
- //context.getAttributes().put(BUILDING_COMPOSITE_COMPONENT_METADATA, Boolean.TRUE);
-
- // Create a temporal tree where all components will be put, but we are only
- // interested in metadata.
- UINamingContainer compositeComponentBase
- = (UINamingContainer) context.getApplication().createComponent(
- context, UINamingContainer.COMPONENT_TYPE, null);
-
- // Fill the component resource key, because this information should be available
- // on metadata to recognize which is the component used as composite component base.
- // Since this method is called from Application.createComponent(FacesContext,Resource),
- // and in that specific method this key is updated, this is the best option we
- // have for recognize it (also this key is used by UIComponent.isCompositeComponent)
- compositeComponentBase.getAttributes().put(Resource.COMPONENT_RESOURCE_KEY, componentResource);
-
- // According to UserTagHandler, in this point we need to wrap the facelet
- // VariableMapper, so local changes are applied on "page context", but
- // data is retrieved from full context
- FaceletContext faceletContext = (FaceletContext) context.
- getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
- VariableMapper orig = faceletContext.getVariableMapper();
- try
- {
- faceletContext.setVariableMapper(new VariableMapperWrapper(orig));
-
- compositeComponentBase.pushComponentToEL(context, compositeComponentBase);
-
- compositeComponentFacelet.apply(context, compositeComponentBase);
-
- compositeComponentBase.popComponentFromEL(context);
- }
- finally
- {
- faceletContext.setVariableMapper(orig);
- }
-
- beanInfo = (BeanInfo) compositeComponentBase.getAttributes().get(UIComponent.BEANINFO_KEY);
- }
- catch (IOException e)
- {
- throw new FacesException(e);
- }
-
- return beanInfo;
- }
-
-
- /**
- * Check if the current facelet applied is used to build view metadata.
- *
- * @param context
- * @return
- */
- public static boolean isBuildingViewMetadata(FacesContext context)
- {
- return context.getAttributes().containsKey(BUILDING_VIEW_METADATA);
- }
-
- public static boolean isRefreshingTransientBuild(FacesContext context)
- {
- return context.getAttributes().containsKey(REFRESHING_TRANSIENT_BUILD);
- }
-
- public static boolean isRemovingComponentBuild(FacesContext context)
- {
- return context.getAttributes().containsKey(REMOVING_COMPONENTS_BUILD);
- }
-
- public static boolean isMarkInitialState(FacesContext context)
- {
- return Boolean.TRUE.equals(context.getAttributes().get(MARK_INITIAL_STATE_KEY));
- }
-
- public static boolean isRefreshTransientBuildOnPSS(FacesContext context)
- {
- //this include both "true" and "auto"
- return context.getAttributes().containsKey(REFRESH_TRANSIENT_BUILD_ON_PSS);
- }
-
- public static boolean isRefreshTransientBuildOnPSSAuto(FacesContext context)
- {
- return "auto".equalsIgnoreCase((String) context.getAttributes().get(REFRESH_TRANSIENT_BUILD_ON_PSS));
- }
-
- public static boolean isCleanTransientBuildOnRestore(FacesContext context)
- {
- return context.getAttributes().containsKey(CLEAN_TRANSIENT_BUILD_ON_RESTORE);
- }
-
- public static void cleanTransientBuildOnRestore(FacesContext context)
- {
- context.getAttributes().put(CLEAN_TRANSIENT_BUILD_ON_RESTORE, Boolean.TRUE);
- }
-
- public static boolean isUsingPSSOnThisView(FacesContext context)
- {
- return context.getAttributes().containsKey(USING_PSS_ON_THIS_VIEW);
- }
-
- /**
- * In short words, this method take care of "target" an "attached object".
- * <ul>
- * <li>The "attached object" is instantiated by a tag handler.</li>
- * <li>The "target" is an object used as "marker", that exposes a List<UIComponent></li>
- * </ul>
- * This method should be called from some composite component tag handler, after
- * all children of composite component has been applied.
- */
- @Override
- @SuppressWarnings("unchecked")
- public void retargetAttachedObjects(FacesContext context,
- UIComponent topLevelComponent, List<AttachedObjectHandler> handlerList)
- {
- Assert.notNull(context, "context");
- Assert.notNull(topLevelComponent, "topLevelComponent");
- Assert.notNull(handlerList, "handlerList");
-
- BeanInfo compositeComponentMetadata
- = (BeanInfo) topLevelComponent.getAttributes().get(UIComponent.BEANINFO_KEY);
-
- if (compositeComponentMetadata == null)
- {
- log.severe("Composite component metadata not found for: " + topLevelComponent.getClientId(context));
- return;
- }
-
- BeanDescriptor compositeComponentDescriptor = compositeComponentMetadata.getBeanDescriptor();
-
- List<AttachedObjectTarget> targetList = (List<AttachedObjectTarget>)
- compositeComponentDescriptor.getValue(AttachedObjectTarget.ATTACHED_OBJECT_TARGETS_KEY);
-
- if (targetList == null || targetList.isEmpty())
- {
- return;
- }
-
- for (int i = 0, size = handlerList.size(); i < size; i++)
- {
- AttachedObjectHandler currentHandler = handlerList.get(i);
- // In the spec javadoc this variable is referred as forAttributeValue, but
- // note it is also called curTargetName
- String forValue = currentHandler.getFor();
-
- // perf: targetList is always arrayList: see AttachedObjectTargetHandler.apply
- // and ClientBehaviorHandler.apply
- for (int k = 0, targetsSize = targetList.size(); k < targetsSize; k++)
- {
- AttachedObjectTarget currentTarget = targetList.get(k);
- FaceletCompositionContext mctx = FaceletCompositionContext.getCurrentInstance();
-
- if ((forValue != null && forValue.equals(currentTarget.getName())) &&
- ((currentTarget instanceof ActionSource2AttachedObjectTarget &&
- currentHandler instanceof ActionSource2AttachedObjectHandler) ||
- (currentTarget instanceof EditableValueHolderAttachedObjectTarget &&
- currentHandler instanceof EditableValueHolderAttachedObjectHandler) ||
- (currentTarget instanceof ValueHolderAttachedObjectTarget &&
- currentHandler instanceof ValueHolderAttachedObjectHandler)))
- {
- // perf: getTargets return ArrayList - see getTargets implementations
- List<UIComponent> targets = currentTarget.getTargets(topLevelComponent);
- for (int l = 0, targetsCount = targets.size(); l < targetsCount; l++)
- {
- UIComponent component = targets.get(l);
- // If we found composite components when traverse the tree
- // we have to call this one recursively, because each composite component
- // should have its own AttachedObjectHandler list, filled earlier when
- // its tag handler is applied.
- if (UIComponent.isCompositeComponent(component))
- {
- // How we obtain the list of AttachedObjectHandler for
- // the current composite component? It should be a component
- // attribute or retrieved by a key inside component.getAttributes
- // map. Since api does not specify any attribute, we suppose
- // this is an implementation detail and it should be retrieved
- // from component attribute map.
- // But this is only the point of the iceberg, because we should
- // define how we register attached object handlers in this list.
- // ANS: see CompositeComponentResourceTagHandler.
- // The current handler should be added to the list, to be chained.
- // Note that the inner component should have a target with the same name
- // as "for" attribute
- mctx.addAttachedObjectHandler(component, currentHandler);
-
- List<AttachedObjectHandler> handlers = mctx.getAttachedObjectHandlers(component);
-
- retargetAttachedObjects(context, component, handlers);
-
- handlers.remove(currentHandler);
- }
- else
- {
- currentHandler.applyAttachedObject(context, component);
- }
- if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
- {
- component.markInitialState();
- }
- }
- }
- else if ((currentTarget instanceof BehaviorHolderAttachedObjectTarget &&
- currentHandler instanceof BehaviorHolderAttachedObjectHandler))
- {
- String eventName = ((BehaviorHolderAttachedObjectHandler) currentHandler).getEventName();
- boolean isDefaultEvent = ((BehaviorHolderAttachedObjectTarget) currentTarget).isDefaultEvent();
-
- if ((eventName != null && eventName.equals(currentTarget.getName())) ||
- (eventName == null && isDefaultEvent))
- {
- List<UIComponent> targets = currentTarget.getTargets(topLevelComponent);
- for (int j = 0, targetssize = targets.size(); j < targetssize; j++)
- {
- UIComponent component = targets.get(j);
- // If we found composite components when traverse the tree
- // we have to call this one recursively, because each composite component
- // should have its own AttachedObjectHandler list, filled earlier when
- // its tag handler is applied.
- if (UIComponent.isCompositeComponent(component))
- {
- if (currentTarget instanceof ClientBehaviorAttachedObjectTarget)
- {
- mctx.addAttachedObjectHandler(component,
- new ClientBehaviorRedirectBehaviorAttachedObjectHandlerWrapper(
- (BehaviorHolderAttachedObjectHandler) currentHandler,
- ((ClientBehaviorAttachedObjectTarget) currentTarget).getEvent()));
- }
- else
- {
- mctx.addAttachedObjectHandler(component, currentHandler);
- }
-
- List<AttachedObjectHandler> handlers = mctx.getAttachedObjectHandlers(component);
-
- retargetAttachedObjects(context, component, handlers);
-
- handlers.remove(currentHandler);
- }
- else
- {
- if (currentHandler instanceof
- ClientBehaviorRedirectBehaviorAttachedObjectHandlerWrapper)
- {
- ClientBehaviorRedirectBehaviorAttachedObjectHandlerWrapper wrapper =
- (ClientBehaviorRedirectBehaviorAttachedObjectHandlerWrapper) currentHandler;
- currentHandler.applyAttachedObject(context,
- new ClientBehaviorRedirectEventComponentWrapper(
- topLevelComponent,
- component,
- wrapper.getWrappedEventName(),
- eventName));
- }
- else
- {
- currentHandler.applyAttachedObject(context, component);
- }
- }
- if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
- {
- component.markInitialState();
- }
- }
- }
- }
- }
- }
- }
-
- @Override
- public void retargetMethodExpressions(FacesContext context, UIComponent topLevelComponent)
- {
- Assert.notNull(context, "context");
-
- BeanInfo compositeComponentMetadata
- = (BeanInfo) topLevelComponent.getAttributes().get(UIComponent.BEANINFO_KEY);
-
- if (compositeComponentMetadata == null)
- {
- log.severe("Composite component metadata not found for: " + topLevelComponent.getClientId(context));
- return;
- }
-
- // "...For each attribute that is a MethodExpression..." This means we have to scan
- // all attributes with "method-signature" attribute and no "type" attribute
- // jakarta.faces.component._ComponentAttributesMap uses BeanInfo.getPropertyDescriptors to
- // traverse over it, but here the metadata returned by UIComponent.BEANINFO_KEY is available
- // only for composite components.
- // That means somewhere we need to create a custom BeanInfo object for composite components
- // that will be filled somewhere (theorically in ViewDeclarationLanguage.getComponentMetadata())
-
- PropertyDescriptor[] propertyDescriptors = compositeComponentMetadata.getPropertyDescriptors();
-
- ELContext elContext = (ELContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
-
- for (PropertyDescriptor propertyDescriptor : propertyDescriptors)
- {
- if (propertyDescriptor.getValue("type") != null)
- {
- // This check is necessary if we have both "type" and "method-signature" set.
- // In that case, "method-signature" is ignored
- continue;
- }
-
- String attributeName = propertyDescriptor.getName();
-
- // <composite:attribute> method-signature attribute is
- // ValueExpression that must evaluate to String
- ValueExpression methodSignatureExpression
- = (ValueExpression) propertyDescriptor.getValue("method-signature");
- String methodSignature = null;
- if (methodSignatureExpression != null)
- {
- // Check if the value expression holds a method signature
- // Note that it could be null, so in that case we don't have to do anything
- methodSignature = (String) methodSignatureExpression.getValue(elContext);
- }
-
- String targetAttributeName = null;
- ValueExpression targetAttributeNameVE
- = (ValueExpression) propertyDescriptor.getValue("targetAttributeName");
- if (targetAttributeNameVE != null)
- {
- targetAttributeName = (String) targetAttributeNameVE.getValue(context.getELContext());
- if (targetAttributeName == null)
- {
- targetAttributeName = attributeName;
- }
- }
- else
- {
- targetAttributeName = attributeName;
- }
-
- boolean isKnownTargetAttributeMethod
- = "action".equals(targetAttributeName) || "actionListener".equals(targetAttributeName)
- || "validator".equals(targetAttributeName) || "valueChangeListener".equals(targetAttributeName);
-
- // either the attributeName has to be a knownMethod or there has to be a method-signature
- if (isKnownTargetAttributeMethod || methodSignature != null)
- {
- ValueExpression targetsExpression =
- (ValueExpression) propertyDescriptor.getValue("targets");
-
- String targets = null;
- // <composite:attribute> targets attribute is
- // ValueExpression that must evaluate to String
- if (targetsExpression != null)
- {
- targets = (String) targetsExpression.getValue(elContext);
- }
-
- if (targets == null)
- {
- // "...let the name of the metadata element be the
- // evaluated value of the targets attribute..."
- targets = attributeName;
- }
-
- FaceletCompositionContext mctx = FaceletCompositionContext.getCurrentInstance();
-
- // If the MethodExpression attribute has been already applied, there is no need to
- // handle it and it is probably a MethodExpression instance is on attribute map, so the
- // inner code will cause a ClassCastException.
- if (!mctx.isMethodExpressionAttributeApplied(topLevelComponent, attributeName))
- {
- ValueExpression attributeNameValueExpression =
- (ValueExpression) topLevelComponent.getAttributes().get(attributeName);
-
- if (attributeNameValueExpression == null)
- {
- // composite:attribute has a default property, so if we can't found on the
- // component attribute map, we should get the default as CompositeComponentELResolver
- // does.
- attributeNameValueExpression = (ValueExpression) propertyDescriptor.getValue("default");
- if (attributeNameValueExpression == null)
- {
- // It is only valid to log an error if the attribute is required
- ValueExpression ve = (ValueExpression) propertyDescriptor.getValue("required");
- if (ve != null)
- {
- Object requiredValue = ve.getValue(elContext);
- Boolean required;
- if (requiredValue instanceof Boolean)
- {
- required = (Boolean) requiredValue;
- }
- else
- {
- required = Boolean.valueOf(requiredValue.toString());
- }
-
- if (required != null && required)
- {
- if (log.isLoggable(Level.SEVERE))
- {
- log.severe("attributeValueExpression not found under the key \""
- + attributeName
- + "\". Looking for the next attribute");
- }
- }
- }
- continue;
- }
- }
-
- String[] targetsArray = StringUtils.splitShortString(targets, ' ');
- String attributeExpressionString = attributeNameValueExpression.getExpressionString();
-
- //Check if the stored valueExpression is a ccRedirection, to handle it properly later.
- boolean ccAttrMeRedirection =
- attributeNameValueExpression instanceof LocationValueExpression &&
- CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(
- attributeNameValueExpression.getExpressionString());
-
- if (isKnownTargetAttributeMethod)
- {
- // To add support to #{cc.attrs.action}, #{cc.attrs.actionListener}, #{cc.attrs.validator} or
- // #{cc.attrs.valueChangeListener} it is necessary to put a MethodExpression or a
- // ValueExpression pointing to the associated java method in the component attribute map.
- // org.apache.myfaces.view.facelets.tag.composite.RetargetMethodExpressionRule already put
- // a ValueExpression, so we only need to put a MethodExpression when a non redirecting
- // expression is used (for example when a nested #{cc.attrs.xxx} is used).
- if ("action".equals(targetAttributeName))
- {
- applyActionMethodExpressionEL(context, elContext,
- topLevelComponent, attributeName,
- attributeExpressionString, attributeNameValueExpression,
- ccAttrMeRedirection);
- }
- else if ("actionListener".equals(targetAttributeName))
- {
- applyActionListenerMethodExpressionEL(context, elContext,
- topLevelComponent, attributeName,
- attributeExpressionString, attributeNameValueExpression,
- ccAttrMeRedirection);
- }
- else if ("validator".equals(targetAttributeName))
- {
- applyValidatorMethodExpressionEL(context, elContext,
- topLevelComponent, attributeName,
- attributeExpressionString, attributeNameValueExpression,
- ccAttrMeRedirection);
- }
- else if ("valueChangeListener".equals(targetAttributeName))
- {
- applyValueChangeListenerMethodExpressionEL(context, elContext,
- topLevelComponent, attributeName,
- attributeExpressionString, attributeNameValueExpression,
- ccAttrMeRedirection);
- }
-
- UIComponent topLevelComponentBase =
- topLevelComponent.getFacet(UIComponent.COMPOSITE_FACET_NAME);
-
- for (String target : targetsArray)
- {
- UIComponent innerComponent
- = ComponentSupport.findComponentChildOrFacetFrom(context, topLevelComponentBase,
- target);
-
- if (innerComponent == null)
- {
- continue;
- }
-
- if (isCompositeComponentRetarget(context, innerComponent, targetAttributeName))
- {
- innerComponent.getAttributes().put(targetAttributeName, attributeNameValueExpression);
-
- mctx.clearMethodExpressionAttribute(innerComponent, targetAttributeName);
-
- retargetMethodExpressions(context, innerComponent);
- if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
- {
- innerComponent.markInitialState();
- }
- }
- else
- {
- if ("action".equals(targetAttributeName))
- {
- applyActionMethodExpressionTarget(context, mctx, elContext,
- topLevelComponentBase, innerComponent,
- attributeName, targetAttributeName,
- attributeExpressionString, attributeNameValueExpression,
- ccAttrMeRedirection);
- if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
- {
- innerComponent.markInitialState();
- }
- }
- else if ("actionListener".equals(targetAttributeName))
- {
- applyActionListenerMethodExpressionTarget(context, mctx, elContext,
- topLevelComponentBase, innerComponent,
- attributeName, targetAttributeName,
- attributeExpressionString, attributeNameValueExpression,
- ccAttrMeRedirection);
- if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
- {
- innerComponent.markInitialState();
- }
- }
- else if ("validator".equals(targetAttributeName))
- {
- applyValidatorMethodExpressionTarget(context, mctx, elContext,
- topLevelComponentBase, innerComponent,
- attributeName, targetAttributeName,
- attributeExpressionString, attributeNameValueExpression,
- ccAttrMeRedirection);
- if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
- {
- innerComponent.markInitialState();
- }
- }
- else if ("valueChangeListener".equals(targetAttributeName))
- {
- applyValueChangeListenerMethodExpressionTarget(context, mctx, elContext,
- topLevelComponentBase, innerComponent,
- attributeName, targetAttributeName,
- attributeExpressionString, attributeNameValueExpression,
- ccAttrMeRedirection);
- if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
- {
- innerComponent.markInitialState();
- }
- }
- }
- }
- }
- else
- {
- MethodExpression methodExpression = null;
- // composite:attribute targets property only has sense for action, actionListener,
- // validator or valueChangeListener. This means we have to retarget the method expression
- // to the topLevelComponent.
-
- // Since a MethodExpression has no state, we can use it multiple times without problem, so
- // first create it here.
- methodSignature = methodSignature.trim();
- methodExpression = context.getApplication().getExpressionFactory().
- createMethodExpression(elContext,
- attributeExpressionString,
- FaceletsViewDeclarationLanguageUtils.getReturnType(methodSignature),
- FaceletsViewDeclarationLanguageUtils.getParameters(methodSignature));
-
- methodExpression = reWrapMethodExpression(methodExpression, attributeNameValueExpression);
-
- applyMethodExpression(context, mctx, topLevelComponent, attributeName,
- targetAttributeName, attributeNameValueExpression, methodExpression,
- ccAttrMeRedirection, targetsArray);
- }
- mctx.markMethodExpressionAttribute(topLevelComponent, attributeName);
- }
-
- // We need to remove the previous ValueExpression, to prevent some possible
- // confusion when the same value is retrieved from the attribute map.
- topLevelComponent.setValueExpression(attributeName, null);
- }
- }
- }
-
- private void applyActionMethodExpressionEL(FacesContext context,
- ELContext elContext,
- UIComponent topLevelComponent,
- String attributeName,
- String attributeExpressionString,
- ValueExpression attributeNameValueExpression,
- boolean ccAttrMeRedirection)
- {
- // target is ActionSource2
- MethodExpression methodExpression = reWrapMethodExpression(context.getApplication().getExpressionFactory().
- createMethodExpression(elContext,
- attributeExpressionString, null,
- EMPTY_CLASS_ARRAY), attributeNameValueExpression);
-
- //Store the method expression to the topLevelComponent to allow reference it through EL
- if (!ccAttrMeRedirection)
- {
- //Replace it with a method expression
- topLevelComponent.getAttributes().put(attributeName, methodExpression);
- }
- // Otherwise keep the current ValueExpression,
- // because it will be used chain other value expressions
- }
-
- private void applyActionListenerMethodExpressionEL(FacesContext context,
- ELContext elContext,
- UIComponent topLevelComponent,
- String attributeName,
- String attributeExpressionString,
- ValueExpression attributeNameValueExpression,
- boolean ccAttrMeRedirection)
- {
- // target is ActionSource2
- MethodExpression methodExpression = reWrapMethodExpression(context.getApplication().getExpressionFactory().
- createMethodExpression(elContext,
- attributeExpressionString, Void.TYPE, ACTION_LISTENER_SIGNATURE),
- attributeNameValueExpression);
-
- MethodExpression methodExpression2 = reWrapMethodExpression(context.getApplication().getExpressionFactory().
- createMethodExpression(elContext,
- attributeExpressionString, Void.TYPE, EMPTY_CLASS_ARRAY),
- attributeNameValueExpression);
-
- //Store the method expression to the topLevelComponent to allow reference it through EL
- if (!ccAttrMeRedirection)
- {
- //Replace it with a method expression
- topLevelComponent.getAttributes().put(attributeName,
- new MethodExpressionMethodExpression(methodExpression, methodExpression2));
- }
- // Otherwise keep the current ValueExpression,
- // because it will be used chain other value expressions
- }
-
- private void applyValidatorMethodExpressionEL(FacesContext context,
- ELContext elContext,
- UIComponent topLevelComponent,
- String attributeName,
- String attributeExpressionString,
- ValueExpression attributeNameValueExpression,
- boolean ccAttrMeRedirection)
- {
- // target is EditableValueHolder
- MethodExpression methodExpression = reWrapMethodExpression(context.getApplication().getExpressionFactory().
- createMethodExpression(elContext,
- attributeExpressionString, Void.TYPE,
- VALIDATOR_SIGNATURE), attributeNameValueExpression);
-
- //Store the method expression to the topLevelComponent to allow reference it through EL
- if (!ccAttrMeRedirection)
- {
- //Replace it with a method expression
- topLevelComponent.getAttributes().put(attributeName, methodExpression);
- }
- // Otherwise keep the current ValueExpression,
- // because it will be used chain other value expressions
- }
-
- private void applyValueChangeListenerMethodExpressionEL(FacesContext context,
- ELContext elContext,
- UIComponent topLevelComponent,
- String attributeName,
- String attributeExpressionString,
- ValueExpression attributeNameValueExpression,
- boolean ccAttrMeRedirection)
- {
- // target is EditableValueHolder
- MethodExpression methodExpression = reWrapMethodExpression(context.getApplication().getExpressionFactory().
- createMethodExpression(elContext,
- attributeExpressionString, Void.TYPE,
- VALUE_CHANGE_LISTENER_SIGNATURE), attributeNameValueExpression);
-
- MethodExpression methodExpression2 = reWrapMethodExpression(context.getApplication().getExpressionFactory().
- createMethodExpression(elContext,
- attributeExpressionString, Void.TYPE,
- EMPTY_CLASS_ARRAY), attributeNameValueExpression);
-
- //Store the method expression to the topLevelComponent to allow reference it through EL
- if (!ccAttrMeRedirection)
- {
- //Replace it with a method expression
- topLevelComponent.getAttributes().put(attributeName,
- new MethodExpressionMethodExpression(methodExpression, methodExpression2));
- }
- // Otherwise keep the current ValueExpression, because it will be used chain other value expressions
- }
-
- private void applyActionMethodExpressionTarget(FacesContext context, FaceletCompositionContext mctx,
- ELContext elContext,
- UIComponent topLevelComponent,
- UIComponent innerComponent,
- String attributeName,
- String targetAttributeName,
- String attributeExpressionString,
- ValueExpression attributeNameValueExpression,
- boolean ccAttrMeRedirection)
- {
- // target is ActionSource2
- MethodExpression methodExpression
- = reWrapMethodExpression(context.getApplication().getExpressionFactory().
- createMethodExpression(elContext,
- attributeExpressionString, null, EMPTY_CLASS_ARRAY),
- attributeNameValueExpression);
-
- // If it is a redirection, a wrapper is used to
- // locate the right instance and call it properly.
- if (ccAttrMeRedirection)
- {
- ((ActionSource2) innerComponent).setActionExpression(
- new ValueExpressionMethodExpression(attributeNameValueExpression));
- }
- else
- {
- ((ActionSource2) innerComponent).setActionExpression(methodExpression);
- }
- }
-
- private void applyActionListenerMethodExpressionTarget(FacesContext context, FaceletCompositionContext mctx,
- ELContext elContext,
- UIComponent topLevelComponent,
- UIComponent innerComponent,
- String attributeName,
- String targetAttributeName,
- String attributeExpressionString,
- ValueExpression attributeNameValueExpression,
- boolean ccAttrMeRedirection)
- {
- //First try to remove any prevous target if any
- ActionListener o = (ActionListener)
- mctx.removeMethodExpressionTargeted(innerComponent, targetAttributeName);
- if (o != null)
- {
- ((ActionSource2) innerComponent).removeActionListener(o);
- }
-
- // target is ActionSource2
- ActionListener actionListener = null;
- // If it is a redirection, a wrapper is used to locate the right instance and call
- //it properly.
- if (ccAttrMeRedirection)
- {
- actionListener = new RedirectMethodExpressionValueExpressionActionListener(
- attributeNameValueExpression);
- }
- else
- {
- MethodExpression methodExpression = reWrapMethodExpression(context.getApplication().getExpressionFactory().
- createMethodExpression(elContext,
- attributeExpressionString, Void.TYPE, ACTION_LISTENER_SIGNATURE), attributeNameValueExpression);
-
- MethodExpression methodExpression2 = reWrapMethodExpression(context.getApplication().getExpressionFactory().
- createMethodExpression(elContext,
- attributeExpressionString, Void.TYPE, EMPTY_CLASS_ARRAY), attributeNameValueExpression);
-
- if (mctx.isUsingPSSOnThisView())
- {
- actionListener = new PartialMethodExpressionActionListener(methodExpression, methodExpression2);
- }
- else
- {
- actionListener = new MethodExpressionActionListener(methodExpression, methodExpression2);
- }
- }
- ((ActionSource2) innerComponent).addActionListener(actionListener);
- mctx.addMethodExpressionTargeted(innerComponent, targetAttributeName, actionListener);
- }
-
- private void applyValidatorMethodExpressionTarget(FacesContext context, FaceletCompositionContext mctx,
- ELContext elContext,
- UIComponent topLevelComponent,
- UIComponent innerComponent,
- String attributeName,
- String targetAttributeName,
- String attributeExpressionString,
- ValueExpression attributeNameValueExpression,
- boolean ccAttrMeRedirection)
- {
- //First try to remove any prevous target if any
- Validator o = (Validator) mctx.removeMethodExpressionTargeted(innerComponent, targetAttributeName);
- if (o != null)
- {
- ((EditableValueHolder) innerComponent).removeValidator(o);
- }
-
- // target is EditableValueHolder
- Validator validator = null;
- // If it is a redirection, a wrapper is used to locate the right instance and call it properly.
- if (ccAttrMeRedirection)
- {
- validator = new RedirectMethodExpressionValueExpressionValidator(attributeNameValueExpression);
- }
- else
- {
- MethodExpression methodExpression = reWrapMethodExpression(context.getApplication().getExpressionFactory().
- createMethodExpression(elContext,
- attributeExpressionString, Void.TYPE,
- VALIDATOR_SIGNATURE), attributeNameValueExpression);
-
- if (mctx.isUsingPSSOnThisView())
- {
- validator = new PartialMethodExpressionValidator(methodExpression);
- }
- else
- {
- validator = new MethodExpressionValidator(methodExpression);
- }
- }
- ((EditableValueHolder) innerComponent).addValidator(validator);
- mctx.addMethodExpressionTargeted(innerComponent, targetAttributeName, validator);
- }
-
- private void applyValueChangeListenerMethodExpressionTarget(FacesContext context, FaceletCompositionContext mctx,
- ELContext elContext,
- UIComponent topLevelComponent,
- UIComponent innerComponent,
- String attributeName,
- String targetAttributeName,
- String attributeExpressionString,
- ValueExpression attributeNameValueExpression,
- boolean ccAttrMeRedirection)
- {
- ValueChangeListener o = (ValueChangeListener) mctx.removeMethodExpressionTargeted(
- innerComponent, targetAttributeName);
- if (o != null)
- {
- ((EditableValueHolder) innerComponent).removeValueChangeListener(o);
- }
-
- // target is EditableValueHolder
- ValueChangeListener valueChangeListener = null;
- // If it is a redirection, a wrapper is used to locate the right instance and call it properly.
- if (ccAttrMeRedirection)
- {
- valueChangeListener = new RedirectMethodExpressionValueExpressionValueChangeListener(
- attributeNameValueExpression);
- }
- else
- {
- MethodExpression methodExpression = reWrapMethodExpression(context.getApplication().getExpressionFactory().
- createMethodExpression(elContext,
- attributeExpressionString, Void.TYPE,
- VALUE_CHANGE_LISTENER_SIGNATURE), attributeNameValueExpression);
-
- MethodExpression methodExpression2 = reWrapMethodExpression(context.getApplication().getExpressionFactory().
- createMethodExpression(elContext,
- attributeExpressionString, Void.TYPE,
- EMPTY_CLASS_ARRAY), attributeNameValueExpression);
-
- if (mctx.isUsingPSSOnThisView())
- {
- valueChangeListener = new PartialMethodExpressionValueChangeListener(methodExpression,
- methodExpression2);
- }
- else
- {
- valueChangeListener = new MethodExpressionValueChangeListener(methodExpression, methodExpression2);
- }
- }
- ((EditableValueHolder) innerComponent).addValueChangeListener(valueChangeListener);
- mctx.addMethodExpressionTargeted(innerComponent, targetAttributeName, valueChangeListener);
- }
-
- private void applyMethodExpression(FacesContext context, FaceletCompositionContext mctx,
- UIComponent topLevelComponent,
- String attributeName,
- String targetAttributeName,
- ValueExpression attributeNameValueExpression,
- MethodExpression methodExpression,
- boolean ccAttrMeRedirection,
- String[] targetsArray)
- {
- UIComponent topLevelComponentBase = topLevelComponent.getFacet(UIComponent.COMPOSITE_FACET_NAME);
-
- for (String target : targetsArray)
- {
- UIComponent innerComponent = ComponentSupport.findComponentChildOrFacetFrom(context,
- topLevelComponentBase, target);
- if (innerComponent == null)
- {
- continue;
- }
-
- // If a component is found, that means the expression should be retarget to the
- // components related
- if (isCompositeComponentRetarget(context, innerComponent, targetAttributeName))
- {
- innerComponent.getAttributes().put(targetAttributeName, attributeNameValueExpression);
-
- mctx.clearMethodExpressionAttribute(innerComponent, targetAttributeName);
-
- retargetMethodExpressions(context, innerComponent);
-
- if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
- {
- //retargetMethodExpression occur on build view time, so it is safe to call markInitiaState here
- innerComponent.markInitialState();
- }
- }
- else
- {
- //Put the retarget
- if (ccAttrMeRedirection)
- {
- // Since we require here a method expression, it is necessary to wrap
- // the ValueExpression into a MethodExpression that handles redirection.
- innerComponent.getAttributes().put(targetAttributeName,
- new ValueExpressionMethodExpression(attributeNameValueExpression));
- }
- else
- {
- innerComponent.getAttributes().put(targetAttributeName, methodExpression);
- }
- if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
- {
- innerComponent.markInitialState();
- }
- }
- }
- //Store the method expression to the topLevelComponent to allow reference it through EL
- if (!ccAttrMeRedirection)
- {
- //Replace it with a method expression
- topLevelComponent.getAttributes().put(attributeName, methodExpression);
- }
- // Othewise keep the current ValueExpression, because it will be used chain other value
- // expressions
- }
-
-
- private boolean isCompositeComponentRetarget(FacesContext context, UIComponent component, String attributeName)
- {
- if (UIComponent.isCompositeComponent(component))
- {
- BeanInfo compositeComponentMetadata = (BeanInfo) component.getAttributes().get(UIComponent.BEANINFO_KEY);
-
- PropertyDescriptor[] propertyDescriptors = compositeComponentMetadata.getPropertyDescriptors();
-
- ELContext elContext = (ELContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
-
- for (PropertyDescriptor propertyDescriptor : propertyDescriptors)
- {
- if (propertyDescriptor.getValue("type") != null)
- {
- // This check is necessary if we have both "type" and "method-signature" set.
- // In that case, "method-signature" is ignored
- continue;
- }
-
- if (attributeName.equals(propertyDescriptor.getName()))
- {
- // <composite:attribute> method-signature attribute is
- // ValueExpression that must evaluate to String
- ValueExpression methodSignatureExpression
- = (ValueExpression) propertyDescriptor.getValue("method-signature");
- String methodSignature = null;
- if (methodSignatureExpression != null)
- {
- // Check if the value expression holds a method signature
- // Note that it could be null, so in that case we don't have to do anything
- methodSignature = (String) methodSignatureExpression.getValue(elContext);
- }
-
- String targetAttributeName = null;
- ValueExpression targetAttributeNameVE = (ValueExpression)
- propertyDescriptor.getValue("targetAttributeName");
- if (targetAttributeNameVE != null)
- {
- targetAttributeName = (String) targetAttributeNameVE.getValue(context.getELContext());
- if (targetAttributeName == null)
- {
- targetAttributeName = attributeName;
- }
- }
- else
- {
- targetAttributeName = attributeName;
- }
-
- boolean isKnownTargetAttributeMethod = "action".equals(targetAttributeName)
- || "actionListener".equals(targetAttributeName)
- || "validator".equals(targetAttributeName)
- || "valueChangeListener".equals(targetAttributeName);
-
- // either the attributeName has to be a knownMethod or there has to be a method-signature
- if (isKnownTargetAttributeMethod || methodSignature != null)
- {
- if ("action".equals(targetAttributeName))
- {
- return !(component instanceof ActionSource2);
- }
- else if ("actionListener".equals(targetAttributeName))
- {
- return !(component instanceof ActionSource2);
- }
- else if ("validator".equals(targetAttributeName))
- {
- return !(component instanceof EditableValueHolder);
- }
- else if ("valueChangeListener".equals(targetAttributeName))
- {
- return !(component instanceof EditableValueHolder);
- }
- else
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- else
- {
- return false;
- }
- }
-
- @SuppressWarnings("unchecked")
- private MethodExpression reWrapMethodExpression(MethodExpression createdMethodExpression,
- ValueExpression originalValueExpression)
- {
- if (originalValueExpression instanceof LocationValueExpression)
- {
- return new LocationMethodExpression(
- ((LocationValueExpression) originalValueExpression).getLocation(),
- reWrapMethodExpression(createdMethodExpression,
- ((LocationValueExpression) originalValueExpression).getWrapped()),
- ((LocationValueExpression) originalValueExpression).getCCLevel());
- }
- else if (originalValueExpression instanceof FacesWrapper &&
- ((FacesWrapper) originalValueExpression).getWrapped() instanceof ValueExpression)
- {
- return reWrapMethodExpression(createdMethodExpression,
- (ValueExpression) ((FacesWrapper) originalValueExpression).getWrapped());
- }
- else
- {
- return createdMethodExpression;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Resource getScriptComponentResource(FacesContext context, Resource componentResource)
- {
- Assert.notNull(context, "context");
- Assert.notNull(componentResource, "componentResource");
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public StateManagementStrategy getStateManagementStrategy(FacesContext context, String viewId)
- {
- if (config.isPartialStateSaving() || _usePartialStateSavingOnThisView(viewId))
- {
- return partialSMS;
- }
-
- return fullSMS;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ViewMetadata getViewMetadata(FacesContext context, String viewId)
- {
- Assert.notNull(context, "facesContext");
- Assert.notNull(viewId, "viewId");
- return new FaceletViewMetadata(viewId);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void renderView(FacesContext context, UIViewRoot view) throws IOException
- {
- if (!view.isRendered())
- {
- return;
- }
-
- // log request
- if (log.isLoggable(Level.FINE))
- {
- log.fine("Rendering View: " + view.getViewId());
- }
-
- try
- {
- // build view - but not if we're in "buildBeforeRestore"
- // land and we've already got a populated view. Note
- // that this optimizations breaks if there's a "c:if" in
- // the page that toggles as a result of request processing -
- // should that be handled? Or
- // is this optimization simply so minor that it should just
- // be trimmed altogether?
- // See JSF 2.0 spec section 2.2.6, buildView is called before
- // Render Response
- //if (!isFilledView(context, view))
- //{
- // buildView(context, view);
- //}
-
- // setup writer and assign it to the context
- ResponseWriter origWriter = createResponseWriter(context);
-
- ExternalContext extContext = context.getExternalContext();
- Writer outputWriter = extContext.getResponseOutputWriter();
-
- StateWriter stateWriter = new StateWriter(outputWriter, 1024, context);
- try
- {
- ResponseWriter writer = origWriter.cloneWithWriter(stateWriter);
- try
- {
- context.setResponseWriter(writer);
-
- StateManager stateMgr = context.getApplication().getStateManager();
- StateManagementStrategy sms = getStateManagementStrategy(context, view.getId());
-
- // force creation of session if saving state there
- // -= Leonardo Uribe =- Do this does not have any sense!. The only reference
- // about these lines are on http://java.net/projects/facelets/sources/svn/revision/376
- // and it says: "fixed lazy session instantiation with eager response commit"
- // This code is obviously to prevent this exception:
- // java.lang.IllegalStateException: Cannot create a session after the response has been committed
- // But in theory if that so, StateManager.saveState must happen before writer.close() is called,
- // which can be done very easily.
- //if (!stateMgr.isSavingStateInClient(context))
- //{
- // extContext.getSession(true);
- //}
-
- // render the view to the response
- writer.startDocument();
-
- view.encodeAll(context);
-
- writer.endDocument();
-
- // finish writing
- // -= Leonardo Uribe =- This does not has sense too, because that's the reason
- // of the try/finally block. In practice, it only forces the close of the tag
- // in HtmlResponseWriter if necessary, but according to the spec, this should
- // be done using writer.flush() instead.
- // writer.close();
-
- // flush to origWriter
- if (stateWriter.isStateWritten())
- {
- // Call this method to force close the tag if necessary.
- // The spec javadoc says this:
- // "... Flush any ouput buffered by the output method to the underlying
- // Writer or OutputStream. This method will not flush the underlying
- // Writer or OutputStream; it simply clears any values buffered by this
- // ResponseWriter. ..."
- writer.flush();
-
- // =-= markoc: STATE_KEY is in output ONLY if
- // stateManager.isSavingStateInClient(context)is true - see
- // org.apache.myfaces.application.ViewHandlerImpl.writeState(FacesContext)
- // TODO this class and ViewHandlerImpl contain same constant <!-...@-->
- Object stateObj = sms.saveView(context);
- String content = stateWriter.getAndResetBuffer();
- int end = content.indexOf(STATE_KEY);
- // See if we can find any trace of the saved state.
- // If so, we need to perform token replacement
- if (end >= 0)
- {
- // save state
- int start = 0;
-
- while (end != -1)
- {
- origWriter.write(content, start, end - start);
-
- String stateStr;
- if (view.isTransient())
- {
- // Force state saving
- stateMgr.writeState(context, stateObj);
- stateStr = stateWriter.getAndResetBuffer();
- }
- else if (stateObj == null)
- {
- stateStr = null;
- }
- else
- {
- stateMgr.writeState(context, stateObj);
- stateStr = stateWriter.getAndResetBuffer();
- }
-
- if (stateStr != null)
- {
- origWriter.write(stateStr);
- }
- start = end + STATE_KEY_LEN;
- end = content.indexOf(STATE_KEY, start);
- }
-
- origWriter.write(content, start, content.length() - start);
- // No trace of any saved state, so we just need to flush the buffer
- }
- else
- {
- origWriter.write(content);
- }
- }
- else if (stateWriter.isStateWrittenWithoutWrapper())
- {
- // The state token has been written but the state has not been
- // saved yet.
- sms.saveView(context);
- }
- else
- {
- // GET case without any form that trigger state saving.
- // Try to store it into cache.
- if (viewPoolProcessor != null &&
- viewPoolProcessor.isViewPoolEnabledForThisView(context, view))
- {
- ViewDeclarationLanguage vdl = context.getApplication().getViewHandler()
- .getViewDeclarationLanguage(context, view.getViewId());
-
- if (ViewDeclarationLanguage.FACELETS_VIEW_DECLARATION_LANGUAGE_ID.equals(vdl.getId()))
- {
- if (sms != null)
- {
- context.getAttributes().put(ViewPoolProcessor.FORCE_HARD_RESET, Boolean.TRUE);
-
- // Force indirectly to store the map in the cache
- try
- {
- Object state = sms.saveView(context);
- }
- finally
- {
- context.getAttributes().remove(ViewPoolProcessor.FORCE_HARD_RESET);
- }
-
- // Clear the calculated value from the application map
- context.getAttributes().remove(SERIALIZED_VIEW_REQUEST_ATTR);
- }
- }
- }
- }
- }
- finally
- {
- // The Facelets implementation must close the writer used to write the response
- writer.close();
- }
- }
- finally
- {
- stateWriter.release(context);
- }
- }
- catch (FileNotFoundException e)
- {
- handleFaceletNotFound(context, view.getViewId());
- }
- catch (Exception e)
- {
- handleRenderException(context, e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public UIViewRoot createView(FacesContext context, String viewId)
- {
- Assert.notNull(viewId, "viewId");
- // we have to check for a possible debug request
- if (UIDebug.debugRequest(context))
- {
- // the current request is a debug request, so we don't need
- // to create a view, since the output has already been written
- // in UIDebug.debugRequest() and facesContext.responseComplete()
- // has been called.
- return null;
- }
- else
- {
- UIViewRoot root = super.createView(context, viewId);
- if (root != null)
- {
- //Ensure calculateResourceLibraryContracts() can be decorated
- ViewDeclarationLanguage vdl = context.getApplication().getViewHandler()
- .getViewDeclarationLanguage(context, viewId);
- List<String> contracts = vdl.calculateResourceLibraryContracts(
- context, root.getViewId() != null ? root.getViewId() : viewId);
- context.setResourceLibraryContracts(contracts);
- }
- return root;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public UIViewRoot restoreView(FacesContext context, String viewId)
- {
- Assert.notNull(viewId, "viewId");
- // Currently there is no way, in which UIDebug.debugRequest(context)
- // can create debug information and return true at this point,
- // because this method is only accessed if the current request
- // is a postback, which will never be true for a debug page.
- // The only point where valid debug output can be produced by now
- // is in createView() -= Jakob Korherr =-
-
- Application application = context.getApplication();
- ViewHandler viewHandler = application.getViewHandler();
-
- // When partial state saving is not used, createView() is not called. To ensure
- // everything is in place it is necessary to calculate the resource library
- // contracts and set them into facesContext.
- ViewDeclarationLanguage vdl = viewHandler.getViewDeclarationLanguage(context, viewId);
- List<String> contracts = vdl.calculateResourceLibraryContracts(context, viewId);
- context.setResourceLibraryContracts(contracts);
-
- // JSF 2.2 stateless views
- // We need to check if the incoming view is stateless or not and if that so rebuild it here
- // note we cannot do this in PartialStateManagementStrategy because it is only used
- // when PSS is enabled, but stateless views can be used without PSS. If the view is stateless,
- // there is no need to ask to the StateManager.
- String renderKitId = viewHandler.calculateRenderKitId(context);
-
- ResponseStateManager manager = getRenderKitFactory().getRenderKit(context, renderKitId)
- .getResponseStateManager();
-
- if (manager.isStateless(context, viewId))
- {
- // Per the spec: build the view.
- UIViewRoot view = null;
- try
- {
- ViewMetadata metadata = vdl.getViewMetadata(context, viewId);
- if (metadata != null)
- {
- view = metadata.createMetadataView(context);
- }
- if (view == null)
- {
- view = viewHandler.createView(context, viewId);
- }
- context.setViewRoot (view);
- boolean oldContextEventState = context.isProcessingEvents();
- try
- {
- context.setProcessingEvents (true);
- vdl.buildView (context, view);
-
- // If the view is not transient, then something is wrong. Throw an exception.
- if (!view.isTransient())
- {
- throw new FacesException("unable to create view \"" + viewId + "\"");
- }
- }
- finally
- {
- context.setProcessingEvents(oldContextEventState);
- }
- }
- catch (Throwable e)
- {
- throw new FacesException("unable to create view \"" + viewId + '"', e);
- }
- FaceletsViewDeclarationLanguageUtils.markRenderedResources(context, view);
- return view;
- }
- else
- {
- UIViewRoot root = super.restoreView(context, viewId);
- FaceletsViewDeclarationLanguageUtils.markRenderedResources(context, root);
- return root;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String calculateViewId(FacesContext context, String viewId)
- {
- return viewIdSupport.deriveLogicalViewId(context, viewId);
- }
-
- /**
- * Creates the Facelet page compiler.
- *
- * @param context
- * the current FacesContext
- *
- * @return the application's Facelet page compiler
- */
- protected Compiler createCompiler(FacesContext context)
- {
- Compiler compiler = new SAXCompiler();
-
- compiler.setDevelopmentProjectStage(context.isProjectStage(ProjectStage.Development));
-
- loadLibraries(context, compiler);
- loadDecorators(context, compiler);
- loadOptions(context, compiler);
-
- return compiler;
- }
-
- /**
- * Creates a FaceletFactory instance using the specified compiler.
- *
- * @param context
- * the current FacesContext
- * @param compiler
- * the compiler to be used by the factory
- *
- * @return the factory used by this VDL to load pages
- */
- protected FaceletFactory createFaceletFactory(FacesContext context, Compiler compiler)
- {
- ExternalContext eContext = context.getExternalContext();
-
- // refresh period
... 7902 lines suppressed ...