Merge pull request #203 from apache/dependabot/github_actions/actions/cache-v2.1.5
Bump actions/cache from v2.1.4 to v2.1.5
diff --git a/api/pom.xml b/api/pom.xml
index 63e156d..31c19ec 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -237,10 +237,7 @@
<sourceDirectory>src/main/javascript/META-INF/resources</sourceDirectory>
<sources>
<source>../../../../test/javascript/org/apache/myfaces/mockups/BrowserMockups.js</source>
- <!--
- <source>jakarta/faces/_util/OpenAjax.js</source>
- -->
- <source>jakarta/faces/_util/_JSF2Utils.js</source>
+ <source>jakarta/faces/_util/_FacesUtils.js</source>
<source>jakarta/faces/ajax/Ajax.js</source>
<source>../../../../test/javascript/org/apache/myfaces/test/_TestScenario.js</source>
</sources>
@@ -252,7 +249,7 @@
<type>TESTSUITES</type>
<includes>
<include>test/MockupTest.js</include>
- <include>utils/_JSF2UtilsTests.js</include>
+ <include>utils/_FacesUtilsTests.js</include>
<include>ajax/AjaxTests.js</include>
</includes>
</testSuite>
diff --git a/api/src/main/java/jakarta/faces/FactoryFinder.java b/api/src/main/java/jakarta/faces/FactoryFinder.java
index c03a445..81655f8 100755
--- a/api/src/main/java/jakarta/faces/FactoryFinder.java
+++ b/api/src/main/java/jakarta/faces/FactoryFinder.java
@@ -131,13 +131,13 @@
if (classLoader == null)
{
- throw new FacesException("jsf api class loader cannot be identified", null);
+ throw new FacesException("faces-api ClassLoader cannot be identified", null);
}
MYFACES_CLASSLOADER = classLoader;
}
catch (Exception e)
{
- throw new FacesException("jsf api class loader cannot be identified", e);
+ throw new FacesException("faces-api ClassLoader cannot be identified", e);
}
}
diff --git a/api/src/main/java/jakarta/faces/annotation/ApplicationMap.java b/api/src/main/java/jakarta/faces/annotation/ApplicationMap.java
index 86e683a..eef6a52 100644
--- a/api/src/main/java/jakarta/faces/annotation/ApplicationMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/ApplicationMap.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package jakarta.faces.annotation;
import java.lang.annotation.ElementType;
diff --git a/api/src/main/java/jakarta/faces/annotation/FacesConfig.java b/api/src/main/java/jakarta/faces/annotation/FacesConfig.java
index 97e87b8..7f292cc 100644
--- a/api/src/main/java/jakarta/faces/annotation/FacesConfig.java
+++ b/api/src/main/java/jakarta/faces/annotation/FacesConfig.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package jakarta.faces.annotation;
import java.lang.annotation.ElementType;
diff --git a/api/src/main/java/jakarta/faces/annotation/FlowMap.java b/api/src/main/java/jakarta/faces/annotation/FlowMap.java
index 599ac2a..2990186 100644
--- a/api/src/main/java/jakarta/faces/annotation/FlowMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/FlowMap.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package jakarta.faces.annotation;
import java.lang.annotation.ElementType;
diff --git a/api/src/main/java/jakarta/faces/annotation/HeaderMap.java b/api/src/main/java/jakarta/faces/annotation/HeaderMap.java
index 3e68415..9a7cfc4 100644
--- a/api/src/main/java/jakarta/faces/annotation/HeaderMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/HeaderMap.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package jakarta.faces.annotation;
import java.lang.annotation.ElementType;
diff --git a/api/src/main/java/jakarta/faces/annotation/HeaderValuesMap.java b/api/src/main/java/jakarta/faces/annotation/HeaderValuesMap.java
index e0169a8..9cfa3f1 100644
--- a/api/src/main/java/jakarta/faces/annotation/HeaderValuesMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/HeaderValuesMap.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package jakarta.faces.annotation;
import java.lang.annotation.ElementType;
diff --git a/api/src/main/java/jakarta/faces/annotation/InitParameterMap.java b/api/src/main/java/jakarta/faces/annotation/InitParameterMap.java
index ec8cd22..1f758eb 100644
--- a/api/src/main/java/jakarta/faces/annotation/InitParameterMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/InitParameterMap.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package jakarta.faces.annotation;
import java.lang.annotation.ElementType;
diff --git a/api/src/main/java/jakarta/faces/annotation/ManagedProperty.java b/api/src/main/java/jakarta/faces/annotation/ManagedProperty.java
index b0f3524..b1cf4d2 100644
--- a/api/src/main/java/jakarta/faces/annotation/ManagedProperty.java
+++ b/api/src/main/java/jakarta/faces/annotation/ManagedProperty.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package jakarta.faces.annotation;
import java.lang.annotation.ElementType;
diff --git a/api/src/main/java/jakarta/faces/annotation/RequestCookieMap.java b/api/src/main/java/jakarta/faces/annotation/RequestCookieMap.java
index 50d27c6..4f7be6e 100644
--- a/api/src/main/java/jakarta/faces/annotation/RequestCookieMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/RequestCookieMap.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package jakarta.faces.annotation;
import java.lang.annotation.ElementType;
diff --git a/api/src/main/java/jakarta/faces/annotation/RequestMap.java b/api/src/main/java/jakarta/faces/annotation/RequestMap.java
index 4feb92b..dcd436f 100644
--- a/api/src/main/java/jakarta/faces/annotation/RequestMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/RequestMap.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package jakarta.faces.annotation;
import java.lang.annotation.ElementType;
diff --git a/api/src/main/java/jakarta/faces/annotation/RequestParameterMap.java b/api/src/main/java/jakarta/faces/annotation/RequestParameterMap.java
index 6b6fdd3..2b67d05 100644
--- a/api/src/main/java/jakarta/faces/annotation/RequestParameterMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/RequestParameterMap.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package jakarta.faces.annotation;
import java.lang.annotation.ElementType;
diff --git a/api/src/main/java/jakarta/faces/annotation/RequestParameterValuesMap.java b/api/src/main/java/jakarta/faces/annotation/RequestParameterValuesMap.java
index 560dd80..07c72d2 100644
--- a/api/src/main/java/jakarta/faces/annotation/RequestParameterValuesMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/RequestParameterValuesMap.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package jakarta.faces.annotation;
import java.lang.annotation.ElementType;
diff --git a/api/src/main/java/jakarta/faces/annotation/SessionMap.java b/api/src/main/java/jakarta/faces/annotation/SessionMap.java
index d852382..2c25148 100644
--- a/api/src/main/java/jakarta/faces/annotation/SessionMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/SessionMap.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package jakarta.faces.annotation;
import java.lang.annotation.ElementType;
diff --git a/api/src/main/java/jakarta/faces/annotation/ViewMap.java b/api/src/main/java/jakarta/faces/annotation/ViewMap.java
index e8c9e74..bece280 100644
--- a/api/src/main/java/jakarta/faces/annotation/ViewMap.java
+++ b/api/src/main/java/jakarta/faces/annotation/ViewMap.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package jakarta.faces.annotation;
import java.lang.annotation.ElementType;
diff --git a/api/src/main/java/jakarta/faces/application/ResourceHandler.java b/api/src/main/java/jakarta/faces/application/ResourceHandler.java
index 68edffd..c528a69 100644
--- a/api/src/main/java/jakarta/faces/application/ResourceHandler.java
+++ b/api/src/main/java/jakarta/faces/application/ResourceHandler.java
@@ -60,12 +60,24 @@
/**
* @since 2.3
*/
+ @Deprecated
public static final String JSF_SCRIPT_RESOURCE_NAME = "faces.js";
/**
* @since 2.3
*/
+ @Deprecated
public static final String JSF_SCRIPT_LIBRARY_NAME = "jakarta.faces";
+
+ /**
+ * @since 4.0
+ */
+ public static final String FACES_SCRIPT_RESOURCE_NAME = "faces.js";
+
+ /**
+ * @since 4.0
+ */
+ public static final String FACES_SCRIPT_LIBRARY_NAME = "jakarta.faces";
private final static String RENDERED_RESOURCES_SET = "org.apache.myfaces.RENDERED_RESOURCES_SET";
diff --git a/api/src/main/java/jakarta/faces/component/UIData.java b/api/src/main/java/jakarta/faces/component/UIData.java
index a431418..a1bbbc8 100644
--- a/api/src/main/java/jakarta/faces/component/UIData.java
+++ b/api/src/main/java/jakarta/faces/component/UIData.java
@@ -52,10 +52,8 @@
import jakarta.faces.model.DataModel;
import jakarta.faces.model.IterableDataModel;
import jakarta.faces.model.ListDataModel;
-import jakarta.faces.model.ResultDataModel;
import jakarta.faces.model.ResultSetDataModel;
import jakarta.faces.model.ScalarDataModel;
-import jakarta.servlet.jsp.jstl.sql.Result;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFacet;
@@ -1984,10 +1982,6 @@
{
return new ResultSetDataModel((ResultSet) value);
}
- else if (value instanceof Result)
- {
- return new ResultDataModel((Result) value);
- }
else if (value instanceof Iterable)
{
return new IterableDataModel<>((Iterable<?>) value);
@@ -2019,8 +2013,8 @@
* </p>
* <ul>
* <li>A value of type DataModel is used directly.</li>
- * <li>Array-like parameters of type array-of-Object, java.util.List, java.sql.ResultSet or
- * jakarta.servlet.jsp.jstl.sql.Result are wrapped in a corresponding DataModel that knows how to iterate over the
+ * <li>Array-like parameters of type array-of-Object, java.util.List or java.sql.ResultSet
+ * are wrapped in a corresponding DataModel that knows how to iterate over the
* elements.</li>
* <li>Other values are wrapped in a DataModel as a single row.</li>
* </ul>
diff --git a/api/src/main/java/jakarta/faces/model/ResultDataModel.java b/api/src/main/java/jakarta/faces/model/ResultDataModel.java
deleted file mode 100755
index d297bd2..0000000
--- a/api/src/main/java/jakarta/faces/model/ResultDataModel.java
+++ /dev/null
@@ -1,139 +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 jakarta.faces.model;
-
-import java.util.SortedMap;
-
-import jakarta.servlet.jsp.jstl.sql.Result;
-
-/**
- * see Javadoc of <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a>
- */
-public class ResultDataModel extends DataModel<SortedMap<String, Object>>
-{
- // FIELDS
- private int _rowIndex = -1;
- private Result _data;
-
- // CONSTRUCTORS
- public ResultDataModel()
- {
- super();
- }
-
- public ResultDataModel(Result result)
- {
- if (result == null)
- {
- throw new NullPointerException("result");
- }
- setWrappedData(result);
- }
-
- // METHODS
- @Override
- public int getRowCount()
- {
- if (getRows() == null)
- {
- return -1;
- }
- return getRows().length;
- }
-
- @Override
- public SortedMap<String, Object> getRowData()
- {
- if (getRows() == null)
- {
- return null;
- }
- if (!isRowAvailable())
- {
- throw new IllegalArgumentException("row is unavailable");
- }
- return getRows()[_rowIndex];
- }
-
- @Override
- public int getRowIndex()
- {
- return _rowIndex;
- }
-
- @Override
- public Object getWrappedData()
- {
- return _data;
- }
-
- @Override
- public boolean isRowAvailable()
- {
- return getRows() != null && _rowIndex >= 0 && _rowIndex < getRows().length;
- }
-
- @Override
- public void setRowIndex(int rowIndex)
- {
- if (rowIndex < -1)
- {
- throw new IllegalArgumentException("illegal rowIndex " + rowIndex);
- }
- int oldRowIndex = _rowIndex;
- _rowIndex = rowIndex;
- if (getRows() != null && oldRowIndex != _rowIndex)
- {
- SortedMap<String, Object> data = isRowAvailable() ? getRowData() : null;
- DataModelEvent event = new DataModelEvent(this, _rowIndex, data);
- DataModelListener[] listeners = getDataModelListeners();
- for (int i = 0; i < listeners.length; i++)
- {
- listeners[i].rowSelected(event);
- }
- }
- }
-
- private SortedMap<String, Object>[] getRows()
- {
- if (_data == null)
- {
- return null;
- }
-
- return _data.getRows();
- }
-
- @Override
- public void setWrappedData(Object data)
- {
- if (data == null)
- {
- setRowIndex(-1);
- _data = null;
- }
- else
- {
- _data = ((Result)data);
- _rowIndex = -1;
- setRowIndex(0);
- }
- }
-
-}
diff --git a/api/src/main/java/jakarta/faces/webapp/PreJsf2ExceptionHandlerFactory.java b/api/src/main/java/jakarta/faces/webapp/PreJsf2ExceptionHandlerFactory.java
deleted file mode 100644
index 3fa0d60..0000000
--- a/api/src/main/java/jakarta/faces/webapp/PreJsf2ExceptionHandlerFactory.java
+++ /dev/null
@@ -1,292 +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 jakarta.faces.webapp;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.Queue;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import jakarta.el.ELException;
-import jakarta.faces.FacesException;
-import jakarta.faces.application.FacesMessage;
-import jakarta.faces.component.UIComponent;
-import jakarta.faces.component.UpdateModelException;
-import jakarta.faces.context.ExceptionHandler;
-import jakarta.faces.context.ExceptionHandlerFactory;
-import jakarta.faces.event.AbortProcessingException;
-import jakarta.faces.event.ExceptionQueuedEvent;
-import jakarta.faces.event.ExceptionQueuedEventContext;
-import jakarta.faces.event.SystemEvent;
-
-/**
- * @since 2.0
- */
-public class PreJsf2ExceptionHandlerFactory extends ExceptionHandlerFactory
-{
-
- public PreJsf2ExceptionHandlerFactory()
- {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ExceptionHandler getExceptionHandler()
- {
- return new PreJsf2ExceptionHandlerImpl();
- }
-
- private static class PreJsf2ExceptionHandlerImpl extends ExceptionHandler
- {
- /*
- * PLEASE NOTE!!!
- * This is a copy of the ExceptionHandler implementation of myfaces-impl
- * (org.apache.myfaces.context.ExceptionHandlerImpl), only handle() differs a bit.
- * Any changes made here should also be applied to ExceptionHandlerImpl in the right way.
- *
- * This is really ugly, but I think we have to do this due to the fact that PreJsf2ExceptionHandlerFactory
- * can be declared directly as an exception handler factory, so it's not as if we can make the methods
- * in the factory abstract and have a concrete impl in the impl project (and therefore be able to
- * extend ExceptionHandlerImpl). If this is not the case, please change accordingly.
- */
-
- private static final Logger log = Logger.getLogger(PreJsf2ExceptionHandlerImpl.class.getName());
-
- private Queue<ExceptionQueuedEvent> handled;
- private Queue<ExceptionQueuedEvent> unhandled;
- private ExceptionQueuedEvent handledAndThrown;
-
- public PreJsf2ExceptionHandlerImpl()
- {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ExceptionQueuedEvent getHandledExceptionQueuedEvent()
- {
- return handledAndThrown;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Iterable<ExceptionQueuedEvent> getHandledExceptionQueuedEvents()
- {
- return handled == null ? Collections.<ExceptionQueuedEvent>emptyList() : handled;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Throwable getRootCause(Throwable t)
- {
- if (t == null)
- {
- throw new NullPointerException("t");
- }
-
- while (t != null)
- {
- Class<?> clazz = t.getClass();
- if (!clazz.equals(FacesException.class) && !clazz.equals(ELException.class))
- {
- return t;
- }
-
- t = t.getCause();
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Iterable<ExceptionQueuedEvent> getUnhandledExceptionQueuedEvents()
- {
- return unhandled == null ? Collections.<ExceptionQueuedEvent>emptyList() : unhandled;
- }
-
- /**
- * {@inheritDoc}
- *
- * Differs from ExceptionHandlerImpl.handle() in three points:
- * - Any exceptions thrown before or after phase execution will be logged and swallowed.
- * - If the Exception is an instance of UpdateModelException, extract the
- * FacesMessage from the UpdateModelException.
- * Log a SEVERE message to the log and queue the FacesMessage on the
- * FacesContext, using the clientId of the source
- * component in a call to FacesContext.addMessage(java.lang.String, jakarta.faces.application.FacesMessage).
- * - Checks org.apache.myfaces.ERROR_HANDLER for backwards compatibility to myfaces-1.2's error handling
- */
- @Override
- public void handle() throws FacesException
- {
- if (unhandled != null && !unhandled.isEmpty())
- {
- if (handled == null)
- {
- handled = new LinkedList<ExceptionQueuedEvent>();
- }
-
- FacesException toThrow = null;
-
- do
- {
- // For each ExceptionEvent in the list
-
- // get the event to handle
- ExceptionQueuedEvent event = unhandled.peek();
- try
- {
- // call its getContext() method
- ExceptionQueuedEventContext context = event.getContext();
-
- // and call getException() on the returned result
- Throwable exception = context.getException();
-
- // spec described behaviour of PreJsf2ExceptionHandler
-
- // UpdateModelException needs special treatment here
- if (exception instanceof UpdateModelException)
- {
- FacesMessage message = ((UpdateModelException) exception).getFacesMessage();
- // Log a SEVERE message to the log
- log.log(Level.SEVERE, message.getSummary(), exception.getCause());
- // queue the FacesMessage on the FacesContext
- UIComponent component = context.getComponent();
- String clientId = null;
- if (component != null)
- {
- clientId = component.getClientId(context.getContext());
- }
- context.getContext().addMessage(clientId, message);
- }
- else if (!shouldSkip(exception) && !context.inBeforePhase() && !context.inAfterPhase())
- {
- // set handledAndThrown so that getHandledExceptionQueuedEvent() returns this event
- handledAndThrown = event;
-
- // Re-wrap toThrow in a ServletException or
- // (PortletException, if in a portlet environment)
- // and throw it
- // FIXME: The spec says to NOT use a FacesException
- // to propagate the exception, but I see
- // no other way as ServletException is not a RuntimeException
- toThrow = wrap(getRethrownException(exception));
- break;
- }
- else
- {
- // Testing mojarra it logs a message and the exception
- // however, this behaviour is not mentioned in the spec
- log.log(Level.SEVERE, exception.getClass().getName() + " occured while processing " +
- (context.inBeforePhase() ? "beforePhase() of " :
- (context.inAfterPhase() ? "afterPhase() of " : "")) +
- "phase " + context.getPhaseId() + ": " +
- "UIComponent-ClientId=" +
- (context.getComponent() != null ?
- context.getComponent().getClientId(context.getContext()) : "") + ", " +
- "Message=" + exception.getMessage());
-
- log.log(Level.SEVERE, exception.getMessage(), exception);
- }
- }
- catch (Throwable t)
- {
- // A FacesException must be thrown if a problem occurs while performing
- // the algorithm to handle the exception
- throw new FacesException("Could not perform the algorithm to handle the Exception", t);
- }
- finally
- {
- // if we will throw the Exception or if we just logged it,
- // we handled it in either way --> add to handled
- handled.add(event);
- unhandled.remove(event);
- }
- } while (!unhandled.isEmpty());
-
- // do we have to throw an Exception?
- if (toThrow != null)
- {
- throw toThrow;
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isListenerForSource(Object source)
- {
- return source instanceof ExceptionQueuedEventContext;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void processEvent(SystemEvent exceptionQueuedEvent) throws AbortProcessingException
- {
- if (unhandled == null)
- {
- unhandled = new LinkedList<ExceptionQueuedEvent>();
- }
-
- unhandled.add((ExceptionQueuedEvent)exceptionQueuedEvent);
- }
-
- protected Throwable getRethrownException(Throwable exception)
- {
- // Let toRethrow be either the result of calling getRootCause() on the Exception,
- // or the Exception itself, whichever is non-null
- Throwable toRethrow = getRootCause(exception);
- if (toRethrow == null)
- {
- toRethrow = exception;
- }
-
- return toRethrow;
- }
-
- protected FacesException wrap(Throwable exception)
- {
- if (exception instanceof FacesException)
- {
- return (FacesException) exception;
- }
- return new FacesException(exception);
- }
-
- protected boolean shouldSkip(Throwable exception)
- {
- return exception instanceof AbortProcessingException;
- }
- }
-}
diff --git a/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/faces-uncompressed.js b/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/faces-uncompressed.js
index 5568448..d0f7ae6 100644
--- a/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/faces-uncompressed.js
+++ b/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/faces-uncompressed.js
@@ -38,7 +38,6 @@
_ls("#{resource['org.apache.myfaces.core.impl.util:_HtmlStripper.js']}", null, null, "UTF-8", false);
_ls("#{resource['org.apache.myfaces.core.impl.util:_OamSubmit.js']}", null, null, "UTF-8", false);
- //_ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_FinalizeableObj.js']}", null, null, "UTF-8", false);
_ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_AjaxUtils.js']}", null, null, "UTF-8", false);
_ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_AjaxRequestQueue.js']}", null, null, "UTF-8", false);
@@ -54,4 +53,4 @@
_ls("#{resource['org.apache.myfaces.core.impl.core:_EndImpl.js']}", null, null, "UTF-8", false);
_ls("#{resource['org.apache.myfaces.core.api:faces.js']}", null, null, "UTF-8", false);
-}
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/api/src/main/javascript/META-INF/resources/myfaces/api/faces.js b/api/src/main/javascript/META-INF/resources/myfaces/api/faces.js
index 82d17df..bc78478 100644
--- a/api/src/main/javascript/META-INF/resources/myfaces/api/faces.js
+++ b/api/src/main/javascript/META-INF/resources/myfaces/api/faces.js
@@ -16,7 +16,7 @@
*/
/**
- *MyFaces core javascripting libraries
+ * MyFaces core javascripting libraries
*
* Those are the central public API functions in the Faces2
* Ajax API! They handle the entire form submit and ajax send
@@ -24,13 +24,6 @@
*/
/**
- * reserve the root namespace
- */
-if ('undefined' != typeof OpenAjax && ('undefined' == typeof faces || null == typeof faces)) {
- OpenAjax.hub.registerLibrary("faces", "www.sun.com", "1.0", null);
-}
-//just in case openajax has failed (testing environment)
-/**
* @ignore
*/
if (!window.faces) {
diff --git a/api/src/test/javascript/org/apache/myfaces/_utils/_JSF2UtilsTests.js b/api/src/test/javascript/org/apache/myfaces/_utils/_FacesUtilsTests.js
similarity index 100%
rename from api/src/test/javascript/org/apache/myfaces/_utils/_JSF2UtilsTests.js
rename to api/src/test/javascript/org/apache/myfaces/_utils/_FacesUtilsTests.js
diff --git a/api/src/test/javascript/org/apache/myfaces/mockups/BrowserMockups.js b/api/src/test/javascript/org/apache/myfaces/mockups/BrowserMockups.js
index 23dab53..0198215 100644
--- a/api/src/test/javascript/org/apache/myfaces/mockups/BrowserMockups.js
+++ b/api/src/test/javascript/org/apache/myfaces/mockups/BrowserMockups.js
@@ -154,7 +154,7 @@
this.appendData = function(/*Object*/ dataVar) {
this._data = dataVar;
- this.data = this._data.join("");
+ this.data = this._data.join("");
};
@@ -231,40 +231,7 @@
};
-
-
if('undefined' == typeof jakarta || null == jakarta) {
var jakarta = new Object();
document.jakarta = jakarta;
}
-
-if('undefined' == typeof org || null == org) {
- var org = new Object();
- document.org = org;
-}
-
-
-
-
-/**
- * we have to emulate openajax as well since
- * it ties the namespaces to the windows explicitely
- * we tie them simply into an array
- * and get the same behavior
- */
-var OpenAjax = new Object();
-
-OpenAjax.hub = new Object();
-
-OpenAjax.hub.registerLibrary = function(prefix, nsURL, version, extra) {
- var namespaces = prefix.split(".");
-
- var root = document;
- for(var cnt = 0; cnt < namespaces.length; cnt ++) {
- var curVal = namespaces[cnt];
- if('undefined' == root[curVal] || null == root[curVal]) {
- root[curVal] = new Object();
- }
- root = root[curVal];
- }
-}
diff --git a/impl/src/main/java/org/apache/myfaces/application/ActionListenerImpl.java b/impl/src/main/java/org/apache/myfaces/application/ActionListenerImpl.java
index 7e95f24..44a5c26 100755
--- a/impl/src/main/java/org/apache/myfaces/application/ActionListenerImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/application/ActionListenerImpl.java
@@ -75,10 +75,11 @@
UIViewRoot root = facesContext.getViewRoot();
ViewPoolProcessor processor = ViewPoolProcessor.getInstance(facesContext);
ViewPool pool = (processor != null) ? processor.getViewPool(facesContext, root) : null;
- if (pool != null && pool.isDeferredNavigationEnabled() &&
- processor.isViewPoolStrategyAllowedForThisView(facesContext, root) &&
- (PhaseId.INVOKE_APPLICATION.equals(facesContext.getCurrentPhaseId()) ||
- PhaseId.APPLY_REQUEST_VALUES.equals(facesContext.getCurrentPhaseId())) )
+ if (pool != null
+ && pool.isDeferredNavigationEnabled()
+ && processor.isViewPoolStrategyAllowedForThisView(facesContext, root)
+ && (PhaseId.INVOKE_APPLICATION.equals(facesContext.getCurrentPhaseId())
+ || PhaseId.APPLY_REQUEST_VALUES.equals(facesContext.getCurrentPhaseId())))
{
NavigationHandler navigationHandler = application.getNavigationHandler();
if (navigationHandler instanceof ConfigurableNavigationHandler)
diff --git a/impl/src/main/java/org/apache/myfaces/cdi/JsfApplicationArtifactHolder.java b/impl/src/main/java/org/apache/myfaces/cdi/FacesApplicationArtifactHolder.java
similarity index 96%
rename from impl/src/main/java/org/apache/myfaces/cdi/JsfApplicationArtifactHolder.java
rename to impl/src/main/java/org/apache/myfaces/cdi/FacesApplicationArtifactHolder.java
index af32c7e..56c09aa 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/JsfApplicationArtifactHolder.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/FacesApplicationArtifactHolder.java
@@ -26,7 +26,7 @@
* used to ensure a valid FacesContext instance is passed when the bean is destroyed.
*/
@ApplicationScoped
-public class JsfApplicationArtifactHolder
+public class FacesApplicationArtifactHolder
{
private ServletContext servletContext;
diff --git a/impl/src/main/java/org/apache/myfaces/cdi/JsfApplicationArtifactHolderExtension.java b/impl/src/main/java/org/apache/myfaces/cdi/FacesApplicationArtifactHolderExtension.java
similarity index 89%
rename from impl/src/main/java/org/apache/myfaces/cdi/JsfApplicationArtifactHolderExtension.java
rename to impl/src/main/java/org/apache/myfaces/cdi/FacesApplicationArtifactHolderExtension.java
index 5db5898..e9db6fb 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/JsfApplicationArtifactHolderExtension.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/FacesApplicationArtifactHolderExtension.java
@@ -24,12 +24,12 @@
import jakarta.enterprise.inject.spi.BeforeBeanDiscovery;
import jakarta.enterprise.inject.spi.Extension;
-public class JsfApplicationArtifactHolderExtension implements Extension
+public class FacesApplicationArtifactHolderExtension implements Extension
{
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event, BeanManager beanManager)
{
AnnotatedType jsfApplicationArtifactHolder =
- beanManager.createAnnotatedType(JsfApplicationArtifactHolder.class);
+ beanManager.createAnnotatedType(FacesApplicationArtifactHolder.class);
event.addAnnotatedType(jsfApplicationArtifactHolder, jsfApplicationArtifactHolder.getJavaClass().getName());
}
}
diff --git a/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactFlowMapProducer.java b/impl/src/main/java/org/apache/myfaces/cdi/FacesArtifactFlowMapProducer.java
similarity index 93%
rename from impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactFlowMapProducer.java
rename to impl/src/main/java/org/apache/myfaces/cdi/FacesArtifactFlowMapProducer.java
index 4b6a423..46dcb85 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactFlowMapProducer.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/FacesArtifactFlowMapProducer.java
@@ -30,14 +30,14 @@
import org.apache.myfaces.cdi.util.ParameterizedTypeImpl;
@ApplicationScoped
-public class JsfArtifactFlowMapProducer extends AbstractDynamicProducer
+public class FacesArtifactFlowMapProducer extends AbstractDynamicProducer
{
class FlowMapAnnotationLiteral extends AnnotationLiteral<FlowMap> implements FlowMap
{
private static final long serialVersionUID = -8623640277155878657L;
}
- public JsfArtifactFlowMapProducer(BeanManager beanManager)
+ public FacesArtifactFlowMapProducer(BeanManager beanManager)
{
super(beanManager);
diff --git a/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducer.java b/impl/src/main/java/org/apache/myfaces/cdi/FacesArtifactProducer.java
similarity index 96%
rename from impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducer.java
rename to impl/src/main/java/org/apache/myfaces/cdi/FacesArtifactProducer.java
index 5f25cfa..bbfeffb 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducer.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/FacesArtifactProducer.java
@@ -49,7 +49,7 @@
import org.apache.myfaces.push.cdi.PushContextImpl;
@ApplicationScoped
-public class JsfArtifactProducer
+public class FacesArtifactProducer
{
@Produces
@Named("application")
@@ -92,6 +92,14 @@
{
return FacesContext.getCurrentInstance();
}
+
+ @Produces
+ @Named("request")
+ @FacesScoped
+ public Object getRequest()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getRequest();
+ }
@Produces
@Named("externalContext")
diff --git a/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducerExtension.java b/impl/src/main/java/org/apache/myfaces/cdi/FacesArtifactProducerExtension.java
similarity index 87%
rename from impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducerExtension.java
rename to impl/src/main/java/org/apache/myfaces/cdi/FacesArtifactProducerExtension.java
index 8c23ec7..ca64339 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducerExtension.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/FacesArtifactProducerExtension.java
@@ -27,7 +27,7 @@
import jakarta.enterprise.inject.spi.ProcessAnnotatedType;
import jakarta.faces.annotation.FacesConfig;
-public class JsfArtifactProducerExtension implements Extension
+public class FacesArtifactProducerExtension implements Extension
{
private boolean registerCdiProducers = false;
@@ -44,8 +44,8 @@
{
if (registerCdiProducers)
{
- AnnotatedType<JsfArtifactProducer> jsfArtifactProducer =
- beanManager.createAnnotatedType(JsfArtifactProducer.class);
+ AnnotatedType<FacesArtifactProducer> jsfArtifactProducer =
+ beanManager.createAnnotatedType(FacesArtifactProducer.class);
event.addAnnotatedType(jsfArtifactProducer, jsfArtifactProducer.getJavaClass().getName());
}
}
@@ -54,7 +54,7 @@
{
if (registerCdiProducers)
{
- afterBeanDiscovery.addBean(new JsfArtifactFlowMapProducer(beanManager));
+ afterBeanDiscovery.addBean(new FacesArtifactFlowMapProducer(beanManager));
}
}
diff --git a/impl/src/main/java/org/apache/myfaces/cdi/util/AbstractContextualStorageHolder.java b/impl/src/main/java/org/apache/myfaces/cdi/util/AbstractContextualStorageHolder.java
index 4e8f006..9a749a8 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/util/AbstractContextualStorageHolder.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/util/AbstractContextualStorageHolder.java
@@ -30,7 +30,7 @@
import java.io.Serializable;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import org.apache.myfaces.cdi.JsfApplicationArtifactHolder;
+import org.apache.myfaces.cdi.FacesApplicationArtifactHolder;
import org.apache.myfaces.context.ExceptionHandlerImpl;
import org.apache.myfaces.context.servlet.StartupFacesContextImpl;
import org.apache.myfaces.context.servlet.StartupServletExternalContextImpl;
@@ -38,7 +38,7 @@
public abstract class AbstractContextualStorageHolder<T extends ContextualStorage> implements Serializable
{
@Inject
- protected JsfApplicationArtifactHolder applicationContextBean;
+ protected FacesApplicationArtifactHolder applicationContextBean;
@Inject
protected BeanManager beanManager;
@@ -59,7 +59,7 @@
Object context = facesContext.getExternalContext().getContext();
if (context instanceof ServletContext)
{
- JsfApplicationArtifactHolder appBean = CDIUtils.get(beanManager, JsfApplicationArtifactHolder.class);
+ FacesApplicationArtifactHolder appBean = CDIUtils.get(beanManager, FacesApplicationArtifactHolder.class);
if (appBean.getServletContext() != null)
{
appBean.setServletContext((ServletContext) context);
diff --git a/impl/src/main/java/org/apache/myfaces/context/ExceptionHandlerImpl.java b/impl/src/main/java/org/apache/myfaces/context/ExceptionHandlerImpl.java
index 91a40fd..1c48908 100644
--- a/impl/src/main/java/org/apache/myfaces/context/ExceptionHandlerImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/context/ExceptionHandlerImpl.java
@@ -33,21 +33,11 @@
import jakarta.faces.event.SystemEvent;
import org.apache.myfaces.util.lang.Assert;
-/**
- * DOCUMENT ME!
- *
+/**
* @since 2.0
*/
public class ExceptionHandlerImpl extends ExceptionHandler
{
- /*
- * PLEASE NOTE!!!
- * jakarta.faces.webapp.PreJsf2ExceptionHandlerFactory uses most parts of this implementation
- * for its private static inner class, only the handle method differs a bit.
- * Thus, any changes made here should also be applied to PreJsf2ExceptionHandlerFactory
- * in the right way (you can copy everything except handle(), this method needs special treatment).
- */
-
private static final Logger log = Logger.getLogger(ExceptionHandlerImpl.class.getName());
private Queue<ExceptionQueuedEvent> handled;
diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/util/ResourceUtils.java b/impl/src/main/java/org/apache/myfaces/renderkit/html/util/ResourceUtils.java
index 18c4157..5ebe5ce 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/util/ResourceUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/html/util/ResourceUtils.java
@@ -98,8 +98,8 @@
// Check first if we have lucky, we are using myfaces and the script has
// been previously rendered
- if (isRenderedScript(facesContext, ResourceHandler.JSF_SCRIPT_LIBRARY_NAME,
- ResourceHandler.JSF_SCRIPT_RESOURCE_NAME))
+ if (isRenderedScript(facesContext, ResourceHandler.FACES_SCRIPT_LIBRARY_NAME,
+ ResourceHandler.FACES_SCRIPT_RESOURCE_NAME))
{
facesContext.getAttributes().put(RENDERED_FACES_JS, Boolean.TRUE);
return;
@@ -116,9 +116,9 @@
//Fast shortcut, don't create component instance and do what HtmlScriptRenderer do.
Resource resource = facesContext.getApplication().getResourceHandler().createResource(
- ResourceHandler.JSF_SCRIPT_RESOURCE_NAME, ResourceHandler.JSF_SCRIPT_LIBRARY_NAME);
- markScriptAsRendered(facesContext, ResourceHandler.JSF_SCRIPT_LIBRARY_NAME,
- ResourceHandler.JSF_SCRIPT_RESOURCE_NAME);
+ ResourceHandler.FACES_SCRIPT_RESOURCE_NAME, ResourceHandler.FACES_SCRIPT_LIBRARY_NAME);
+ markScriptAsRendered(facesContext, ResourceHandler.FACES_SCRIPT_LIBRARY_NAME,
+ ResourceHandler.FACES_SCRIPT_RESOURCE_NAME);
writer.startElement(HTML.SCRIPT_ELEM, null);
HtmlRendererUtils.renderScriptType(facesContext, writer);
writer.writeURIAttribute(HTML.SRC_ATTR, resource.getRequestPath(), null);
diff --git a/impl/src/main/java/org/apache/myfaces/resource/InternalClassLoaderResourceLoader.java b/impl/src/main/java/org/apache/myfaces/resource/InternalClassLoaderResourceLoader.java
index 903809e..b08f15e 100644
--- a/impl/src/main/java/org/apache/myfaces/resource/InternalClassLoaderResourceLoader.java
+++ b/impl/src/main/java/org/apache/myfaces/resource/InternalClassLoaderResourceLoader.java
@@ -154,9 +154,9 @@
{
//handle faces.js
final boolean jakartaFacesLib = libraryName != null &&
- ResourceHandler.JSF_SCRIPT_LIBRARY_NAME.equals(libraryName);
+ ResourceHandler.FACES_SCRIPT_LIBRARY_NAME.equals(libraryName);
final boolean jakartaFaces = jakartaFacesLib &&
- ResourceHandler.JSF_SCRIPT_RESOURCE_NAME.equals(resourceName);
+ ResourceHandler.FACES_SCRIPT_RESOURCE_NAME.equals(resourceName);
if (jakartaFaces)
{
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/CompilationManager.java b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/CompilationManager.java
index 2dde7fa..0d9d9e4 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/CompilationManager.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/CompilationManager.java
@@ -479,25 +479,31 @@
protected static boolean isRemove(String ns, String name)
{
- return (UILibrary.NAMESPACE.equals(ns) || UILibrary.ALIAS_NAMESPACE.equals(ns)) && "remove".equals(name);
+ return "remove".equals(name) && (UILibrary.NAMESPACE.equals(ns)
+ || UILibrary.JCP_NAMESPACE.equals(ns)
+ || UILibrary.SUN_NAMESPACE.equals(ns));
}
protected static boolean isTrimmed(String ns, String name)
{
- return (UILibrary.NAMESPACE.equals(ns) || UILibrary.ALIAS_NAMESPACE.equals(ns))
- && (CompositionHandler.NAME.equals(name) || ComponentRefHandler.NAME.equals(name));
+ return (CompositionHandler.NAME.equals(name) || ComponentRefHandler.NAME.equals(name)) &&
+ (UILibrary.NAMESPACE.equals(ns)
+ || UILibrary.JCP_NAMESPACE.equals(ns)
+ || UILibrary.SUN_NAMESPACE.equals(ns));
}
protected static boolean isCompositeComponentInterface(String ns, String name)
{
- return (CompositeLibrary.NAMESPACE.equals(ns) || CompositeLibrary.ALIAS_NAMESPACE.equals(ns))
- && InterfaceHandler.NAME.equals(name);
+ return InterfaceHandler.NAME.equals(name) && (CompositeLibrary.NAMESPACE.equals(ns)
+ || CompositeLibrary.JCP_NAMESPACE.equals(ns)
+ || CompositeLibrary.SUN_NAMESPACE.equals(ns));
}
protected static boolean isCompositeComponentImplementation(String ns, String name)
{
- return (CompositeLibrary.NAMESPACE.equals(ns) || CompositeLibrary.ALIAS_NAMESPACE.equals(ns))
- && ImplementationHandler.NAME.equals(name);
+ return ImplementationHandler.NAME.equals(name) && (CompositeLibrary.NAMESPACE.equals(ns)
+ || CompositeLibrary.JCP_NAMESPACE.equals(ns)
+ || CompositeLibrary.SUN_NAMESPACE.equals(ns));
}
private String[] determineQName(Tag tag)
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/FaceletsCompilerSupport.java b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/FaceletsCompilerSupport.java
index 9df9fcb..621514e 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/FaceletsCompilerSupport.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/FaceletsCompilerSupport.java
@@ -90,7 +90,9 @@
compiler.addTagLibrary(new CompositeResourceLibrary(context,
CompositeResourceLibrary.NAMESPACE_PREFIX));
compiler.addTagLibrary(new CompositeResourceLibrary(context,
- CompositeResourceLibrary.ALIAS_NAMESPACE_PREFIX));
+ CompositeResourceLibrary.JCP_NAMESPACE_PREFIX));
+ compiler.addTagLibrary(new CompositeResourceLibrary(context,
+ CompositeResourceLibrary.SUN_NAMESPACE_PREFIX));
compiler.addTagLibrary(new JsfLibrary());
compiler.addTagLibrary(new PassThroughLibrary());
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/RefreshDynamicComponentListener.java b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/RefreshDynamicComponentListener.java
index c1c11bc..e4098c8 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/RefreshDynamicComponentListener.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/RefreshDynamicComponentListener.java
@@ -165,11 +165,15 @@
}
else if (taglibURI.startsWith(CompositeResourceLibrary.NAMESPACE_PREFIX))
{
- values[0] = new Object[]{0, taglibURI.substring(35)};
+ values[0] = new Object[]{0, taglibURI.substring(CompositeResourceLibrary.NAMESPACE_PREFIX.length())};
}
- else if(taglibURI.startsWith(CompositeResourceLibrary.ALIAS_NAMESPACE_PREFIX))
+ else if(taglibURI.startsWith(CompositeResourceLibrary.JCP_NAMESPACE_PREFIX))
{
- values[0] = new Object[]{1, taglibURI.substring(34)};
+ values[0] = new Object[]{1, taglibURI.substring(CompositeResourceLibrary.JCP_NAMESPACE_PREFIX.length())};
+ }
+ else if(taglibURI.startsWith(CompositeResourceLibrary.SUN_NAMESPACE_PREFIX))
+ {
+ values[0] = new Object[]{2, taglibURI.substring(CompositeResourceLibrary.SUN_NAMESPACE_PREFIX.length())};
}
else
{
@@ -198,9 +202,23 @@
else if (values[0] instanceof Object[])
{
Object[] def = (Object[]) values[0];
- String ns = (((Integer) def[0]) == 0) ?
- CompositeResourceLibrary.NAMESPACE_PREFIX :
- CompositeResourceLibrary.ALIAS_NAMESPACE_PREFIX;
+ int index = (Integer) def[0];
+ String ns;
+ switch (index)
+ {
+ case 0:
+ ns = CompositeResourceLibrary.NAMESPACE_PREFIX;
+ break;
+ case 1:
+ ns = CompositeResourceLibrary.JCP_NAMESPACE_PREFIX;
+ break;
+ case 2:
+ ns = CompositeResourceLibrary.SUN_NAMESPACE_PREFIX;
+ break;
+ default:
+ ns = "";
+ break;
+ }
taglibURI = ns + (String) ((Object[]) values[0])[1];
}
tagName = (String) values[1];
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/SAXCompiler.java b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/SAXCompiler.java
index 6cd984d..6472d1e 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/SAXCompiler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/SAXCompiler.java
@@ -376,7 +376,9 @@
{
this.unit.popTag();
}
- if ((CoreLibrary.NAMESPACE.equals(uri) || CoreLibrary.ALIAS_NAMESPACE.equals(uri)))
+ if ((CoreLibrary.NAMESPACE.equals(uri)
+ || CoreLibrary.JCP_NAMESPACE.equals(uri)
+ || CoreLibrary.SUN_NAMESPACE.equals(uri)))
{
if ("metadata".equals(localName))
{
@@ -387,7 +389,9 @@
this.unit.popTag();
}
}
- else if (UILibrary.NAMESPACE.equals(uri) || UILibrary.ALIAS_NAMESPACE.equals(uri))
+ else if (UILibrary.NAMESPACE.equals(uri)
+ || UILibrary.JCP_NAMESPACE.equals(uri)
+ || UILibrary.SUN_NAMESPACE.equals(uri))
{
if (!inMetadata && "remove".equals(localName))
{
@@ -480,8 +484,10 @@
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
{
- if ( (CoreLibrary.NAMESPACE.equals(uri) ||
- CoreLibrary.ALIAS_NAMESPACE.equals(uri)) && this.uiRemoveCount <= 0)
+ if (this.uiRemoveCount <= 0 &&
+ (CoreLibrary.NAMESPACE.equals(uri)
+ || CoreLibrary.JCP_NAMESPACE.equals(uri)
+ || CoreLibrary.SUN_NAMESPACE.equals(uri)))
{
if ("metadata".equals(localName))
{
@@ -496,8 +502,9 @@
{
this.unit.pushTag(new Tag(createLocation(), uri, localName, qName, createAttributes(attributes)));
}
- else if (UILibrary.NAMESPACE.equals(uri) ||
- UILibrary.ALIAS_NAMESPACE.equals(uri))
+ else if (UILibrary.NAMESPACE.equals(uri)
+ || UILibrary.JCP_NAMESPACE.equals(uri)
+ || UILibrary.SUN_NAMESPACE.equals(uri))
{
if ("remove".equals(localName))
{
@@ -629,7 +636,9 @@
this.unit.popTag();
}
else if (inCompositeImplementation &&
- (CompositeLibrary.NAMESPACE.equals(uri) || CompositeLibrary.ALIAS_NAMESPACE.equals(uri)) )
+ (CompositeLibrary.NAMESPACE.equals(uri)
+ || CompositeLibrary.JCP_NAMESPACE.equals(uri)
+ || CompositeLibrary.SUN_NAMESPACE.equals(uri)))
{
if ("insertFacet".equals(localName) ||
"renderFacet".equals(localName) ||
@@ -640,7 +649,9 @@
}
}
- if (CompositeLibrary.NAMESPACE.equals(uri) || CompositeLibrary.ALIAS_NAMESPACE.equals(uri))
+ if (CompositeLibrary.NAMESPACE.equals(uri)
+ || CompositeLibrary.JCP_NAMESPACE.equals(uri)
+ || CompositeLibrary.SUN_NAMESPACE.equals(uri))
{
if (InterfaceHandler.NAME.equals(localName))
{
@@ -735,7 +746,9 @@
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
{
- if (CompositeLibrary.NAMESPACE.equals(uri) || CompositeLibrary.ALIAS_NAMESPACE.equals(uri))
+ if (CompositeLibrary.NAMESPACE.equals(uri)
+ || CompositeLibrary.JCP_NAMESPACE.equals(uri)
+ || CompositeLibrary.SUN_NAMESPACE.equals(uri))
{
if (InterfaceHandler.NAME.equals(localName))
{
@@ -752,7 +765,9 @@
this.unit.pushTag(new Tag(createLocation(), uri, localName, qName, createAttributes(attributes)));
}
else if (inCompositeImplementation &&
- (CompositeLibrary.NAMESPACE.equals(uri) || CompositeLibrary.ALIAS_NAMESPACE.equals(uri)))
+ (CompositeLibrary.NAMESPACE.equals(uri)
+ || CompositeLibrary.JCP_NAMESPACE.equals(uri)
+ || CompositeLibrary.SUN_NAMESPACE.equals(uri)))
{
if ("insertFacet".equals(localName) ||
"renderFacet".equals(localName) ||
@@ -942,7 +957,9 @@
boolean tagContainParams = (
("include".equals(tagName) || "decorate".equals(tagName) || "composition".equals(tagName)) &&
- (UILibrary.NAMESPACE.equals(taglibURI) || UILibrary.ALIAS_NAMESPACE.equals(taglibURI)) );
+ (UILibrary.NAMESPACE.equals(taglibURI)
+ || UILibrary.JCP_NAMESPACE.equals(taglibURI)
+ || UILibrary.SUN_NAMESPACE.equals(taglibURI)));
Location location = new Location(alias, 0, 0);
int len = attributes.size();
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java
index 475b55f..0f21177 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java
@@ -61,23 +61,29 @@
private final Map<String, Method> _functions;
private final String _namespace;
- private final String _aliasNamespace;
+ private final String _jcpNamespace;
+ private final String _sunNamespace;
private Boolean _strictJsf2FaceletsCompatibility;
- public AbstractTagLibrary(String namespace, String aliasNamespace)
+ public AbstractTagLibrary(String namespace)
+ {
+ this(namespace, null, null);
+ }
+
+ public AbstractTagLibrary(String namespace, String jcpNamespace)
+ {
+ this(namespace, jcpNamespace, null);
+ }
+
+ public AbstractTagLibrary(String namespace, String jcpNamespace, String sunNamespace)
{
_namespace = namespace;
- _aliasNamespace = aliasNamespace;
+ _jcpNamespace = jcpNamespace;
+ _sunNamespace = sunNamespace;
_factories = new HashMap<>();
_functions = new HashMap<>();
}
-
- public AbstractTagLibrary(String namespace)
- {
- this(namespace,null);
- }
-
-
+
/*
* (non-Javadoc)
*
@@ -86,7 +92,9 @@
@Override
public boolean containsNamespace(String ns)
{
- return _namespace.equals(ns) || (_aliasNamespace != null && _aliasNamespace.equals(ns));
+ return _namespace.equals(ns)
+ || (_jcpNamespace != null && _jcpNamespace.equals(ns))
+ || (_sunNamespace != null && _sunNamespace.equals(ns));
}
/*
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/MetaRulesetImpl.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/MetaRulesetImpl.java
index 8f80e12..fcf3ac0 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/MetaRulesetImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/MetaRulesetImpl.java
@@ -122,22 +122,26 @@
// to find the passthrough attributes.
TagAttribute[] passthroughAttribute = _tag.getAttributes().getAll(
PassThroughLibrary.NAMESPACE);
- TagAttribute[] passthroughAttributeAlias = _tag.getAttributes().getAll(
- PassThroughLibrary.ALIAS_NAMESPACE);
+ TagAttribute[] passthroughAttributeJcp = _tag.getAttributes().getAll(
+ PassThroughLibrary.JCP_NAMESPACE);
+ TagAttribute[] passthroughAttributeSun = _tag.getAttributes().getAll(
+ PassThroughLibrary.SUN_NAMESPACE);
- if (passthroughAttribute.length > 0 ||
- passthroughAttributeAlias.length > 0)
+ if (passthroughAttribute.length > 0
+ || passthroughAttributeJcp.length > 0
+ || passthroughAttributeSun.length > 0)
{
- _passthroughAttributes = new TagAttribute[passthroughAttribute.length+
- passthroughAttributeAlias.length];
+ _passthroughAttributes = new TagAttribute[passthroughAttribute.length +
+ passthroughAttributeJcp.length + passthroughAttributeSun.length];
int i = 0;
for (TagAttribute attribute : allAttributes)
{
// The fastest check is check if the length is > 0, because
// most attributes usually has no namespace attached.
if (attribute.getNamespace().length() > 0 &&
- (PassThroughLibrary.NAMESPACE.equals(attribute.getNamespace()) ||
- PassThroughLibrary.ALIAS_NAMESPACE.equals(attribute.getNamespace())))
+ (PassThroughLibrary.NAMESPACE.equals(attribute.getNamespace())
+ || PassThroughLibrary.JCP_NAMESPACE.equals(attribute.getNamespace())
+ || PassThroughLibrary.SUN_NAMESPACE.equals(attribute.getNamespace())))
{
_passthroughAttributes[i] = attribute;
i++;
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeLibrary.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeLibrary.java
index 7ffb75b..1443a50 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeLibrary.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeLibrary.java
@@ -26,12 +26,13 @@
*/
public class CompositeLibrary extends AbstractTagLibrary
{
- public final static String NAMESPACE = "http://xmlns.jcp.org/jsf/composite";
- public final static String ALIAS_NAMESPACE = "http://java.sun.com/jsf/composite";
+ public final static String NAMESPACE = "jakarta.faces.composite";
+ public final static String JCP_NAMESPACE = "http://xmlns.jcp.org/jsf/composite";
+ public final static String SUN_NAMESPACE = "http://java.sun.com/jsf/composite";
public CompositeLibrary()
{
- super(NAMESPACE, ALIAS_NAMESPACE);
+ super(NAMESPACE, JCP_NAMESPACE, SUN_NAMESPACE);
addTagHandler("actionSource", ActionSourceHandler.class);
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeResourceLibrary.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeResourceLibrary.java
index 4933da0..ea1865e 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeResourceLibrary.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeResourceLibrary.java
@@ -49,8 +49,9 @@
*/
public class CompositeResourceLibrary implements TagLibrary
{
- public final static String NAMESPACE_PREFIX = "http://xmlns.jcp.org/jsf/composite/";
- public final static String ALIAS_NAMESPACE_PREFIX = "http://java.sun.com/jsf/composite/";
+ public final static String NAMESPACE_PREFIX = "jakarta.faces.composite";
+ public final static String JCP_NAMESPACE_PREFIX = "http://xmlns.jcp.org/jsf/composite/";
+ public final static String SUN_NAMESPACE_PREFIX = "http://java.sun.com/jsf/composite/";
private final ResourceHandler _resourceHandler;
private Pattern _acceptPatterns;
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CreateDynamicCompositeComponentListener.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CreateDynamicCompositeComponentListener.java
index cb3379c..ce944db 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CreateDynamicCompositeComponentListener.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CreateDynamicCompositeComponentListener.java
@@ -198,11 +198,15 @@
}
else if (taglibURI.startsWith(CompositeResourceLibrary.NAMESPACE_PREFIX))
{
- values[0] = new Object[]{0, taglibURI.substring(35)};
+ values[0] = new Object[]{0, taglibURI.substring(CompositeResourceLibrary.NAMESPACE_PREFIX.length())};
}
- else if(taglibURI.startsWith(CompositeResourceLibrary.ALIAS_NAMESPACE_PREFIX))
+ else if(taglibURI.startsWith(CompositeResourceLibrary.JCP_NAMESPACE_PREFIX))
{
- values[0] = new Object[]{1, taglibURI.substring(34)};
+ values[0] = new Object[]{1, taglibURI.substring(CompositeResourceLibrary.JCP_NAMESPACE_PREFIX.length())};
+ }
+ else if(taglibURI.startsWith(CompositeResourceLibrary.SUN_NAMESPACE_PREFIX))
+ {
+ values[0] = new Object[]{2, taglibURI.substring(CompositeResourceLibrary.SUN_NAMESPACE_PREFIX.length())};
}
else
{
@@ -230,9 +234,23 @@
else if (values[0] instanceof Object[])
{
Object[] def = (Object[])values[0];
- String ns = (((Integer) def[0]) == 0) ?
- CompositeResourceLibrary.NAMESPACE_PREFIX :
- CompositeResourceLibrary.ALIAS_NAMESPACE_PREFIX;
+ int index = (Integer) def[0];
+ String ns;
+ switch (index)
+ {
+ case 0:
+ ns = CompositeResourceLibrary.NAMESPACE_PREFIX;
+ break;
+ case 1:
+ ns = CompositeResourceLibrary.JCP_NAMESPACE_PREFIX;
+ break;
+ case 2:
+ ns = CompositeResourceLibrary.SUN_NAMESPACE_PREFIX;
+ break;
+ default:
+ ns = "";
+ break;
+ }
taglibURI = ns + (String) ((Object[]) values[0])[1];
}
tagName = (String)values[1];
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/JsfLibrary.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/JsfLibrary.java
index 183081e..38ec1b9 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/JsfLibrary.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/JsfLibrary.java
@@ -26,14 +26,15 @@
*/
public final class JsfLibrary extends AbstractTagLibrary
{
- public final static String NAMESPACE = "http://xmlns.jcp.org/jsf";
- public final static String ALIAS_NAMESPACE = "http://java.sun.com/jsf";
+ public final static String NAMESPACE = "jakarta.faces";
+ public final static String JCP_NAMESPACE = "http://xmlns.jcp.org/jsf";
+ public final static String SUN_NAMESPACE = "http://java.sun.com/jsf";
public final static JsfLibrary INSTANCE = new JsfLibrary();
public JsfLibrary()
{
- super(NAMESPACE, ALIAS_NAMESPACE);
+ super(NAMESPACE, JCP_NAMESPACE, SUN_NAMESPACE);
this.addComponent("element", "oam.passthrough.Element",
"jakarta.faces.passthrough.Element", JsfElementHandler.class);
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/PassThroughLibrary.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/PassThroughLibrary.java
index 74be7d0..b535a18 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/PassThroughLibrary.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/PassThroughLibrary.java
@@ -29,13 +29,14 @@
*/
public class PassThroughLibrary extends AbstractTagLibrary
{
- public final static String NAMESPACE = "http://xmlns.jcp.org/jsf/passthrough";
- public final static String ALIAS_NAMESPACE = "http://java.sun.com/jsf/passthrough";
+ public final static String NAMESPACE = "jakarta.faces.passthrough";
+ public final static String JCP_NAMESPACE = "http://xmlns.jcp.org/jsf/passthrough";
+ public final static String SUN_NAMESPACE = "http://java.sun.com/jsf/passthrough";
public final static PassThroughLibrary INSTANCE = new PassThroughLibrary();
public PassThroughLibrary()
{
- super(NAMESPACE, ALIAS_NAMESPACE);
+ super(NAMESPACE, JCP_NAMESPACE, SUN_NAMESPACE);
}
}
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/core/AjaxHandler.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/core/AjaxHandler.java
index b310554..368ec32 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/core/AjaxHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/core/AjaxHandler.java
@@ -255,8 +255,8 @@
{
UIComponent outputScript = facesContext.getApplication().
createComponent(facesContext, "jakarta.faces.Output", ResourceUtils.DEFAULT_SCRIPT_RENDERER_TYPE);
- outputScript.getAttributes().put(ComponentAttrs.NAME_ATTR, ResourceHandler.JSF_SCRIPT_RESOURCE_NAME);
- outputScript.getAttributes().put(ComponentAttrs.LIBRARY_ATTR, ResourceHandler.JSF_SCRIPT_LIBRARY_NAME);
+ outputScript.getAttributes().put(ComponentAttrs.NAME_ATTR, ResourceHandler.FACES_SCRIPT_RESOURCE_NAME);
+ outputScript.getAttributes().put(ComponentAttrs.LIBRARY_ATTR, ResourceHandler.FACES_SCRIPT_LIBRARY_NAME);
outputScript.getAttributes().put(ComponentAttrs.TARGET_ATTR, "head");
// Since this component will be relocated, we need a generated clientId from the
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/core/CoreLibrary.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/core/CoreLibrary.java
index 5cbd89b..69e3825 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/core/CoreLibrary.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/core/CoreLibrary.java
@@ -46,15 +46,15 @@
*/
public final class CoreLibrary extends AbstractTagLibrary
{
-
- public final static String NAMESPACE = "http://xmlns.jcp.org/jsf/core";
- public final static String ALIAS_NAMESPACE = "http://java.sun.com/jsf/core";
+ public final static String NAMESPACE = "jakarta.faces.core";
+ public final static String JCP_NAMESPACE = "http://xmlns.jcp.org/jsf/core";
+ public final static String SUN_NAMESPACE = "http://java.sun.com/jsf/core";
public final static CoreLibrary INSTANCE = new CoreLibrary();
public CoreLibrary()
{
- super(NAMESPACE, ALIAS_NAMESPACE);
+ super(NAMESPACE, JCP_NAMESPACE, SUN_NAMESPACE);
this.addTagHandler("actionListener", ActionListenerHandler.class);
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/html/AbstractHtmlLibrary.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/html/AbstractHtmlLibrary.java
index cbfa6b1..a54fd2d 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/html/AbstractHtmlLibrary.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/html/AbstractHtmlLibrary.java
@@ -32,11 +32,16 @@
super(namespace);
}
- public AbstractHtmlLibrary(String namespace, String aliasNamespace)
+ public AbstractHtmlLibrary(String namespace, String jcpNamespace)
{
- super(namespace, aliasNamespace);
+ super(namespace, jcpNamespace);
}
+ public AbstractHtmlLibrary(String namespace, String jcpNamespace, String sunNamespace)
+ {
+ super(namespace, jcpNamespace, sunNamespace);
+ }
+
public void addHtmlComponent(String name, String componentType, String rendererType)
{
super.addComponent(name, componentType, rendererType, HtmlComponentHandler.class);
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/html/DefaultTagDecorator.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/html/DefaultTagDecorator.java
index fc3754e..3556ae3 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/html/DefaultTagDecorator.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/html/DefaultTagDecorator.java
@@ -41,13 +41,9 @@
public class DefaultTagDecorator implements TagDecorator
{
public final static String XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
- public final static String JSF_NAMESPACE = JsfLibrary.NAMESPACE;
- public final static String JSF_ALIAS_NAMESPACE = JsfLibrary.ALIAS_NAMESPACE;
- public final static String PASS_THROUGH_NAMESPACE = PassThroughLibrary.NAMESPACE;
- public final static String PASS_THROUGH_ALIAS_NAMESPACE = PassThroughLibrary.ALIAS_NAMESPACE;
private final static String EMPTY_NAMESPACE = "";
- private final static String P_ELEMENTNAME = "p:"+Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY;
+ private final static String P_ELEMENTNAME = "p:" + Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY;
/**
* Fast array for lookup of local names to be inspected.
@@ -166,7 +162,9 @@
for (String namespace : tag.getAttributes().getNamespaces())
{
- if (JSF_NAMESPACE.equals(namespace) || JSF_ALIAS_NAMESPACE.equals(namespace))
+ if (JsfLibrary.NAMESPACE.equals(namespace)
+ || JsfLibrary.JCP_NAMESPACE.equals(namespace)
+ || JsfLibrary.SUN_NAMESPACE.equals(namespace))
{
jsfNamespaceFound = true;
break;
@@ -224,8 +222,8 @@
}
else
{
- throw new FaceletException("Attributes under "+JSF_NAMESPACE+
- " can only be used for tags under "+ XHTML_NAMESPACE +" or tags with no namespace defined" );
+ throw new FaceletException("Attributes under " +JsfLibrary.NAMESPACE +
+ " can only be used for tags under " + XHTML_NAMESPACE + " or tags with no namespace defined" );
}
}
@@ -236,7 +234,7 @@
String elementNameTagLocalName = tag.getLocalName();
TagAttribute elementNameTagAttribute = new TagAttributeImpl(
- tag.getLocation(), PASS_THROUGH_NAMESPACE , Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY,
+ tag.getLocation(), PassThroughLibrary.NAMESPACE , Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY,
P_ELEMENTNAME, elementNameTagLocalName );
// 1. Count how many attributes requires to be duplicated
@@ -286,7 +284,9 @@
component.
..."
*/
- if (JSF_NAMESPACE.equals(namespace) || JSF_ALIAS_NAMESPACE.equals(namespace))
+ if (JsfLibrary.NAMESPACE.equals(namespace)
+ || JsfLibrary.JCP_NAMESPACE.equals(namespace)
+ || JsfLibrary.SUN_NAMESPACE.equals(namespace))
{
// "... If the current attribute's namespace is http://xmlns.jcp.org/jsf, convertedTagAttribute's
// qualified name must be the current attribute's local name and convertedTagAttribute's
@@ -306,8 +306,8 @@
// attribute to the passthrough attribute map, so there is an error in the spec documentation.
//convertedTagAttributes[j] = tagAttribute;
- convertedNamespace = PASS_THROUGH_NAMESPACE;
- qname = "p:"+tagAttribute.getLocalName();
+ convertedNamespace = PassThroughLibrary.NAMESPACE;
+ qname = "p:" + tagAttribute.getLocalName();
convertedTagAttributes[j] = new TagAttributeImpl(tagAttribute.getLocation(),
convertedNamespace, tagAttribute.getLocalName(), qname, tagAttribute.getValue());
@@ -321,7 +321,7 @@
// attribute to the passthrough attribute map, so there is an error in the spec documentation.
//convertedTagAttributes[j] = tagAttribute;
- convertedNamespace = PASS_THROUGH_NAMESPACE;
+ convertedNamespace = PassThroughLibrary.NAMESPACE;
qname = "p:" + tagAttribute.getLocalName();
convertedTagAttributes[j] = new TagAttributeImpl(tagAttribute.getLocation(),
@@ -334,9 +334,10 @@
convertedTagAttributes[j] = tagAttribute;
}
- if (Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY.equals(convertedTagAttributes[j].getLocalName()) && (
- PASS_THROUGH_NAMESPACE.equals(convertedTagAttributes[j].getNamespace()) ||
- PASS_THROUGH_ALIAS_NAMESPACE.equals(convertedTagAttributes[j].getNamespace()) ) )
+ if (Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY.equals(convertedTagAttributes[j].getLocalName())
+ && (PassThroughLibrary.NAMESPACE.equals(convertedTagAttributes[j].getNamespace())
+ || PassThroughLibrary.JCP_NAMESPACE.equals(convertedTagAttributes[j].getNamespace())
+ || PassThroughLibrary.SUN_NAMESPACE.equals(convertedTagAttributes[j].getNamespace())))
{
elementNameTagAttributeSet = true;
}
@@ -387,7 +388,8 @@
private String attributeLocalName;
private String attributePrefix;
private final String attributeNamespace;
- private final String attributeAliasNamespace;
+ private final String attributeJcpNamespace;
+ private final String attributeSunNamespace;
private String matchValue;
private String targetQName;
@@ -427,7 +429,8 @@
this.attributeLocalName = (j >= 0) ? attributeQName.substring(j+1) : attributeQName;
this.attributePrefix = (j >= 0) ? attributeQName.substring(0, j) : null;
this.attributeNamespace = resolveSelectorNamespace(this.attributePrefix);
- this.attributeAliasNamespace = resolveAliasSelectorNamespace(this.attributePrefix);
+ this.attributeJcpNamespace = resolveJcpSelectorNamespace(this.attributePrefix);
+ this.attributeSunNamespace = resolveSunSelectorNamespace(this.attributePrefix);
}
else
{
@@ -436,7 +439,8 @@
this.attributeLocalName = null;
this.attributePrefix = null;
this.attributeNamespace = "";
- this.attributeAliasNamespace = null;
+ this.attributeJcpNamespace = null;
+ this.attributeSunNamespace = null;
}
this.targetQName = targetQName;
@@ -453,7 +457,7 @@
}
else if (j == 3 && targetQName.startsWith("jsf"))
{
- this.targetNamespace = JsfLibrary.ALIAS_NAMESPACE;
+ this.targetNamespace = JsfLibrary.SUN_NAMESPACE;
this.targetLocalName = targetQName.substring(j+1);
}
}
@@ -473,11 +477,17 @@
{
String attributeNS = attributeNamespace;
TagAttribute attr = tag.getAttributes().get(attributeNS, attributeLocalName);
- if (attr == null && attributeAliasNamespace.length() > 0)
+ if (attr == null && attributeJcpNamespace.length() > 0)
{
- attributeNS = attributeAliasNamespace;
- attr = tag.getAttributes().get(attributeAliasNamespace, attributeLocalName);
+ attributeNS = attributeJcpNamespace;
+ attr = tag.getAttributes().get(attributeNS, attributeLocalName);
}
+ if (attr == null && attributeSunNamespace.length() > 0)
+ {
+ attributeNS = attributeSunNamespace;
+ attr = tag.getAttributes().get(attributeNS, attributeLocalName);
+ }
+
if (attr != null)
{
if (attributeNS.equals(attr.getNamespace()) )
@@ -492,7 +502,7 @@
return this;
}
}
- else if (attributeNS == "" && attr.getNamespace() == null)
+ else if ("".equals(attributeNS) && attr.getNamespace() == null)
{
// if namespace is empty match
if (matchValue.equals(attr.getValue()))
@@ -512,9 +522,15 @@
TagAttribute attr = tag.getAttributes().get(attributeNS, attributeLocalName);
if (attr == null)
{
- attributeNS = attributeAliasNamespace;
+ attributeNS = attributeJcpNamespace;
attr = tag.getAttributes().get(attributeNS, attributeLocalName);
}
+ if (attr == null)
+ {
+ attributeNS = attributeSunNamespace;
+ attr = tag.getAttributes().get(attributeNS, attributeLocalName);
+ }
+
if (attr != null)
{
if (attributeNS.equals(attr.getNamespace()))
@@ -562,19 +578,36 @@
return "";
}
- private static String resolveAliasSelectorNamespace(String prefix)
+ private static String resolveJcpSelectorNamespace(String prefix)
{
if ("jsf".equals(prefix))
{
- return JsfLibrary.ALIAS_NAMESPACE;
+ return JsfLibrary.JCP_NAMESPACE;
}
else if ("h".equals(prefix))
{
- return HtmlLibrary.ALIAS_NAMESPACE;
+ return HtmlLibrary.JCP_NAMESPACE;
}
else if ("f".equals(prefix))
{
- return CoreLibrary.ALIAS_NAMESPACE;
+ return CoreLibrary.JCP_NAMESPACE;
+ }
+ return "";
+ }
+
+ private static String resolveSunSelectorNamespace(String prefix)
+ {
+ if ("jsf".equals(prefix))
+ {
+ return JsfLibrary.SUN_NAMESPACE;
+ }
+ else if ("h".equals(prefix))
+ {
+ return HtmlLibrary.SUN_NAMESPACE;
+ }
+ else if ("f".equals(prefix))
+ {
+ return CoreLibrary.SUN_NAMESPACE;
}
return "";
}
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/html/HtmlLibrary.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/html/HtmlLibrary.java
index 1ff9bf1..aa61536 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/html/HtmlLibrary.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/faces/html/HtmlLibrary.java
@@ -24,15 +24,15 @@
*/
public final class HtmlLibrary extends AbstractHtmlLibrary
{
-
- public final static String NAMESPACE = "http://xmlns.jcp.org/jsf/html";
- public final static String ALIAS_NAMESPACE = "http://java.sun.com/jsf/html";
+ public final static String NAMESPACE = "jakarta.faces.html";
+ public final static String JCP_NAMESPACE = "http://xmlns.jcp.org/jsf/html";
+ public final static String SUN_NAMESPACE = "http://java.sun.com/jsf/html";
public final static HtmlLibrary INSTANCE = new HtmlLibrary();
public HtmlLibrary()
{
- super(NAMESPACE, ALIAS_NAMESPACE);
+ super(NAMESPACE, JCP_NAMESPACE, SUN_NAMESPACE);
this.addHtmlComponent("body", "jakarta.faces.OutputBody", "jakarta.faces.Body");
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreLibrary.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreLibrary.java
index f03aeb7..fb0925b 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreLibrary.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreLibrary.java
@@ -26,9 +26,9 @@
*/
public final class JstlCoreLibrary extends AbstractTagLibrary
{
-
- public final static String NAMESPACE = "http://xmlns.jcp.org/jsp/jstl/core";
- public final static String ALIAS_NAMESPACE = "http://java.sun.com/jsp/jstl/core";
+ public final static String NAMESPACE = "jakarta.tags.core";
+ public final static String JCP_NAMESPACE = "http://xmlns.jcp.org/jsp/jstl/core";
+ public final static String SUN_NAMESPACE = "http://java.sun.com/jsp/jstl/core";
// This namespace was used in the early stages of JSF 2.0 development, but later
// it was fixed to use the same syntax for jsp. But some applications still
@@ -40,7 +40,7 @@
public JstlCoreLibrary()
{
- super(NAMESPACE, ALIAS_NAMESPACE);
+ super(NAMESPACE, JCP_NAMESPACE, SUN_NAMESPACE);
this.addTagHandler("if", IfHandler.class);
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/LegacyJstlCoreLibrary.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/LegacyJstlCoreLibrary.java
index 0fb9205..b499471 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/LegacyJstlCoreLibrary.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/LegacyJstlCoreLibrary.java
@@ -31,9 +31,9 @@
*/
public final class LegacyJstlCoreLibrary extends AbstractTagLibrary
{
-
- public final static String NAMESPACE = "http://xmlns.jcp.org/jsp/jstl/core";
- public final static String ALIAS_NAMESPACE = "http://java.sun.com/jsp/jstl/core";
+ public final static String NAMESPACE = "jakarta.tags.core";
+ public final static String JCP_NAMESPACE = "http://xmlns.jcp.org/jsp/jstl/core";
+ public final static String SUN_NAMESPACE = "http://java.sun.com/jsp/jstl/core";
// This namespace was used in the early stages of JSF 2.0 development, but later
// it was fixed to use the same syntax for jsp. But some applications still
@@ -45,7 +45,7 @@
public LegacyJstlCoreLibrary()
{
- super(NAMESPACE, ALIAS_NAMESPACE);
+ super(NAMESPACE, JCP_NAMESPACE, SUN_NAMESPACE);
this.addTagHandler("if", IfHandler.class);
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFnLibrary.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFnLibrary.java
index 0aad6a8..bb398cd 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFnLibrary.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFnLibrary.java
@@ -37,10 +37,11 @@
*/
public class JstlFnLibrary implements TagLibrary
{
- public final static String NAMESPACE = "http://xmlns.jcp.org/jsp/jstl/functions";
- public final static String ALIAS_NAMESPACE = "http://java.sun.com/jsp/jstl/functions";
+ public final static String NAMESPACE = "jakarta.tags.functions";
+ public final static String JCP_NAMESPACE = "http://xmlns.jcp.org/jsp/jstl/functions";
+ public final static String SUN_NAMESPACE = "http://java.sun.com/jsp/jstl/functions";
- private final Map<String, Method> fns = new HashMap<String, Method>();
+ private final Map<String, Method> fns = new HashMap<>();
public JstlFnLibrary()
{
@@ -65,7 +66,7 @@
@Override
public boolean containsNamespace(String ns)
{
- return NAMESPACE.equals(ns) || ALIAS_NAMESPACE.equals(ns);
+ return NAMESPACE.equals(ns) || JCP_NAMESPACE.equals(ns) || SUN_NAMESPACE.equals(ns);
}
@Override
@@ -83,7 +84,7 @@
@Override
public boolean containsFunction(String ns, String name)
{
- if (NAMESPACE.equals(ns) || ALIAS_NAMESPACE.equals(ns))
+ if (NAMESPACE.equals(ns) || JCP_NAMESPACE.equals(ns) || SUN_NAMESPACE.equals(ns))
{
return this.fns.containsKey(name);
}
@@ -94,7 +95,7 @@
@Override
public Method createFunction(String ns, String name)
{
- if (NAMESPACE.equals(ns) || ALIAS_NAMESPACE.equals(ns))
+ if (NAMESPACE.equals(ns) || JCP_NAMESPACE.equals(ns) || SUN_NAMESPACE.equals(ns))
{
return (Method) this.fns.get(name);
}
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyUILibrary.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyUILibrary.java
index 64bb22f..8fc2496 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyUILibrary.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyUILibrary.java
@@ -27,15 +27,15 @@
*/
public final class LegacyUILibrary extends AbstractTagLibrary
{
-
- public final static String NAMESPACE = "http://xmlns.jcp.org/jsf/facelets";
- public final static String ALIAS_NAMESPACE = "http://java.sun.com/jsf/facelets";
+ public final static String NAMESPACE = "jakarta.faces.facelets";
+ public final static String JCP_NAMESPACE = "http://xmlns.jcp.org/jsf/facelets";
+ public final static String SUN_NAMESPACE = "http://java.sun.com/jsf/facelets";
public final static LegacyUILibrary INSTANCE = new LegacyUILibrary();
public LegacyUILibrary()
{
- super(NAMESPACE, ALIAS_NAMESPACE);
+ super(NAMESPACE, JCP_NAMESPACE, SUN_NAMESPACE);
this.addComponent("component", ComponentRef.COMPONENT_TYPE, null, ComponentRefHandler.class);
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/RepeatHandler.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/RepeatHandler.java
index 81ee11e..300d414 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/RepeatHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/RepeatHandler.java
@@ -49,8 +49,9 @@
{
MetaRuleset meta = super.createMetaRuleset(type);
- if (!UILibrary.NAMESPACE.equals(this.tag.getNamespace()) &&
- !UILibrary.ALIAS_NAMESPACE.equals(this.tag.getNamespace()))
+ if (!UILibrary.NAMESPACE.equals(this.tag.getNamespace())
+ && !UILibrary.JCP_NAMESPACE.equals(this.tag.getNamespace())
+ && !UILibrary.SUN_NAMESPACE.equals(this.tag.getNamespace()))
{
meta.add(new TagMetaData(type));
}
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/UILibrary.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/UILibrary.java
index 48f4f09..c5dea1c 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/UILibrary.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/UILibrary.java
@@ -32,15 +32,15 @@
*/
public final class UILibrary extends AbstractTagLibrary
{
-
- public final static String NAMESPACE = "http://xmlns.jcp.org/jsf/facelets";
- public final static String ALIAS_NAMESPACE = "http://java.sun.com/jsf/facelets";
+ public final static String NAMESPACE = "jakarta.faces.facelets";
+ public final static String JCP_NAMESPACE = "http://xmlns.jcp.org/jsf/facelets";
+ public final static String SUN_NAMESPACE = "http://java.sun.com/jsf/facelets";
public final static UILibrary INSTANCE = new UILibrary();
public UILibrary()
{
- super(NAMESPACE, ALIAS_NAMESPACE);
+ super(NAMESPACE, JCP_NAMESPACE, SUN_NAMESPACE);
this.addTagHandler("include", IncludeHandler.class);
diff --git a/impl/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension b/impl/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension
index b8ef9c3..c3859db 100644
--- a/impl/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension
+++ b/impl/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension
@@ -1,6 +1,6 @@
org.apache.myfaces.cdi.FacesScopeExtension
-org.apache.myfaces.cdi.JsfArtifactProducerExtension
-org.apache.myfaces.cdi.JsfApplicationArtifactHolderExtension
+org.apache.myfaces.cdi.FacesArtifactProducerExtension
+org.apache.myfaces.cdi.FacesApplicationArtifactHolderExtension
org.apache.myfaces.cdi.config.FacesConfigExtension
org.apache.myfaces.cdi.managedproperty.ManagedPropertyExtension
org.apache.myfaces.cdi.model.FacesDataModelExtension
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DataTableTestCaseUrn.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DataTableTestCaseUrn.java
new file mode 100644
index 0000000..004f2a3
--- /dev/null
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DataTableTestCaseUrn.java
@@ -0,0 +1,90 @@
+/*
+ * 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.tag.faces.html;
+
+import jakarta.faces.component.UIColumn;
+import jakarta.faces.component.UIData;
+import jakarta.faces.component.UIOutput;
+import jakarta.faces.component.UIPanel;
+import jakarta.faces.component.UIViewRoot;
+import jakarta.faces.component.html.HtmlColumn;
+import jakarta.faces.component.html.HtmlDataTable;
+import jakarta.faces.component.html.HtmlOutputText;
+import jakarta.faces.context.ResponseWriter;
+
+import org.apache.myfaces.renderkit.html.HtmlTableRenderer;
+import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.apache.myfaces.view.facelets.bean.Example;
+import org.apache.myfaces.util.lang.FastWriter;
+import org.junit.Test;
+
+public class DataTableTestCaseUrn extends FaceletTestCase
+{
+
+ @Override
+ protected void setupComponents() throws Exception
+ {
+ application.addComponent(UIViewRoot.COMPONENT_TYPE, UIViewRoot.class
+ .getName());
+ application.addComponent(UIPanel.COMPONENT_TYPE,
+ UIPanel.class.getName());
+ application.addComponent(HtmlDataTable.COMPONENT_TYPE,
+ HtmlDataTable.class.getName());
+ application.addComponent(UIColumn.COMPONENT_TYPE,
+ UIColumn.class.getName());
+ application.addComponent(HtmlColumn.COMPONENT_TYPE,
+ HtmlColumn.class.getName());
+ application.addComponent(HtmlOutputText.COMPONENT_TYPE,
+ HtmlOutputText.class.getName());
+ }
+
+ @Override
+ protected void setupConvertersAndValidators() throws Exception
+ {
+ }
+
+ @Override
+ protected void setupRenderers() throws Exception
+ {
+ renderKit.addRenderer(UIOutput.COMPONENT_FAMILY,
+ "jakarta.faces.Text", new HtmlTextRenderer());
+ renderKit.addRenderer(UIData.COMPONENT_FAMILY,
+ "jakarta.faces.Table", new HtmlTableRenderer());
+ }
+
+ @Test
+ public void testDataTable() throws Exception
+ {
+ facesContext.getExternalContext().getRequestMap().put("company",
+ Example.createCompany());
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "dataTableUrn.xml");
+
+ FastWriter fw = new FastWriter();
+ ResponseWriter rw = facesContext.getResponseWriter();
+ rw = rw.cloneWithWriter(fw);
+ facesContext.setResponseWriter(rw);
+ root.encodeAll(facesContext);
+ //System.out.println(fw);
+ }
+
+}
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DefaultHtmlDecoratorTestCase.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DefaultHtmlDecoratorTestCase.java
index 30ff14f..e86c520 100644
--- a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DefaultHtmlDecoratorTestCase.java
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DefaultHtmlDecoratorTestCase.java
@@ -18,7 +18,6 @@
*/
package org.apache.myfaces.view.facelets.tag.faces.html;
-import org.apache.myfaces.view.facelets.tag.faces.html.DefaultTagDecorator;
import java.io.StringWriter;
import jakarta.faces.component.UIComponent;
import jakarta.faces.component.UIForm;
@@ -55,6 +54,7 @@
import org.apache.myfaces.view.facelets.FaceletTestCase;
import org.apache.myfaces.view.facelets.tag.TagAttributeImpl;
import org.apache.myfaces.view.facelets.tag.TagAttributesImpl;
+import org.apache.myfaces.view.facelets.tag.faces.JsfLibrary;
import org.junit.Assert;
import org.junit.Test;
@@ -256,7 +256,7 @@
Tag tag = new Tag(location, DefaultTagDecorator.XHTML_NAMESPACE, "body", "body",
new TagAttributesImpl(new TagAttribute[]
{
- new TagAttributeImpl(location, DefaultTagDecorator.JSF_NAMESPACE, "id", "jsf:id", "idBody")
+ new TagAttributeImpl(location, JsfLibrary.NAMESPACE, "id", "jsf:id", "idBody")
}
));
@@ -273,7 +273,7 @@
Tag tag = new Tag(location, DefaultTagDecorator.XHTML_NAMESPACE, "a", "a",
new TagAttributesImpl(new TagAttribute[]
{
- new TagAttributeImpl(location, DefaultTagDecorator.JSF_NAMESPACE, "action", "jsf:action", "#{test.testAction}")
+ new TagAttributeImpl(location, JsfLibrary.NAMESPACE, "action", "jsf:action", "#{test.testAction}")
}
));
@@ -290,7 +290,7 @@
Tag tag = new Tag(location, DefaultTagDecorator.XHTML_NAMESPACE, "body", "body",
new TagAttributesImpl(new TagAttribute[]
{
- new TagAttributeImpl(location, DefaultTagDecorator.JSF_ALIAS_NAMESPACE, "id", "jsf:id", "idBody")
+ new TagAttributeImpl(location, JsfLibrary.SUN_NAMESPACE, "id", "jsf:id", "idBody")
}
));
@@ -307,7 +307,7 @@
Tag tag = new Tag(location, DefaultTagDecorator.XHTML_NAMESPACE, "a", "a",
new TagAttributesImpl(new TagAttribute[]
{
- new TagAttributeImpl(location, DefaultTagDecorator.JSF_ALIAS_NAMESPACE, "action", "jsf:action", "#{test.testAction}")
+ new TagAttributeImpl(location, JsfLibrary.SUN_NAMESPACE, "action", "jsf:action", "#{test.testAction}")
}
));
diff --git a/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DefaultHtmlDecoratorTestCaseUrn.java b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DefaultHtmlDecoratorTestCaseUrn.java
new file mode 100644
index 0000000..da3a2ea
--- /dev/null
+++ b/impl/src/test/java/org/apache/myfaces/view/facelets/tag/faces/html/DefaultHtmlDecoratorTestCaseUrn.java
@@ -0,0 +1,643 @@
+/*
+ * 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.tag.faces.html;
+
+import java.io.StringWriter;
+import jakarta.faces.component.UIComponent;
+import jakarta.faces.component.UIForm;
+import jakarta.faces.component.UIInput;
+import jakarta.faces.component.UIOutput;
+import jakarta.faces.component.UIViewRoot;
+import jakarta.faces.component.html.HtmlBody;
+import jakarta.faces.component.html.HtmlCommandButton;
+import jakarta.faces.component.html.HtmlCommandLink;
+import jakarta.faces.component.html.HtmlGraphicImage;
+import jakarta.faces.component.html.HtmlHead;
+import jakarta.faces.component.html.HtmlInputFile;
+import jakarta.faces.component.html.HtmlInputHidden;
+import jakarta.faces.component.html.HtmlInputSecret;
+import jakarta.faces.component.html.HtmlInputText;
+import jakarta.faces.component.html.HtmlInputTextarea;
+import jakarta.faces.component.html.HtmlOutcomeTargetButton;
+import jakarta.faces.component.html.HtmlOutcomeTargetLink;
+import jakarta.faces.component.html.HtmlOutputLabel;
+import jakarta.faces.component.html.HtmlOutputLink;
+import jakarta.faces.component.html.HtmlSelectBooleanCheckbox;
+import jakarta.faces.component.html.HtmlSelectManyListbox;
+import jakarta.faces.component.html.HtmlSelectOneListbox;
+import jakarta.faces.context.ResponseWriter;
+import jakarta.faces.view.Location;
+import jakarta.faces.view.facelets.Tag;
+import jakarta.faces.view.facelets.TagAttribute;
+import jakarta.faces.view.facelets.TagDecorator;
+import org.apache.myfaces.config.MyfacesConfig;
+import org.apache.myfaces.renderkit.html.HtmlResponseWriterImpl;
+import org.apache.myfaces.renderkit.html.util.ResourceUtils;
+import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
+import org.apache.myfaces.test.utils.HtmlRenderedAttr;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.apache.myfaces.view.facelets.tag.TagAttributeImpl;
+import org.apache.myfaces.view.facelets.tag.TagAttributesImpl;
+import org.apache.myfaces.view.facelets.tag.faces.JsfLibrary;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @author Leonardo Uribe
+ */
+public class DefaultHtmlDecoratorTestCaseUrn extends FaceletTestCase
+{
+
+ @Override
+ protected void setUpServletObjects() throws Exception
+ {
+ super.setUpServletObjects();
+ //servletContext.addInitParameter(FaceletViewDeclarationLanguage.PARAM_DECORATORS,
+ // DefaultTagDecorator.class.getName());
+
+ servletContext.addInitParameter(MyfacesConfig.RENDER_CLIENTBEHAVIOR_SCRIPTS_AS_STRING, "true");
+ }
+
+ @Test
+ public void testHtmlPassthrough1() throws Exception
+ {
+ request.getSession().setAttribute("test", new MockBean());
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testHtmlPassthrough1urn.xhtml");
+
+ checkTags();
+
+ //StringWriter sw = new StringWriter();
+ //MockResponseWriter mrw = new MockResponseWriter(sw);
+ //facesContext.setResponseWriter(mrw);
+ //sw.flush();
+ }
+
+ @Test
+ public void testHtmlPassthrough2() throws Exception
+ {
+ request.getSession().setAttribute("test", new MockBean());
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testHtmlPassthrough2urn.xhtml");
+
+ checkTags();
+
+ //StringWriter sw = new StringWriter();
+ //MockResponseWriter mrw = new MockResponseWriter(sw);
+ //facesContext.setResponseWriter(mrw);
+ //sw.flush();
+ }
+
+ private void checkTags() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+
+ HtmlHead head = (HtmlHead) root.findComponent("idHead");
+ int linksFound = 0;
+ int scriptsFound = 0;
+ for (UIComponent child : head.getChildren())
+ {
+ if (child instanceof UIOutput)
+ {
+ if (ResourceUtils.DEFAULT_SCRIPT_RENDERER_TYPE.equals(child.getRendererType()))
+ {
+ Assert.assertEquals("osc", child.getId());
+ scriptsFound++;
+ }
+ if (ResourceUtils.DEFAULT_STYLESHEET_RENDERER_TYPE.equals(child.getRendererType()))
+ {
+ Assert.assertEquals("osh", child.getId());
+ linksFound++;
+ }
+ }
+ }
+ for (UIComponent child : root.getComponentResources(facesContext, "head"))
+ {
+ if ("jakarta.faces.resource.Stylesheet".equals(child.getRendererType()))
+ {
+ Assert.assertEquals("osh", child.getId());
+ linksFound++;
+ }
+ }
+
+ Assert.assertEquals(1, linksFound);
+ Assert.assertEquals(1, scriptsFound);
+
+ HtmlBody body = (HtmlBody) root.findComponent("idBody");
+ Assert.assertNotNull(body);
+
+ UIForm form = (UIForm) root.findComponent("myForm");
+ Assert.assertNotNull(form);
+
+ HtmlCommandLink link1 = (HtmlCommandLink) form.findComponent("link1");
+ Assert.assertNotNull(link1);
+ Assert.assertEquals("#{test.testAction}", link1.getActionExpression().getExpressionString());
+
+ HtmlCommandLink link2 = (HtmlCommandLink) form.findComponent("link2");
+ Assert.assertNotNull(link2);
+ Assert.assertEquals(1, link2.getActionListeners().length);
+
+ HtmlOutputLink link3 = (HtmlOutputLink) form.findComponent("link3");
+ Assert.assertNotNull(link3);
+ Assert.assertEquals("/my/new/location.txt", link3.getValue());
+
+ HtmlOutcomeTargetLink link4 = (HtmlOutcomeTargetLink) form.findComponent("link4");
+ Assert.assertNotNull(link4);
+ Assert.assertEquals("rollback", link4.getOutcome());
+
+ HtmlCommandButton button = (HtmlCommandButton) form.findComponent("button1");
+ Assert.assertNotNull(button);
+ Assert.assertEquals("#{test.testAction}", button.getActionExpression().getExpressionString());
+
+ HtmlOutcomeTargetButton button2 = (HtmlOutcomeTargetButton) form.findComponent("button2");
+ Assert.assertNotNull(button2);
+ Assert.assertEquals("rollback", button2.getOutcome());
+
+ HtmlGraphicImage img1 = (HtmlGraphicImage) form.findComponent("img1");
+ Assert.assertNotNull(img1);
+ Assert.assertEquals("/my/image.png", img1.getUrl());
+
+ HtmlCommandButton input1 = (HtmlCommandButton) form.findComponent("input1");
+ Assert.assertNotNull(input1);
+
+ HtmlSelectBooleanCheckbox input2 = (HtmlSelectBooleanCheckbox) form.findComponent("input2");
+ Assert.assertNotNull(input2);
+
+ HtmlInputText input3 = (HtmlInputText) form.findComponent("input3");
+ Assert.assertNotNull(input3);
+
+ HtmlInputText input4 = (HtmlInputText) form.findComponent("input4");
+ Assert.assertNotNull(input4);
+
+ HtmlInputText input5 = (HtmlInputText) form.findComponent("input5");
+ Assert.assertNotNull(input5);
+
+ HtmlInputText input6 = (HtmlInputText) form.findComponent("input6");
+ Assert.assertNotNull(input6);
+
+ HtmlInputText input7 = (HtmlInputText) form.findComponent("input7");
+ Assert.assertNotNull(input7);
+
+ HtmlInputText input8 = (HtmlInputText) form.findComponent("input8");
+ Assert.assertNotNull(input8);
+
+ HtmlInputText input9 = (HtmlInputText) form.findComponent("input9");
+ Assert.assertNotNull(input9);
+
+ HtmlInputText input10 = (HtmlInputText) form.findComponent("input10");
+ Assert.assertNotNull(input10);
+
+ HtmlInputText input11 = (HtmlInputText) form.findComponent("input11");
+ Assert.assertNotNull(input11);
+
+ HtmlInputText input12 = (HtmlInputText) form.findComponent("input12");
+ Assert.assertNotNull(input12);
+
+ HtmlInputText input13 = (HtmlInputText) form.findComponent("input13");
+ Assert.assertNotNull(input13);
+
+ HtmlInputText input14 = (HtmlInputText) form.findComponent("input14");
+ Assert.assertNotNull(input14);
+
+ HtmlInputFile input15 = (HtmlInputFile) form.findComponent("input15");
+ Assert.assertNotNull(input15);
+
+ HtmlInputHidden input16 = (HtmlInputHidden) form.findComponent("input16");
+ Assert.assertNotNull(input16);
+
+ HtmlInputSecret input17 = (HtmlInputSecret) form.findComponent("input17");
+ Assert.assertNotNull(input17);
+
+ HtmlCommandButton input18 = (HtmlCommandButton) form.findComponent("input18");
+ Assert.assertNotNull(input18);
+
+ HtmlCommandButton input19 = (HtmlCommandButton) form.findComponent("input19");
+ Assert.assertNotNull(input19);
+
+ HtmlInputText input20 = (HtmlInputText) form.findComponent("input20");
+ Assert.assertNotNull(input20);
+
+ HtmlOutputLabel label1 = (HtmlOutputLabel) form.findComponent("label1");
+ Assert.assertNotNull(label1);
+
+ HtmlSelectOneListbox select1 = (HtmlSelectOneListbox) form.findComponent("select1");
+ Assert.assertNotNull(select1);
+
+ HtmlSelectManyListbox select2 = (HtmlSelectManyListbox) form.findComponent("select2");
+ Assert.assertNotNull(select2);
+
+ HtmlInputTextarea textarea1 = (HtmlInputTextarea) form.findComponent("textarea1");
+ Assert.assertNotNull(textarea1);
+ }
+
+ @Test
+ public void testDefaultTagDecorator1() throws Exception
+ {
+ Location location = new Location("/test.xhtml", 20, 5);
+ Tag tag = new Tag(location, DefaultTagDecorator.XHTML_NAMESPACE, "body", "body",
+ new TagAttributesImpl(new TagAttribute[]
+ {
+ new TagAttributeImpl(location, JsfLibrary.NAMESPACE, "id", "jsf:id", "idBody")
+ }
+ ));
+
+ TagDecorator tagDecorator = new DefaultTagDecorator();
+ Tag decoratedTag = tagDecorator.decorate(tag);
+
+ Assert.assertNotNull(decoratedTag);
+ }
+
+ @Test
+ public void testDefaultTagDecorator2() throws Exception
+ {
+ Location location = new Location("/test.xhtml", 20, 5);
+ Tag tag = new Tag(location, DefaultTagDecorator.XHTML_NAMESPACE, "a", "a",
+ new TagAttributesImpl(new TagAttribute[]
+ {
+ new TagAttributeImpl(location, JsfLibrary.NAMESPACE, "action", "jsf:action", "#{test.testAction}")
+ }
+ ));
+
+ TagDecorator tagDecorator = new DefaultTagDecorator();
+ Tag decoratedTag = tagDecorator.decorate(tag);
+
+ Assert.assertNotNull(decoratedTag);
+ }
+
+ @Test
+ public void testDefaultTagDecorator3() throws Exception
+ {
+ Location location = new Location("/test.xhtml", 20, 5);
+ Tag tag = new Tag(location, DefaultTagDecorator.XHTML_NAMESPACE, "body", "body",
+ new TagAttributesImpl(new TagAttribute[]
+ {
+ new TagAttributeImpl(location, JsfLibrary.SUN_NAMESPACE, "id", "jsf:id", "idBody")
+ }
+ ));
+
+ TagDecorator tagDecorator = new DefaultTagDecorator();
+ Tag decoratedTag = tagDecorator.decorate(tag);
+
+ Assert.assertNotNull(decoratedTag);
+ }
+
+ @Test
+ public void testDefaultTagDecorator4() throws Exception
+ {
+ Location location = new Location("/test.xhtml", 20, 5);
+ Tag tag = new Tag(location, DefaultTagDecorator.XHTML_NAMESPACE, "a", "a",
+ new TagAttributesImpl(new TagAttribute[]
+ {
+ new TagAttributeImpl(location, JsfLibrary.SUN_NAMESPACE, "action", "jsf:action", "#{test.testAction}")
+ }
+ ));
+
+ TagDecorator tagDecorator = new DefaultTagDecorator();
+ Tag decoratedTag = tagDecorator.decorate(tag);
+
+ Assert.assertNotNull(decoratedTag);
+ }
+
+ @Test
+ public void testNoMatchJSFElement1() throws Exception
+ {
+ request.getSession().setAttribute("test", new MockBean());
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testNoMatchJSFElement1.xhtml");
+
+ UIComponent box1 = root.findComponent("myForm:box1");
+ Assert.assertNotNull(box1);
+ Assert.assertEquals(box1.getRendererType(), "jakarta.faces.passthrough.Element");
+
+ //StringWriter sw = new StringWriter();
+ //MockResponseWriter mrw = new MockResponseWriter(sw);
+ //facesContext.setResponseWriter(mrw);
+ //sw.flush();
+ }
+
+ @Test
+ public void testConvertTagAttributes1() throws Exception
+ {
+ request.getSession().setAttribute("test", new MockBean());
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testConvertTagAttributes1.xhtml");
+
+ //<input jsf:id="box1" type="text"
+ // jsf:value="#{test.value}" jsf:customAttr="SomeValue"
+ // onclick="alert('hello')"
+ // placeholder="Enter text"
+ // pt:data_up="Going Up"/>
+ UIInput input1 = (UIInput) root.findComponent("myForm:box1");
+ Assert.assertNotNull(input1);
+
+ Assert.assertEquals(input1.getPassThroughAttributes().get("placeholder"), "Enter text");
+ Assert.assertNull(input1.getAttributes().get("placeholder"));
+
+
+ Assert.assertEquals(input1.getAttributes().get("customAttr"), "SomeValue");
+ // Attributes outside "id", "binding", "rendered" or "transient" can be
+ // copied on passthrough attribute map.
+ Assert.assertNull(input1.getPassThroughAttributes().get("customAttr"));
+
+ Assert.assertEquals(input1.getPassThroughAttributes().get("data_up"), "Going Up");
+ Assert.assertNull(input1.getAttributes().get("data_up"));
+
+ Assert.assertNotNull(input1.getValueExpression("value"));
+ //Assert.assertNotNull(input1.getPassThroughAttributes().get("value"));
+ Assert.assertNull(input1.getPassThroughAttributes().get("value"));
+ Assert.assertEquals(input1.getValue(), "value1");
+ Assert.assertEquals(input1.getAttributes().get("value"), "value1");
+
+ //<input jsf:id="box2" pt:elementName="meter"
+ // jsf:value="#{test.value}" jsf:customAttr="SomeValue"
+ // onclick="alert('hello')"
+ // placeholder="Enter text"
+ // pt:data_up="Going Up">Hello World!</input>
+ UIComponent input2 = root.findComponent("myForm:box2");
+ Assert.assertFalse(input2 instanceof UIInput);
+ Assert.assertEquals(input2.getRendererType(), "jakarta.faces.passthrough.Element");
+
+ Assert.assertEquals(input2.getPassThroughAttributes().get("placeholder"), "Enter text");
+ //Assert.assertEquals(input2.getAttributes().get("placeholder"), "Enter text");
+ Assert.assertNull(input2.getAttributes().get("placeholder"));
+
+ Assert.assertEquals(input2.getAttributes().get("customAttr"), "SomeValue");
+ //Assert.assertNull(input2.getAttributes().get("customAttr"));
+ //Assert.assertEquals(input2.getPassThroughAttributes().get("customAttr"), "SomeValue");
+ Assert.assertNull(input2.getPassThroughAttributes().get("customAttr"));
+
+ Assert.assertEquals(input2.getPassThroughAttributes().get("data_up"), "Going Up");
+ Assert.assertNull(input2.getAttributes().get("data_up"));
+
+ // note there is no type attribute, so it is translated into a jsf:element, and in that
+ // component, "value" is not defined, so it is set as passthrough
+ Assert.assertNotNull(input2.getValueExpression("value"));
+ Assert.assertNull(input2.getPassThroughAttributes().get("value"));
+ Assert.assertNotNull(input2.getAttributes().get("value"));
+
+ //<jsf:element id="box3" elementName="meter"
+ // value="#{test.value}" customAttr="SomeValue"
+ // onclick="alert('hello')"
+ // placeholder="Enter text"
+ // pt:data_up="Going Up">
+ // Hello Element!
+ //</jsf:element>
+ UIComponent input3 = root.findComponent("myForm:box3");
+ Assert.assertFalse(input3 instanceof UIInput);
+ Assert.assertEquals(input3.getRendererType(), "jakarta.faces.passthrough.Element");
+
+ Assert.assertEquals(input3.getAttributes().get("placeholder"), "Enter text");
+ Assert.assertNull(input3.getPassThroughAttributes().get("placeholder"));
+
+ Assert.assertNull(input3.getPassThroughAttributes().get("customAttr"));
+ Assert.assertEquals(input3.getAttributes().get("customAttr"), "SomeValue");
+
+ Assert.assertEquals(input3.getPassThroughAttributes().get("data_up"), "Going Up");
+ Assert.assertNull(input3.getAttributes().get("data_up"));
+
+ Assert.assertNotNull(input3.getValueExpression("value"));
+ Assert.assertNull(input3.getPassThroughAttributes().get("value"));
+ Assert.assertNotNull(input3.getAttributes().get("value"));
+
+ //Assert.assertEquals(input2.getPassThroughAttributes().get("elementName"), "meter");
+
+ //<h:panelGroup id="box4">
+ //<div jsf:class="noprint">
+ // MYBOX4
+ //</div>
+ //</h:panelGroup>
+ UIComponent box4 = root.findComponent("myForm:box4");
+ Assert.assertNotNull(box4);
+ UIComponent boxDiv4 = box4.getChildren().get(0);
+ Assert.assertNotNull(boxDiv4);
+ Assert.assertEquals(boxDiv4.getAttributes().get("styleClass"), "noprint");
+ //Assert.assertEquals(boxDiv4.getPassThroughAttributes().get("class"), "noprint");
+ Assert.assertNull(boxDiv4.getPassThroughAttributes().get("class"));
+
+ //<h:panelGroup id="box5">
+ //<div jsf:style="noprint">
+ // MYBOX5
+ //</div>
+ //</h:panelGroup>
+ UIComponent box5 = root.findComponent("myForm:box5");
+ Assert.assertNotNull(box5);
+ UIComponent boxDiv5 = box5.getChildren().get(0);
+ Assert.assertNotNull(boxDiv5);
+ Assert.assertNotNull(boxDiv5.getAttributes().get("style"));
+ //Assert.assertEquals(boxDiv5.getPassThroughAttributes().get("style"), "noprint");
+ Assert.assertNull(boxDiv5.getPassThroughAttributes().get("style"));
+
+ StringWriter sw = new StringWriter();
+
+ ResponseWriter mrw = new HtmlResponseWriterImpl(sw, "text/html", "UTF-8");
+ facesContext.setResponseWriter(mrw);
+
+ HtmlRenderedAttr[] attrs = {
+ new HtmlRenderedAttr("data_up", "Going Up"),
+ new HtmlRenderedAttr("placeholder", "Enter text"),
+ new HtmlRenderedAttr("onclick", "alert('hello')"),
+ //new HtmlRenderedAttr("customAttr", "SomeValue"),
+ new HtmlRenderedAttr("value", "value1")
+ };
+
+ input1.encodeAll(facesContext);
+
+ sw.flush();
+
+ HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
+ if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
+ {
+ Assert.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ }
+
+ sw = new StringWriter();
+ mrw = new HtmlResponseWriterImpl(sw, "text/html", "UTF-8");
+ facesContext.setResponseWriter(mrw);
+
+ input2.encodeAll(facesContext);
+
+ sw.flush();
+
+ attrs = new HtmlRenderedAttr[]{
+ new HtmlRenderedAttr("data_up", "Going Up"),
+ new HtmlRenderedAttr("onclick", "alert('hello')"),
+ //new HtmlRenderedAttr("customAttr", "SomeValue"),
+ new HtmlRenderedAttr("placeholder", "Enter text")
+ };
+
+ HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
+ if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
+ {
+ Assert.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ }
+ Assert.assertTrue(sw.toString().contains("<meter "));
+ Assert.assertTrue(sw.toString().contains("</meter>"));
+
+ sw = new StringWriter();
+ mrw = new HtmlResponseWriterImpl(sw, "text/html", "UTF-8");
+ facesContext.setResponseWriter(mrw);
+
+ input3.encodeAll(facesContext);
+
+ sw.flush();
+
+ attrs = new HtmlRenderedAttr[]{
+ new HtmlRenderedAttr("data_up", "Going Up"),
+ //new HtmlRenderedAttr("placeholder", "Enter text"),
+ //new HtmlRenderedAttr("customAttr", "SomeValue"),
+ //new HtmlRenderedAttr("value", "value1"),
+ new HtmlRenderedAttr("onclick", "alert('hello')"),
+ };
+
+ HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
+ if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
+ {
+ Assert.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ }
+ Assert.assertTrue(sw.toString().contains("<meter "));
+ Assert.assertTrue(sw.toString().contains("</meter>"));
+
+ // TEST 4
+ sw = new StringWriter();
+ mrw = new HtmlResponseWriterImpl(sw, "text/html", "UTF-8");
+ facesContext.setResponseWriter(mrw);
+
+ boxDiv4.encodeAll(facesContext);
+
+ sw.flush();
+
+ attrs = new HtmlRenderedAttr[]{
+ new HtmlRenderedAttr("class", "noprint"),
+ };
+
+ HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
+ if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
+ {
+ Assert.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ }
+ Assert.assertTrue(sw.toString().contains("MYBOX4"));
+ Assert.assertTrue(sw.toString().contains("<div "));
+ Assert.assertTrue(sw.toString().contains("</div>"));
+
+ // TEST 5
+ sw = new StringWriter();
+ mrw = new HtmlResponseWriterImpl(sw, "text/html", "UTF-8");
+ facesContext.setResponseWriter(mrw);
+
+ boxDiv5.encodeAll(facesContext);
+
+ sw.flush();
+
+ attrs = new HtmlRenderedAttr[]{
+ new HtmlRenderedAttr("style", "noprint"),
+ };
+
+ HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
+ if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
+ {
+ Assert.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ }
+ Assert.assertTrue(sw.toString().contains("MYBOX5"));
+ Assert.assertTrue(sw.toString().contains("<div "));
+ Assert.assertTrue(sw.toString().contains("</div>"));
+ }
+
+ @Test
+ public void testConvertTagAttributes6() throws Exception
+ {
+ request.getSession().setAttribute("test", new MockBean());
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testConvertTagAttributes6.xhtml");
+
+ //<div jsf:id="box6" jsf:onclick="alert('hello')">
+ // <f:ajax event="click" render="box5"/>
+ // MYBOX6
+ //</div>
+ // Try second time, to avoid the script section by f:ajax effect
+ UIComponent box6 = root.findComponent("myForm:box6");
+ Assert.assertNotNull(box6);
+ Assert.assertEquals(box6.getAttributes().get("onclick"), "alert('hello')");
+
+ StringWriter sw = new StringWriter();
+ ResponseWriter mrw = new HtmlResponseWriterImpl(sw, "text/html", "UTF-8");
+ facesContext.setResponseWriter(mrw);
+
+ box6.encodeAll(facesContext);
+
+ sw.flush();
+ HtmlRenderedAttr[] attrs = new HtmlRenderedAttr[]{
+ new HtmlRenderedAttr("onclick",
+ "faces.util.chain(this, event,'alert(\\'hello\\')', "
+ + "'myfaces.ab(this,event,\\'click\\',\\'\\',\\'myForm:box5\\')');"),
+ };
+
+ HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
+ if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
+ {
+ Assert.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ }
+ Assert.assertTrue(sw.toString().contains("MYBOX6"));
+ Assert.assertTrue(sw.toString().contains("<div "));
+ Assert.assertTrue(sw.toString().contains("</div>"));
+ }
+
+ @Test
+ public void testConvertTagAttributes7() throws Exception
+ {
+ request.getSession().setAttribute("test", new MockBean());
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testConvertTagAttributes7.xhtml");
+
+ //<h:panelGroup id="box7">
+ // <img jsf:name="external.png" alt="Some Logo"/>
+ //</h:panelGroup>
+
+ UIComponent box7 = root.findComponent("myForm:box7");
+ Assert.assertNotNull(box7);
+ UIComponent boxDiv7 = box7.getChildren().get(0);
+ Assert.assertNotNull(boxDiv7);
+
+ StringWriter sw = new StringWriter();
+
+ ResponseWriter mrw = new HtmlResponseWriterImpl(sw, "text/html", "UTF-8");
+ facesContext.setResponseWriter(mrw);
+
+ boxDiv7.encodeAll(facesContext);
+
+ sw.flush();
+ HtmlRenderedAttr[] attrs = new HtmlRenderedAttr[]{
+ new HtmlRenderedAttr("alt", "Some Logo"),
+ };
+
+ HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
+ if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
+ {
+ Assert.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
+ }
+ Assert.assertTrue(sw.toString().contains("<img "));
+ Assert.assertTrue(sw.toString().contains("jakarta.faces.resource/external.png"));
+ }
+}
diff --git a/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/faces/html/dataTable.xml b/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/faces/html/dataTable.xml
index 72c22ed..27d7b77 100644
--- a/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/faces/html/dataTable.xml
+++ b/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/faces/html/dataTable.xml
@@ -15,9 +15,9 @@
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core">
+ xmlns:ui="jakarta.faces.facelets"
+ xmlns:h="jakarta.faces.html"
+ xmlns:f="jakarta.faces.core">
<body>
<ui:composition>
diff --git a/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/faces/html/dataTableUrn.xml b/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/faces/html/dataTableUrn.xml
new file mode 100644
index 0000000..72c22ed
--- /dev/null
+++ b/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/faces/html/dataTableUrn.xml
@@ -0,0 +1,36 @@
+<!--
+ Licensed 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.
+
+ $Id$
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+<body>
+
+<ui:composition>
+<h:dataTable value="#{company.departments}" var="dept">
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="#{dept.name}"/>
+ </f:facet>
+ <h:outputText value="#{dept.name}"/>
+ </h:column>
+</h:dataTable>
+</ui:composition>
+
+
+</body>
+</html>
\ No newline at end of file
diff --git a/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/faces/html/testHtmlPassthrough1urn.xhtml b/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/faces/html/testHtmlPassthrough1urn.xhtml
new file mode 100644
index 0000000..beb6d75
--- /dev/null
+++ b/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/faces/html/testHtmlPassthrough1urn.xhtml
@@ -0,0 +1,75 @@
+<!--
+ Licensed 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.
+
+ $Id: defineInclude.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="jakarta.faces.html"
+ xmlns:f="jakarta.faces.core"
+ xmlns:faces="jakarta.faces">
+<head faces:id="idHead">
+ <link rel="stylesheet" type="text/css" href="custom.css"/>
+ <script type="text/javascript">
+ function hello(){
+ alert("Hello");
+ }
+ </script>
+ <link faces:id="osh" rel="stylesheet" type="text/css" faces:library="mylib" faces:name="resource.css"/>
+ <script faces:id="osc" type="text/javascript">
+ function hello(){
+ alert("Hello");
+ }
+ </script>
+</head>
+<body faces:id="idBody">
+ <form faces:id="myForm">
+ <a faces:id="link1" faces:action="#{test.testAction}"/>
+ <a faces:id="link2" faces:actionListener="#{test.testActionListener}"/>
+ <a faces:id="link3" faces:value="/my/new/location.txt"/>
+ <a faces:id="link4" faces:outcome="rollback"/>
+ <button faces:id="button1" faces:action="#{test.testAction}"/>
+ <button faces:id="button2" faces:outcome="rollback"/>
+ <img faces:id="img1" faces:url="/my/image.png"/>
+ <input faces:id="input1" type="button"/>
+ <input faces:id="input2" type="checkbox"/>
+ <input faces:id="input3" type="color"/>
+ <input faces:id="input4" type="date"/>
+ <input faces:id="input5" type="datetime"/>
+ <input faces:id="input6" type="datetime-local"/>
+ <input faces:id="input7" type="email"/>
+ <input faces:id="input8" type="month"/>
+ <input faces:id="input9" type="number"/>
+ <input faces:id="input10" type="range"/>
+ <input faces:id="input11" type="search"/>
+ <input faces:id="input12" type="time"/>
+ <input faces:id="input13" type="url"/>
+ <input faces:id="input14" type="week"/>
+ <input faces:id="input15" type="file"/>
+ <input faces:id="input16" type="hidden"/>
+ <input faces:id="input17" type="password"/>
+ <input faces:id="input18" type="reset"/>
+ <input faces:id="input19" type="submit"/>
+ <input faces:id="input20" type="anything"/>
+ <label faces:id="label1" />
+ <select faces:id="select1">
+ <f:selectItem itemValue="option1"/>
+ </select>
+ <select faces:id="select2" multiple="multiple">
+ <f:selectItem itemValue="option1"/>
+ <f:selectItem itemValue="option2"/>
+ </select>
+ <textarea faces:id="textarea1"/>
+ </form>
+</body>
+</html>
\ No newline at end of file
diff --git a/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/faces/html/testHtmlPassthrough2urn.xhtml b/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/faces/html/testHtmlPassthrough2urn.xhtml
new file mode 100644
index 0000000..d0e0d2d
--- /dev/null
+++ b/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/faces/html/testHtmlPassthrough2urn.xhtml
@@ -0,0 +1,75 @@
+<!--
+ Licensed 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.
+
+ $Id: defineInclude.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="jakarta.faces.html"
+ xmlns:f="jakarta.faces.core"
+ xmlns:my="jakarta.faces">
+<head my:id="idHead">
+ <link rel="stylesheet" type="text/css" href="custom.css"/>
+ <script type="text/javascript">
+ function hello(){
+ alert("Hello");
+ }
+ </script>
+ <link my:id="osh" rel="stylesheet" type="text/css" my:library="mylib" my:name="resource.css"/>
+ <script my:id="osc" type="text/javascript">
+ function hello(){
+ alert("Hello");
+ }
+ </script>
+</head>
+<body my:id="idBody">
+ <form my:id="myForm">
+ <a my:id="link1" my:action="#{test.testAction}"/>
+ <a my:id="link2" my:actionListener="#{test.testActionListener}"/>
+ <a my:id="link3" my:value="/my/new/location.txt"/>
+ <a my:id="link4" my:outcome="rollback"/>
+ <button my:id="button1" my:action="#{test.testAction}"/>
+ <button my:id="button2" my:outcome="rollback"/>
+ <img my:id="img1" my:url="/my/image.png"/>
+ <input my:id="input1" type="button"/>
+ <input my:id="input2" type="checkbox"/>
+ <input my:id="input3" type="color"/>
+ <input my:id="input4" type="date"/>
+ <input my:id="input5" type="datetime"/>
+ <input my:id="input6" type="datetime-local"/>
+ <input my:id="input7" type="email"/>
+ <input my:id="input8" type="month"/>
+ <input my:id="input9" type="number"/>
+ <input my:id="input10" type="range"/>
+ <input my:id="input11" type="search"/>
+ <input my:id="input12" type="time"/>
+ <input my:id="input13" type="url"/>
+ <input my:id="input14" type="week"/>
+ <input my:id="input15" type="file"/>
+ <input my:id="input16" type="hidden"/>
+ <input my:id="input17" type="password"/>
+ <input my:id="input18" type="reset"/>
+ <input my:id="input19" type="submit"/>
+ <input my:id="input20" type="anything"/>
+ <label my:id="label1" />
+ <select my:id="select1">
+ <f:selectItem itemValue="option1"/>
+ </select>
+ <select my:id="select2" multiple="multiple">
+ <f:selectItem itemValue="option1"/>
+ <f:selectItem itemValue="option2"/>
+ </select>
+ <textarea my:id="textarea1"/>
+ </form>
+</body>
+</html>
\ No newline at end of file