-
Notifications
You must be signed in to change notification settings - Fork 316
FISH-10615 Fix deployment bugs discovered while implementing EAR enhancements #7212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
lprimak
wants to merge
32
commits into
payara:FISH-10752-Reapply-EAR-Deployment-Changes-and-Shared-War-Libs
from
flowlogix:fix-deployment-bugs
Closed
Changes from 13 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
4f4383c
bugfix: EAR deployment bugs found
lprimak 2555d00
exclude RAR and EJB-JAR modules from WAR/EAR-lib wiring to comply wit…
lprimak e4d1c05
added fish.payara.war-beans-visible-in-ear-libs system / app property
lprimak fa3923f
bugfix: dis-ambiguate by class loader if bean IDs are the same
lprimak ce9c62a
fixed RAR injection bug
lprimak 6e76b70
another RAR fix
lprimak 8c83f60
another stab at RAR fix
lprimak e111c58
another stab at RAR fix
lprimak af91b86
RAR issue - fixed based on the reproducer
lprimak a07e85c
RAR code cleanup
lprimak 95592f8
fixed Jakarta Rest TCK test that uses custom serializer
lprimak 5d11d02
JSON-B code cleanup
lprimak a571ceb
Json-B: instroduce lambda
lprimak 42a85d1
Jakarta Web Service: update tester servlet to supported arguments
lprimak 4e2d97d
Web Services: restore deployment context after wstx service startup
lprimak 81d5381
Revert "Web Services: restore deployment context after wstx service s…
lprimak daed1b9
more generic fix for recursive deployments (ex: WebServices/WSTX depl…
lprimak 3565710
bugfix: only apply Jax-RS resolver type for CDI if it's not a class w…
lprimak 5bae52c
one more guess at Rest integratino issues
lprimak 46a6d0a
add context providers registered via @Provider annotation
lprimak bdb0398
working interceptor
lprimak f8f05f7
refactor
lprimak 2f261bb
review comment - fixed confusing line
lprimak f9cde87
fallback to any type from the proper BDA if the registered type is a …
lprimak 86704b9
fixed class loader check
lprimak 0cb1b80
added backup find of Weld manager instance in case none of the ClassL…
lprimak 8494928
cleanup
lprimak 0cf55b0
reworked and simplified CDI BeanManager find algorithm
lprimak ea3ee83
fixed circular reference to current deployment context
lprimak f00b096
refactor assymetric equals() code into multimap
lprimak 6bebd5d
cleanup: removed code and associated `fish.payara.war-beans-visible-i…
lprimak 3f57431
cleanup: remove unused `recursivelyAdd()` method
lprimak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,7 +37,7 @@ | |
| * only if the new code is made subject to such option by the copyright | ||
| * holder. | ||
| */ | ||
| // Portions Copyright [2024] [Payara Foundation and/or its affiliates] | ||
| // Portions Copyright [2024-2025] [Payara Foundation and/or its affiliates] | ||
|
|
||
| package org.glassfish.weld; | ||
|
|
||
|
|
@@ -55,6 +55,7 @@ | |
| import jakarta.enterprise.inject.spi.CDIProvider; | ||
| import java.util.Map; | ||
| import java.util.Set; | ||
| import static org.glassfish.weld.JaxRSJsonContextResolver.currentType; | ||
|
|
||
| /** | ||
| * @author <a href="mailto:[email protected]">JJ Snyder</a> | ||
|
|
@@ -103,6 +104,15 @@ protected BeanManagerImpl unsatisfiedBeanManager(String callerClassName) { | |
|
|
||
| return super.unsatisfiedBeanManager(callerClassName); | ||
| } | ||
|
|
||
| @Override | ||
| protected String getCallingClassName() { | ||
| if (currentType.get() != null) { | ||
| return currentType.get().getName(); | ||
| } else { | ||
| return super.getCallingClassName(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
107 changes: 107 additions & 0 deletions
107
...erver/web/weld-integration/src/main/java/org/glassfish/weld/JaxRSJsonContextResolver.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| /* | ||
| * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | ||
| * | ||
| * Copyright (c) [2025] Payara Foundation and/or its affiliates. All rights reserved. | ||
| * | ||
| * The contents of this file are subject to the terms of either the GNU | ||
| * General Public License Version 2 only ("GPL") or the Common Development | ||
| * and Distribution License("CDDL") (collectively, the "License"). You | ||
| * may not use this file except in compliance with the License. You can | ||
| * obtain a copy of the License at | ||
| * https://github.com/payara/Payara/blob/main/LICENSE.txt | ||
| * See the License for the specific | ||
| * language governing permissions and limitations under the License. | ||
| * | ||
| * When distributing the software, include this License Header Notice in each | ||
| * file and include the License file at glassfish/legal/LICENSE.txt. | ||
| * | ||
| * GPL Classpath Exception: | ||
| * The Payara Foundation designates this particular file as subject to the "Classpath" | ||
| * exception as provided by the Payara Foundation in the GPL Version 2 section of the License | ||
| * file that accompanied this code. | ||
| * | ||
| * Modifications: | ||
| * If applicable, add the following below the License Header, with the fields | ||
| * enclosed by brackets [] replaced by your own identifying information: | ||
| * "Portions Copyright [year] [name of copyright owner]" | ||
| * | ||
| * Contributor(s): | ||
| * If you wish your version of this file to be governed by only the CDDL or | ||
| * only the GPL Version 2, indicate your decision by adding "[Contributor] | ||
| * elects to include this software in this distribution under the [CDDL or GPL | ||
| * Version 2] license." If you don't indicate a single choice of license, a | ||
| * recipient has the option to distribute your version of this file under | ||
| * either the CDDL, the GPL Version 2 or to extend the choice of license to | ||
| * its licensees as provided above. However, if you add GPL Version 2 code | ||
| * and therefore, elected the GPL Version 2 license, then the option applies | ||
| * only if the new code is made subject to such option by the copyright | ||
| * holder. | ||
| */ | ||
| package org.glassfish.weld; | ||
|
|
||
| import jakarta.annotation.Priority; | ||
| import jakarta.json.bind.Jsonb; | ||
| import jakarta.json.bind.JsonbBuilder; | ||
| import jakarta.ws.rs.ConstrainedTo; | ||
| import jakarta.ws.rs.Produces; | ||
| import jakarta.ws.rs.core.FeatureContext; | ||
| import jakarta.ws.rs.core.MediaType; | ||
| import jakarta.ws.rs.ext.ContextResolver; | ||
| import org.glassfish.jersey.internal.spi.ForcedAutoDiscoverable; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.concurrent.ConcurrentHashMap; | ||
| import java.util.stream.Collectors; | ||
| import static jakarta.ws.rs.RuntimeType.SERVER; | ||
| import static org.glassfish.jersey.internal.spi.AutoDiscoverable.DEFAULT_PRIORITY; | ||
|
|
||
| /** | ||
| * Works in conjunction with {@link org.glassfish.weld.GlassFishWeldProvider} to provide the | ||
| * correct {@link Jsonb} instance based on the type of Jax-RS resource class being processed. | ||
| * | ||
| * This includes creating {@link Jsonb} instances that contains correct {@link jakarta.enterprise.inject.spi.BeanManager} | ||
| */ | ||
| @ConstrainedTo(SERVER) | ||
| @Priority(DEFAULT_PRIORITY) | ||
| @Produces(MediaType.APPLICATION_JSON) | ||
| public class JaxRSJsonContextResolver implements ContextResolver<Jsonb>, ForcedAutoDiscoverable { | ||
| private final Map<Class<?>, Jsonb> jsonbMap = new ConcurrentHashMap<>(); | ||
| static final ThreadLocal<Class<?>> currentType = new ThreadLocal<>(); | ||
| private final List<ContextResolver<?>> existingResolvers; | ||
|
|
||
| public JaxRSJsonContextResolver() { | ||
| this.existingResolvers = Collections.emptyList(); | ||
| } | ||
|
|
||
| private JaxRSJsonContextResolver(List<ContextResolver<?>> existingResolvers) { | ||
| this.existingResolvers = existingResolvers; | ||
| } | ||
|
|
||
| @Override | ||
| public void configure(FeatureContext context) { | ||
| List<ContextResolver<?>> resolvers = context.getConfiguration().getInstances().stream() | ||
| .filter(ContextResolver.class::isInstance) | ||
| .map(resolver -> (ContextResolver<?>) resolver) | ||
lprimak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| .collect(Collectors.toList()); | ||
| context.register(new JaxRSJsonContextResolver(resolvers)); | ||
| } | ||
|
|
||
| @Override | ||
| public Jsonb getContext(Class<?> type) { | ||
| return jsonbMap.computeIfAbsent(type, unused -> { | ||
| currentType.set(type); | ||
| try { | ||
| for (ContextResolver<?> resolver : existingResolvers) { | ||
| Object result = resolver.getContext(type); | ||
| if (result instanceof Jsonb) { | ||
| return (Jsonb) result; | ||
| } | ||
| } | ||
| return JsonbBuilder.create(); | ||
| } finally { | ||
| currentType.remove(); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.