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 2020/10/30 19:02:40 UTC
[myfaces] branch master updated: Jakarta Faces 4.0 - Removed JSP
support; Part2 ViewHandler + other stuff
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 d667662 Jakarta Faces 4.0 - Removed JSP support; Part2 ViewHandler + other stuff
d667662 is described below
commit d667662b90bcc24c9bbc1b6b9e93ab6bcd4539ab
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Fri Oct 30 20:02:33 2020 +0100
Jakarta Faces 4.0 - Removed JSP support; Part2 ViewHandler + other stuff
---
api/pom.xml | 43 --
.../jakarta/faces/application/Application.java | 10 +-
.../jakarta/faces/application/ViewHandler.java | 6 +-
.../java/jakarta/faces/component/UICommand.java | 2 +-
.../java/jakarta/faces/component/UIViewAction.java | 2 +-
.../java/jakarta/faces/component/UIViewRoot.java | 6 +-
.../jakarta/faces/component/_UISelectItem.java | 2 +-
.../java/jakarta/faces/model/ResultDataModel.java | 1 -
.../faces/view/ViewDeclarationLanguage.java | 5 -
.../quarkus/deployment/MyFacesProcessor.java | 16 +-
.../quarkus/runtime/QuarkusFacesInitilializer.java | 4 +-
.../runtime/spi/QuarkusELResolverBuilder.java | 4 +-
impl/pom.xml | 4 -
.../myfaces/application/ApplicationImpl.java | 19 +-
.../myfaces/application/ViewHandlerImpl.java | 10 +-
.../org/apache/myfaces/config/MyfacesConfig.java | 39 +-
.../myfaces/config/element/FaceletsProcessing.java | 1 -
...ForFaces.java => DefaultELResolverBuilder.java} | 13 +-
.../org/apache/myfaces/el/ELResolverBuilder.java | 18 +-
.../apache/myfaces/el/ELResolverBuilderForJSP.java | 89 ----
.../myfaces/el/ResolverForJSPInitializer.java | 86 ----
.../el/resolver/FacesCompositeELResolver.java | 275 -------------
.../implicitobject/ImplicitObjectResolver.java | 23 +-
.../apache/myfaces/renderkit/ErrorPageWriter.java | 2 +-
.../view/ViewDeclarationLanguageFactoryImpl.java | 52 +--
.../compiler/FaceletsProcessingInstructions.java | 17 -
.../myfaces/view/jsp/FaceletsOnlyException.java | 44 --
.../view/jsp/JspViewDeclarationLanguage.java | 291 -------------
.../view/jsp/JspViewDeclarationLanguageBase.java | 457 ---------------------
.../jsp/JspViewDeclarationLanguageStrategy.java | 95 -----
...ializer.java => DefaultFacesInitilializer.java} | 4 +-
.../myfaces/webapp/FacesInitializerFactory.java | 28 +-
.../apache/myfaces/webapp/JspFacesInitializer.java | 144 -------
.../myfaces/application/ViewIdSupportTest.java | 11 +-
.../compiler/JSPXFaceletsProcessingTestCase.java | 121 ------
.../view/jsp/JspViewDeclarationLanguageTest.java | 169 --------
.../myfaces/webapp/JspFacesInitializerTest.java | 103 -----
parent/pom.xml | 6 -
test/pom.xml | 4 -
39 files changed, 53 insertions(+), 2173 deletions(-)
diff --git a/api/pom.xml b/api/pom.xml
index 963e5e6..6d65938 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -337,10 +337,6 @@
javax.validation*;version="[1.0.0, 2.0.0)",
javax.servlet;version="[3, 5)",
javax.servlet.http;version="[3, 5)",
- javax.servlet.jsp;version="[2.1.0, 3.1)",
- javax.servlet.jsp.jstl.core;version="[1.1.2, 2.0.0)",
- javax.servlet.jsp.jstl.sql;version="[1.1.2, 2.0.0)",
- javax.servlet.jsp.tagext;version="[2.1.0, 3.2)",
jakarta.faces.*;version="${project.version}"
</Import-Package>
<Require-Bundle>
@@ -356,31 +352,6 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
-
- <!-- generate jandex file for Quarkus but skip classes which depends on JSP dependency -->
- <plugin>
- <groupId>org.jboss.jandex</groupId>
- <artifactId>jandex-maven-plugin</artifactId>
- <version>1.0.6</version>
- <executions>
- <execution>
- <id>make-index</id>
- <goals>
- <goal>jandex</goal>
- </goals>
- <configuration>
- <fileSets>
- <fileSet>
- <directory>${project.build.outputDirectory}</directory>
- <excludes>
- </excludes>
- </fileSet>
- </fileSets>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
</plugins>
</build>
@@ -402,16 +373,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
- <tags>
- <tag>
- <name>JSFJspTag</name>
- <placement>X</placement>
- </tag>
- <tag>
- <name>JSFJspAttribute</name>
- <placement>X</placement>
- </tag>
- </tags>
</configuration>
<executions>
<execution>
@@ -525,10 +486,6 @@
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-jsp-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-websocket-api</artifactId>
</dependency>
<dependency>
diff --git a/api/src/main/java/jakarta/faces/application/Application.java b/api/src/main/java/jakarta/faces/application/Application.java
index 4802f4c..5239a95 100755
--- a/api/src/main/java/jakarta/faces/application/Application.java
+++ b/api/src/main/java/jakarta/faces/application/Application.java
@@ -233,8 +233,7 @@ public abstract class Application
*
* <p>
* It is illegal to register an ELResolver after the application has received any requests from the client. If an
- * attempt is made to register a listener after that time, an IllegalStateException must be thrown. This restriction
- * is in place to allow the JSP container to optimize for the common case where no additional
+ * attempt is made to register a listener after that time, an IllegalStateException must be thrown.
* <code>ELResolvers</code> are in the chain, aside from the standard ones. It is permissible to add
* <code>ELResolvers</code> before or after initialization to a CompositeELResolver that is already in the chain.
* <p>
@@ -670,12 +669,7 @@ public abstract class Application
* <code>{@link #evaluateExpressionGet(jakarta.faces.context.FacesContext, java.lang.String, java.lang.Class)}.
* </code>
* </p>
- *
- * <p>
- * The implementation must return the <code>ExpressionFactory</code> from the JSP container by calling <code>
- * JspFactory.getDefaultFactory().getJspApplicationContext(servletContext).getExpressionFactory()</code>.
- * </p>
- *
+ *
* <p>
* An implementation is provided that throws <code>UnsupportedOperationException</code> so that users that decorate
* the <code>Application</code> continue to work.
diff --git a/api/src/main/java/jakarta/faces/application/ViewHandler.java b/api/src/main/java/jakarta/faces/application/ViewHandler.java
index babee25..ee3c6a1 100755
--- a/api/src/main/java/jakarta/faces/application/ViewHandler.java
+++ b/api/src/main/java/jakarta/faces/application/ViewHandler.java
@@ -54,8 +54,6 @@ import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConf
* <p>
* Examples:
* <ul>
- * <li>A JSP ViewHandler exists for using "jsp" pages as the presentation technology. This class then works together
- * with a taghandler class and a jsp servlet class to implement the methods on this abstract class definition.
* <li>A Facelets ViewHandler instead uses an xml file to define the components and non-component data that make up a
* specific view.
* </ul>
@@ -71,13 +69,13 @@ public abstract class ViewHandler
{
public static final String CHARACTER_ENCODING_KEY = "jakarta.faces.request.charset";
public static final String DEFAULT_FACELETS_SUFFIX = ".xhtml";
- public static final String DEFAULT_SUFFIX = ".xhtml .view.xml .jsp";
+ public static final String DEFAULT_SUFFIX = ".xhtml";
/**
* Indicate the default suffixes, separated by spaces to derive the default file URI
* used by JSF to create views and render pages.
*/
- @JSFWebConfigParam(defaultValue=".xhtml .view.xml .jsp", since="1.1", group="viewhandler")
+ @JSFWebConfigParam(defaultValue=".xhtml", since="1.1", group="viewhandler")
public static final String DEFAULT_SUFFIX_PARAM_NAME = "jakarta.faces.DEFAULT_SUFFIX";
/**
diff --git a/api/src/main/java/jakarta/faces/component/UICommand.java b/api/src/main/java/jakarta/faces/component/UICommand.java
index 58e0297..861b460 100644
--- a/api/src/main/java/jakarta/faces/component/UICommand.java
+++ b/api/src/main/java/jakarta/faces/component/UICommand.java
@@ -137,7 +137,7 @@ public class UICommand extends UIComponentBase implements ActionSource2
* is functionally equivalent to a reference to an action method that returns the string literal.
* </p>
*/
- @JSFProperty(stateHolder=true, returnSignature = "java.lang.Object", jspName = "action", clientEvent="action")
+ @JSFProperty(stateHolder=true, returnSignature = "java.lang.Object", clientEvent="action")
@Override
public MethodExpression getActionExpression()
{
diff --git a/api/src/main/java/jakarta/faces/component/UIViewAction.java b/api/src/main/java/jakarta/faces/component/UIViewAction.java
index 4572ae0..f51fbdf 100644
--- a/api/src/main/java/jakarta/faces/component/UIViewAction.java
+++ b/api/src/main/java/jakarta/faces/component/UIViewAction.java
@@ -212,7 +212,7 @@ public class UIViewAction extends UIComponentBase implements ActionSource2
getStateHelper().put(PropertyKeys.immediate, immediate );
}
- @JSFProperty(stateHolder=true, returnSignature = "java.lang.Object", jspName = "action", clientEvent="action")
+ @JSFProperty(stateHolder=true, returnSignature = "java.lang.Object", clientEvent="action")
@Override
public MethodExpression getActionExpression()
{
diff --git a/api/src/main/java/jakarta/faces/component/UIViewRoot.java b/api/src/main/java/jakarta/faces/component/UIViewRoot.java
index ad5c383..576d67c 100644
--- a/api/src/main/java/jakarta/faces/component/UIViewRoot.java
+++ b/api/src/main/java/jakarta/faces/component/UIViewRoot.java
@@ -647,8 +647,7 @@ public class UIViewRoot extends UIComponentBase implements UniqueIdVendor
*
* @return the new afterPhaseListener value
*/
- @JSFProperty(returnSignature = "void", methodSignature = "jakarta.faces.event.PhaseEvent",
- jspName = "afterPhase", stateHolder=true)
+ @JSFProperty(returnSignature = "void", methodSignature = "jakarta.faces.event.PhaseEvent", stateHolder=true)
public MethodExpression getAfterPhaseListener()
{
return (MethodExpression) getStateHelper().eval(PropertyKeys.afterPhaseListener);
@@ -660,8 +659,7 @@ public class UIViewRoot extends UIComponentBase implements UniqueIdVendor
*
* @return the new beforePhaseListener value
*/
- @JSFProperty(returnSignature = "void", methodSignature = "jakarta.faces.event.PhaseEvent",
- jspName = "beforePhase", stateHolder=true)
+ @JSFProperty(returnSignature = "void", methodSignature = "jakarta.faces.event.PhaseEvent", stateHolder=true)
public MethodExpression getBeforePhaseListener()
{
return (MethodExpression) getStateHelper().eval(PropertyKeys.beforePhaseListener);
diff --git a/api/src/main/java/jakarta/faces/component/_UISelectItem.java b/api/src/main/java/jakarta/faces/component/_UISelectItem.java
index ed4a3b7..58fe8e3 100644
--- a/api/src/main/java/jakarta/faces/component/_UISelectItem.java
+++ b/api/src/main/java/jakarta/faces/component/_UISelectItem.java
@@ -98,7 +98,7 @@ abstract class _UISelectItem extends UIComponentBase
*
* @return the new itemEscaped value
*/
- @JSFProperty(defaultValue = "true", jspName = "escape", deferredValueType="java.lang.String")
+ @JSFProperty(defaultValue = "true", deferredValueType="java.lang.String")
public abstract boolean isItemEscaped();
/**
diff --git a/api/src/main/java/jakarta/faces/model/ResultDataModel.java b/api/src/main/java/jakarta/faces/model/ResultDataModel.java
index c643c13..d297bd2 100755
--- a/api/src/main/java/jakarta/faces/model/ResultDataModel.java
+++ b/api/src/main/java/jakarta/faces/model/ResultDataModel.java
@@ -22,7 +22,6 @@ import java.util.SortedMap;
import jakarta.servlet.jsp.jstl.sql.Result;
-//import jakarta.servlet.jsp.
/**
* see Javadoc of <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a>
*/
diff --git a/api/src/main/java/jakarta/faces/view/ViewDeclarationLanguage.java b/api/src/main/java/jakarta/faces/view/ViewDeclarationLanguage.java
index 5dfa6c5..214efde 100644
--- a/api/src/main/java/jakarta/faces/view/ViewDeclarationLanguage.java
+++ b/api/src/main/java/jakarta/faces/view/ViewDeclarationLanguage.java
@@ -42,11 +42,6 @@ public abstract class ViewDeclarationLanguage
/**
* @since 2.1
*/
- public static final String JSP_VIEW_DECLARATION_LANGUAGE_ID = "java.faces.JSP";
-
- /**
- * @since 2.1
- */
public static final String FACELETS_VIEW_DECLARATION_LANGUAGE_ID = "java.faces.Facelets";
public abstract void buildView(FacesContext context, UIViewRoot view) throws IOException;
diff --git a/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/MyFacesProcessor.java b/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/MyFacesProcessor.java
index f599d1f..eb85df8 100644
--- a/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/MyFacesProcessor.java
+++ b/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/MyFacesProcessor.java
@@ -127,7 +127,7 @@ import org.apache.myfaces.cdi.util.BeanEntry;
import org.apache.myfaces.config.FacesConfigurator;
import org.apache.myfaces.core.api.shared.lang.PropertyDescriptorUtils;
import org.apache.myfaces.core.extensions.quarkus.runtime.spi.QuarkusFactoryFinderProvider;
-import org.apache.myfaces.el.ELResolverBuilderForFaces;
+import org.apache.myfaces.el.DefaultELResolverBuilder;
import org.apache.myfaces.renderkit.ErrorPageWriter;
import org.apache.myfaces.spi.FactoryFinderProviderFactory;
import org.apache.myfaces.spi.impl.DefaultWebConfigProviderFactory;
@@ -139,7 +139,7 @@ import org.apache.myfaces.view.facelets.compiler.TagLibraryConfig;
import org.apache.myfaces.view.facelets.tag.MethodRule;
import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport;
import org.apache.myfaces.webapp.AbstractFacesInitializer;
-import org.apache.myfaces.webapp.FaceletsInitilializer;
+import org.apache.myfaces.webapp.DefaultFacesInitilializer;
import org.apache.myfaces.webapp.MyFacesContainerInitializer;
import org.jboss.jandex.AnnotationTarget;
import org.jboss.jandex.ClassInfo;
@@ -283,8 +283,6 @@ class MyFacesProcessor
MyfacesConfig.INJECTION_PROVIDER, QuarkusInjectionProvider.class.getName()));
initParam.produce(new ServletInitParamBuildItem(
MyfacesConfig.FACES_INITIALIZER, QuarkusFacesInitilializer.class.getName()));
- initParam.produce(new ServletInitParamBuildItem(
- MyfacesConfig.SUPPORT_JSP, "false"));
}
@BuildStep
@@ -449,14 +447,13 @@ class MyFacesProcessor
"jakarta.faces.component._DeltaStateHelper",
"jakarta.faces.component._DeltaStateHelper$InternalMap"));
- classes.addAll(Arrays.asList(
- ApplicationImplEventManager.class,
+ classes.addAll(Arrays.asList(ApplicationImplEventManager.class,
DefaultWebConfigProviderFactory.class,
ErrorPageWriter.class,
MyFacesContainerInitializer.class,
ExceptionQueuedEventContext.class,
FacesConfigurator.class,
- FaceletsInitilializer.class,
+ DefaultFacesInitilializer.class,
TagLibraryConfig.class,
String.class,
ViewScopeProxyMap.class,
@@ -493,12 +490,11 @@ class MyFacesProcessor
classNames.addAll(collectImplementors(combinedIndex, Validator.class.getName()));
classNames.addAll(collectImplementors(combinedIndex, Behavior.class.getName()));
- classes.addAll(Arrays.asList(
- ClassUtils.class,
+ classes.addAll(Arrays.asList(ClassUtils.class,
FactoryFinderProviderFactory.class,
ComponentSupport.class,
QuarkusFactoryFinderProvider.class,
- ELResolverBuilderForFaces.class,
+ DefaultELResolverBuilder.class,
AbstractFacesInitializer.class,
ExternalContextUtils.class,
BeanEntry.class));
diff --git a/extensions/quarkus/runtime/src/main/java/org/apache/myfaces/core/extensions/quarkus/runtime/QuarkusFacesInitilializer.java b/extensions/quarkus/runtime/src/main/java/org/apache/myfaces/core/extensions/quarkus/runtime/QuarkusFacesInitilializer.java
index a28fb78..a4e3481 100644
--- a/extensions/quarkus/runtime/src/main/java/org/apache/myfaces/core/extensions/quarkus/runtime/QuarkusFacesInitilializer.java
+++ b/extensions/quarkus/runtime/src/main/java/org/apache/myfaces/core/extensions/quarkus/runtime/QuarkusFacesInitilializer.java
@@ -28,7 +28,7 @@ import javax.servlet.ServletContext;
import org.apache.myfaces.cdi.config.FacesConfigBeanHolder;
import org.apache.myfaces.cdi.model.FacesDataModelManager;
import org.apache.myfaces.spi.FactoryFinderProviderFactory;
-import org.apache.myfaces.webapp.FaceletsInitilializer;
+import org.apache.myfaces.webapp.DefaultFacesInitilializer;
import org.apache.myfaces.core.extensions.quarkus.runtime.spi.QuarkusFactoryFinderProviderFactory;
@@ -36,7 +36,7 @@ import org.apache.myfaces.core.extensions.quarkus.runtime.spi.QuarkusFactoryFind
* Custom FacesInitializer to execute our integration code, always before MyFaces starts.
* With ServletListeners or other ways, we would have order/priority problems.
*/
-public class QuarkusFacesInitilializer extends FaceletsInitilializer
+public class QuarkusFacesInitilializer extends DefaultFacesInitilializer
{
@Override
diff --git a/extensions/quarkus/runtime/src/main/java/org/apache/myfaces/core/extensions/quarkus/runtime/spi/QuarkusELResolverBuilder.java b/extensions/quarkus/runtime/src/main/java/org/apache/myfaces/core/extensions/quarkus/runtime/spi/QuarkusELResolverBuilder.java
index b974e92..79f5cc3 100644
--- a/extensions/quarkus/runtime/src/main/java/org/apache/myfaces/core/extensions/quarkus/runtime/spi/QuarkusELResolverBuilder.java
+++ b/extensions/quarkus/runtime/src/main/java/org/apache/myfaces/core/extensions/quarkus/runtime/spi/QuarkusELResolverBuilder.java
@@ -22,14 +22,14 @@ import javax.el.ELResolver;
import org.apache.myfaces.config.MyfacesConfig;
import org.apache.myfaces.config.RuntimeConfig;
-import org.apache.myfaces.el.ELResolverBuilderForFaces;
+import org.apache.myfaces.el.DefaultELResolverBuilder;
/**
* Custom {@link org.apache.myfaces.el.ELResolverBuilder} which only works with EL3.x+
* and replaces the {@link javax.enterprise.inject.spi.BeanManager#getELResolver()}
* with our own {@link QuarkusCdiELResolver}
*/
-public class QuarkusELResolverBuilder extends ELResolverBuilderForFaces
+public class QuarkusELResolverBuilder extends DefaultELResolverBuilder
{
public QuarkusELResolverBuilder(RuntimeConfig runtimeConfig, MyfacesConfig myfacesConfig)
diff --git a/impl/pom.xml b/impl/pom.xml
index df003eb..fe96853 100644
--- a/impl/pom.xml
+++ b/impl/pom.xml
@@ -994,10 +994,6 @@
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-jsp-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-websocket-api</artifactId>
</dependency>
<dependency>
diff --git a/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java b/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
index b3ead4b..7e3de82 100755
--- a/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
@@ -111,9 +111,7 @@ import org.apache.myfaces.config.element.Property;
import org.apache.myfaces.config.element.ResourceBundle;
import org.apache.myfaces.context.RequestViewContext;
import org.apache.myfaces.context.RequestViewMetadata;
-import org.apache.myfaces.el.ELResolverBuilderForFaces;
-import org.apache.myfaces.el.resolver.FacesCompositeELResolver;
-import org.apache.myfaces.el.resolver.FacesCompositeELResolver.Scope;
+import org.apache.myfaces.el.DefaultELResolverBuilder;
import org.apache.myfaces.flow.FlowHandlerImpl;
import org.apache.myfaces.lifecycle.LifecycleImpl;
import org.apache.myfaces.config.MyfacesConfig;
@@ -272,18 +270,11 @@ public class ApplicationImpl extends Application
_dateTimeConverterDefaultTimeZoneIsSystemTimeZone = true;
}
- elResolver = new Lazy<>(() -> {
- CompositeELResolver celr;
- if (_myfacesConfig.isSupportJSP())
- {
- celr = new FacesCompositeELResolver(Scope.Faces);
- }
- else
- {
- celr = new CompositeELResolver();
- }
+ elResolver = new Lazy<>(() ->
+ {
+ CompositeELResolver celr = new CompositeELResolver();
- new ELResolverBuilderForFaces(_runtimeConfig, _myfacesConfig)
+ new DefaultELResolverBuilder(_runtimeConfig, _myfacesConfig)
.build(getFacesContext(), celr);
return celr;
diff --git a/impl/src/main/java/org/apache/myfaces/application/ViewHandlerImpl.java b/impl/src/main/java/org/apache/myfaces/application/ViewHandlerImpl.java
index 6612e2e..2f3e8c7 100644
--- a/impl/src/main/java/org/apache/myfaces/application/ViewHandlerImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/application/ViewHandlerImpl.java
@@ -428,13 +428,7 @@ public class ViewHandlerImpl extends ViewHandler
{
stateWriter.writingState();
}
-
-
}
- //else
- //{
- //we're in a JSP, let the JSPStatemanager know that we need to actually write the state
- //}
}
private Map<String, List<String>> getViewParameterList(FacesContext context,
@@ -456,10 +450,8 @@ public class ViewHandlerImpl extends ViewHandler
//ViewDeclarationLanguage vdl = getViewHandler(context).
// getViewDeclarationLanguage(context, calculatedViewId);
// -= Leonardo Uribe =- Temporally reverted by TCK issues.
- ViewDeclarationLanguage vdl = getViewDeclarationLanguage(context,calculatedViewId);
+ ViewDeclarationLanguage vdl = getViewDeclarationLanguage(context, calculatedViewId);
ViewMetadata viewMetadata = vdl.getViewMetadata(context, viewId);
-
- // getViewMetadata() returns null on JSP
if (viewMetadata != null)
{
UIViewRoot viewFromMetaData = viewMetadata.createMetadataView(context);
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 9f21917..8d5fbd7 100755
--- a/impl/src/main/java/org/apache/myfaces/config/MyfacesConfig.java
+++ b/impl/src/main/java/org/apache/myfaces/config/MyfacesConfig.java
@@ -231,17 +231,6 @@ public class MyfacesConfig
private static final int COMPONENT_UNIQUE_IDS_CACHE_SIZE_DEFAULT = 200;
/**
- * If set false, myfaces won't support JSP. JSP are deprecated in JSF 2.X. Default value is true.
- * If this property is set is false, all related logic for JSP is skipped.
- */
- @JSFWebConfigParam(since="2.0.13,2.1.7", expectedValues="true,false", defaultValue="true",
- desc="If set false, myfaces won't support JSP. JSP are deprecated in " +
- "JSF 2.X. Default value is true.",
- group="EL", tags="performance ")
- public final static String SUPPORT_JSP = "org.apache.myfaces.SUPPORT_JSP";
- private final static boolean SUPPORT_JSP_DEFAULT = true;
-
- /**
* 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.
*
@@ -619,10 +608,6 @@ public class MyfacesConfig
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;
-
- @JSFWebConfigParam(defaultValue=".jsp", since="2.3", group="viewhandler")
- public static final String JSP_SUFFIX = "org.apache.myfaces.JSP_SUFFIX";
- private static final String JSP_SUFFIX_DEFAULT = ".jsp";
/**
* Enforce f:validateBean to be called first before any JSF validator.
@@ -836,7 +821,6 @@ public class MyfacesConfig
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 supportJSP = SUPPORT_JSP_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;
@@ -876,7 +860,6 @@ public class MyfacesConfig
private boolean viewIdProtectedCacheEnabled = VIEWID_PROTECTED_CACHE_ENABLED_DEFAULT;
private boolean viewIdDeriveCacheEnabled = VIEWID_DERIVE_CACHE_ENABLED_DEFAULT;
private int viewIdCacheSize = VIEWID_CACHE_SIZE_DEFAULT;
- private String jspSuffix = JSP_SUFFIX_DEFAULT;
private boolean beanBeforeJsfValidation = BEAN_BEFORE_JSF_VALIDATION_DEFAULT;
private String facesInitPlugins;
private boolean initializeSkipJarFacesConfigScan = INITIALIZE_SKIP_JAR_FACES_CONFIG_SCAN_DEFAULT;
@@ -1038,13 +1021,6 @@ public class MyfacesConfig
cfg.componentUniqueIdsCacheSize = getInt(extCtx, COMPONENT_UNIQUE_IDS_CACHE_SIZE,
COMPONENT_UNIQUE_IDS_CACHE_SIZE_DEFAULT);
-
- cfg.supportJSP = getBoolean(extCtx, SUPPORT_JSP,
- SUPPORT_JSP_DEFAULT);
- if (cfg.supportJSP && ClassUtils.simpleClassForName("jakarta.servlet.jsp.JspApplicationContext", false) == null)
- {
- cfg.supportJSP = false;
- }
cfg.strictJsf2ViewNotFound = getBoolean(extCtx, STRICT_JSF_2_VIEW_NOT_FOUND,
STRICT_JSF_2_VIEW_NOT_FOUND_DEFAULT);
@@ -1240,10 +1216,7 @@ public class MyfacesConfig
cfg.viewIdCacheSize = getInt(extCtx, VIEWID_CACHE_SIZE,
VIEWID_CACHE_SIZE_DEFAULT);
-
- cfg.jspSuffix = getString(extCtx, JSP_SUFFIX,
- JSP_SUFFIX_DEFAULT);
-
+
cfg.beanBeforeJsfValidation = getBoolean(extCtx, BEAN_BEFORE_JSF_VALIDATION,
BEAN_BEFORE_JSF_VALIDATION_DEFAULT);
@@ -1493,11 +1466,6 @@ public class MyfacesConfig
return componentUniqueIdsCacheSize;
}
- public boolean isSupportJSP()
- {
- return supportJSP;
- }
-
public boolean isStrictJsf2ViewNotFound()
{
return strictJsf2ViewNotFound;
@@ -1668,11 +1636,6 @@ public class MyfacesConfig
return viewIdCacheSize;
}
- public String getJspSuffix()
- {
- return jspSuffix;
- }
-
public boolean isBeanBeforeJsfValidation()
{
return beanBeforeJsfValidation;
diff --git a/impl/src/main/java/org/apache/myfaces/config/element/FaceletsProcessing.java b/impl/src/main/java/org/apache/myfaces/config/element/FaceletsProcessing.java
index ff24224..839657b 100644
--- a/impl/src/main/java/org/apache/myfaces/config/element/FaceletsProcessing.java
+++ b/impl/src/main/java/org/apache/myfaces/config/element/FaceletsProcessing.java
@@ -30,7 +30,6 @@ public abstract class FaceletsProcessing implements Serializable
public static final String PROCESS_AS_HTML5 = "html5";
public static final String PROCESS_AS_XHTML = "xhtml";
public static final String PROCESS_AS_XML = "xml";
- public static final String PROCESS_AS_JSPX = "jspx";
public abstract String getFileExtension();
diff --git a/impl/src/main/java/org/apache/myfaces/el/ELResolverBuilderForFaces.java b/impl/src/main/java/org/apache/myfaces/el/DefaultELResolverBuilder.java
similarity index 94%
rename from impl/src/main/java/org/apache/myfaces/el/ELResolverBuilderForFaces.java
rename to impl/src/main/java/org/apache/myfaces/el/DefaultELResolverBuilder.java
index b6311ad..12cd9d8 100644
--- a/impl/src/main/java/org/apache/myfaces/el/ELResolverBuilderForFaces.java
+++ b/impl/src/main/java/org/apache/myfaces/el/DefaultELResolverBuilder.java
@@ -39,7 +39,6 @@ import org.apache.myfaces.cdi.util.CDIUtils;
import org.apache.myfaces.config.RuntimeConfig;
import org.apache.myfaces.el.resolver.CompositeComponentELResolver;
-import org.apache.myfaces.el.resolver.FacesCompositeELResolver.Scope;
import org.apache.myfaces.el.resolver.ImportConstantsELResolver;
import org.apache.myfaces.el.resolver.ImportHandlerResolver;
import org.apache.myfaces.el.resolver.ResourceBundleResolver;
@@ -58,7 +57,7 @@ import org.apache.myfaces.util.lang.ClassUtils;
* @author Mathias Broekelmann (latest modification by $Author$)
* @version $Revision$ $Date$
*/
-public class ELResolverBuilderForFaces extends ELResolverBuilder
+public class DefaultELResolverBuilder extends ELResolverBuilder
{
private static final Class STATIC_FIELD_EL_RESOLVER_CLASS;
private static final Method GET_STREAM_EL_RESOLVER_METHOD;
@@ -81,7 +80,7 @@ public class ELResolverBuilderForFaces extends ELResolverBuilder
GET_STREAM_EL_RESOLVER_METHOD = getStreamELResolverMethod;
}
- public ELResolverBuilderForFaces(RuntimeConfig runtimeConfig, MyfacesConfig myfacesConfig)
+ public DefaultELResolverBuilder(RuntimeConfig runtimeConfig, MyfacesConfig myfacesConfig)
{
super(runtimeConfig, myfacesConfig);
}
@@ -97,12 +96,12 @@ public class ELResolverBuilderForFaces extends ELResolverBuilder
// Add CDI ELResolver for JSF 2.3
if (isReplaceImplicitObjectResolverWithCDIResolver(facesContext))
{
- list.add(ImplicitObjectResolver.makeResolverForFacesCDI());
+ list.add(ImplicitObjectResolver.makeResolverForCDI());
list.add(getCDIELResolver());
}
else
{
- list.add(ImplicitObjectResolver.makeResolverForFaces());
+ list.add(ImplicitObjectResolver.makeResolver());
}
list.add(new CompositeComponentELResolver(config));
@@ -159,10 +158,10 @@ public class ELResolverBuilderForFaces extends ELResolverBuilder
}
// give the user a chance to sort the resolvers
- sortELResolvers(list, Scope.Faces);
+ sortELResolvers(list);
// give the user a chance to filter the resolvers
- Iterable<ELResolver> filteredELResolvers = filterELResolvers(list, Scope.Faces);
+ Iterable<ELResolver> filteredELResolvers = filterELResolvers(list);
// add the resolvers from the list to the CompositeELResolver
for (ELResolver resolver : filteredELResolvers)
diff --git a/impl/src/main/java/org/apache/myfaces/el/ELResolverBuilder.java b/impl/src/main/java/org/apache/myfaces/el/ELResolverBuilder.java
index a2cc0ac..e4c4bad 100644
--- a/impl/src/main/java/org/apache/myfaces/el/ELResolverBuilder.java
+++ b/impl/src/main/java/org/apache/myfaces/el/ELResolverBuilder.java
@@ -32,14 +32,12 @@ import org.apache.myfaces.cdi.config.FacesConfigBeanHolder;
import org.apache.myfaces.cdi.util.CDIUtils;
import org.apache.myfaces.config.MyfacesConfig;
import org.apache.myfaces.config.RuntimeConfig;
-import org.apache.myfaces.el.resolver.FacesCompositeELResolver;
import org.apache.myfaces.util.ExternalSpecifications;
/**
* The ELResolverBuilder is responsible to build the el resolver which is used by the application through
* {@link jakarta.faces.application.Application#getELResolver()} according to 1.2 spec
- * section 5.6.2 or to be used as the el resolver for jsp
- * according to 1.2 spec section 5.6.1
+ * section 5.6.2
*
* @author Mathias Broekelmann (latest modification by $Author$)
* @version $Revision$ $Date$
@@ -81,10 +79,9 @@ public class ELResolverBuilder
/**
* Sort the ELResolvers with a custom Comparator provided by the user.
* @param resolvers
- * @param scope scope of ELResolvers (Faces,JSP)
* @since 1.2.10, 2.0.2
*/
- protected void sortELResolvers(List<ELResolver> resolvers, FacesCompositeELResolver.Scope scope)
+ protected void sortELResolvers(List<ELResolver> resolvers)
{
if (runtimeConfig.getELResolverComparator() != null)
{
@@ -95,8 +92,8 @@ public class ELResolverBuilder
if (log.isLoggable(Level.INFO))
{
- log.log(Level.INFO, "Chain of EL resolvers for {0} sorted with: {1} and the result order is {2}",
- new Object [] {scope, runtimeConfig.getELResolverComparator(), resolvers});
+ log.log(Level.INFO, "Chain of EL resolvers sorted with: {1} and the result order is {2}",
+ new Object [] { runtimeConfig.getELResolverComparator(), resolvers});
}
}
catch (Exception e)
@@ -110,10 +107,9 @@ public class ELResolverBuilder
/**
* Filters the ELResolvers with a custom Predicate provided by the user.
* @param resolvers list of ELResolvers
- * @param scope scope of ELResolvers (Faces,JSP)
* @return Iterable instance of Iterable containing filtered ELResolvers
*/
- protected Iterable<ELResolver> filterELResolvers(List<ELResolver> resolvers, FacesCompositeELResolver.Scope scope)
+ protected Iterable<ELResolver> filterELResolvers(List<ELResolver> resolvers)
{
Predicate<ELResolver> predicate = runtimeConfig.getELResolverPredicate();
@@ -126,8 +122,8 @@ public class ELResolverBuilder
if (log.isLoggable(Level.INFO))
{
- log.log(Level.INFO, "Chain of EL resolvers for {0} filtered with: {1} and the result is {2}",
- new Object [] {scope, predicate, resolvers});
+ log.log(Level.INFO, "Chain of EL resolvers filtered with: {1} and the result is {2}",
+ new Object [] {predicate, resolvers});
}
}
catch (Exception e)
diff --git a/impl/src/main/java/org/apache/myfaces/el/ELResolverBuilderForJSP.java b/impl/src/main/java/org/apache/myfaces/el/ELResolverBuilderForJSP.java
deleted file mode 100644
index 474c896..0000000
--- a/impl/src/main/java/org/apache/myfaces/el/ELResolverBuilderForJSP.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.el;
-
-import org.apache.myfaces.el.resolver.FlashELResolver;
-import java.util.ArrayList;
-import java.util.List;
-
-import jakarta.el.CompositeELResolver;
-import jakarta.el.ELResolver;
-import jakarta.enterprise.inject.spi.BeanManager;
-import jakarta.faces.context.FacesContext;
-import org.apache.myfaces.cdi.util.CDIUtils;
-import org.apache.myfaces.config.MyfacesConfig;
-
-import org.apache.myfaces.config.RuntimeConfig;
-import org.apache.myfaces.el.resolver.FacesCompositeELResolver.Scope;
-import org.apache.myfaces.el.resolver.ResourceBundleResolver;
-import org.apache.myfaces.el.resolver.ResourceResolver;
-import org.apache.myfaces.el.resolver.implicitobject.ImplicitObjectResolver;
-
-/**
- * build the el resolver for jsp. see 1.2 spec section 5.6.1
- *
- * @author Mathias Broekelmann (latest modification by $Author$)
- * @version $Revision$ $Date$
- */
-public class ELResolverBuilderForJSP extends ELResolverBuilder
-{
- public ELResolverBuilderForJSP(RuntimeConfig runtimeConfig, MyfacesConfig myfacesConfig)
- {
- super(runtimeConfig, myfacesConfig);
- }
-
- @Override
- public void build(FacesContext facesContext, CompositeELResolver compositeElResolver)
- {
- // add the ELResolvers to a List first to be able to sort them
- List<ELResolver> list = new ArrayList<>();
-
- if (isReplaceImplicitObjectResolverWithCDIResolver(facesContext))
- {
- //Add CDI ELResolver instead.
- BeanManager beanManager = CDIUtils.getBeanManager(facesContext.getExternalContext());
- list.add(beanManager.getELResolver());
- }
- else
- {
- list.add(ImplicitObjectResolver.makeResolverForJSP());
- }
-
- //Flash object is instanceof Map, so it is necessary to resolve
- //before MapELResolver. Better to put this one before
- list.add(new FlashELResolver());
- list.add(new ResourceBundleResolver());
- list.add(new ResourceResolver());
-
- addFromRuntimeConfig(list);
-
- // give the user a chance to sort the resolvers
- sortELResolvers(list, Scope.JSP);
-
- // give the user a chance to filter the resolvers
- Iterable<ELResolver> filteredELResolvers = filterELResolvers(list, Scope.JSP);
-
- // add the resolvers from the list to the CompositeELResolver
- for (ELResolver resolver : filteredELResolvers)
- {
- compositeElResolver.add(resolver);
- }
- }
-
-}
diff --git a/impl/src/main/java/org/apache/myfaces/el/ResolverForJSPInitializer.java b/impl/src/main/java/org/apache/myfaces/el/ResolverForJSPInitializer.java
deleted file mode 100644
index bebfaa0..0000000
--- a/impl/src/main/java/org/apache/myfaces/el/ResolverForJSPInitializer.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.el;
-
-import java.util.Iterator;
-
-import jakarta.faces.FactoryFinder;
-import jakarta.faces.context.FacesContext;
-import jakarta.faces.event.PhaseEvent;
-import jakarta.faces.event.PhaseId;
-import jakarta.faces.event.PhaseListener;
-import jakarta.faces.lifecycle.LifecycleFactory;
-
-/**
- * The class will initialize the resolver for JSP
- *
- * @author Mathias Broekelmann (latest modification by $Author$)
- * @version $Revision$ $Date$
- */
-public final class ResolverForJSPInitializer implements PhaseListener
-{
- private final ELResolverBuilder _resolverBuilder;
- private volatile boolean initialized;
- private final jakarta.el.CompositeELResolver _resolverForJSP;
-
- public ResolverForJSPInitializer(final ELResolverBuilder resolverBuilder,
- final jakarta.el.CompositeELResolver resolverForJSP)
- {
- _resolverBuilder = resolverBuilder;
- _resolverForJSP = resolverForJSP;
- }
-
- @Override
- public void beforePhase(final PhaseEvent event)
- {
- if (!initialized)
- {
- synchronized(this)
- {
- if (!initialized)
- {
- FacesContext facesContext = event.getFacesContext();
- facesContext = (facesContext == null) ? FacesContext.getCurrentInstance() : facesContext;
- _resolverBuilder.build(facesContext, _resolverForJSP);
-
- LifecycleFactory factory = (LifecycleFactory)
- FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
- for (Iterator<String> iter = factory.getLifecycleIds(); iter.hasNext();)
- {
- factory.getLifecycle(iter.next()).removePhaseListener(this);
- }
-
- initialized = true;
- }
- }
- }
- }
-
- @Override
- public void afterPhase(final PhaseEvent event)
- {
- }
-
- @Override
- public PhaseId getPhaseId()
- {
- return PhaseId.ANY_PHASE;
- }
-
-}
diff --git a/impl/src/main/java/org/apache/myfaces/el/resolver/FacesCompositeELResolver.java b/impl/src/main/java/org/apache/myfaces/el/resolver/FacesCompositeELResolver.java
deleted file mode 100644
index d671488..0000000
--- a/impl/src/main/java/org/apache/myfaces/el/resolver/FacesCompositeELResolver.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * 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.el.resolver;
-
-import jakarta.el.ELContext;
-import jakarta.faces.context.FacesContext;
-import java.beans.FeatureDescriptor;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Arrays;
-
-/**
- * <p>
- * This composite el resolver will be used at the top level resolver for faces
- * ({@link jakarta.faces.application.Application#getELResolver()})
- * and jsp (the one we add with {@link jakarta.servlet.jsp.JspApplicationContext#addELResolver(jakarta.el.ELResolver)}.
- * </p>
- * <p>
- * This implementation does nothing if there is no actual faces context. This is necessarry since we registered our
- * resolvers into the jsp engine. Therefore we have to make sure that jsp only pages where no faces context is available
- * are still working
- * </p>
- *
- * @author Mathias Broekelmann (latest modification by $Author$)
- * @version $Revision$ $Date$
- */
-public final class FacesCompositeELResolver extends org.apache.myfaces.el.resolver.CompositeELResolver
-{
- public static final String SCOPE = FacesCompositeELResolver.class.getName() + ".Scope";
-
- private final Scope _scope;
-
- public enum Scope
- {
- Faces, JSP, NONE
- }
-
- public FacesCompositeELResolver(final Scope scope)
- {
- if (scope == null)
- {
- throw new IllegalArgumentException("scope must not be one of " + Arrays.toString(Scope.values()));
- }
- _scope = scope;
- }
-
- private static FacesContext facesContext(final ELContext context)
- {
- FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
- if (facesContext == null)
- {
- facesContext = FacesContext.getCurrentInstance();
- }
- return facesContext;
- }
-
- @Override
- public Class<?> getCommonPropertyType(final ELContext context, final Object base)
- {
- final FacesContext facesContext = facesContext(context);
- if (facesContext == null)
- {
- return null;
- }
-
- final Map<Object, Object> requestMap = facesContext.getAttributes();
- Scope prevScope = null;
- try
- {
- prevScope = getScope(requestMap);
- setScope(requestMap);
- return super.getCommonPropertyType(context, base);
- }
- finally
- {
- if (prevScope != null)
- {
- setScope(requestMap, prevScope);
- }
- else
- {
- unsetScope(requestMap);
- }
- }
-
- }
-
- @Override
- public Iterator<FeatureDescriptor> getFeatureDescriptors(final ELContext context, final Object base)
- {
- final FacesContext facesContext = facesContext(context);
- if (facesContext == null)
- {
- return null;
- }
-
- final Map<Object, Object> requestMap = facesContext.getAttributes();
- Scope prevScope = null;
- try
- {
- prevScope = getScope(requestMap);
- setScope(requestMap);
- return super.getFeatureDescriptors(context, base);
- }
- finally
- {
- if (prevScope != null)
- {
- setScope(requestMap, prevScope);
- }
- else
- {
- unsetScope(requestMap);
- }
- }
- }
-
- @Override
- public Class<?> getType(final ELContext context, final Object base, final Object property)
- {
- final FacesContext facesContext = facesContext(context);
- if (facesContext == null)
- {
- return null;
- }
-
- final Map<Object, Object> requestMap = facesContext.getAttributes();
- Scope prevScope = null;
- try
- {
- prevScope = getScope(requestMap);
- setScope(requestMap);
- return super.getType(context, base, property);
- }
- finally
- {
- if (prevScope != null)
- {
- setScope(requestMap, prevScope);
- }
- else
- {
- unsetScope(requestMap);
- }
- }
- }
-
- @Override
- public Object getValue(final ELContext context, final Object base, final Object property)
- {
- final FacesContext facesContext = facesContext(context);
- if (facesContext == null)
- {
- return null;
- }
-
- final Map<Object, Object> requestMap = facesContext.getAttributes();
- Scope prevScope = null;
- try
- {
- prevScope = getScope(requestMap);
- setScope(requestMap);
- return super.getValue(context, base, property);
- }
- finally
- {
- if (prevScope != null)
- {
- setScope(requestMap, prevScope);
- }
- else
- {
- unsetScope(requestMap);
- }
- }
- }
-
- @Override
- public boolean isReadOnly(final ELContext context, final Object base, final Object property)
- {
- final FacesContext facesContext = facesContext(context);
- if (facesContext == null)
- {
- return false;
- }
-
- final Map<Object, Object> requestMap = facesContext.getAttributes();
- Scope prevScope = null;
- try
- {
- prevScope = getScope(requestMap);
- setScope(requestMap);
- return super.isReadOnly(context, base, property);
- }
- finally
- {
- if (prevScope != null)
- {
- setScope(requestMap, prevScope);
- }
- else
- {
- unsetScope(requestMap);
- }
- }
- }
-
- @Override
- public void setValue(final ELContext context, final Object base, final Object property, final Object val)
- {
- final FacesContext facesContext = facesContext(context);
- if (facesContext == null)
- {
- return;
- }
-
- final Map<Object, Object> requestMap = facesContext.getAttributes();
- Scope prevScope = null;
- try
- {
- prevScope = getScope(requestMap);
- setScope(requestMap);
- super.setValue(context, base, property, val);
-
- }
- finally
- {
- if (prevScope != null)
- {
- setScope(requestMap, prevScope);
- }
- else
- {
- unsetScope(requestMap);
- }
- }
- }
-
- private void setScope(final Map<Object, Object> attributes)
- {
- attributes.put(SCOPE, _scope);
- }
-
- private Scope getScope(final Map<Object, Object> attributes)
- {
- return (Scope) attributes.get(SCOPE);
- }
-
- private void setScope(final Map<Object, Object> attributes, Scope prevScope)
- {
- attributes.put(SCOPE, prevScope);
- }
-
- private static void unsetScope(final Map<Object, Object> attributes)
- {
- //attributes.remove(SCOPE);
- attributes.put(SCOPE, Scope.NONE);
- }
-}
diff --git a/impl/src/main/java/org/apache/myfaces/el/resolver/implicitobject/ImplicitObjectResolver.java b/impl/src/main/java/org/apache/myfaces/el/resolver/implicitobject/ImplicitObjectResolver.java
index 3c30dde..cc6f005 100644
--- a/impl/src/main/java/org/apache/myfaces/el/resolver/implicitobject/ImplicitObjectResolver.java
+++ b/impl/src/main/java/org/apache/myfaces/el/resolver/implicitobject/ImplicitObjectResolver.java
@@ -36,30 +36,12 @@ import java.util.Map;
*/
public class ImplicitObjectResolver extends ELResolver
{
-
private Map<String, ImplicitObject> implicitObjects;
/**
- * Static factory for an ELResolver for resolving implicit objects in JSPs. See JSF 1.2 spec section 5.6.1.1
- */
- public static ELResolver makeResolverForJSP()
- {
- Map<String, ImplicitObject> forJSPList = new HashMap<>(8); //4
- ImplicitObject io1 = new FacesContextImplicitObject();
- forJSPList.put(io1.getName(), io1);
- ImplicitObject io2 = new ViewImplicitObject();
- forJSPList.put(io2.getName(), io2);
- ImplicitObject io3 = new ResourceImplicitObject();
- forJSPList.put(io3.getName(), io3);
- ImplicitObject io4 = new ViewScopeImplicitObject();
- forJSPList.put(io4.getName(), io4);
- return new ImplicitObjectResolver(forJSPList);
- }
-
- /**
* Static factory for an ELResolver for resolving implicit objects in all of Faces. See JSF 1.2 spec section 5.6.1.2
*/
- public static ELResolver makeResolverForFaces()
+ public static ELResolver makeResolver()
{
Map<String, ImplicitObject> forFacesList = new HashMap<>(30); //19
ImplicitObject io1 = new ApplicationImplicitObject();
@@ -103,7 +85,7 @@ public class ImplicitObjectResolver extends ELResolver
return new ImplicitObjectResolver(forFacesList);
}
- public static ELResolver makeResolverForFacesCDI()
+ public static ELResolver makeResolverForCDI()
{
Map<String, ImplicitObject> forFacesCDIList = new HashMap<>(4); //2
ImplicitObject io;
@@ -123,7 +105,6 @@ public class ImplicitObjectResolver extends ELResolver
this.implicitObjects = new HashMap<>();
}
- /** Creates a new instance of ImplicitObjectResolverForJSP */
private ImplicitObjectResolver(Map<String, ImplicitObject> implicitObjects)
{
this();
diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/ErrorPageWriter.java b/impl/src/main/java/org/apache/myfaces/renderkit/ErrorPageWriter.java
index 2844d2c..af94503 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/ErrorPageWriter.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/ErrorPageWriter.java
@@ -509,7 +509,7 @@ public final class ErrorPageWriter
// throw an IllegalArgumentException instead of a FileNotFoundException,
// because when using <ui:debug /> this error is hard to trace,
// because the Exception is thrown in the Renderer and so it seems like
- // the facelet (or jsp) does not exist.
+ // the facelet does not exist.
throw new IllegalArgumentException("Could not find resource " + rsc);
}
diff --git a/impl/src/main/java/org/apache/myfaces/view/ViewDeclarationLanguageFactoryImpl.java b/impl/src/main/java/org/apache/myfaces/view/ViewDeclarationLanguageFactoryImpl.java
index 3417c4c..6959967 100644
--- a/impl/src/main/java/org/apache/myfaces/view/ViewDeclarationLanguageFactoryImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/view/ViewDeclarationLanguageFactoryImpl.java
@@ -21,20 +21,13 @@ package org.apache.myfaces.view;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import jakarta.faces.context.FacesContext;
import jakarta.faces.view.ViewDeclarationLanguage;
import jakarta.faces.view.ViewDeclarationLanguageFactory;
-import org.apache.myfaces.config.MyfacesConfig;
import org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguageStrategy;
-import org.apache.myfaces.view.jsp.JspViewDeclarationLanguageStrategy;
/**
- * This is the default VDL factory used as of JSF 2.0, it tries to use Facelet VDL whenever possible,
- * but fallback on JSP if required.
+ * This is the default VDL factory used as of JSF 2.0, it tries to use Facelet VDL whenever possible.
*
* @author Simon Lessard (latest modification by $Author$)
* @version $Revision$ $Date$
@@ -42,11 +35,7 @@ import org.apache.myfaces.view.jsp.JspViewDeclarationLanguageStrategy;
* @since 2.0
*/
public class ViewDeclarationLanguageFactoryImpl extends ViewDeclarationLanguageFactory
-{
- private static final String FACELETS_1_VIEW_HANDLER = "com.sun.facelets.FaceletViewHandler";
-
- private static final Logger LOGGER = Logger.getLogger(ViewDeclarationLanguageFactoryImpl.class.getName());
-
+{
private volatile boolean _initialized;
private volatile ViewDeclarationLanguageStrategy[] _supportedLanguages;
@@ -103,43 +92,12 @@ public class ViewDeclarationLanguageFactoryImpl extends ViewDeclarationLanguageF
{
if (!_initialized)
{
- FacesContext context = FacesContext.getCurrentInstance();
-
- logWarningIfLegacyFaceletViewHandlerIsPresent(context);
-
- if (MyfacesConfig.getCurrentInstance(context).isSupportJSP())
+ _supportedLanguages = new ViewDeclarationLanguageStrategy[]
{
- _supportedLanguages = new ViewDeclarationLanguageStrategy[2];
- _supportedLanguages[0] = new FaceletViewDeclarationLanguageStrategy();
- _supportedLanguages[1] = new JspViewDeclarationLanguageStrategy();
- }
- else
- {
- _supportedLanguages = new ViewDeclarationLanguageStrategy[1];
- _supportedLanguages[0] = new FaceletViewDeclarationLanguageStrategy();
- }
+ new FaceletViewDeclarationLanguageStrategy()
+ };
_initialized = true;
}
}
-
- /**
- * If the Facelets-1 ViewHandler com.sun.facelets.FaceletViewHandler is present, log a error.
- *
- * @param context the <code>FacesContext</code>
- */
- private void logWarningIfLegacyFaceletViewHandlerIsPresent(FacesContext context)
- {
- boolean facelets1ViewHandlerPresent
- = context.getApplication().getViewHandler().getClass().getName().equals(FACELETS_1_VIEW_HANDLER);
-
- if (facelets1ViewHandlerPresent)
- {
- if (LOGGER.isLoggable(Level.WARNING))
- {
- LOGGER.log(Level.WARNING, "Your faces-config.xml contains the " + FACELETS_1_VIEW_HANDLER + " class."
- + "\nYou need to remove it since it's not supported anymore since JSF 2.0");
- }
- }
- }
}
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/FaceletsProcessingInstructions.java b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/FaceletsProcessingInstructions.java
index 27e6add..3e238c0 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/FaceletsProcessingInstructions.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/FaceletsProcessingInstructions.java
@@ -26,7 +26,6 @@ package org.apache.myfaces.view.facelets.compiler;
public final class FaceletsProcessingInstructions
{
public static final String PROCESS_AS_HTML5 = "html5";
- public static final String PROCESS_AS_JSPX = "jspx";
public static final String PROCESS_AS_XHTML = "xhtml";
public static final String PROCESS_AS_XML = "xml";
@@ -41,10 +40,6 @@ public final class FaceletsProcessingInstructions
private static final FaceletsProcessingInstructions FACELETS_PROCESSING_XML =
new FaceletsProcessingInstructions(
true, true, true, true, true, true, true);
-
- private static final FaceletsProcessingInstructions FACELETS_PROCESSING_JSPX =
- new FaceletsProcessingInstructions(
- true, true, true, true, false, true, false);
private static final FaceletsProcessingInstructions FACELETS_PROCESSING_HTML5_COMPRESS_SPACES =
new FaceletsProcessingInstructions(
@@ -58,10 +53,6 @@ public final class FaceletsProcessingInstructions
new FaceletsProcessingInstructions(
true, true, true, true, true, true, true, true);
- private static final FaceletsProcessingInstructions FACELETS_PROCESSING_JSPX_COMPRESS_SPACES =
- new FaceletsProcessingInstructions(
- true, true, true, true, false, true, false, true);
-
private final boolean consumeXmlDocType;
private final boolean consumeXmlDeclaration;
private final boolean consumeProcessingInstructions;
@@ -90,10 +81,6 @@ public final class FaceletsProcessingInstructions
{
return FACELETS_PROCESSING_XML;
}
- else if (PROCESS_AS_JSPX.equals(processAs))
- {
- return FACELETS_PROCESSING_JSPX;
- }
else
{
return FACELETS_PROCESSING_XHTML;
@@ -123,10 +110,6 @@ public final class FaceletsProcessingInstructions
{
return FACELETS_PROCESSING_XML_COMPRESS_SPACES;
}
- else if (PROCESS_AS_JSPX.equals(processAs))
- {
- return FACELETS_PROCESSING_JSPX_COMPRESS_SPACES;
- }
else
{
return FACELETS_PROCESSING_XHTML_COMPRESS_SPACES;
diff --git a/impl/src/main/java/org/apache/myfaces/view/jsp/FaceletsOnlyException.java b/impl/src/main/java/org/apache/myfaces/view/jsp/FaceletsOnlyException.java
deleted file mode 100644
index 9b2ee5b..0000000
--- a/impl/src/main/java/org/apache/myfaces/view/jsp/FaceletsOnlyException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.jsp;
-
-/**
- * An Exception that indicates that the user uses a
- * facelets-only feature on a JSP.
- *
- * NOTE: this class must not extend FacesException, because
- * otherwise its message won't be displayed by the ExceptionHandler.
- * Thus it directly extends Exception.
- *
- * @author Jakob Korherr (latest modification by $Author$)
- * @version $Revision$ $Date$
- *
- * @since 2.0
- */
-public class FaceletsOnlyException extends Exception
-{
-
- private static final long serialVersionUID = 4268633427284543647L;
-
- public FaceletsOnlyException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
-}
diff --git a/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguage.java b/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguage.java
deleted file mode 100644
index f1818a0..0000000
--- a/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguage.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * 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.jsp;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.Locale;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.stream.Stream;
-
-import jakarta.faces.FacesException;
-import jakarta.faces.application.ViewVisitOption;
-import jakarta.faces.component.UIViewRoot;
-import jakarta.faces.context.ExternalContext;
-import jakarta.faces.context.FacesContext;
-import jakarta.faces.event.PostAddToViewEvent;
-import jakarta.faces.render.ResponseStateManager;
-import jakarta.servlet.ServletRequest;
-import jakarta.servlet.ServletResponse;
-import jakarta.servlet.http.HttpServletResponse;
-import jakarta.servlet.jsp.jstl.core.Config;
-
-import org.apache.myfaces.view.ServletViewResponseWrapper;
-import org.apache.myfaces.application.viewstate.StateCacheUtils;
-import org.apache.myfaces.view.ViewDeclarationLanguageStrategy;
-import org.apache.myfaces.view.facelets.tag.composite.CompositeLibrary;
-import org.apache.myfaces.view.facelets.tag.jsf.core.CoreLibrary;
-import org.apache.myfaces.view.facelets.tag.jsf.html.HtmlLibrary;
-import org.apache.myfaces.view.facelets.tag.ui.UILibrary;
-
-/**
- * @author Simon Lessard (latest modification by $Author$)
- * @version $Revision$ $Date$
- *
- * @since 2.0
- */
-public class JspViewDeclarationLanguage extends JspViewDeclarationLanguageBase
-{
- public static final Logger log = Logger.getLogger(JspViewDeclarationLanguage.class.getName());
-
- /**
- * Tags that are only available on facelets and not on JSP.
- * If a user uses one of these tags on a JSP, we will provide
- * a more informative error message than the standard one.
- */
- public static final String[] FACELETS_ONLY_F_TAGS = {"ajax", "event", "metadata"};
- public static final String[] FACELETS_ONLY_H_TAGS = {"outputScript", "outputStylesheet",
- "head", "body", "button", "link"};
-
- private final ViewDeclarationLanguageStrategy _strategy;
- private LinkedList<String> _suffixes;
-
- public JspViewDeclarationLanguage()
- {
- if (log.isLoggable(Level.FINEST))
- {
- log.finest("New JspViewDeclarationLanguage instance created");
- }
-
- _strategy = new JspViewDeclarationLanguageStrategy();
- }
-
- public JspViewDeclarationLanguage(FacesContext facesContext, ViewDeclarationLanguageStrategy strategy,
- LinkedList<String> suffixes)
- {
- this._strategy = strategy;
- this._suffixes = suffixes;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void buildView(FacesContext context, UIViewRoot view) throws IOException
- {
- // call buildView() from JspViewDeclarationLanguageBase to do some startup work
- super.buildView(context, view);
-
- ExternalContext externalContext = context.getExternalContext();
- ServletResponse response = (ServletResponse) externalContext.getResponse();
- ServletRequest request = (ServletRequest) externalContext.getRequest();
-
- Locale locale = view.getLocale();
- response.setLocale(locale);
- Config.set(request, Config.FMT_LOCALE, context.getViewRoot().getLocale());
-
- String viewId = view.getViewId();
- ServletViewResponseWrapper wrappedResponse = new ServletViewResponseWrapper((HttpServletResponse) response);
-
- externalContext.setResponse(wrappedResponse);
- try
- {
- externalContext.dispatch(viewId);
- }
- catch (FacesException e)
- {
- // try to extract the most likely exceptions here
- // and provide a better error message for them
-
- String message = e.getMessage();
-
- // errors related to using facelets-only tags on a JSP page
- if (message != null)
- {
- // does the message contain "f" (prefix f of tags)
- // or the related uri http://java.sun.com/jsf/core
- if (message.contains("\"f\"")
- || message.contains('"' + CoreLibrary.NAMESPACE + '"'))
- {
- // check facelets-only f tags
- for (String tag : FACELETS_ONLY_F_TAGS)
- {
- if (message.contains('"' + tag + '"'))
- {
- String exceptionMessage = "The tag f:" + tag +
- " is only available on facelets.";
- throw new FacesException(exceptionMessage,
- new FaceletsOnlyException(exceptionMessage, e.getCause()));
- }
- }
- }
- else if (message.contains("\"h\"")
- || message.contains('"' + HtmlLibrary.NAMESPACE + '"'))
- {
- // check facelets-only h tags
- for (String tag : FACELETS_ONLY_H_TAGS)
- {
- if (message.contains('"' + tag + '"'))
- {
- String exceptionMessage = "The tag h:" + tag +
- " is only available on facelets.";
- throw new FacesException(exceptionMessage,
- new FaceletsOnlyException(exceptionMessage, e.getCause()));
- }
- }
- }
- else
- {
- // check facelets-only namespaces
- String namespace = null;
- if (message.contains(UILibrary.NAMESPACE))
- {
- namespace = UILibrary.NAMESPACE;
- }
- else if (message.contains(CompositeLibrary.NAMESPACE))
- {
- namespace = CompositeLibrary.NAMESPACE;
- }
-
- if (namespace != null)
- {
- // the message contains a facelets-only namespace
- String exceptionMessage = "All tags with namespace " +
- namespace + " are only available on facelets.";
- throw new FacesException(exceptionMessage,
- new FaceletsOnlyException(exceptionMessage, e.getCause()));
- }
- }
- }
-
- // no rule applied to this Exception - rethrow it
- throw e;
- }
- finally
- {
- externalContext.setResponse(response);
- }
-
- boolean errorResponse = wrappedResponse.getStatus() < 200 || wrappedResponse.getStatus() > 299;
- if (errorResponse)
- {
- wrappedResponse.flushToWrappedResponse();
- return;
- }
-
- // Skip this step if we are rendering an ajax request, because no content outside
- // f:view tag should be output.
- // Note that the ResponseSwitch would prevent this output from beeing written
- // in renderView(), but not providing the information at all makes it faster!
- if (!context.getPartialViewContext().isPartialRequest())
- {
- // store the wrapped response in the request, so it is thread-safe
- setAfterViewTagResponseWrapper(externalContext, wrappedResponse);
- }
-
- // Publish PostAddToView over UIViewRoot, because this is not done automatically.
- context.getApplication().publishEvent(context, PostAddToViewEvent.class, UIViewRoot.class, view);
- }
-
- @Override
- protected boolean isViewStateAlreadyEncoded(FacesContext context)
- {
- ResponseStateManager responseStateManager = context.getRenderKit().getResponseStateManager();
- if (StateCacheUtils.isMyFacesResponseStateManager(responseStateManager))
- {
- if (StateCacheUtils.getMyFacesResponseStateManager(responseStateManager).
- isWriteStateAfterRenderViewRequired(context))
- {
- return false;
- }
- else
- {
- return true;
- }
- }
- else
- {
- return false;
- }
- }
-
- @Override
- protected void sendSourceNotFound(FacesContext context, String message)
- {
- HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
- try
- {
- context.responseComplete();
- response.sendError(HttpServletResponse.SC_NOT_FOUND, message);
- }
- catch (IOException ioe)
- {
- throw new FacesException(ioe);
- }
- }
-
- @Override
- public boolean viewExists(FacesContext facesContext, String viewId)
- {
- if (_strategy.handles(viewId))
- {
- return super.viewExists(facesContext, viewId);
- }
- return false;
- }
-
- @Override
- public Stream<String> getViews(FacesContext facesContext, String path, int maxDepth, ViewVisitOption... options)
- {
- Stream<String> stream = super.getViews(facesContext, path, maxDepth, options);
- stream = stream.filter(f -> (_strategy.handles(f) && isValidJSPView(facesContext,f)));
- if (options != null &&
- Arrays.binarySearch(options, ViewVisitOption.RETURN_AS_MINIMAL_IMPLICIT_OUTCOME) >= 0)
- {
- stream = stream.map(f -> _strategy.getMinimalImplicitOutcome(f));
- }
- return stream;
- }
-
- private boolean isValidJSPView(FacesContext facesContext, String path)
- {
- boolean isValid = false;
-
- // _suffixes should only be null if this JSPViewDeclarationLanguage was created
- // via the default constructor.
- if (_suffixes == null)
- {
- _suffixes = JspViewDeclarationLanguageStrategy.loadSuffixes(facesContext.getExternalContext());
- }
-
- for (String suffix : _suffixes)
- {
- if (path != null && path.endsWith (suffix))
- {
- isValid = true;
- break;
- }
- }
-
- return isValid;
- }
-
-}
diff --git a/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguageBase.java b/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguageBase.java
deleted file mode 100644
index edfe458..0000000
--- a/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguageBase.java
+++ /dev/null
@@ -1,457 +0,0 @@
-/*
- * 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.jsp;
-
-import java.beans.BeanInfo;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import jakarta.faces.FactoryFinder;
-import jakarta.faces.application.Resource;
-import jakarta.faces.application.StateManager;
-import jakarta.faces.application.ViewHandler;
-import jakarta.faces.component.UIViewRoot;
-import jakarta.faces.context.ExternalContext;
-import jakarta.faces.context.FacesContext;
-import jakarta.faces.context.ResponseWriter;
-import jakarta.faces.render.RenderKit;
-import jakarta.faces.render.RenderKitFactory;
-import jakarta.faces.view.StateManagementStrategy;
-import jakarta.faces.view.ViewDeclarationLanguage;
-import jakarta.faces.view.ViewMetadata;
-import jakarta.servlet.ServletResponse;
-import jakarta.servlet.ServletResponseWrapper;
-import jakarta.servlet.http.HttpServletResponse;
-
-import org.apache.myfaces.application.ViewIdSupport;
-import org.apache.myfaces.config.MyfacesConfig;
-import org.apache.myfaces.util.lang.Assert;
-import org.apache.myfaces.view.HttpServletResponseSwitch;
-import org.apache.myfaces.view.ResponseSwitch;
-import org.apache.myfaces.view.ServletResponseSwitch;
-import org.apache.myfaces.view.ViewDeclarationLanguageBase;
-import org.apache.myfaces.view.ViewResponseWrapper;
-
-
-public abstract class JspViewDeclarationLanguageBase extends ViewDeclarationLanguageBase
-{
- private static final Logger log = Logger.getLogger(JspViewDeclarationLanguageBase.class.getName());
-
- private static final String FORM_STATE_MARKER = "<!-...@-->";
- private static final String AFTER_VIEW_TAG_CONTENT_PARAM = JspViewDeclarationLanguageBase.class
- + ".AFTER_VIEW_TAG_CONTENT";
- private static final int FORM_STATE_MARKER_LEN = FORM_STATE_MARKER.length();
-
- private ViewIdSupport viewIdSupport;
-
- @Override
- public String getId()
- {
- return ViewDeclarationLanguage.JSP_VIEW_DECLARATION_LANGUAGE_ID;
- }
-
- @Override
- public void buildView(FacesContext context, UIViewRoot view) throws IOException
- {
- // memorize that buildView() has been called for this view
- setViewBuilt(context, view);
-
- if (context.getPartialViewContext().isPartialRequest())
- {
- // try to get (or create) a ResponseSwitch and turn off the output
- Object origResponse = context.getExternalContext().getResponse();
- ResponseSwitch responseSwitch = getResponseSwitch(origResponse);
- if (responseSwitch == null)
- {
- // no ResponseSwitch installed yet - create one
- responseSwitch = createResponseSwitch(origResponse);
- if (responseSwitch != null)
- {
- // install the ResponseSwitch
- context.getExternalContext().setResponse(responseSwitch);
- }
- }
- if (responseSwitch != null)
- {
- // turn the output off
- responseSwitch.setEnabled(false);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public BeanInfo getComponentMetadata(FacesContext context, Resource componentResource)
- {
- throw new UnsupportedOperationException();
- }
- /**
- * {@inheritDoc}
- */
- @Override
- public Resource getScriptComponentResource(FacesContext context, Resource componentResource)
- {
- throw new UnsupportedOperationException();
- }
- /**
- * {@inheritDoc}
- */
- @Override
- public void renderView(FacesContext context, UIViewRoot view) throws IOException
- {
- //Try not to use native objects in this class. Both MyFaces and the bridge
- //provide implementations of buildView but they do not override this class.
- Assert.notNull(context, "context");
- Assert.notNull(view, "view");
-
- // do not render the view if the rendered attribute for the view is false
- if (!view.isRendered())
- {
- if (log.isLoggable(Level.FINEST))
- {
- log.finest("View is not rendered");
- }
- return;
- }
-
- // Check if the current view has already been built via VDL.buildView()
- // and if not, build it from here. This is necessary because legacy ViewHandler
- // implementations return null on getViewDeclarationLanguage() and thus
- // VDL.buildView() is never called. Furthermore, before JSF 2.0 introduced
- // the VDLs, the code that built the view was in ViewHandler.renderView().
- if (!isViewBuilt(context, view))
- {
- buildView(context, view);
- }
-
- ExternalContext externalContext = context.getExternalContext();
-
- String viewId = context.getViewRoot().getViewId();
-
- if (log.isLoggable(Level.FINEST))
- {
- log.finest("Rendering JSP view: " + viewId);
- }
-
-
- // handle character encoding as of section 2.5.2.2 of JSF 1.1
- if(null != externalContext.getSession(false))
- {
- externalContext.getSessionMap().put(ViewHandler.CHARACTER_ENCODING_KEY,
- externalContext.getResponseCharacterEncoding());
- }
-
- // render the view in this method (since JSF 1.2)
- RenderKitFactory renderFactory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
- RenderKit renderKit = renderFactory.getRenderKit(context, view.getRenderKitId());
-
- ResponseWriter responseWriter = context.getResponseWriter();
- if (responseWriter == null)
- {
- responseWriter = renderKit.createResponseWriter(externalContext.getResponseOutputWriter(),
- null, externalContext.getRequestCharacterEncoding());
- context.setResponseWriter(responseWriter);
- }
-
- // try to enable the ResponseSwitch again (disabled in buildView())
- Object response = context.getExternalContext().getResponse();
- ResponseSwitch responseSwitch = getResponseSwitch(response);
- if (responseSwitch != null)
- {
- responseSwitch.setEnabled(true);
- }
-
- ResponseWriter oldResponseWriter = responseWriter;
- StringWriter stateAwareWriter = null;
-
- StateManager stateManager = context.getApplication().getStateManager();
- boolean viewStateAlreadyEncoded = isViewStateAlreadyEncoded(context);
-
- if (!viewStateAlreadyEncoded)
- {
- // we will need to parse the reponse and replace the view_state token with the actual state
- stateAwareWriter = new StringWriter();
-
- // Create a new response-writer using as an underlying writer the stateAwareWriter
- // Effectively, all output will be buffered in the stateAwareWriter so that later
- // this writer can replace the state-markers with the actual state.
- responseWriter = oldResponseWriter.cloneWithWriter(stateAwareWriter);
- context.setResponseWriter(responseWriter);
- }
-
- try
- {
- if (!actuallyRenderView(context, view))
- {
- return;
- }
- }
- finally
- {
- if(oldResponseWriter != null)
- {
- context.setResponseWriter(oldResponseWriter);
- }
- }
-
- if (!viewStateAlreadyEncoded)
- {
- // parse the response and replace the token wit the state
- flushBufferToWriter(stateAwareWriter.getBuffer(), externalContext.getResponseOutputWriter());
- }
- else
- {
- stateManager.saveView(context);
- }
-
- // now disable the ResponseSwitch again
- if (responseSwitch != null)
- {
- responseSwitch.setEnabled(false);
- }
-
- // Final step - we output any content in the wrappedResponse response from above to the response,
- // removing the wrappedResponse response from the request, we don't need it anymore
- ViewResponseWrapper afterViewTagResponse = (ViewResponseWrapper) externalContext.getRequestMap()
- .get(AFTER_VIEW_TAG_CONTENT_PARAM);
- externalContext.getRequestMap().remove(AFTER_VIEW_TAG_CONTENT_PARAM);
-
- // afterViewTagResponse is null if the current request is a partial request
- if (afterViewTagResponse != null)
- {
- afterViewTagResponse.flushToWriter(externalContext.getResponseOutputWriter(),
- externalContext.getResponseCharacterEncoding());
- }
-
- //TODO sobryan: Is this right?
- context.getResponseWriter().flush();
- }
- /**
- * {@inheritDoc}
- */
- @Override
- public ViewMetadata getViewMetadata(FacesContext context, String viewId)
- {
- // Not necessary given that this method always returns null, but staying true to
- // the spec.
-
- Assert.notNull(context, "context");
- //checkNull(viewId, "viewId");
-
- // JSP impl must return null.
-
- return null;
- }
-
- protected boolean isViewStateAlreadyEncoded(FacesContext context)
- {
- if (MyfacesConfig.getCurrentInstance(context).isMyfacesImplAvailable())
- {
- // In MyFaces the viewState key is already encoded is server side state saving is being used
- return !context.getApplication().getStateManager().isSavingStateInClient(context);
- }
- else
- {
- return false;
- }
- }
-
- protected void setAfterViewTagResponseWrapper(ExternalContext ec, ViewResponseWrapper wrapper)
- {
- ec.getRequestMap().put(AFTER_VIEW_TAG_CONTENT_PARAM, wrapper);
- }
-
- protected void flushBufferToWriter(StringBuffer buff, Writer writer) throws IOException
- {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- StateManager stateManager = facesContext.getApplication().getStateManager();
-
- StringWriter stateWriter = new StringWriter();
- ResponseWriter realWriter = facesContext.getResponseWriter();
- facesContext.setResponseWriter(realWriter.cloneWithWriter(stateWriter));
-
- Object serializedView = stateManager.saveView(facesContext);
-
- stateManager.writeState(facesContext, serializedView);
- facesContext.setResponseWriter(realWriter);
-
- String state = stateWriter.getBuffer().toString();
-
- // State markers must be replaced
- int lastFormMarkerPos = 0;
- int formMarkerPos = 0;
- // Find all state markers and write out actual state instead
- while ((formMarkerPos = buff.indexOf(JspViewDeclarationLanguageBase.FORM_STATE_MARKER, formMarkerPos)) > -1)
- {
- // Write content before state marker
- writePartialBuffer(buff, lastFormMarkerPos, formMarkerPos, writer);
- // Write state and move position in buffer after marker
- writer.write(state);
- formMarkerPos += JspViewDeclarationLanguageBase.FORM_STATE_MARKER_LEN;
- lastFormMarkerPos = formMarkerPos;
- }
-
- // Write content after last state marker
- if (lastFormMarkerPos < buff.length())
- {
- writePartialBuffer(buff, lastFormMarkerPos, buff.length(), writer);
- }
- }
-
- protected void writePartialBuffer(StringBuffer contentBuffer, int beginIndex,
- int endIndex, Writer writer) throws IOException
- {
- int index = beginIndex;
- int bufferSize = 2048;
- char[] bufToWrite = new char[bufferSize];
-
- while (index < endIndex)
- {
- int maxSize = Math.min(bufferSize, endIndex - index);
-
- contentBuffer.getChars(index, index + maxSize, bufToWrite, 0);
- writer.write(bufToWrite, 0, maxSize);
-
- index += bufferSize;
- }
- }
-
- /**
- * Render the view now - properly setting and resetting the response writer
- * [MF] Modified to return a boolean so subclass that delegates can determine
- * whether the rendering succeeded or not. TRUE means success.
- */
- protected boolean actuallyRenderView(FacesContext facesContext, UIViewRoot viewToRender)
- throws IOException
- {
- // Set the new ResponseWriter into the FacesContext, saving the old one aside.
- ResponseWriter responseWriter = facesContext.getResponseWriter();
-
- // Now we actually render the document
- // Call startDocument() on the ResponseWriter.
- responseWriter.startDocument();
-
- // Call encodeAll() on the UIViewRoot
- viewToRender.encodeAll(facesContext);
-
- // Call endDocument() on the ResponseWriter
- responseWriter.endDocument();
-
- responseWriter.flush();
-
- // rendered successfully -- forge ahead
- return true;
- }
-
- @Override
- public StateManagementStrategy getStateManagementStrategy(FacesContext context, String viewId)
- {
- return null;
- }
-
- @Override
- protected String calculateViewId(FacesContext context, String viewId)
- {
- if (viewIdSupport == null)
- {
- viewIdSupport = ViewIdSupport.getInstance(context);
- }
-
- return viewIdSupport.deriveLogicalViewId(context, viewId);
- }
-
- /**
- * Returns true if the given UIViewRoot has already been built via VDL.buildView().
- * This is necessary because legacy ViewHandler implementations return null on
- * getViewDeclarationLanguage() and thus VDL.buildView() is never called.
- * So we have to check this in renderView() and, if it is false, we have to
- * call buildView() manually before the rendering.
- *
- * @param facesContext
- * @param view
- * @return
- */
- protected boolean isViewBuilt(FacesContext facesContext, UIViewRoot view)
- {
- return Boolean.TRUE.equals(facesContext.getAttributes().get(view));
- }
-
- /**
- * Saves a flag in the attribute map of the FacesContext to indicate
- * that the given UIViewRoot was already built with VDL.buildView().
- *
- * @param facesContext
- * @param view
- */
- protected void setViewBuilt(FacesContext facesContext, UIViewRoot view)
- {
- facesContext.getAttributes().put(view, Boolean.TRUE);
- }
-
- /**
- * Trys to obtain a ResponseSwitch from the Response.
- * @param response
- * @return if found, the ResponseSwitch, null otherwise
- */
- private static ResponseSwitch getResponseSwitch(Object response)
- {
- // unwrap the response until we find a ResponseSwitch
- while (response != null)
- {
- if (response instanceof ResponseSwitch)
- {
- // found
- return (ResponseSwitch) response;
- }
- if (response instanceof ServletResponseWrapper)
- {
- // unwrap
- response = ((ServletResponseWrapper) response).getResponse();
- }
- // no more possibilities to find a ResponseSwitch
- break;
- }
- return null; // not found
- }
-
- /**
- * Try to create a ResponseSwitch for this response.
- * @param response
- * @return the created ResponseSwitch, if there is a ResponseSwitch
- * implementation for the given response, null otherwise
- */
- private static ResponseSwitch createResponseSwitch(Object response)
- {
- if (response instanceof HttpServletResponse)
- {
- return new HttpServletResponseSwitch((HttpServletResponse) response);
- }
- else if (response instanceof ServletResponse)
- {
- return new ServletResponseSwitch((ServletResponse) response);
- }
- return null;
- }
-
-}
diff --git a/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguageStrategy.java b/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguageStrategy.java
deleted file mode 100644
index 8200c44..0000000
--- a/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguageStrategy.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.jsp;
-
-import java.util.LinkedList;
-import java.util.StringTokenizer;
-import jakarta.faces.context.ExternalContext;
-import jakarta.faces.context.FacesContext;
-import jakarta.faces.view.ViewDeclarationLanguage;
-import org.apache.myfaces.config.MyfacesConfig;
-
-import org.apache.myfaces.view.ViewDeclarationLanguageStrategy;
-
-/**
- * @author Simon Lessard (latest modification by $Author$)
- * @version $Revision$ $Date$
- *
- * @since 2.0
- */
-public class JspViewDeclarationLanguageStrategy implements ViewDeclarationLanguageStrategy
-{
- private ViewDeclarationLanguage _language;
- private LinkedList<String> _suffixes;
-
- public JspViewDeclarationLanguageStrategy()
- {
- FacesContext facesContext = FacesContext.getCurrentInstance();
-
- _suffixes = loadSuffixes (facesContext.getExternalContext());
- _language = new JspViewDeclarationLanguage(facesContext, this, _suffixes);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ViewDeclarationLanguage getViewDeclarationLanguage()
- {
- return _language;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean handles(String viewId)
- {
- return true;
- }
-
- static LinkedList<String> loadSuffixes (ExternalContext context)
- {
- LinkedList<String> result = new LinkedList<String>();
- String definedSuffixes = MyfacesConfig.getCurrentInstance(context).getJspSuffix();
-
- // This is a space-separated list of suffixes, so parse them out.
- StringTokenizer tokenizer = new StringTokenizer (definedSuffixes, " ");
-
- while (tokenizer.hasMoreTokens())
- {
- result.add (tokenizer.nextToken());
- }
-
- return result;
- }
-
- @Override
- public String getMinimalImplicitOutcome(String viewId)
- {
- for (String suffix : _suffixes)
- {
- if (viewId != null && viewId.endsWith(suffix))
- {
- return viewId.substring(0, viewId.length()-suffix.length());
- }
- }
- return viewId;
- }
-}
diff --git a/impl/src/main/java/org/apache/myfaces/webapp/FaceletsInitilializer.java b/impl/src/main/java/org/apache/myfaces/webapp/DefaultFacesInitilializer.java
similarity index 93%
rename from impl/src/main/java/org/apache/myfaces/webapp/FaceletsInitilializer.java
rename to impl/src/main/java/org/apache/myfaces/webapp/DefaultFacesInitilializer.java
index 2511b0c..4309014 100644
--- a/impl/src/main/java/org/apache/myfaces/webapp/FaceletsInitilializer.java
+++ b/impl/src/main/java/org/apache/myfaces/webapp/DefaultFacesInitilializer.java
@@ -31,9 +31,9 @@ import jakarta.servlet.ServletContext;
*
* @author Martin Koci
*/
-public class FaceletsInitilializer extends org.apache.myfaces.webapp.AbstractFacesInitializer
+public class DefaultFacesInitilializer extends org.apache.myfaces.webapp.AbstractFacesInitializer
{
- private static final Logger log = Logger.getLogger(FaceletsInitilializer.class.getName());
+ private static final Logger log = Logger.getLogger(DefaultFacesInitilializer.class.getName());
@Override
protected void initContainerIntegration(ServletContext servletContext, ExternalContext externalContext)
diff --git a/impl/src/main/java/org/apache/myfaces/webapp/FacesInitializerFactory.java b/impl/src/main/java/org/apache/myfaces/webapp/FacesInitializerFactory.java
index f6957fa..b3f6247 100644
--- a/impl/src/main/java/org/apache/myfaces/webapp/FacesInitializerFactory.java
+++ b/impl/src/main/java/org/apache/myfaces/webapp/FacesInitializerFactory.java
@@ -23,7 +23,6 @@ import jakarta.servlet.ServletContext;
import org.apache.myfaces.config.MyfacesConfig;
import org.apache.myfaces.util.lang.ClassUtils;
-import org.apache.myfaces.util.lang.StringUtils;
/**
* Simple Factory to get a FacesInitializer implementation either from a web.xml
@@ -41,10 +40,10 @@ public class FacesInitializerFactory
*/
public static FacesInitializer getFacesInitializer(ServletContext context)
{
- FacesInitializer initializer = _getFacesInitializerFromInitParam(context);
+ FacesInitializer initializer = getFacesInitializerFromInitParam(context);
if (initializer == null)
{
- initializer = _getDefaultFacesInitializer(context);
+ initializer = new DefaultFacesInitilializer();
}
return initializer;
}
@@ -54,7 +53,7 @@ public class FacesInitializerFactory
* @param context
* @return
*/
- private static FacesInitializer _getFacesInitializerFromInitParam(ServletContext context)
+ private static FacesInitializer getFacesInitializerFromInitParam(ServletContext context)
{
String initializerClassName = context.getInitParameter(MyfacesConfig.FACES_INITIALIZER);
if (initializerClassName != null)
@@ -79,25 +78,4 @@ public class FacesInitializerFactory
}
return null;
}
-
- /**
- * Returns a FacesInitializer that fits for the current environment (JSP 2.0 or 2.1).
- * @param context
- * @return
- */
- private static FacesInitializer _getDefaultFacesInitializer(ServletContext context)
- {
- // No MyfacesConfig available yet, we must read the parameter directly:
- String initParameter = context.getInitParameter(MyfacesConfig.SUPPORT_JSP);
- if (StringUtils.isBlank(initParameter) || Boolean.TRUE.toString().equals(initParameter))
- {
- if (ClassUtils.simpleClassForName("jakarta.servlet.jsp.JspApplicationContext", false) != null)
- {
- return new JspFacesInitializer();
- }
- }
-
- return new FaceletsInitilializer();
- }
-
}
diff --git a/impl/src/main/java/org/apache/myfaces/webapp/JspFacesInitializer.java b/impl/src/main/java/org/apache/myfaces/webapp/JspFacesInitializer.java
deleted file mode 100644
index ca14fae..0000000
--- a/impl/src/main/java/org/apache/myfaces/webapp/JspFacesInitializer.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.webapp;
-
-import java.util.Iterator;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import jakarta.el.ExpressionFactory;
-import jakarta.faces.FactoryFinder;
-import jakarta.faces.context.ExternalContext;
-import jakarta.faces.event.PhaseListener;
-import jakarta.faces.lifecycle.LifecycleFactory;
-import jakarta.servlet.ServletContext;
-import jakarta.servlet.jsp.JspApplicationContext;
-import jakarta.servlet.jsp.JspFactory;
-import org.apache.myfaces.config.MyfacesConfig;
-
-import org.apache.myfaces.config.RuntimeConfig;
-import org.apache.myfaces.el.ResolverForJSPInitializer;
-import org.apache.myfaces.el.ELResolverBuilder;
-import org.apache.myfaces.el.ELResolverBuilderForJSP;
-import org.apache.myfaces.el.resolver.FacesCompositeELResolver;
-import org.apache.myfaces.el.resolver.FacesCompositeELResolver.Scope;
-import org.apache.myfaces.util.lang.ClassUtils;
-
-/**
- * Initializes MyFaces in a JSP 2.1 environment.
- *
- */
-public class JspFacesInitializer extends AbstractFacesInitializer
-{
- private static final Logger log = Logger.getLogger(JspFacesInitializer.class.getName());
-
- /**
- * Cached instance of the JspFactory to use.
- */
- private JspFactory jspFactory;
-
- @Override
- protected void initContainerIntegration(
- ServletContext servletContext, ExternalContext externalContext)
- {
- JspApplicationContext appCtx =
- getJspFactory().getJspApplicationContext(servletContext);
- appCtx.addELContextListener(new FacesELContextListener());
-
- // check for user-specified ExpressionFactory
- ExpressionFactory expressionFactory = getUserDefinedExpressionFactory(externalContext);
- if (expressionFactory == null)
- {
- expressionFactory = appCtx.getExpressionFactory();
- }
-
- RuntimeConfig runtimeConfig =
- buildConfiguration(servletContext, externalContext, expressionFactory);
-
- // configure the el resolver for jsp
- configureResolverForJSP(appCtx, runtimeConfig, externalContext);
- }
-
- protected JspFactory getJspFactory()
- {
- if (jspFactory == null)
- {
- // workaround for Tomcat
- // JspFactory.getDefaultFactory() will return null unless JspRuntimeContext was initialized
- try
- {
- ClassUtils.classForName("org.apache.jasper.compiler.JspRuntimeContext");
- }
- catch (ClassNotFoundException e)
- {
- // ignore
- }
- catch (Exception ex)
- {
- log.log(Level.FINE, "An unexpected exception occured "
- + "while loading the JspRuntimeContext.", ex);
- }
-
- jspFactory = JspFactory.getDefaultFactory();
- }
-
- return jspFactory;
- }
-
- /**
- * Sets the JspFactory to use. Currently, this method just simplifies
- * testing.
- *
- * @param jspFactory
- * the JspFactory to use
- */
- protected void setJspFactory(JspFactory jspFactory)
- {
- this.jspFactory = jspFactory;
- }
-
- /**
- * Register a phase listener to every lifecycle. This listener will lazy fill the el resolver for jsp as soon as the
- * first lifecycle is executed. This is necessarry to allow a faces application further setup after MyFaces has been
- * initialized. When the first request is processed no further configuation of the el resolvers is allowed.
- *
- * @param appCtx
- * @param runtimeConfig
- */
- private void configureResolverForJSP(JspApplicationContext appCtx, RuntimeConfig runtimeConfig,
- ExternalContext externalContext)
- {
- FacesCompositeELResolver facesCompositeELResolver = new FacesCompositeELResolver(Scope.JSP);
- appCtx.addELResolver(facesCompositeELResolver);
- PhaseListener resolverForJSPInitializer = new ResolverForJSPInitializer(
- createResolverBuilderForJSP(runtimeConfig, MyfacesConfig.getCurrentInstance(externalContext)),
- facesCompositeELResolver);
-
- LifecycleFactory factory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
- for (Iterator<String> iter = factory.getLifecycleIds(); iter.hasNext();)
- {
- factory.getLifecycle(iter.next()).addPhaseListener(resolverForJSPInitializer);
- }
- }
-
- protected ELResolverBuilder createResolverBuilderForJSP(RuntimeConfig runtimeConfig, MyfacesConfig myfacesConfig)
- {
- return new ELResolverBuilderForJSP(runtimeConfig, myfacesConfig);
- }
-}
diff --git a/impl/src/test/java/org/apache/myfaces/application/ViewIdSupportTest.java b/impl/src/test/java/org/apache/myfaces/application/ViewIdSupportTest.java
index ebaeaac..d945d20 100644
--- a/impl/src/test/java/org/apache/myfaces/application/ViewIdSupportTest.java
+++ b/impl/src/test/java/org/apache/myfaces/application/ViewIdSupportTest.java
@@ -25,6 +25,7 @@ import java.net.URL;
import org.apache.myfaces.test.base.junit.AbstractJsfTestCase;
import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
public class ViewIdSupportTest extends AbstractJsfTestCase
@@ -79,16 +80,6 @@ public class ViewIdSupportTest extends AbstractJsfTestCase
}
@Test
- public void testDeriveViewId1() throws Exception
- {
- request.setPathElements("/testwebapp", "/view1.jsf", null , null);
-
- String derivedViewId = viewHandlerSupport.deriveViewId(facesContext, "/view1.jsf");
-
- Assert.assertNotNull(derivedViewId);
- }
-
- @Test
public void testDeriveViewId2() throws Exception
{
request.setPathElements("/testwebapp", "/faces", "/view1.jsp" , null);
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/JSPXFaceletsProcessingTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/JSPXFaceletsProcessingTestCase.java
deleted file mode 100644
index fad9e45..0000000
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/compiler/JSPXFaceletsProcessingTestCase.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.compiler;
-
-import java.io.StringWriter;
-
-import jakarta.faces.component.UIForm;
-import jakarta.faces.component.UIOutput;
-import jakarta.faces.component.UIPanel;
-import jakarta.faces.component.UISelectItem;
-import jakarta.faces.component.UISelectOne;
-import jakarta.faces.component.UIViewRoot;
-import jakarta.faces.component.html.HtmlForm;
-import jakarta.faces.component.html.HtmlOutputText;
-import jakarta.faces.component.html.HtmlPanelGrid;
-import jakarta.faces.component.html.HtmlSelectOneMenu;
-
-import org.junit.Assert;
-
-import org.apache.myfaces.config.RuntimeConfig;
-import org.apache.myfaces.config.impl.element.FaceletsProcessingImpl;
-import org.apache.myfaces.renderkit.html.HtmlFormRenderer;
-import org.apache.myfaces.renderkit.html.HtmlGridRenderer;
-import org.apache.myfaces.renderkit.html.HtmlMenuRenderer;
-import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
-import org.apache.myfaces.test.mock.MockResponseWriter;
-import org.apache.myfaces.view.facelets.FaceletTestCase;
-import org.junit.Test;
-
-public class JSPXFaceletsProcessingTestCase extends FaceletTestCase {
-
- @Override
- protected void setupComponents() throws Exception
- {
- application.addComponent(UIViewRoot.COMPONENT_TYPE,
- UIViewRoot.class.getName());
- application.addComponent(HtmlForm.COMPONENT_TYPE,
- HtmlForm.class.getName());
- application.addComponent(HtmlPanelGrid.COMPONENT_TYPE,
- HtmlPanelGrid.class.getName());
- application.addComponent(HtmlSelectOneMenu.COMPONENT_TYPE,
- HtmlSelectOneMenu.class.getName());
- application.addComponent(UISelectItem.COMPONENT_TYPE,
- UISelectItem.class.getName());
- application.addComponent(HtmlOutputText.COMPONENT_TYPE,
- HtmlOutputText.class.getName());
- }
-
- @Override
- protected void setupRenderers() throws Exception
- {
- renderKit.addRenderer(UIForm.COMPONENT_FAMILY,
- "jakarta.faces.Form", new HtmlFormRenderer());
- renderKit.addRenderer(UIOutput.COMPONENT_FAMILY,
- "jakarta.faces.Text", new HtmlTextRenderer());
- renderKit.addRenderer(UISelectOne.COMPONENT_FAMILY,
- "jakarta.faces.Menu", new HtmlMenuRenderer());
- renderKit.addRenderer(UIPanel.COMPONENT_FAMILY,
- "jakarta.faces.Grid", new HtmlGridRenderer());
-
- }
-
-
-
- @Override
- protected void setUpExternalContext() throws Exception
- {
- super.setUpExternalContext();
-
- FaceletsProcessingImpl item = new FaceletsProcessingImpl();
- item.setFileExtension(".jspx");
- item.setProcessAs(FaceletsProcessingImpl.PROCESS_AS_JSPX);
- RuntimeConfig.getCurrentInstance(externalContext).addFaceletProcessingConfiguration(FaceletsProcessingImpl.PROCESS_AS_JSPX, item);
- }
-
- @Test
- public void testJSPXProcessing1() throws Exception
- {
- facesContext.getExternalContext().getRequestMap().put("rquote", "\"");
-
- UIViewRoot root = facesContext.getViewRoot();
- vdl.buildView(facesContext, root, "testJSPXProcessing1.jspx");
-
- StringWriter sw = new StringWriter();
- MockResponseWriter mrw = new MockResponseWriter(sw);
- facesContext.setResponseWriter(mrw);
-
- root.encodeAll(facesContext);
-
- sw.flush();
-
- String resp = sw.toString();
-
- Assert.assertFalse("Response contains DOCTYPE declaration", resp.contains("<!DOCTYPE"));
- Assert.assertFalse("Response contains xml declaration", resp.contains("<?xml"));
- Assert.assertFalse("Response contains xml processing instructions", resp.contains("<?name"));
- Assert.assertFalse("Response contains cdata section", resp.contains("<![CDATA["));
- Assert.assertTrue("Response does not contains cdata content", resp.contains("cdata not consumed"));
- Assert.assertTrue("Response does not escape characters", resp.contains("In this mode, if you put a double quote, it will NOT be replaced by " : \""));
- Assert.assertFalse("Response contains comments", resp.contains("<!--"));
- Assert.assertTrue("Response should escape EL but not markup", resp.contains("Check EL Escaping " : \""));
-
- }
-}
diff --git a/impl/src/test/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguageTest.java b/impl/src/test/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguageTest.java
deleted file mode 100644
index ed314d4..0000000
--- a/impl/src/test/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguageTest.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * 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.jsp;
-
-import java.io.IOException;
-
-import jakarta.faces.component.UIViewRoot;
-import jakarta.faces.context.FacesContext;
-
-import org.apache.myfaces.test.base.junit.AbstractJsfTestCase;
-import org.junit.Assert;
-
-/**
- * Test class for JspViewDeclarationLanguage.
- *
- * @author Jakob Korherr (latest modification by $Author$)
- * @version $Revision$ $Date$
- */
-public class JspViewDeclarationLanguageTest extends AbstractJsfTestCase
-{
-
- private TrackingJspViewDeclarationLanguage jspVdl;
-
- @Override
- public void setUp() throws Exception
- {
- super.setUp();
-
- jspVdl = new TrackingJspViewDeclarationLanguage();
- }
-
- @Override
- public void tearDown() throws Exception
- {
- jspVdl = null;
-
- super.tearDown();
- }
-
- /**
- * Tests if renderView() implicitly calls buildView() if there was no call
- * to buildView() for the given UIViewRoot yet. This is needed in order to
- * support legacy ViewHandlers which return null on getViewDeclarationLanguage()
- * and thus vdl.buildView() was not called yet when renderView() is invoked.
- */
- public void testBuildViewCalledBeforeViewRendered()
- {
- try
- {
- jspVdl.renderView(facesContext, facesContext.getViewRoot());
- }
- catch (Exception e)
- {
- // we're not testing the real behavior here, so Exceptions may occur
- }
-
- // assert that buildView() was implicitly called once (by renderView())
- Assert.assertEquals(1, jspVdl._buildViewCalled);
- }
-
- /**
- * Tests if buildView() is not called twice if it has already been called
- * before renderView() is invoked.
- * This test is related to testBuildViewCalledBeforeViewRendered.
- */
- public void testBuildViewNotCalledTwiceInRenderView()
- {
- try
- {
- jspVdl.buildView(facesContext, facesContext.getViewRoot());
- }
- catch (Exception e)
- {
- // we're not testing the real behavior here, so Exceptions may occur
- }
- try
- {
- jspVdl.renderView(facesContext, facesContext.getViewRoot());
- }
- catch (Exception e)
- {
- // we're not testing the real behavior here, so Exceptions may occur
- }
-
- // assert that buildView() was only called once
- Assert.assertEquals(1, jspVdl._buildViewCalled);
- }
-
- /**
- * Tests if the direct/implicit calls to builView() work correctly
- * for different views.
- * This test is related to testBuildViewCalledBeforeViewRendered
- * and testBuildViewNotCalledTwiceInRenderView.
- */
- public void testBuildViewRenderViewContractForDifferentViews()
- {
- UIViewRoot firstView = facesContext.getViewRoot();
- UIViewRoot secondView = new UIViewRoot();
-
- try
- {
- jspVdl.buildView(facesContext, firstView);
- }
- catch (Exception e)
- {
- // we're not testing the real behavior here, so Exceptions may occur
- }
- try
- {
- jspVdl.renderView(facesContext, firstView);
- }
- catch (Exception e)
- {
- // we're not testing the real behavior here, so Exceptions may occur
- }
- try
- {
- jspVdl.renderView(facesContext, secondView);
- }
- catch (Exception e)
- {
- // we're not testing the real behavior here, so Exceptions may occur
- }
-
- // assert that buildView() was called twice:
- // the first time directly by jspVdl.buildView() for firstView
- // the second time implicitly by jspVdl.renderView() for secondView
- Assert.assertEquals(2, jspVdl._buildViewCalled);
- }
-
-
- /**
- * Extends JspViewDeclarationLanguage to count the calls to buildView().
- *
- * @author Jakob Korherr
- */
- private class TrackingJspViewDeclarationLanguage extends JspViewDeclarationLanguage
- {
-
- private int _buildViewCalled = 0;
-
- @Override
- public void buildView(FacesContext context, UIViewRoot view)
- throws IOException
- {
- _buildViewCalled++;
-
- super.buildView(context, view);
- }
-
- }
-
-}
diff --git a/impl/src/test/java/org/apache/myfaces/webapp/JspFacesInitializerTest.java b/impl/src/test/java/org/apache/myfaces/webapp/JspFacesInitializerTest.java
deleted file mode 100644
index 606c0b4..0000000
--- a/impl/src/test/java/org/apache/myfaces/webapp/JspFacesInitializerTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.webapp;
-
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.isA;
-
-import jakarta.el.ExpressionFactory;
-import jakarta.faces.webapp.FacesServlet;
-import jakarta.servlet.ServletContext;
-import jakarta.servlet.jsp.JspApplicationContext;
-import jakarta.servlet.jsp.JspFactory;
-
-import org.apache.myfaces.config.RuntimeConfig;
-import org.apache.myfaces.el.resolver.FacesCompositeELResolver;
-import org.apache.myfaces.test.base.junit.AbstractJsfTestCase;
-import org.easymock.IAnswer;
-import org.easymock.classextension.EasyMock;
-import org.easymock.classextension.IMocksControl;
-
-/**
- * @author Mathias Broekelmann (latest modification by $Author$)
- * @version $Revision$ $Date$
- */
-public class JspFacesInitializerTest extends AbstractJsfTestCase
-{
- /**
- * Test method for {@link org.apache.myfaces.webapp.DefaultFacesInitializer#initFaces(jakarta.servlet.ServletContext)}.
- * @throws Exception
- */
- public void testInitFaces() throws Exception
- {
- // TODO adapt this test case for MyFaces 2.0, because currently it checks nothing!
-
- JspFacesInitializer initializer = new JspFacesInitializer();
- IMocksControl control = EasyMock.createControl();
-
- JspFactory jspFactory = control.createMock(JspFactory.class);
- initializer.setJspFactory(jspFactory);
-
- RuntimeConfig runtimeConfig = control.createMock(RuntimeConfig.class);
-
- ServletContext context = control.createMock(ServletContext.class);
- ExpressionFactory expressionFactory = control.createMock(ExpressionFactory.class);
- runtimeConfig.setExpressionFactory(expressionFactory);
-
- expect(context.getAttribute(eq(RuntimeConfig.class.getName()))).andReturn(runtimeConfig).anyTimes();
-
- expect(context.getInitParameter(eq(FacesServlet.CONFIG_FILES_ATTR))).andReturn(null);
- expect(context.getResourceAsStream(eq("/WEB-INF/faces-config.xml"))).andReturn(null);
- expect(context.getInitParameter(eq(FacesServlet.LIFECYCLE_ID_ATTR))).andReturn(null);
- expect(context.getServletRegistrations()).andReturn(null);
-
- // TODO: add myfaces specific tests
- expect(context.getResource(isA(String.class))).andReturn(null);
- expect(context.getResourceAsStream(isA(String.class))).andReturn(null);
- expect(context.getInitParameter(isA(String.class))).andReturn(null).anyTimes();
- expect(context.getAttribute(isA(String.class))).andReturn(null).anyTimes();
- context.setAttribute(isA(String.class), anyObject());
- expectLastCall().anyTimes();
- expect(context.getRealPath(isA(String.class))).andAnswer(new IAnswer<String>() {
- public String answer() throws Throwable
- {
- return (String) org.easymock.EasyMock.getCurrentArguments()[0];
- }
- });
-
- JspApplicationContext jspAppCtx = control.createMock(JspApplicationContext.class);
- expect(jspAppCtx.getExpressionFactory()).andReturn(expressionFactory);
- jspAppCtx.addELContextListener(isA(FacesELContextListener.class));
- expect(jspFactory.getJspApplicationContext(eq(context))).andReturn(jspAppCtx);
- jspAppCtx.addELResolver(isA(FacesCompositeELResolver.class));
-
- control.replay();
- initializer.initFaces(context);
-
- // In MYFACES-1222: The Jsp21FacesInitializer isn't practicable anymore.
- // The ServletContext-Mock won't return its WebXml instance, so Jsp21FacesInitializer will stop initializing.
- // This is why the next line is commented:
-
- //control.verify();
- }
-
-}
diff --git a/parent/pom.xml b/parent/pom.xml
index c4a0cbe..46e7843 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -350,12 +350,6 @@
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-jsp-api</artifactId>
- <version>10.0.0-M4</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-websocket-api</artifactId>
<version>10.0.0-M9</version>
<scope>provided</scope>
diff --git a/test/pom.xml b/test/pom.xml
index 0f614f8..9a56c85 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -57,10 +57,6 @@
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-el-api</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-jsp-api</artifactId>
- </dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>