This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/deltaspike.git
The following commit(s) were added to refs/heads/master by this push:
new d48836124 removed pre Faces 2.3 stuff
d48836124 is described below
commit d488361245a959f2c940ab9068ec793398f8d82a
Author: Thomas Andraschko <[email protected]>
AuthorDate: Thu Mar 30 16:27:29 2023 +0200
removed pre Faces 2.3 stuff
---
.../component/window/WindowIdHtmlRenderer.java | 2 +-
...faultErrorViewAwareExceptionHandlerWrapper.java | 2 +-
.../jsf/impl/injection/AbstractBeanStorage.java | 54 -------
.../AbstractContextualReferenceWrapper.java | 154 ------------------
.../jsf/impl/injection/ConverterWrapper.java | 67 --------
.../jsf/impl/injection/DependentBeanEntry.java | 54 -------
.../InjectionAwareApplicationWrapper.java | 86 ----------
.../impl/injection/ManagedArtifactResolver.java | 92 -----------
.../injection/RequestDependentBeanStorage.java | 27 ----
.../jsf/impl/injection/ValidatorWrapper.java | 56 -------
.../proxy/ConverterAndValidatorProxyExtension.java | 179 ---------------------
.../proxy/ConverterAndValidatorProxyFactory.java | 80 ---------
.../proxy/ConverterInvocationHandler.java | 34 ----
.../injection/proxy/DefaultPartialStateHolder.java | 74 ---------
.../proxy/ValidatorInvocationHandler.java | 33 ----
.../phase/JsfRequestLifecycleBroadcaster.java | 6 +-
.../request/DeltaSpikeFacesContextFactory.java | 2 +-
.../JsfClientWindowAwareLifecycleWrapper.java | 2 +-
.../listener/request/JsfRequestBroadcaster.java | 62 +------
.../listener/system/JsfSystemEventBroadcaster.java | 2 +-
.../NavigationHandlerAwareApplication.java | 2 +-
.../jsf/impl/scope/mapped/Jsf2BeanWrapper.java | 116 -------------
.../scope/mapped/MappedJsf2ScopeExtension.java | 134 ---------------
.../jsf/impl/scope/view/ViewScopedContext.java | 171 --------------------
.../jsf/impl/scope/view/ViewScopedExtension.java | 91 -----------
.../jsf/impl/util/ClientWindowHelper.java | 4 +-
.../apache/deltaspike/jsf/impl/util/JsfUtils.java | 11 --
.../services/javax.enterprise.inject.spi.Extension | 4 -
28 files changed, 18 insertions(+), 1583 deletions(-)
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/window/WindowIdHtmlRenderer.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/window/WindowIdHtmlRenderer.java
index 7604316b2..b8d8e594f 100644
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/window/WindowIdHtmlRenderer.java
+++
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/component/window/WindowIdHtmlRenderer.java
@@ -37,7 +37,7 @@ import
org.apache.deltaspike.jsf.spi.scope.window.ClientWindowConfig;
@FacesRenderer(componentFamily = WindowIdComponent.COMPONENT_FAMILY,
rendererType = WindowIdComponent.COMPONENT_TYPE)
@ResourceDependencies( {
@ResourceDependency(library = "deltaspike", name = "windowhandler.js",
target = "head"),
- @ResourceDependency(library = "javax.faces", name = "jsf.js", target =
"head") } )
+ @ResourceDependency(library = "jakarta.faces", name = "jsf.js", target
= "head") } )
public class WindowIdHtmlRenderer extends Renderer
{
private volatile ClientWindow clientWindow;
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultErrorViewAwareExceptionHandlerWrapper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultErrorViewAwareExceptionHandlerWrapper.java
index 72d0bbb8e..06ca53ca1 100644
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultErrorViewAwareExceptionHandlerWrapper.java
+++
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultErrorViewAwareExceptionHandlerWrapper.java
@@ -116,7 +116,7 @@ public class DefaultErrorViewAwareExceptionHandlerWrapper
extends ExceptionHandl
continue;
}
- if
(facesContext.isProjectStage(javax.faces.application.ProjectStage.Development)
||
+ if
(facesContext.isProjectStage(jakarta.faces.application.ProjectStage.Development)
||
ProjectStageProducer.getInstance().getProjectStage()
== ProjectStage.Development ||
ProjectStageProducer.getInstance().getProjectStage()
instanceof TestStage)
{
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/AbstractBeanStorage.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/AbstractBeanStorage.java
deleted file mode 100644
index 67aa4b9a7..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/AbstractBeanStorage.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.injection;
-
-import jakarta.annotation.PreDestroy;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-abstract class AbstractBeanStorage
-{
- private static final Logger LOG =
Logger.getLogger(AbstractBeanStorage.class.getName());
-
- private List<DependentBeanEntry> dependentBeanEntries = new
ArrayList<DependentBeanEntry>();
-
- public void add(DependentBeanEntry dependentBeanEntry)
- {
- this.dependentBeanEntries.add(dependentBeanEntry);
- }
-
- @PreDestroy
- public void cleanup()
- {
- for (DependentBeanEntry beanEntry : this.dependentBeanEntries)
- {
- try
- {
- beanEntry.getBean().destroy(beanEntry.getInstance(),
beanEntry.getCreationalContext());
- }
- catch (RuntimeException e)
- {
- LOG.log(Level.SEVERE, e.getMessage(), e);
- }
- }
- this.dependentBeanEntries.clear();
- }
-}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/AbstractContextualReferenceWrapper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/AbstractContextualReferenceWrapper.java
deleted file mode 100644
index b2453fa37..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/AbstractContextualReferenceWrapper.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.injection;
-
-import org.apache.deltaspike.core.api.provider.BeanProvider;
-import org.apache.deltaspike.core.util.ClassUtils;
-import org.apache.deltaspike.jsf.api.config.JsfModuleConfig;
-
-import jakarta.faces.FacesWrapper;
-import jakarta.faces.component.PartialStateHolder;
-import jakarta.faces.component.StateHolder;
-import jakarta.faces.context.FacesContext;
-
-//no backward compatibility for full state-saving
-abstract class AbstractContextualReferenceWrapper<T> implements
PartialStateHolder, FacesWrapper<T>
-{
- private T wrapped;
- private transient Boolean fullStateSavingFallbackEnabled;
-
- protected AbstractContextualReferenceWrapper()
- {
- }
-
- protected AbstractContextualReferenceWrapper(T wrapped, boolean
fullStateSavingFallbackEnabled)
- {
- this.wrapped = wrapped;
- this.fullStateSavingFallbackEnabled = fullStateSavingFallbackEnabled;
- }
-
- @Override
- public void markInitialState()
- {
- if (this.wrapped instanceof PartialStateHolder)
- {
- ((PartialStateHolder) this.wrapped).markInitialState();
- }
- }
-
- @Override
- public void clearInitialState()
- {
- if (this.wrapped instanceof PartialStateHolder)
- {
- ((PartialStateHolder) this.wrapped).clearInitialState();
- }
- }
-
- @Override
- public boolean initialStateMarked()
- {
- return this.wrapped instanceof PartialStateHolder &&
((PartialStateHolder) this.wrapped).initialStateMarked();
- }
-
- @Override
- public Object saveState(FacesContext context)
- {
- if (this.fullStateSavingFallbackEnabled == null)
- {
- this.fullStateSavingFallbackEnabled =
-
BeanProvider.getContextualReference(JsfModuleConfig.class).isFullStateSavingFallbackEnabled();
- }
-
- if (this.wrapped instanceof StateHolder)
- {
- Object[] result = new Object[2];
-
- if (this.fullStateSavingFallbackEnabled)
- {
- result[0] = this.getWrapped().getClass().getName();
- }
- result[1] = ((StateHolder)wrapped).saveState(context);
- return result;
- }
-
- if (this.fullStateSavingFallbackEnabled)
- {
- Object[] result = new Object[1];
- result[0] = this.getWrapped().getClass().getName();
-
- return result;
- }
- return null;
- }
-
- @Override
- public void restoreState(FacesContext context, Object state)
- {
- Object[] wrappedState = (Object[]) state;
-
- if (this.wrapped == null) //fallback for full state-saving
- {
- Class wrappedClass =
ClassUtils.tryToLoadClassForName((String)wrappedState[0]);
-
- T resolvedInstance = resolveInstanceForClass(context,
wrappedClass);
-
- //TODO re-visit logic for multiple (custom) wrappers
- if (resolvedInstance instanceof AbstractContextualReferenceWrapper)
- {
- resolvedInstance =
((AbstractContextualReferenceWrapper<T>)resolvedInstance).getWrapped();
- }
- this.wrapped = resolvedInstance;
- }
-
- if (this.wrapped == null)
- {
- this.wrapped =
(T)ClassUtils.tryToInstantiateClassForName((String)wrappedState[0]);
- BeanProvider.injectFields(this.wrapped);
- }
-
- if (this.wrapped instanceof StateHolder)
- {
- ((StateHolder) this.wrapped).restoreState(context,
wrappedState[1]);
- }
- }
-
- @Override
- public boolean isTransient()
- {
- return this.wrapped instanceof StateHolder && ((StateHolder)
this.wrapped).isTransient();
- }
-
- @Override
- public void setTransient(boolean newTransientValue)
- {
- if (this.wrapped instanceof StateHolder)
- {
- ((StateHolder) this.wrapped).setTransient(newTransientValue);
- }
- }
-
- @Override
- public T getWrapped()
- {
- return this.wrapped;
- }
-
- protected abstract T resolveInstanceForClass(FacesContext facesContext,
Class<?> wrappedClass);
-}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/ConverterWrapper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/ConverterWrapper.java
deleted file mode 100644
index b8ced961b..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/ConverterWrapper.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.injection;
-
-import jakarta.faces.component.UIComponent;
-import jakarta.faces.context.FacesContext;
-import jakarta.faces.convert.Converter;
-import jakarta.faces.convert.ConverterException;
-import jakarta.faces.convert.FacesConverter;
-
-public class ConverterWrapper extends
AbstractContextualReferenceWrapper<Converter> implements Converter
-{
- public ConverterWrapper()
- {
- }
-
- public ConverterWrapper(Converter wrapped, boolean
fullStateSavingFallbackEnabled)
- {
- super(wrapped, fullStateSavingFallbackEnabled);
- }
-
- @Override
- public Object getAsObject(FacesContext facesContext, UIComponent
component, String value) throws ConverterException
- {
- return getWrapped().getAsObject(facesContext, component, value);
- }
-
- @Override
- public String getAsString(FacesContext facesContext, UIComponent
component, Object value) throws ConverterException
- {
- return getWrapped().getAsString(facesContext, component, value);
- }
-
- @Override
- protected Converter resolveInstanceForClass(FacesContext facesContext,
Class<?> wrappedClass)
- {
- FacesConverter facesConverter =
wrappedClass.getAnnotation(FacesConverter.class);
-
- if (facesConverter == null)
- {
- return null;
- }
-
- if (!"".equals(facesConverter.value()))
- {
- return
facesContext.getApplication().createConverter(facesConverter.value());
- }
-
- return
facesContext.getApplication().createConverter(facesConverter.forClass());
- }
-}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/DependentBeanEntry.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/DependentBeanEntry.java
deleted file mode 100644
index 23d656dd0..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/DependentBeanEntry.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.injection;
-
-import jakarta.enterprise.context.spi.CreationalContext;
-import jakarta.enterprise.inject.spi.Bean;
-import java.io.Serializable;
-
-class DependentBeanEntry<T> implements Serializable
-{
- private static final long serialVersionUID = 7148484695430831322L;
-
- private final T instance;
- private final Bean<?> bean;
- private final CreationalContext<T> creationalContext;
-
- DependentBeanEntry(T instance, Bean<?> bean, CreationalContext<T>
creationalContext)
- {
- this.instance = instance;
- this.bean = bean;
- this.creationalContext = creationalContext;
- }
-
- T getInstance()
- {
- return instance;
- }
-
- Bean<?> getBean()
- {
- return bean;
- }
-
- CreationalContext<T> getCreationalContext()
- {
- return creationalContext;
- }
-}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/InjectionAwareApplicationWrapper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/InjectionAwareApplicationWrapper.java
index 879bdbec7..bf628149c 100644
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/InjectionAwareApplicationWrapper.java
+++
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/InjectionAwareApplicationWrapper.java
@@ -18,28 +18,20 @@
*/
package org.apache.deltaspike.jsf.impl.injection;
-import org.apache.deltaspike.core.util.ProxyUtils;
import org.apache.deltaspike.jsf.api.config.JsfModuleConfig;
import org.apache.deltaspike.jsf.impl.security.SecurityAwareViewHandler;
-import org.apache.deltaspike.proxy.spi.DeltaSpikeProxy;
-import jakarta.faces.FacesException;
import jakarta.faces.application.Application;
import jakarta.faces.application.ApplicationWrapper;
import jakarta.faces.application.ProjectStage;
import jakarta.faces.context.FacesContext;
-import jakarta.faces.convert.Converter;
import jakarta.faces.event.PreDestroyViewMapEvent;
import jakarta.faces.event.SystemEvent;
-import jakarta.faces.validator.Validator;
public class InjectionAwareApplicationWrapper extends ApplicationWrapper
{
private final Application wrapped;
- private final boolean containerManagedConvertersEnabled;
- private final boolean containerManagedValidatorsEnabled;
private final boolean preDestroyViewMapEventFilterMode;
- private final boolean fullStateSavingFallbackEnabled;
private final ProjectStage projectStage;
public InjectionAwareApplicationWrapper(
@@ -47,60 +39,10 @@ public class InjectionAwareApplicationWrapper extends
ApplicationWrapper
ProjectStage projectStage)
{
this.wrapped = wrapped;
- this.containerManagedConvertersEnabled =
jsfModuleConfig.isContainerManagedConvertersEnabled();
- this.containerManagedValidatorsEnabled =
jsfModuleConfig.isContainerManagedValidatorsEnabled();
- this.fullStateSavingFallbackEnabled =
jsfModuleConfig.isFullStateSavingFallbackEnabled();
this.preDestroyViewMapEventFilterMode =
preDestroyViewMapEventFilterMode;
this.projectStage = projectStage;
}
- @Override
- public Converter createConverter(Class<?> targetClass)
- {
- return
managedOrDefaultConverter(this.wrapped.createConverter(targetClass));
- }
-
- @Override
- public Converter createConverter(String converterId)
- {
- return
managedOrDefaultConverter(this.wrapped.createConverter(converterId));
- }
-
- private Converter managedOrDefaultConverter(Converter defaultResult)
- {
- if (!this.containerManagedConvertersEnabled)
- {
- return defaultResult;
- }
- if (defaultResult == null)
- {
- return null;
- }
-
- Converter result =
ManagedArtifactResolver.resolveManagedConverter(defaultResult.getClass());
-
- if (result == null)
- {
- return defaultResult;
- }
-
- if (result instanceof DeltaSpikeProxy ||
ProxyUtils.isProxiedClass(result.getClass()))
- {
- return result;
- }
- else
- {
- return new ConverterWrapper(result,
this.fullStateSavingFallbackEnabled);
- }
- }
-
- @Override
- public Validator createValidator(String validatorId) throws FacesException
- {
- return
managedOrDefaultValidator(this.wrapped.createValidator(validatorId));
- }
-
-
@Override
public ProjectStage getProjectStage()
{
@@ -111,34 +53,6 @@ public class InjectionAwareApplicationWrapper extends
ApplicationWrapper
return this.projectStage;
}
- private Validator managedOrDefaultValidator(Validator defaultResult)
- {
- if (!this.containerManagedValidatorsEnabled)
- {
- return defaultResult;
- }
- if (defaultResult == null)
- {
- return null;
- }
-
- Validator result =
ManagedArtifactResolver.resolveManagedValidator(defaultResult.getClass());
-
- if (result == null)
- {
- return defaultResult;
- }
-
- if (result instanceof DeltaSpikeProxy ||
ProxyUtils.isProxiedClass(result.getClass()))
- {
- return result;
- }
- else
- {
- return new ValidatorWrapper(result,
this.fullStateSavingFallbackEnabled);
- }
- }
-
@Override
public void publishEvent(FacesContext facesContext, Class<? extends
SystemEvent> systemEventClass, Object source)
{
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/ManagedArtifactResolver.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/ManagedArtifactResolver.java
deleted file mode 100644
index 17c5054a6..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/ManagedArtifactResolver.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.injection;
-
-import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
-import org.apache.deltaspike.core.api.provider.BeanProvider;
-
-import jakarta.enterprise.context.Dependent;
-import jakarta.enterprise.context.spi.CreationalContext;
-import jakarta.enterprise.inject.Typed;
-import jakarta.enterprise.inject.spi.Bean;
-import jakarta.enterprise.inject.spi.BeanManager;
-import jakarta.faces.convert.Converter;
-import jakarta.faces.validator.Validator;
-import java.util.Set;
-
-@Typed()
-public abstract class ManagedArtifactResolver
-{
- public static final String JAVAX_FACES_CONVERT_PACKAGE_NAME =
"javax.faces.convert";
- public static final String JAVAX_FACES_VALIDATOR_PACKAGE_NAME =
"javax.faces.validator";
-
- /**
- * Constructor which prevents the instantiation of this class
- */
- private ManagedArtifactResolver()
- {
- }
-
- public static Converter resolveManagedConverter(Class<? extends Converter>
converterClass)
- {
- if
(JAVAX_FACES_CONVERT_PACKAGE_NAME.equals(converterClass.getPackage().getName()))
- {
- return null;
- }
-
- return
getContextualReference(BeanManagerProvider.getInstance().getBeanManager(),
converterClass);
- }
-
- public static Validator resolveManagedValidator(Class<? extends Validator>
validatorClass)
- {
- if
(JAVAX_FACES_VALIDATOR_PACKAGE_NAME.equals(validatorClass.getPackage().getName()))
- {
- return null;
- }
-
- return
getContextualReference(BeanManagerProvider.getInstance().getBeanManager(),
validatorClass);
- }
-
- private static <T> T getContextualReference(BeanManager beanManager,
Class<T> type)
- {
- Set<Bean<?>> beans = beanManager.getBeans(type);
-
- if (beans == null || beans.isEmpty())
- {
- return null;
- }
-
- Bean<?> bean = beanManager.resolve(beans);
-
- CreationalContext<?> creationalContext =
beanManager.createCreationalContext(bean);
-
- @SuppressWarnings({ "unchecked", "UnnecessaryLocalVariable" })
- T result = (T) beanManager.getReference(bean, type, creationalContext);
-
- if (bean.getScope().equals(Dependent.class))
- {
- AbstractBeanStorage beanStorage =
BeanProvider.getContextualReference(RequestDependentBeanStorage.class);
-
- //noinspection unchecked
- beanStorage.add(new DependentBeanEntry(result, bean,
creationalContext));
- }
-
- return result;
- }
-}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/RequestDependentBeanStorage.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/RequestDependentBeanStorage.java
deleted file mode 100644
index 70cedec8a..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/RequestDependentBeanStorage.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.injection;
-
-import jakarta.enterprise.context.RequestScoped;
-
-//TODO merge with AbstractBeanStorage if ViewDependentBeanStorage isn't needed
(see MYFACES-3805)
-@RequestScoped
-public class RequestDependentBeanStorage extends AbstractBeanStorage
-{
-}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/ValidatorWrapper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/ValidatorWrapper.java
deleted file mode 100644
index 17e91c6d4..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/ValidatorWrapper.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.injection;
-
-import jakarta.faces.component.UIComponent;
-import jakarta.faces.context.FacesContext;
-import jakarta.faces.validator.FacesValidator;
-import jakarta.faces.validator.Validator;
-import jakarta.faces.validator.ValidatorException;
-
-public class ValidatorWrapper extends
AbstractContextualReferenceWrapper<Validator> implements Validator
-{
- public ValidatorWrapper()
- {
- }
-
- public ValidatorWrapper(Validator wrapped, boolean
fullStateSavingFallbackEnabled)
- {
- super(wrapped, fullStateSavingFallbackEnabled);
- }
-
- @Override
- public void validate(FacesContext facesContext, UIComponent component,
Object value) throws ValidatorException
- {
- getWrapped().validate(facesContext, component, value);
- }
-
- @Override
- protected Validator resolveInstanceForClass(FacesContext facesContext,
Class<?> wrappedClass)
- {
- FacesValidator facesValidator =
wrappedClass.getAnnotation(FacesValidator.class);
-
- if (facesValidator == null)
- {
- return null;
- }
-
- return
facesContext.getApplication().createValidator(facesValidator.value());
- }
-}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/proxy/ConverterAndValidatorProxyExtension.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/proxy/ConverterAndValidatorProxyExtension.java
deleted file mode 100644
index 0ceafd5e9..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/proxy/ConverterAndValidatorProxyExtension.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.injection.proxy;
-
-import org.apache.deltaspike.core.spi.activation.Deactivatable;
-import org.apache.deltaspike.core.util.ClassDeactivationUtils;
-import org.apache.deltaspike.core.util.bean.BeanBuilder;
-import org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder;
-import org.apache.deltaspike.proxy.api.DeltaSpikeProxyContextualLifecycle;
-
-import jakarta.enterprise.event.Observes;
-import jakarta.enterprise.inject.spi.AfterBeanDiscovery;
-import jakarta.enterprise.inject.spi.AnnotatedType;
-import jakarta.enterprise.inject.spi.Bean;
-import jakarta.enterprise.inject.spi.BeanManager;
-import jakarta.enterprise.inject.spi.BeforeBeanDiscovery;
-import jakarta.enterprise.inject.spi.Extension;
-import jakarta.enterprise.inject.spi.ProcessAnnotatedType;
-import jakarta.faces.convert.Converter;
-import jakarta.faces.validator.Validator;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.logging.Logger;
-
-public class ConverterAndValidatorProxyExtension implements Extension,
Deactivatable
-{
- private static final Logger LOG =
Logger.getLogger(ConverterAndValidatorProxyExtension.class.getName());
-
- private Boolean isActivated = true;
- private Set<Class<?>> classesToProxy = new HashSet<Class<?>>();
-
- protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
- {
- this.isActivated = ClassDeactivationUtils.isActivated(getClass());
- }
-
- @SuppressWarnings("UnusedDeclaration")
- public <X> void
findConverterAndValidatorsWhichNeedProxiesForDependencyInjectionSupport(
- @Observes ProcessAnnotatedType<X> pat, BeanManager beanManager)
- {
- if (!this.isActivated)
- {
- return;
- }
-
- Class<X> beanClass = pat.getAnnotatedType().getJavaClass();
-
- if (!(Converter.class.isAssignableFrom(beanClass) ||
(Validator.class.isAssignableFrom(beanClass))))
- {
- return;
- }
-
- Bean<X> bean = new
BeanBuilder<X>(beanManager).readFromType(pat.getAnnotatedType()).create();
- // veto normal converters/validators -> they will get excluded from
the special handling later on
- if (!hasInjectionPoints(bean) && !hasNormalScopeAnnotation(bean,
beanManager))
- {
- pat.veto();
- return;
- }
-
- // converters/validators without properties for tags, will be handled
by the corresponding manual wrapper
- if (!hasPublicProperty(beanClass))
- {
- return;
- }
-
- if (!(Modifier.isFinal(beanClass.getModifiers())))
- {
- this.classesToProxy.add(beanClass);
- pat.veto();
- }
- else
- {
- LOG.warning("To use dependency-injection in converters/validators
with properties, " +
- "you they aren't allowed to be 'final'.");
- }
- }
-
- protected <X> boolean hasInjectionPoints(Bean<X> bean)
- {
- return !bean.getInjectionPoints().isEmpty();
- }
-
- protected <X> boolean hasNormalScopeAnnotation(Bean<X> bean, BeanManager
beanManager)
- {
- Class<? extends Annotation> scopeAnnotationClass = bean.getScope();
- return scopeAnnotationClass != null &&
beanManager.isNormalScope(scopeAnnotationClass);
- }
-
- protected <X> boolean hasPublicProperty(Class<X> beanClass)
- {
- for (Method currentMethod : beanClass.getMethods())
- {
- if (currentMethod.getName().startsWith("set") &&
currentMethod.getName().length() > 3
- && currentMethod.getParameterTypes().length == 1 &&
- hasGetterMethod(beanClass,
currentMethod.getName().substring(3)))
- {
- return true;
- }
- }
- return false;
- }
-
- protected boolean hasGetterMethod(Class beanClass, String name)
- {
- try
- {
- if (beanClass.getMethod("get" + name) != null ||
beanClass.getMethod("is" + name) != null)
- {
- return true;
- }
- }
- catch (Exception e)
- {
- return false;
- }
- return false;
- }
-
- public <X> void createBeans(@Observes AfterBeanDiscovery
afterBeanDiscovery, BeanManager beanManager)
- {
- if (!this.isActivated)
- {
- return;
- }
-
- for (Class<?> originalClass : this.classesToProxy)
- {
- Bean bean = createBean(originalClass, beanManager);
-
- if (bean != null)
- {
- afterBeanDiscovery.addBean(bean);
- }
- }
-
- this.classesToProxy.clear();
- }
-
- protected <T> Bean<T> createBean(Class<T> beanClass, BeanManager
beanManager)
- {
- Class<? extends InvocationHandler> invocationHandlerClass =
- Converter.class.isAssignableFrom(beanClass) ?
- ConverterInvocationHandler.class :
ValidatorInvocationHandler.class;
-
- AnnotatedType<T> annotatedType = new
AnnotatedTypeBuilder<T>().readFromType(beanClass).create();
-
- DeltaSpikeProxyContextualLifecycle lifecycle = new
DeltaSpikeProxyContextualLifecycle(beanClass,
- invocationHandlerClass,
ConverterAndValidatorProxyFactory.getInstance(), beanManager);
-
- BeanBuilder<T> beanBuilder = new BeanBuilder<T>(beanManager)
- .readFromType(annotatedType)
- .passivationCapable(true)
- .beanLifecycle(lifecycle);
-
- return beanBuilder.create();
- }
-}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/proxy/ConverterAndValidatorProxyFactory.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/proxy/ConverterAndValidatorProxyFactory.java
deleted file mode 100644
index fd9f46ab9..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/proxy/ConverterAndValidatorProxyFactory.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.injection.proxy;
-
-import org.apache.deltaspike.proxy.api.DeltaSpikeProxyFactory;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import jakarta.enterprise.inject.Typed;
-import jakarta.faces.component.PartialStateHolder;
-import jakarta.faces.component.StateHolder;
-
-@Typed
-public class ConverterAndValidatorProxyFactory extends DeltaSpikeProxyFactory
-{
- private static final ConverterAndValidatorProxyFactory INSTANCE = new
ConverterAndValidatorProxyFactory();
-
- public static ConverterAndValidatorProxyFactory getInstance()
- {
- return INSTANCE;
- }
-
- @Override
- protected String getProxyClassSuffix()
- {
- return "$$DSJsfProxy";
- }
-
- @Override
- protected ArrayList<Method> getDelegateMethods(Class<?> targetClass,
ArrayList<Method> allMethods)
- {
- if (!StateHolder.class.isAssignableFrom(targetClass))
- {
- ArrayList<Method> delegateMethods = new ArrayList<Method>();
-
delegateMethods.addAll(Arrays.asList(StateHolder.class.getDeclaredMethods()));
-
delegateMethods.addAll(Arrays.asList(PartialStateHolder.class.getDeclaredMethods()));
- return delegateMethods;
- }
-
- if (!PartialStateHolder.class.isAssignableFrom(targetClass))
- {
- ArrayList<Method> delegateMethods = new ArrayList<Method>();
-
delegateMethods.addAll(Arrays.asList(PartialStateHolder.class.getDeclaredMethods()));
- return delegateMethods;
- }
-
- return null;
- }
-
- @Override
- protected Class<?>[] getAdditionalInterfacesToImplement(Class<?>
targetClass)
- {
- List<Class<?>> interfaces = Arrays.asList(targetClass.getInterfaces());
- if (!interfaces.contains(PartialStateHolder.class))
- {
- return new Class<?>[] { PartialStateHolder.class };
- }
-
- return null;
- }
-}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/proxy/ConverterInvocationHandler.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/proxy/ConverterInvocationHandler.java
deleted file mode 100644
index ab42e5ad1..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/proxy/ConverterInvocationHandler.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.injection.proxy;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-
-public class ConverterInvocationHandler implements InvocationHandler
-{
- private DefaultPartialStateHolder defaultPartialStateHolder = new
DefaultPartialStateHolder();
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args) throws
Throwable
- {
- return method.invoke(defaultPartialStateHolder, args);
-
- }
-}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/proxy/DefaultPartialStateHolder.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/proxy/DefaultPartialStateHolder.java
deleted file mode 100644
index c357c72b5..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/proxy/DefaultPartialStateHolder.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.injection.proxy;
-
-import jakarta.faces.component.PartialStateHolder;
-import jakarta.faces.context.FacesContext;
-
-//the converter-/validator proxy needs to implement PartialStateHolder to
force a special path of the jsf state handling
-//which forces a call to InjectionAwareApplicationWrapper on the postback.
-//this class provides the default behaviour for the reflection calls,
-//if the original converter-/validator doesn't implement the interface
-public class DefaultPartialStateHolder implements PartialStateHolder
-{
- private boolean transientValue;
- private boolean initialStateMarked;
-
- @Override
- public Object saveState(FacesContext context)
- {
- return null; //not needed
- }
-
- @Override
- public void restoreState(FacesContext context, Object state)
- {
- //not needed
- }
-
- @Override
- public boolean isTransient()
- {
- return this.transientValue;
- }
-
- @Override
- public void setTransient(boolean newTransientValue)
- {
- this.transientValue = newTransientValue;
- }
-
- @Override
- public void clearInitialState()
- {
- this.initialStateMarked = false;
- }
-
- @Override
- public boolean initialStateMarked()
- {
- return this.initialStateMarked;
- }
-
- @Override
- public void markInitialState()
- {
- this.initialStateMarked = true;
- }
-}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/proxy/ValidatorInvocationHandler.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/proxy/ValidatorInvocationHandler.java
deleted file mode 100644
index 54007a639..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/injection/proxy/ValidatorInvocationHandler.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.injection.proxy;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-
-public class ValidatorInvocationHandler implements InvocationHandler
-{
- private DefaultPartialStateHolder defaultPartialStateHolder = new
DefaultPartialStateHolder();
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args) throws
Throwable
- {
- return method.invoke(defaultPartialStateHolder, args);
- }
-}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/phase/JsfRequestLifecycleBroadcaster.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/phase/JsfRequestLifecycleBroadcaster.java
index c5331680e..0d149c497 100644
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/phase/JsfRequestLifecycleBroadcaster.java
+++
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/phase/JsfRequestLifecycleBroadcaster.java
@@ -143,7 +143,7 @@ public class JsfRequestLifecycleBroadcaster
}
}
- protected Annotation createAnnotationLiteral(javax.faces.event.PhaseId
phaseId, boolean isBeforeEvent)
+ protected Annotation createAnnotationLiteral(jakarta.faces.event.PhaseId
phaseId, boolean isBeforeEvent)
{
if (isBeforeEvent)
{
@@ -152,7 +152,7 @@ public class JsfRequestLifecycleBroadcaster
return createAfterLiteral(phaseId);
}
- protected Annotation createBeforeLiteral(final javax.faces.event.PhaseId
phaseId)
+ protected Annotation createBeforeLiteral(final jakarta.faces.event.PhaseId
phaseId)
{
return new BeforePhaseBinding()
{
@@ -166,7 +166,7 @@ public class JsfRequestLifecycleBroadcaster
};
}
- protected Annotation createAfterLiteral(final javax.faces.event.PhaseId
phaseId)
+ protected Annotation createAfterLiteral(final jakarta.faces.event.PhaseId
phaseId)
{
return new AfterPhaseBinding()
{
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
index a085ebbb5..4353132b3 100644
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
+++
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
@@ -49,7 +49,7 @@ public class DeltaSpikeFacesContextFactory extends
FacesContextFactory implement
}
/**
- * Wrapps the created {@link javax.faces.context.FacesContext} with {@link
DeltaSpikeFacesContextWrapper}
+ * Wrapps the created {@link jakarta.faces.context.FacesContext} with
{@link DeltaSpikeFacesContextWrapper}
* <p/>
* {@inheritDoc}
*/
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfClientWindowAwareLifecycleWrapper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfClientWindowAwareLifecycleWrapper.java
index 3cb919786..2f27bc579 100644
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfClientWindowAwareLifecycleWrapper.java
+++
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfClientWindowAwareLifecycleWrapper.java
@@ -135,7 +135,7 @@ public class JsfClientWindowAwareLifecycleWrapper extends
LifecycleWrapper
private static void delegateAttachWindow(FacesContext facesContext,
Lifecycle lifecycle) throws Exception
{
//if there is an external wrapper (e.g. in case of other libs), we
have to check
- //the version of javax.faces.lifecycle.Lifecycle (>= or < v2.2)
+ //the version of jakarta.faces.lifecycle.Lifecycle (>= or < v2.2)
//without the check and an old lib (in the classpath) #attachWindow
would get ignored without exception
if (lifecycle instanceof LifecycleWrapper /*autom. provides
#attachWindow*/ ||
lifecycle.getClass().getDeclaredMethod("attachWindow",
FacesContext.class) != null)
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfRequestBroadcaster.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfRequestBroadcaster.java
index 8c438a287..b5ec35fe7 100644
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfRequestBroadcaster.java
+++
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfRequestBroadcaster.java
@@ -18,66 +18,28 @@
*/
package org.apache.deltaspike.jsf.impl.listener.request;
-import org.apache.deltaspike.core.api.literal.DestroyedLiteral;
-import org.apache.deltaspike.core.api.literal.InitializedLiteral;
import org.apache.deltaspike.core.spi.activation.Deactivatable;
-import org.apache.deltaspike.core.util.ClassUtils;
-import org.apache.deltaspike.core.util.metadata.AnnotationInstanceProvider;
-import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.enterprise.context.Initialized;
+import jakarta.enterprise.context.RequestScoped;
import jakarta.enterprise.event.Event;
-import jakarta.faces.bean.RequestScoped;
import jakarta.faces.context.FacesContext;
import jakarta.inject.Inject;
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-import java.util.Map;
/**
* Broadcaster for
- * {@link org.apache.deltaspike.core.api.lifecycle.Initialized}
- * {@link org.apache.deltaspike.core.api.lifecycle.Destroyed}
- * with
- * {@link FacesContext} as event-payload
- * and/or in case of CDI 1.1+
* {@link jakarta.enterprise.context.Initialized}
* {@link jakarta.enterprise.context.Destroyed}
* with
- * {@link javax.faces.bean.RequestScoped} as annotation-parameter and
+ * {@link jakarta.faces.bean.RequestScoped} as annotation-parameter and
* {@link FacesContext} as event-payload
*/
@ApplicationScoped
public class JsfRequestBroadcaster implements Deactivatable
{
- @Inject
- private Event<FacesContext> jsfRequestEvent;
-
- /*
- * annotation-instances for the optional cdi 1.1+ support
- */
- private Annotation initializedAnnotationInstance;
- private Annotation destroyedAnnotationInstance;
-
- @PostConstruct
- protected void init()
- {
- Map<String, Class> values = new HashMap<String, Class>();
- values.put("value", RequestScoped.class);
- Class<? extends Annotation> initializedAnnotationClass =
-
ClassUtils.tryToLoadClassForName("jakarta.enterprise.context.Initialized");
- if (initializedAnnotationClass != null)
- {
- this.initializedAnnotationInstance =
AnnotationInstanceProvider.of(initializedAnnotationClass, values);
- }
-
- Class<? extends Annotation> destroyedAnnotationClass =
-
ClassUtils.tryToLoadClassForName("jakarta.enterprise.context.Destroyed");
- if (destroyedAnnotationClass != null)
- {
- this.destroyedAnnotationInstance =
AnnotationInstanceProvider.of(destroyedAnnotationClass, values);
- }
- }
+ @Inject @Initialized(RequestScoped.class) private Event<FacesContext>
initEvent;
+ @Inject @Initialized(RequestScoped.class) private Event<FacesContext>
destroyedEvent;
/**
* Broadcasts @Initialized-event(s)
@@ -86,12 +48,7 @@ public class JsfRequestBroadcaster implements Deactivatable
*/
public void broadcastInitializedJsfRequestEvent(FacesContext facesContext)
{
- this.jsfRequestEvent.select(new
InitializedLiteral()).fire(facesContext);
-
- if (this.initializedAnnotationInstance != null)
- {
-
this.jsfRequestEvent.select(this.initializedAnnotationInstance).fire(facesContext);
- }
+ this.initEvent.fire(facesContext);
}
/**
@@ -101,11 +58,6 @@ public class JsfRequestBroadcaster implements Deactivatable
*/
public void broadcastDestroyedJsfRequestEvent(FacesContext facesContext)
{
- this.jsfRequestEvent.select(new DestroyedLiteral()).fire(facesContext);
-
- if (this.destroyedAnnotationInstance != null)
- {
-
this.jsfRequestEvent.select(this.destroyedAnnotationInstance).fire(facesContext);
- }
+ this.destroyedEvent.fire(facesContext);
}
}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/system/JsfSystemEventBroadcaster.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/system/JsfSystemEventBroadcaster.java
index a665e82ba..2e65d097c 100644
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/system/JsfSystemEventBroadcaster.java
+++
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/system/JsfSystemEventBroadcaster.java
@@ -53,6 +53,6 @@ public class JsfSystemEventBroadcaster implements
SystemEventListener, Deactivat
}
BeanManager beanManager =
BeanManagerProvider.getInstance().getBeanManager();
- beanManager.fireEvent(e);
+ beanManager.getEvent().fire(e);
}
}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/navigation/NavigationHandlerAwareApplication.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/navigation/NavigationHandlerAwareApplication.java
index 75088bdba..9be5c3b5e 100644
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/navigation/NavigationHandlerAwareApplication.java
+++
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/navigation/NavigationHandlerAwareApplication.java
@@ -77,7 +77,7 @@ public class NavigationHandlerAwareApplication extends
ApplicationWrapper implem
}
Class wrapperClass = ClassUtils
-
.tryToLoadClassForName("javax.faces.application.ConfigurableNavigationHandlerWrapper");
+
.tryToLoadClassForName("jakarta.faces.application.ConfigurableNavigationHandlerWrapper");
if (wrapperClass != null)
{
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/mapped/Jsf2BeanWrapper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/mapped/Jsf2BeanWrapper.java
deleted file mode 100644
index 5cbe6783b..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/mapped/Jsf2BeanWrapper.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.scope.mapped;
-
-import org.apache.deltaspike.core.util.metadata.AnnotationInstanceProvider;
-
-import jakarta.enterprise.inject.spi.AnnotatedType;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Helper used by {@link MappedJsf2ScopeExtension}
- */
-//TODO refactor it
-class Jsf2BeanWrapper implements AnnotatedType<Object>
-{
- private final AnnotatedType wrapped;
- private Map<Class<? extends Annotation>, Annotation> annotations;
- private Set<Annotation> annotationSet;
-
- Jsf2BeanWrapper(AnnotatedType wrapped,
- Class<? extends Annotation> cdiScopeAnnotation,
- Class<? extends Annotation> jsf2ScopeAnnotation)
- {
- this.wrapped = wrapped;
- Set<Annotation> originalAnnotationSet = wrapped.getAnnotations();
- this.annotations = new HashMap<Class<? extends Annotation>,
Annotation>(originalAnnotationSet.size());
-
- for (Annotation originalAnnotation : originalAnnotationSet)
- {
- if
(!originalAnnotation.annotationType().equals(jsf2ScopeAnnotation))
- {
- this.annotations.put(originalAnnotation.annotationType(),
originalAnnotation);
- }
- }
-
- this.annotations.put(cdiScopeAnnotation,
AnnotationInstanceProvider.of(cdiScopeAnnotation));
-
- this.annotationSet = new HashSet<Annotation>(this.annotations.size());
- this.annotationSet.addAll(this.annotations.values());
- }
-
- @Override
- public Class getJavaClass()
- {
- return wrapped.getJavaClass();
- }
-
- @Override
- public Set getConstructors()
- {
- return wrapped.getConstructors();
- }
-
- @Override
- public Set getMethods()
- {
- return wrapped.getMethods();
- }
-
- @Override
- public Set getFields()
- {
- return wrapped.getFields();
- }
-
- @Override
- public Type getBaseType()
- {
- return wrapped.getBaseType();
- }
-
- @Override
- public Set<Type> getTypeClosure()
- {
- return wrapped.getTypeClosure();
- }
-
- @Override
- public <T extends Annotation> T getAnnotation(Class<T> targetClass)
- {
- return (T) this.annotations.get(targetClass);
- }
-
- @Override
- public Set<Annotation> getAnnotations()
- {
- return this.annotationSet;
- }
-
- @Override
- public boolean isAnnotationPresent(Class<? extends Annotation> targetClass)
- {
- return this.annotations.containsKey(targetClass);
- }
-}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/mapped/MappedJsf2ScopeExtension.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/mapped/MappedJsf2ScopeExtension.java
deleted file mode 100644
index bb2273420..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/mapped/MappedJsf2ScopeExtension.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.scope.mapped;
-
-import org.apache.deltaspike.core.api.projectstage.ProjectStage;
-import org.apache.deltaspike.core.spi.activation.Deactivatable;
-import org.apache.deltaspike.core.util.ClassDeactivationUtils;
-import org.apache.deltaspike.core.util.ClassUtils;
-import org.apache.deltaspike.core.util.ProjectStageProducer;
-import org.apache.deltaspike.jsf.impl.util.JsfUtils;
-
-import jakarta.enterprise.event.Observes;
-import jakarta.enterprise.inject.spi.AnnotatedType;
-import jakarta.enterprise.inject.spi.BeforeBeanDiscovery;
-import jakarta.enterprise.inject.spi.Extension;
-import jakarta.enterprise.inject.spi.ProcessAnnotatedType;
-import jakarta.faces.bean.ManagedBean;
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Logger;
-
-/**
- * Maps JSF2 scopes to CDI scopes
- */
-public class MappedJsf2ScopeExtension implements Extension, Deactivatable
-{
- private boolean isActivated = true;
-
- private final Logger logger =
Logger.getLogger(MappedJsf2ScopeExtension.class.getName());
-
- private Map<Class<? extends Annotation>, Class<? extends Annotation>>
mappedJsfScopes
- = new HashMap<Class<? extends Annotation>, Class<? extends
Annotation>>();
-
- /**
- * Default constructor which initializes the scope mapping
- */
- public MappedJsf2ScopeExtension()
- {
- // skip on JSF3.x
- if
(ClassUtils.tryToLoadClassForName("javax.faces.bean.ApplicationScoped") != null)
- {
- this.mappedJsfScopes.put(javax.faces.bean.ApplicationScoped.class,
- jakarta.enterprise.context.ApplicationScoped.class);
- this.mappedJsfScopes.put(javax.faces.bean.SessionScoped.class,
- jakarta.enterprise.context.SessionScoped.class);
- this.mappedJsfScopes.put(javax.faces.bean.RequestScoped.class,
- jakarta.enterprise.context.RequestScoped.class);
-
- if (JsfUtils.isViewScopeDelegationEnabled())
- {
- this.mappedJsfScopes.put(javax.faces.bean.ViewScoped.class,
-
ClassUtils.tryToLoadClassForName("javax.faces.view.ViewScoped"));
- }
- }
- }
-
- protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
- {
- this.isActivated = ClassDeactivationUtils.isActivated(getClass());
- }
-
- protected void convertJsf2Scopes(@Observes ProcessAnnotatedType
processAnnotatedType)
- {
- if (!isActivated)
- {
- return;
- }
-
- //TODO
- //CodiStartupBroadcaster.broadcastStartup();
-
- Class<? extends Annotation> jsf2ScopeAnnotation =
getJsf2ScopeAnnotation(processAnnotatedType);
-
- if (jsf2ScopeAnnotation != null &&
!isBeanWithManagedBeanAnnotation(processAnnotatedType))
- {
- processAnnotatedType.setAnnotatedType(
- convertBean(processAnnotatedType.getAnnotatedType(),
jsf2ScopeAnnotation));
- }
- }
-
- private Class<? extends Annotation>
getJsf2ScopeAnnotation(ProcessAnnotatedType processAnnotatedType)
- {
- for (Class<? extends Annotation> currentJsfScope :
this.mappedJsfScopes.keySet())
- {
- if
(processAnnotatedType.getAnnotatedType().getJavaClass().isAnnotationPresent(currentJsfScope))
- {
- return currentJsfScope;
- }
- }
- return null;
- }
-
- private boolean isBeanWithManagedBeanAnnotation(ProcessAnnotatedType
processAnnotatedType)
- {
- Class<?> beanClass =
processAnnotatedType.getAnnotatedType().getJavaClass();
-
- return beanClass.isAnnotationPresent(ManagedBean.class);
- }
-
- private AnnotatedType convertBean(AnnotatedType annotatedType, Class<?
extends Annotation> jsf2ScopeAnnotation)
- {
- logConvertedBean(annotatedType, jsf2ScopeAnnotation);
-
- return new Jsf2BeanWrapper(annotatedType,
this.mappedJsfScopes.get(jsf2ScopeAnnotation), jsf2ScopeAnnotation);
- }
-
- private void logConvertedBean(AnnotatedType annotatedType, Class<? extends
Annotation> jsf2ScopeAnnotation)
- {
- ProjectStage projectStage =
ProjectStageProducer.getInstance().getProjectStage();
-
- if (projectStage == ProjectStage.Development)
- {
- logger.info("JSF2 bean was converted to a CDI bean. Type: " +
annotatedType.getJavaClass().getName() +
- " original scope: " + jsf2ScopeAnnotation.getName());
- }
- }
-}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/view/ViewScopedContext.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/view/ViewScopedContext.java
deleted file mode 100644
index 624f7773d..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/view/ViewScopedContext.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.scope.view;
-
-import jakarta.enterprise.context.spi.Contextual;
-import jakarta.enterprise.context.spi.CreationalContext;
-import jakarta.enterprise.inject.spi.BeanManager;
-import jakarta.faces.bean.ViewScoped;
-import jakarta.faces.component.UIViewRoot;
-import jakarta.faces.context.FacesContext;
-import jakarta.faces.event.PreDestroyViewMapEvent;
-import jakarta.faces.event.SystemEvent;
-import jakarta.faces.event.SystemEventListener;
-import java.lang.annotation.Annotation;
-import java.util.Map;
-
-import org.apache.deltaspike.core.util.context.AbstractContext;
-import org.apache.deltaspike.core.util.context.ContextualStorage;
-
-/**
- * This class provides the contexts lifecycle for the
- * new JSF-2 @ViewScoped Context.
- */
-public class ViewScopedContext extends AbstractContext implements
SystemEventListener
-{
- private static final String CONTEXTUAL_MAP_NAME =
"deltaspike.contextualInstanceMap";
-
- private boolean isJsfSubscribed = false;
-
- private BeanManager beanManager;
-
- public ViewScopedContext(BeanManager beanManager)
- {
- super(beanManager);
- this.beanManager = beanManager;
- }
-
- @Override
- protected ContextualStorage getContextualStorage(Contextual<?> contextual,
boolean createIfNotExists)
- {
- Map<String, Object> viewMap = getViewMap();
- ContextualStorage storage = (ContextualStorage)
viewMap.get(CONTEXTUAL_MAP_NAME);
-
- if (storage == null && createIfNotExists)
- {
- storage = new ContextualStorage(beanManager, false,
isPassivatingScope());
- viewMap.put(CONTEXTUAL_MAP_NAME, storage);
- }
-
- return storage;
- }
-
- @Override
- public <T> T get(Contextual<T> bean)
- {
- subscribeToJsf();
-
- return super.get(bean);
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public <T> T get(Contextual<T> bean, CreationalContext<T>
creationalContext)
- {
- subscribeToJsf();
-
- return super.get(bean, creationalContext);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Class<? extends Annotation> getScope()
- {
- return ViewScoped.class;
- }
-
- /**
- * The view context is active if a valid ViewRoot could be detected.
- */
- @Override
- public boolean isActive()
- {
- return getViewRoot() != null;
- }
-
- private void subscribeToJsf()
- {
- if (!isJsfSubscribed)
- {
-
FacesContext.getCurrentInstance().getApplication().subscribeToEvent(PreDestroyViewMapEvent.class,
this);
-
- isJsfSubscribed = true;
- }
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isListenerForSource(Object source)
- {
- if (source instanceof UIViewRoot)
- {
- return true;
- }
-
- return false;
- }
-
- /**
- * We get PreDestroyViewMapEvent events from the JSF servlet and destroy
our contextual
- * instances. This should (theoretically!) also get fired if the webapp
closes, so there
- * should be no need to manually track all view scopes and destroy them at
a shutdown.
- *
- * @see
javax.faces.event.SystemEventListener#processEvent(javax.faces.event.SystemEvent)
- */
- @Override
- public void processEvent(SystemEvent event)
- {
- if (event instanceof PreDestroyViewMapEvent)
- {
- destroyAllActive();
- }
- }
-
- protected UIViewRoot getViewRoot()
- {
- FacesContext context = FacesContext.getCurrentInstance();
-
- if (context != null)
- {
- return context.getViewRoot();
- }
-
- return null;
- }
-
- protected Map<String, Object> getViewMap()
- {
- UIViewRoot viewRoot = getViewRoot();
-
- if (viewRoot != null)
- {
- return viewRoot.getViewMap(true);
- }
-
- return null;
- }
-}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/view/ViewScopedExtension.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/view/ViewScopedExtension.java
deleted file mode 100644
index c746c4db6..000000000
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/scope/view/ViewScopedExtension.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.jsf.impl.scope.view;
-
-
-import jakarta.enterprise.event.Observes;
-import jakarta.enterprise.inject.spi.AfterBeanDiscovery;
-import jakarta.enterprise.inject.spi.BeanManager;
-import jakarta.enterprise.inject.spi.BeforeBeanDiscovery;
-import jakarta.enterprise.inject.spi.Extension;
-import jakarta.faces.bean.ViewScoped;
-
-import org.apache.deltaspike.core.spi.activation.Deactivatable;
-import org.apache.deltaspike.core.util.ClassDeactivationUtils;
-import org.apache.deltaspike.jsf.impl.util.JsfUtils;
-
-
-/**
- * <p>This CDI extension enables support for the new JSF-2 @ViewScoped
annotation.</p>
- *
- * <p>2 steps are necessary:</p>
- * <ol>
- * <li>We have to manually add the @ViewScoped annotation
- * as a passivating {@link jakarta.enterprise.context.NormalScope},
- * since this annotation is neither a JSR-330 annotation
- * nor a JSR-299 annotation and therefor doesn't get picked up automatically.
This has to be
- * before the bean scanning starts.</li>
- * <li>After the bean scanning succeeded, we register the
- * {@link jakarta.enterprise.context.spi.Context} for the
- * ViewScoped. The {@link ViewScopedContext} is responsible for actually
storing all our
- * @ViewScoped contextual instances in the JSF ViewMap.</li>
- * </ol>
- */
-public class ViewScopedExtension implements Extension, Deactivatable
-{
- private boolean isActivated = true;
-
- /**
- * javax.faces.bean.ViewScoped is no CDI Scope.
- * We need to add it programmatically to CDI.
- */
- public void addViewScoped(@Observes BeforeBeanDiscovery
beforeBeanDiscovery)
- {
- isActivated = ClassDeactivationUtils.isActivated(getClass());
-
- if (isActivated)
- {
- //this extension is only needed if the cdi-based view-scope
handling isn't delegated to jsf 2.2+
- isActivated = !JsfUtils.isViewScopeDelegationEnabled();
- }
-
- if (!isActivated)
- {
- return;
- }
-
- beforeBeanDiscovery.addScope(ViewScoped.class, true, true);
- }
-
- /**
- * Register and start the ViewScopedContext.
- */
- public void registerViewContext(@Observes AfterBeanDiscovery
afterBeanDiscovery, BeanManager beanManager)
- {
- if (!isActivated)
- {
- return;
- }
-
- //X TODO check whether we still need this in EE6:
CodiStartupBroadcaster.broadcastStartup();
-
- afterBeanDiscovery.addContext(new ViewScopedContext(beanManager));
- }
-
-}
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/ClientWindowHelper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/ClientWindowHelper.java
index b2ea2ad3e..9d58801ea 100644
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/ClientWindowHelper.java
+++
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/ClientWindowHelper.java
@@ -42,7 +42,7 @@ public abstract class ClientWindowHelper
public abstract class RequestParameters
{
public static final String POST_WINDOW_ID = "dspwid";
- public static final String JSF_POST_WINDOW_ID =
"javax.faces.ClientWindow";
+ public static final String JSF_POST_WINDOW_ID =
"jakarta.faces.ClientWindow";
public static final String GET_WINDOW_ID = "dswid";
public static final String REQUEST_TOKEN = "dsrid";
}
@@ -111,7 +111,7 @@ public abstract class ClientWindowHelper
/**
* Appends the current windowId to the given url, if enabled via
- * {@link
ClientWindow#isClientWindowRenderModeEnabled(javax.faces.context.FacesContext)}
+ * {@link
ClientWindow#isClientWindowRenderModeEnabled(jakarta.faces.context.FacesContext)}
*
* @param facesContext the {@link FacesContext}
* @param url the url
diff --git
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/JsfUtils.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/JsfUtils.java
index 8917053d6..fe99ca45f 100644
---
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/JsfUtils.java
+++
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/JsfUtils.java
@@ -21,8 +21,6 @@ package org.apache.deltaspike.jsf.impl.util;
import org.apache.deltaspike.core.api.config.view.metadata.ViewConfigResolver;
import org.apache.deltaspike.core.api.provider.BeanProvider;
import
org.apache.deltaspike.core.api.config.view.navigation.NavigationParameterContext;
-import org.apache.deltaspike.core.util.ClassUtils;
-import org.apache.deltaspike.jsf.api.config.base.JsfBaseConfig;
import org.apache.deltaspike.jsf.api.config.JsfModuleConfig;
import org.apache.deltaspike.jsf.impl.listener.phase.WindowMetaData;
import org.apache.deltaspike.jsf.impl.message.FacesMessageEntry;
@@ -357,15 +355,6 @@ public abstract class JsfUtils
return true;
}
- /**
- * @return true if JSF 2.2+ is available and the delegation mode isn't
deactivated via config, false otherwise
- */
- public static boolean isViewScopeDelegationEnabled()
- {
- return ClassUtils.tryToLoadClassForName("javax.faces.view.ViewScoped")
!= null &&
- JsfBaseConfig.ScopeCustomization.ViewDelegation.DELEGATE_TO_JSF;
- }
-
public static void logWrongModuleUsage(String name)
{
Logger.getLogger(name).log(
diff --git
a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
index 26896347c..499b6416d 100644
---
a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
+++
b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
@@ -17,8 +17,4 @@
# under the License.
#
-org.apache.deltaspike.jsf.impl.scope.view.ViewScopedExtension
-
-org.apache.deltaspike.jsf.impl.scope.mapped.MappedJsf2ScopeExtension
org.apache.deltaspike.jsf.impl.config.view.ViewConfigExtension
-org.apache.deltaspike.jsf.impl.injection.proxy.ConverterAndValidatorProxyExtension
\ No newline at end of file