diff --git a/bom/pom.xml b/bom/pom.xml index 50ee2a4463..1682bcaca4 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -2,6 +2,7 @@ diff --git a/core-common/src/main/java/org/glassfish/jersey/internal/inject/InserterException.java b/core-common/src/main/java/org/glassfish/jersey/internal/inject/InserterException.java new file mode 100644 index 0000000000..da80ccae8f --- /dev/null +++ b/core-common/src/main/java/org/glassfish/jersey/internal/inject/InserterException.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2010, 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.glassfish.jersey.internal.inject; + +import javax.ws.rs.ProcessingException; +import javax.ws.rs.WebApplicationException; + +/** + * A runtime exception that contains a cause, a checked or runtime exception, + * that may be passed to the cause of a {@link WebApplicationException}. + * + * @author Paul Sandoz + * @author Gaurav Gupta + * + */ +public class InserterException extends ProcessingException { + private static final long serialVersionUID = -4918023257104413981L; + + /** + * Create new parameter extractor exception. + * + * @param message exception message. + */ + public InserterException(String message) { + super(message); + } + + /** + * Create new parameter extractor exception. + * + * @param message exception message. + * @param cause exception cause. + */ + public InserterException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Create new parameter extractor exception. + * + * @param cause exception cause. + */ + public InserterException(Throwable cause) { + super(cause); + } +} diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamConverterConfigurator.java b/core-common/src/main/java/org/glassfish/jersey/internal/inject/ParamConverterConfigurator.java similarity index 86% rename from core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamConverterConfigurator.java rename to core-common/src/main/java/org/glassfish/jersey/internal/inject/ParamConverterConfigurator.java index 29f97e4599..477d918852 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamConverterConfigurator.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/inject/ParamConverterConfigurator.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -14,15 +15,12 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ -package org.glassfish.jersey.server.internal.inject; +package org.glassfish.jersey.internal.inject; import javax.ws.rs.ext.ParamConverterProvider; import org.glassfish.jersey.internal.BootstrapBag; import org.glassfish.jersey.internal.BootstrapConfigurator; -import org.glassfish.jersey.internal.inject.Bindings; -import org.glassfish.jersey.internal.inject.InjectionManager; -import org.glassfish.jersey.internal.inject.InstanceBinding; /** * Configurator which initializes and register {@link ParamConverters.AggregatedProvider} instances into {@link InjectionManager}. diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamConverterFactory.java b/core-common/src/main/java/org/glassfish/jersey/internal/inject/ParamConverterFactory.java similarity index 88% rename from core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamConverterFactory.java rename to core-common/src/main/java/org/glassfish/jersey/internal/inject/ParamConverterFactory.java index ca542316f9..c29091dedd 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamConverterFactory.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/inject/ParamConverterFactory.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -14,20 +15,18 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ -package org.glassfish.jersey.server.internal.inject; +package org.glassfish.jersey.internal.inject; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.ArrayList; -import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Set; - +import javax.inject.Singleton; import javax.ws.rs.ext.ParamConverter; import javax.ws.rs.ext.ParamConverterProvider; -import javax.inject.Singleton; - /** * An aggregate {@link ParamConverterProvider param converter provider} that loads all * the registered {@link ParamConverterProvider} implementations. @@ -42,14 +41,15 @@ * @author Marek Potociar (marek.potociar at oracle.com) * @author Miroslav Fuksa */ + @Singleton public class ParamConverterFactory implements ParamConverterProvider { private final List converterProviders; - ParamConverterFactory(Set providers, Set customProviders) { + public ParamConverterFactory(Set providers, Set customProviders) { - Set copyProviders = new HashSet<>(providers); + Set copyProviders = new LinkedHashSet<>(providers); converterProviders = new ArrayList<>(); converterProviders.addAll(customProviders); copyProviders.removeAll(customProviders); diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamConverters.java b/core-common/src/main/java/org/glassfish/jersey/internal/inject/ParamConverters.java similarity index 98% rename from core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamConverters.java rename to core-common/src/main/java/org/glassfish/jersey/internal/inject/ParamConverters.java index f7ac1948ec..7d5a953dd0 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamConverters.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/inject/ParamConverters.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -14,7 +15,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ -package org.glassfish.jersey.server.internal.inject; +package org.glassfish.jersey.internal.inject; import java.lang.annotation.Annotation; import java.lang.reflect.Constructor; @@ -32,10 +33,9 @@ import javax.inject.Singleton; -import org.glassfish.jersey.internal.inject.ExtractorException; import org.glassfish.jersey.internal.util.ReflectionHelper; import org.glassfish.jersey.message.internal.HttpDateFormat; -import org.glassfish.jersey.server.internal.LocalizationMessages; +import org.glassfish.jersey.internal.LocalizationMessages; /** * Container of several different {@link ParamConverterProvider param converter providers} @@ -46,7 +46,7 @@ * @author Marek Potociar (marek.potociar at oracle.com) */ @Singleton -class ParamConverters { +public class ParamConverters { private abstract static class AbstractStringReader implements ParamConverter { diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/PrimitiveMapper.java b/core-common/src/main/java/org/glassfish/jersey/internal/inject/PrimitiveMapper.java similarity index 89% rename from core-server/src/main/java/org/glassfish/jersey/server/internal/inject/PrimitiveMapper.java rename to core-common/src/main/java/org/glassfish/jersey/internal/inject/PrimitiveMapper.java index eb9ce14b6b..b763cc4ff5 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/PrimitiveMapper.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/inject/PrimitiveMapper.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -14,7 +15,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ -package org.glassfish.jersey.server.internal.inject; +package org.glassfish.jersey.internal.inject; import java.util.Collections; import java.util.Map; @@ -27,11 +28,11 @@ * @author Paul Sandoz * @author Marek Potociar (marek.potociar at oracle.com) */ -final class PrimitiveMapper { +public final class PrimitiveMapper { - static final Map primitiveToClassMap = + public static final Map primitiveToClassMap = getPrimitiveToClassMap(); - static final Map primitiveToDefaultValueMap = + public static final Map primitiveToDefaultValueMap = getPrimitiveToDefaultValueMap(); private static Map getPrimitiveToClassMap() { diff --git a/core-common/src/main/java/org/glassfish/jersey/internal/inject/Providers.java b/core-common/src/main/java/org/glassfish/jersey/internal/inject/Providers.java index a965574541..ebc8b8c7e0 100644 --- a/core-common/src/main/java/org/glassfish/jersey/internal/inject/Providers.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/inject/Providers.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -83,6 +84,7 @@ private static Map, ProviderRuntime> getJaxRsProviderInterfaces() { interfaces.put(javax.ws.rs.ext.ReaderInterceptor.class, ProviderRuntime.BOTH); interfaces.put(javax.ws.rs.ext.WriterInterceptor.class, ProviderRuntime.BOTH); interfaces.put(javax.ws.rs.ext.ParamConverterProvider.class, ProviderRuntime.BOTH); + interfaces.put(org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper.class, ProviderRuntime.BOTH); interfaces.put(javax.ws.rs.container.ContainerRequestFilter.class, ProviderRuntime.SERVER); interfaces.put(javax.ws.rs.container.ContainerResponseFilter.class, ProviderRuntime.SERVER); @@ -91,6 +93,7 @@ private static Map, ProviderRuntime> getJaxRsProviderInterfaces() { interfaces.put(javax.ws.rs.client.ClientResponseFilter.class, ProviderRuntime.CLIENT); interfaces.put(javax.ws.rs.client.ClientRequestFilter.class, ProviderRuntime.CLIENT); interfaces.put(javax.ws.rs.client.RxInvokerProvider.class, ProviderRuntime.CLIENT); + interfaces.put(org.eclipse.microprofile.rest.client.ext.AsyncInvocationInterceptorFactory.class, ProviderRuntime.CLIENT); return interfaces; } diff --git a/core-common/src/main/java/org/glassfish/jersey/message/internal/MessageBodyFactory.java b/core-common/src/main/java/org/glassfish/jersey/message/internal/MessageBodyFactory.java index 5b78763dd4..5e9806185e 100644 --- a/core-common/src/main/java/org/glassfish/jersey/message/internal/MessageBodyFactory.java +++ b/core-common/src/main/java/org/glassfish/jersey/message/internal/MessageBodyFactory.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -35,6 +36,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import java.util.function.Function; import java.util.logging.Level; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/model/AnnotatedMethod.java b/core-common/src/main/java/org/glassfish/jersey/model/AnnotatedMethod.java similarity index 98% rename from core-server/src/main/java/org/glassfish/jersey/server/model/AnnotatedMethod.java rename to core-common/src/main/java/org/glassfish/jersey/model/AnnotatedMethod.java index db91b507c8..db98ca4baa 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/model/AnnotatedMethod.java +++ b/core-common/src/main/java/org/glassfish/jersey/model/AnnotatedMethod.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -14,7 +15,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ -package org.glassfish.jersey.server.model; +package org.glassfish.jersey.model; import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; @@ -115,7 +116,7 @@ public Method getMethod() { * * @return the underlying declared Java method. */ - Method getDeclaredMethod() { + public Method getDeclaredMethod() { return m; } diff --git a/core-server/src/main/java/org/glassfish/jersey/server/model/ParamQualifier.java b/core-common/src/main/java/org/glassfish/jersey/model/ParamQualifier.java similarity index 92% rename from core-server/src/main/java/org/glassfish/jersey/server/model/ParamQualifier.java rename to core-common/src/main/java/org/glassfish/jersey/model/ParamQualifier.java index b0ca557bf8..1086ec2e03 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/model/ParamQualifier.java +++ b/core-common/src/main/java/org/glassfish/jersey/model/ParamQualifier.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -14,7 +15,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ -package org.glassfish.jersey.server.model; +package org.glassfish.jersey.model; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/model/Parameter.java b/core-common/src/main/java/org/glassfish/jersey/model/Parameter.java similarity index 99% rename from core-server/src/main/java/org/glassfish/jersey/server/model/Parameter.java rename to core-common/src/main/java/org/glassfish/jersey/model/Parameter.java index 9467ea828e..f1937365ac 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/model/Parameter.java +++ b/core-common/src/main/java/org/glassfish/jersey/model/Parameter.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -14,7 +15,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ -package org.glassfish.jersey.server.model; +package org.glassfish.jersey.model; import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; @@ -48,7 +49,7 @@ import org.glassfish.jersey.internal.util.ReflectionHelper; import org.glassfish.jersey.internal.util.collection.ClassTypePair; -import org.glassfish.jersey.server.Uri; +import org.glassfish.jersey.uri.Uri; /** * Method parameter model. diff --git a/core-server/src/main/java/org/glassfish/jersey/server/Uri.java b/core-common/src/main/java/org/glassfish/jersey/uri/Uri.java similarity index 97% rename from core-server/src/main/java/org/glassfish/jersey/server/Uri.java rename to core-common/src/main/java/org/glassfish/jersey/uri/Uri.java index 3b7db08874..d494f69ff0 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/Uri.java +++ b/core-common/src/main/java/org/glassfish/jersey/uri/Uri.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2011, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -14,7 +15,7 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ -package org.glassfish.jersey.server; +package org.glassfish.jersey.uri; import java.lang.annotation.Documented; import java.lang.annotation.Retention; diff --git a/core-common/src/main/resources/org/glassfish/jersey/internal/localization.properties b/core-common/src/main/resources/org/glassfish/jersey/internal/localization.properties index 791997da3f..995a79d880 100644 --- a/core-common/src/main/resources/org/glassfish/jersey/internal/localization.properties +++ b/core-common/src/main/resources/org/glassfish/jersey/internal/localization.properties @@ -1,5 +1,6 @@ # # Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018 Payara Foundation and/or its affiliates. # # This program and the accompanying materials are made available under the # terms of the Eclipse Public License v. 2.0, which is available at @@ -47,6 +48,7 @@ error.msg=WARNING: {0} error.newcookie.expires=NewCookie Expires header value ({0}) cannot be read. error.notfound.messagebodywriter=MessageBodyWriter not found for media type={0}, type={1}, genericType={2}. error.notfound.messagebodyreader=MessageBodyReader not found for media type={0}, type={1}, genericType={2}. +error.parameter.invalid.char.value=Value "{0}" is not a character. error.parsing.entity.tag=Error parsing entity tag: {0} error.provider.constrainedTo.wrong.package=A registered provider {0} is constrained (via @ConstrainedTo) to {1} runtime but does not implement any provider interface usable in the runtime. error.provider.constrainedTo.wrong.runtime=A provider {0} registered in {2} runtime is constrained (via @ConstrainedTo) to {1} runtime. @@ -107,6 +109,7 @@ message.content.buffering.failed=Failed to buffer the message content input stre message.content.input.stream.close.failed=Error closing message content input stream. message.content.buffer.reset.failed=Error resetting the buffered message content input stream. method.not.getter.nor.setter=Method is neither getter nor setter. +method.parameter.cannot.be.null=Method parameter "{0}" cannot be null. multiple.matching.constructors.found=Found {0} constructors with {1} parameters in {2} class. Selecting the first found constructor: {3} new.cookie.is.null=New cookie is null. no.container.available=No container available. diff --git a/core-server/src/test/java/org/glassfish/jersey/server/model/ParameterTest.java b/core-common/src/test/java/org/glassfish/jersey/model/ParameterTest.java similarity index 98% rename from core-server/src/test/java/org/glassfish/jersey/server/model/ParameterTest.java rename to core-common/src/test/java/org/glassfish/jersey/model/ParameterTest.java index 00e51ad0f1..608a3e7712 100644 --- a/core-server/src/test/java/org/glassfish/jersey/server/model/ParameterTest.java +++ b/core-common/src/test/java/org/glassfish/jersey/model/ParameterTest.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -14,16 +15,14 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ -package org.glassfish.jersey.server.model; +package org.glassfish.jersey.model; import javax.inject.Inject; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.List; - import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; diff --git a/core-server/src/test/java/org/glassfish/jersey/server/model/ParameterWithMultipleAnnotationsTest.java b/core-common/src/test/java/org/glassfish/jersey/model/ParameterWithMultipleAnnotationsTest.java similarity index 97% rename from core-server/src/test/java/org/glassfish/jersey/server/model/ParameterWithMultipleAnnotationsTest.java rename to core-common/src/test/java/org/glassfish/jersey/model/ParameterWithMultipleAnnotationsTest.java index a8b1adf3f0..5081dce188 100644 --- a/core-server/src/test/java/org/glassfish/jersey/server/model/ParameterWithMultipleAnnotationsTest.java +++ b/core-common/src/test/java/org/glassfish/jersey/model/ParameterWithMultipleAnnotationsTest.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -14,15 +15,13 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ -package org.glassfish.jersey.server.model; +package org.glassfish.jersey.model; import java.lang.annotation.Retention; import java.lang.annotation.Target; import java.lang.reflect.Method; import java.util.List; - import javax.ws.rs.PathParam; - import org.junit.Test; import static org.junit.Assert.assertEquals; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/ApplicationHandler.java b/core-server/src/main/java/org/glassfish/jersey/server/ApplicationHandler.java index 6e9449ab8b..8f1b2851d5 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/ApplicationHandler.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/ApplicationHandler.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2011, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -75,7 +76,7 @@ import org.glassfish.jersey.server.internal.JerseyRequestTimeoutHandler; import org.glassfish.jersey.server.internal.LocalizationMessages; import org.glassfish.jersey.server.internal.ProcessingProviders; -import org.glassfish.jersey.server.internal.inject.ParamConverterConfigurator; +import org.glassfish.jersey.internal.inject.ParamConverterConfigurator; import org.glassfish.jersey.server.internal.inject.ParamExtractorConfigurator; import org.glassfish.jersey.server.internal.inject.ValueParamProviderConfigurator; import org.glassfish.jersey.server.internal.monitoring.ApplicationEventImpl; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/filter/RolesAllowedDynamicFeature.java b/core-server/src/main/java/org/glassfish/jersey/server/filter/RolesAllowedDynamicFeature.java index fb1a8bf627..34299ee05b 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/filter/RolesAllowedDynamicFeature.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/filter/RolesAllowedDynamicFeature.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -33,7 +34,7 @@ import javax.annotation.security.RolesAllowed; import org.glassfish.jersey.server.internal.LocalizationMessages; -import org.glassfish.jersey.server.model.AnnotatedMethod; +import org.glassfish.jersey.model.AnnotatedMethod; /** * A {@link DynamicFeature} supporting the {@code javax.annotation.security.RolesAllowed}, diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/AbstractValueParamProvider.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/AbstractValueParamProvider.java index a5395ee025..5297a15ea7 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/AbstractValueParamProvider.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/AbstractValueParamProvider.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -24,7 +25,7 @@ import javax.inject.Provider; import org.glassfish.jersey.server.ContainerRequest; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.spi.internal.ValueParamProvider; /** diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/AsyncResponseValueParamProvider.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/AsyncResponseValueParamProvider.java index 4fb834d315..4edd882794 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/AsyncResponseValueParamProvider.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/AsyncResponseValueParamProvider.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -24,7 +25,7 @@ import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.AsyncContext; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.spi.internal.ValueParamProvider; /** diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/BeanParamValueParamProvider.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/BeanParamValueParamProvider.java index 8bd0a7a1e4..62041b197d 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/BeanParamValueParamProvider.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/BeanParamValueParamProvider.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -29,7 +30,7 @@ import org.glassfish.jersey.internal.util.collection.Cache; import org.glassfish.jersey.process.internal.RequestScoped; import org.glassfish.jersey.server.ContainerRequest; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; /** * Value factory provider for {@link BeanParam bean parameters}. diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/CookieParamValueParamProvider.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/CookieParamValueParamProvider.java index 24d5629d77..29945594a7 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/CookieParamValueParamProvider.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/CookieParamValueParamProvider.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -30,7 +31,7 @@ import org.glassfish.jersey.internal.util.collection.MultivaluedStringMap; import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.ParamException; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; /** * Value factory provider supporting the {@link CookieParam} injection annotation. diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/DelegatedInjectionValueParamProvider.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/DelegatedInjectionValueParamProvider.java index 4b2001a4fe..55709e44ac 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/DelegatedInjectionValueParamProvider.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/DelegatedInjectionValueParamProvider.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -31,8 +32,8 @@ import org.glassfish.jersey.internal.util.collection.LazyValue; import org.glassfish.jersey.process.internal.RequestScoped; import org.glassfish.jersey.server.ContainerRequest; -import org.glassfish.jersey.server.model.Parameter; -import org.glassfish.jersey.server.model.Parameter.Source; +import org.glassfish.jersey.model.Parameter; +import org.glassfish.jersey.model.Parameter.Source; import org.glassfish.jersey.server.spi.internal.ValueParamProvider; /** diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/EntityParamValueParamProvider.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/EntityParamValueParamProvider.java index 55d379d0f5..6aae858d8a 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/EntityParamValueParamProvider.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/EntityParamValueParamProvider.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -28,7 +29,7 @@ import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.internal.LocalizationMessages; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; /** * Provides injection of {@link Request} entity value or {@link Request} instance diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/FormParamValueParamProvider.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/FormParamValueParamProvider.java index df47771640..bbb568b3fd 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/FormParamValueParamProvider.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/FormParamValueParamProvider.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -44,7 +45,7 @@ import org.glassfish.jersey.server.ParamException; import org.glassfish.jersey.server.internal.InternalServerProperties; import org.glassfish.jersey.server.internal.LocalizationMessages; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; /** * Value factory provider supporting the {@link FormParam} injection annotation. diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/HeaderParamValueParamProvider.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/HeaderParamValueParamProvider.java index fa92d1ca4f..2f823c64c2 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/HeaderParamValueParamProvider.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/HeaderParamValueParamProvider.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -26,7 +27,7 @@ import org.glassfish.jersey.internal.inject.ExtractorException; import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.ParamException; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; /** * Value supplier provider supporting the {@link HeaderParam @HeaderParam} injection annotation. diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/MatrixParamValueParamProvider.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/MatrixParamValueParamProvider.java index 1692256ff2..27dcdd2e2f 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/MatrixParamValueParamProvider.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/MatrixParamValueParamProvider.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -28,7 +29,7 @@ import org.glassfish.jersey.internal.inject.ExtractorException; import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.ParamException; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; /** * Value supplier provider supporting the {@link MatrixParam @MatrixParam} injection annotation. diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/MultivaluedParameterExtractorFactory.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/MultivaluedParameterExtractorFactory.java index 4239036c9b..efd153af0f 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/MultivaluedParameterExtractorFactory.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/MultivaluedParameterExtractorFactory.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -30,11 +31,13 @@ import javax.inject.Singleton; import org.glassfish.jersey.internal.inject.ExtractorException; +import org.glassfish.jersey.internal.inject.ParamConverterFactory; import org.glassfish.jersey.internal.util.ReflectionHelper; import org.glassfish.jersey.internal.util.collection.ClassTypePair; import org.glassfish.jersey.internal.util.collection.LazyValue; import org.glassfish.jersey.server.internal.LocalizationMessages; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; +import org.glassfish.jersey.internal.inject.PrimitiveMapper; /** * Implementation of {@link MultivaluedParameterExtractorProvider}. For each diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/MultivaluedParameterExtractorProvider.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/MultivaluedParameterExtractorProvider.java index cf8b7afaf3..0aabeaf6b7 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/MultivaluedParameterExtractorProvider.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/MultivaluedParameterExtractorProvider.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -16,7 +17,7 @@ package org.glassfish.jersey.server.internal.inject; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; /** * Provider of multivalued parameter extractors. diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamExtractorConfigurator.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamExtractorConfigurator.java index 7d56f88b5e..ca674d01fe 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamExtractorConfigurator.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamExtractorConfigurator.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -22,6 +23,7 @@ import org.glassfish.jersey.internal.BootstrapConfigurator; import org.glassfish.jersey.internal.inject.Bindings; import org.glassfish.jersey.internal.inject.InjectionManager; +import org.glassfish.jersey.internal.inject.ParamConverterFactory; import org.glassfish.jersey.internal.inject.Providers; import org.glassfish.jersey.internal.util.collection.LazyValue; import org.glassfish.jersey.internal.util.collection.Value; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamInjectionResolver.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamInjectionResolver.java index a4db0887bb..5f8e6eebf7 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamInjectionResolver.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ParamInjectionResolver.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -32,7 +33,7 @@ import org.glassfish.jersey.internal.inject.InjectionResolver; import org.glassfish.jersey.internal.util.ReflectionHelper; import org.glassfish.jersey.server.ContainerRequest; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.spi.internal.ValueParamProvider; /** diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/PathParamValueParamProvider.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/PathParamValueParamProvider.java index d89725e9ae..b810cb1c6b 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/PathParamValueParamProvider.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/PathParamValueParamProvider.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -30,7 +31,7 @@ import org.glassfish.jersey.internal.inject.ExtractorException; import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.ParamException.PathParamException; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; /** * {@link PathParam @PathParam} injection value provider. diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/QueryParamValueParamProvider.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/QueryParamValueParamProvider.java index 1b3c7d6f03..4e2b5f4251 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/QueryParamValueParamProvider.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/QueryParamValueParamProvider.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -26,7 +27,7 @@ import org.glassfish.jersey.internal.inject.ExtractorException; import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.ParamException; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; /** * Value supplier provider supporting the {@link QueryParam @QueryParam} injection annotation. diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ValueParamProviderConfigurator.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ValueParamProviderConfigurator.java index f2a6979fd6..ebb310789f 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ValueParamProviderConfigurator.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/ValueParamProviderConfigurator.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -46,7 +47,7 @@ import org.glassfish.jersey.internal.util.collection.Values; import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.ServerBootstrapBag; -import org.glassfish.jersey.server.Uri; +import org.glassfish.jersey.uri.Uri; import org.glassfish.jersey.server.AsyncContext; import org.glassfish.jersey.server.internal.process.RequestProcessingContextReference; import org.glassfish.jersey.server.spi.internal.ValueParamProvider; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/WebTargetValueParamProvider.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/WebTargetValueParamProvider.java index 69aba9bc1c..84cfafe153 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/WebTargetValueParamProvider.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/inject/WebTargetValueParamProvider.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -45,9 +46,9 @@ import org.glassfish.jersey.server.ClientBinding; import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.ExtendedUriInfo; -import org.glassfish.jersey.server.Uri; +import org.glassfish.jersey.uri.Uri; import org.glassfish.jersey.server.internal.LocalizationMessages; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.uri.internal.JerseyUriBuilder; /** diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/routing/MethodSelectingRouter.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/routing/MethodSelectingRouter.java index 0a7fa44ba9..ee91c3dd4c 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/routing/MethodSelectingRouter.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/routing/MethodSelectingRouter.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -53,7 +54,7 @@ import org.glassfish.jersey.server.internal.LocalizationMessages; import org.glassfish.jersey.server.internal.process.RequestProcessingContext; import org.glassfish.jersey.server.model.Invocable; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.model.ResourceMethod; /** diff --git a/core-server/src/main/java/org/glassfish/jersey/server/model/HandlerConstructor.java b/core-server/src/main/java/org/glassfish/jersey/server/model/HandlerConstructor.java index 094afa034c..fcf3689839 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/model/HandlerConstructor.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/model/HandlerConstructor.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -16,6 +17,7 @@ package org.glassfish.jersey.server.model; +import org.glassfish.jersey.model.Parameter; import java.lang.reflect.Constructor; import java.util.List; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/model/IntrospectionModeller.java b/core-server/src/main/java/org/glassfish/jersey/server/model/IntrospectionModeller.java index 239ab9e759..8a9cc2a0a5 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/model/IntrospectionModeller.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/model/IntrospectionModeller.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -16,6 +17,8 @@ package org.glassfish.jersey.server.model; +import org.glassfish.jersey.model.AnnotatedMethod; +import org.glassfish.jersey.model.Parameter; import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.lang.reflect.Method; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/model/Invocable.java b/core-server/src/main/java/org/glassfish/jersey/server/model/Invocable.java index dca0322e39..2085b6e48c 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/model/Invocable.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/model/Invocable.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2011, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -16,6 +17,7 @@ package org.glassfish.jersey.server.model; +import org.glassfish.jersey.model.Parameter; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/model/InvocableValidator.java b/core-server/src/main/java/org/glassfish/jersey/server/model/InvocableValidator.java index 7279bf2488..0edfc0df6a 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/model/InvocableValidator.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/model/InvocableValidator.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -16,6 +17,7 @@ package org.glassfish.jersey.server.model; +import org.glassfish.jersey.model.Parameter; import java.lang.annotation.Annotation; import java.util.HashSet; import java.util.Set; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/model/MethodHandler.java b/core-server/src/main/java/org/glassfish/jersey/server/model/MethodHandler.java index f8aea1b3f6..c1195fa1f4 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/model/MethodHandler.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/model/MethodHandler.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -16,6 +17,7 @@ package org.glassfish.jersey.server.model; +import org.glassfish.jersey.model.Parameter; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Collection; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/model/MethodList.java b/core-server/src/main/java/org/glassfish/jersey/server/model/MethodList.java index 6d8fc06189..89e926ff08 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/model/MethodList.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/model/MethodList.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -16,6 +17,7 @@ package org.glassfish.jersey.server.model; +import org.glassfish.jersey.model.AnnotatedMethod; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Modifier; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/model/Parameterized.java b/core-server/src/main/java/org/glassfish/jersey/server/model/Parameterized.java index 62896a7807..389bcf27b3 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/model/Parameterized.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/model/Parameterized.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -16,6 +17,7 @@ package org.glassfish.jersey.server.model; +import org.glassfish.jersey.model.Parameter; import java.util.List; /** diff --git a/core-server/src/main/java/org/glassfish/jersey/server/model/ResourceMethod.java b/core-server/src/main/java/org/glassfish/jersey/server/model/ResourceMethod.java index ebf8f757d4..d7006cdc4a 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/model/ResourceMethod.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/model/ResourceMethod.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -16,6 +17,7 @@ package org.glassfish.jersey.server.model; +import org.glassfish.jersey.model.Parameter; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Type; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/model/ResourceMethodValidator.java b/core-server/src/main/java/org/glassfish/jersey/server/model/ResourceMethodValidator.java index 583982f3d5..7617207354 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/model/ResourceMethodValidator.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/model/ResourceMethodValidator.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -16,6 +17,7 @@ package org.glassfish.jersey.server.model; +import org.glassfish.jersey.model.Parameter; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/model/RuntimeResourceModelValidator.java b/core-server/src/main/java/org/glassfish/jersey/server/model/RuntimeResourceModelValidator.java index fc935b09e3..6989c8ad27 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/model/RuntimeResourceModelValidator.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/model/RuntimeResourceModelValidator.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -16,6 +17,7 @@ package org.glassfish.jersey.server.model; +import org.glassfish.jersey.model.Parameter; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/model/internal/JavaResourceMethodDispatcherProvider.java b/core-server/src/main/java/org/glassfish/jersey/server/model/internal/JavaResourceMethodDispatcherProvider.java index fe8ff6ae1e..32ccc30c90 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/model/internal/JavaResourceMethodDispatcherProvider.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/model/internal/JavaResourceMethodDispatcherProvider.java @@ -31,7 +31,7 @@ import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.internal.inject.ConfiguredValidator; import org.glassfish.jersey.server.model.Invocable; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.spi.internal.ParamValueFactoryWithSource; import org.glassfish.jersey.server.spi.internal.ParameterValueHelper; import org.glassfish.jersey.server.spi.internal.ResourceMethodDispatcher; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/spi/internal/ParamValueFactoryWithSource.java b/core-server/src/main/java/org/glassfish/jersey/server/spi/internal/ParamValueFactoryWithSource.java index 1f3e61fa95..dac5f58762 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/spi/internal/ParamValueFactoryWithSource.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/spi/internal/ParamValueFactoryWithSource.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -20,7 +21,7 @@ import java.util.function.Supplier; import org.glassfish.jersey.server.ContainerRequest; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; /** * Extends {@link Supplier} interface with diff --git a/core-server/src/main/java/org/glassfish/jersey/server/spi/internal/ParameterValueHelper.java b/core-server/src/main/java/org/glassfish/jersey/server/spi/internal/ParameterValueHelper.java index b752a54df0..ea24cb102d 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/spi/internal/ParameterValueHelper.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/spi/internal/ParameterValueHelper.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -31,7 +32,7 @@ import org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException; import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.internal.process.MappableException; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.model.Parameterized; /** diff --git a/core-server/src/main/java/org/glassfish/jersey/server/spi/internal/ValueParamProvider.java b/core-server/src/main/java/org/glassfish/jersey/server/spi/internal/ValueParamProvider.java index c69e674b2a..0a79e532a7 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/spi/internal/ValueParamProvider.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/spi/internal/ValueParamProvider.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -22,7 +23,7 @@ import javax.ws.rs.RuntimeType; import org.glassfish.jersey.server.ContainerRequest; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.spi.Contract; /** diff --git a/core-server/src/main/java/org/glassfish/jersey/server/wadl/WadlGenerator.java b/core-server/src/main/java/org/glassfish/jersey/server/wadl/WadlGenerator.java index f3fe533da4..1bcf7680f8 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/wadl/WadlGenerator.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/wadl/WadlGenerator.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -27,7 +28,7 @@ import javax.xml.bind.annotation.XmlRegistry; import javax.xml.namespace.QName; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.wadl.internal.ApplicationDescription; import com.sun.research.ws.wadl.Application; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/WadlBuilder.java b/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/WadlBuilder.java index cdf6caf005..41305c71fb 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/WadlBuilder.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/WadlBuilder.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -35,7 +36,7 @@ import org.glassfish.jersey.internal.Version; import org.glassfish.jersey.server.internal.LocalizationMessages; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.model.ResourceMethod; import org.glassfish.jersey.server.wadl.WadlGenerator; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/WadlGeneratorImpl.java b/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/WadlGeneratorImpl.java index 2a703e443a..f7547e6fa4 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/WadlGeneratorImpl.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/WadlGeneratorImpl.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -23,7 +24,7 @@ import javax.xml.namespace.QName; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.model.ResourceMethod; import org.glassfish.jersey.server.wadl.WadlGenerator; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/WadlGeneratorApplicationDoc.java b/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/WadlGeneratorApplicationDoc.java index cfa08de989..442a57a7cd 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/WadlGeneratorApplicationDoc.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/WadlGeneratorApplicationDoc.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -27,7 +28,7 @@ import javax.inject.Provider; import javax.xml.parsers.SAXParserFactory; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.wadl.WadlGenerator; import org.glassfish.jersey.server.wadl.internal.ApplicationDescription; import org.glassfish.jersey.server.wadl.internal.WadlUtils; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/WadlGeneratorGrammarsSupport.java b/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/WadlGeneratorGrammarsSupport.java index 8e2a31e13b..2d27ecf8a6 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/WadlGeneratorGrammarsSupport.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/WadlGeneratorGrammarsSupport.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -28,7 +29,7 @@ import javax.inject.Provider; import javax.xml.parsers.SAXParserFactory; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.wadl.WadlGenerator; import org.glassfish.jersey.server.wadl.internal.ApplicationDescription; import org.glassfish.jersey.server.wadl.internal.WadlUtils; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/WadlGeneratorJAXBGrammarGenerator.java b/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/WadlGeneratorJAXBGrammarGenerator.java index 2f303e86aa..747c1b0096 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/WadlGeneratorJAXBGrammarGenerator.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/WadlGeneratorJAXBGrammarGenerator.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -48,7 +49,7 @@ import javax.xml.transform.Result; import javax.xml.transform.stream.StreamResult; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.wadl.WadlGenerator; import org.glassfish.jersey.server.wadl.internal.ApplicationDescription; import org.glassfish.jersey.server.wadl.internal.WadlGeneratorImpl; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/resourcedoc/ResourceDocAccessor.java b/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/resourcedoc/ResourceDocAccessor.java index 8631c5b5d5..0e5967d0a9 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/resourcedoc/ResourceDocAccessor.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/resourcedoc/ResourceDocAccessor.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -22,7 +23,7 @@ import java.util.logging.Logger; import org.glassfish.jersey.server.internal.LocalizationMessages; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.wadl.internal.generators.resourcedoc.model.AnnotationDocType; import org.glassfish.jersey.server.wadl.internal.generators.resourcedoc.model.ClassDocType; import org.glassfish.jersey.server.wadl.internal.generators.resourcedoc.model.MethodDocType; diff --git a/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/resourcedoc/WadlGeneratorResourceDocSupport.java b/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/resourcedoc/WadlGeneratorResourceDocSupport.java index 421bb9f021..2b55e58ea2 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/resourcedoc/WadlGeneratorResourceDocSupport.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/wadl/internal/generators/resourcedoc/WadlGeneratorResourceDocSupport.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -28,7 +29,7 @@ import javax.inject.Provider; import javax.xml.parsers.SAXParserFactory; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.model.ResourceMethod; import org.glassfish.jersey.server.wadl.WadlGenerator; import org.glassfish.jersey.server.wadl.internal.ApplicationDescription; diff --git a/core-server/src/test/java/org/glassfish/jersey/server/TestInjectionManagerFactory.java b/core-server/src/test/java/org/glassfish/jersey/server/TestInjectionManagerFactory.java index fed2888ba4..204b9d044c 100644 --- a/core-server/src/test/java/org/glassfish/jersey/server/TestInjectionManagerFactory.java +++ b/core-server/src/test/java/org/glassfish/jersey/server/TestInjectionManagerFactory.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -33,7 +34,7 @@ import org.glassfish.jersey.message.internal.MessagingBinders; import org.glassfish.jersey.model.internal.ManagedObjectsFinalizer; import org.glassfish.jersey.process.internal.RequestScope; -import org.glassfish.jersey.server.internal.inject.ParamConverterConfigurator; +import org.glassfish.jersey.internal.inject.ParamConverterConfigurator; import org.glassfish.jersey.server.internal.inject.ParamExtractorConfigurator; import org.glassfish.jersey.server.internal.inject.ValueParamProviderConfigurator; import org.glassfish.jersey.server.internal.process.RequestProcessingConfigurator; diff --git a/core-server/src/test/java/org/glassfish/jersey/server/internal/inject/ParamConverterInternalTest.java b/core-server/src/test/java/org/glassfish/jersey/server/internal/inject/ParamConverterInternalTest.java index 9b4c393e3b..cf69fb7a1f 100644 --- a/core-server/src/test/java/org/glassfish/jersey/server/internal/inject/ParamConverterInternalTest.java +++ b/core-server/src/test/java/org/glassfish/jersey/server/internal/inject/ParamConverterInternalTest.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -39,6 +40,7 @@ import javax.ws.rs.ext.ParamConverterProvider; import org.glassfish.jersey.internal.inject.ExtractorException; +import org.glassfish.jersey.internal.inject.ParamConverters; import org.glassfish.jersey.internal.util.ReflectionHelper; import org.glassfish.jersey.internal.util.collection.ClassTypePair; import org.glassfish.jersey.server.ApplicationHandler; diff --git a/core-server/src/test/java/org/glassfish/jersey/server/internal/inject/UriTest.java b/core-server/src/test/java/org/glassfish/jersey/server/internal/inject/UriTest.java index 9690d864ac..0b84c52067 100644 --- a/core-server/src/test/java/org/glassfish/jersey/server/internal/inject/UriTest.java +++ b/core-server/src/test/java/org/glassfish/jersey/server/internal/inject/UriTest.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -30,7 +31,7 @@ import org.glassfish.jersey.server.ContainerResponse; import org.glassfish.jersey.server.RequestContextBuilder; import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.jersey.server.Uri; +import org.glassfish.jersey.uri.Uri; import org.junit.Test; import static org.hamcrest.CoreMatchers.equalTo; diff --git a/core-server/src/test/java/org/glassfish/jersey/server/model/GenericMethodListTest.java b/core-server/src/test/java/org/glassfish/jersey/server/model/GenericMethodListTest.java index 9a23891b3f..bff082ca43 100644 --- a/core-server/src/test/java/org/glassfish/jersey/server/model/GenericMethodListTest.java +++ b/core-server/src/test/java/org/glassfish/jersey/server/model/GenericMethodListTest.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -16,6 +17,7 @@ package org.glassfish.jersey.server.model; +import org.glassfish.jersey.model.AnnotatedMethod; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; diff --git a/core-server/src/test/java/org/glassfish/jersey/server/model/MethodListTest.java b/core-server/src/test/java/org/glassfish/jersey/server/model/MethodListTest.java index c78d435a58..b878d63c5c 100644 --- a/core-server/src/test/java/org/glassfish/jersey/server/model/MethodListTest.java +++ b/core-server/src/test/java/org/glassfish/jersey/server/model/MethodListTest.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -16,6 +17,7 @@ package org.glassfish.jersey.server.model; +import org.glassfish.jersey.model.AnnotatedMethod; import org.junit.Test; import java.util.HashSet; diff --git a/core-server/src/test/java/org/glassfish/jersey/server/modelapi/annotation/IntrospectionModellerTest.java b/core-server/src/test/java/org/glassfish/jersey/server/modelapi/annotation/IntrospectionModellerTest.java index a74ec77389..335f0f0c96 100644 --- a/core-server/src/test/java/org/glassfish/jersey/server/modelapi/annotation/IntrospectionModellerTest.java +++ b/core-server/src/test/java/org/glassfish/jersey/server/modelapi/annotation/IntrospectionModellerTest.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2011, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -33,7 +34,7 @@ import javax.inject.Inject; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.model.Resource; import org.glassfish.jersey.server.model.ResourceMethod; diff --git a/core-server/src/test/java/org/glassfish/jersey/server/wadl/config/WadlGeneratorConfigTest.java b/core-server/src/test/java/org/glassfish/jersey/server/wadl/config/WadlGeneratorConfigTest.java index 5aa59e98c5..86b3d29b64 100644 --- a/core-server/src/test/java/org/glassfish/jersey/server/wadl/config/WadlGeneratorConfigTest.java +++ b/core-server/src/test/java/org/glassfish/jersey/server/wadl/config/WadlGeneratorConfigTest.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -25,7 +26,7 @@ import javax.ws.rs.core.MediaType; import org.glassfish.jersey.server.TestInjectionManagerFactory; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.model.ResourceMethod; import org.glassfish.jersey.server.wadl.WadlGenerator; import org.glassfish.jersey.server.wadl.internal.ApplicationDescription; diff --git a/core-server/src/test/java/org/glassfish/jersey/server/wadl/config/WadlGeneratorConfigurationLoaderTest.java b/core-server/src/test/java/org/glassfish/jersey/server/wadl/config/WadlGeneratorConfigurationLoaderTest.java index 589dc89b0e..dfce1baeb0 100644 --- a/core-server/src/test/java/org/glassfish/jersey/server/wadl/config/WadlGeneratorConfigurationLoaderTest.java +++ b/core-server/src/test/java/org/glassfish/jersey/server/wadl/config/WadlGeneratorConfigurationLoaderTest.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -24,7 +25,7 @@ import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.server.ServerProperties; import org.glassfish.jersey.server.TestInjectionManagerFactory; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.model.ResourceMethod; import org.glassfish.jersey.server.wadl.WadlGenerator; import org.glassfish.jersey.server.wadl.internal.ApplicationDescription; diff --git a/core-server/src/test/java/org/glassfish/jersey/server/wadl/config/WadlGeneratorLoaderTest.java b/core-server/src/test/java/org/glassfish/jersey/server/wadl/config/WadlGeneratorLoaderTest.java index 06670553e4..ece3001811 100644 --- a/core-server/src/test/java/org/glassfish/jersey/server/wadl/config/WadlGeneratorLoaderTest.java +++ b/core-server/src/test/java/org/glassfish/jersey/server/wadl/config/WadlGeneratorLoaderTest.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -32,7 +33,7 @@ import javax.ws.rs.core.MediaType; import org.glassfish.jersey.server.TestInjectionManagerFactory; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.model.ResourceMethod; import org.glassfish.jersey.server.wadl.WadlGenerator; import org.glassfish.jersey.server.wadl.internal.ApplicationDescription; diff --git a/examples/helloworld-microprofile-rest-client/README.MD b/examples/helloworld-microprofile-rest-client/README.MD new file mode 100644 index 0000000000..4fda89a19b --- /dev/null +++ b/examples/helloworld-microprofile-rest-client/README.MD @@ -0,0 +1,35 @@ +[//]: # " Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved. " +[//]: # " Copyright (c) 2018 Payara Foundation and/or its affiliates. " +[//]: # " " +[//]: # " This program and the accompanying materials are made available under the " +[//]: # " terms of the Eclipse Distribution License v. 1.0, which is available at " +[//]: # " http://www.eclipse.org/org/documents/edl-v10.php. " +[//]: # " " +[//]: # " SPDX-License-Identifier: BSD-3-Clause " + +Hello World Example +=================== + +This example demonstrates Hello World Microprofile Rest Client example. +JAX-RS resource returns the usual text `Hello World!` +and `HelloWorldClient` rest client interface used as a means to invoke the `HelloWorldResource` service. + +Contents +-------- + +The mapping of the URI path space is presented in the following table: + +URI path | Resource class | HTTP methods | Notes +-------------------- | ------------------- | ------------ | -------------------------------------------------------- +**_/helloworld_** | HelloWorldResource | GET | Returns `Hello World!` + +Running the Example +------------------- + +Run the example as follows: + +> mvn clean compile exec:java + +This deploys the example using [Grizzly](http://grizzly.java.net/) container. You can access the application at: + +- diff --git a/examples/helloworld-microprofile-rest-client/pom.xml b/examples/helloworld-microprofile-rest-client/pom.xml new file mode 100644 index 0000000000..d133a8d6ab --- /dev/null +++ b/examples/helloworld-microprofile-rest-client/pom.xml @@ -0,0 +1,85 @@ + + + + + 4.0.0 + + + org.glassfish.jersey.examples + project + 2.28-SNAPSHOT + + + helloworld-microprofile-rest-client + jar + jersey-examples-helloworld-microprofile-rest-client + + Example using only the standard JAX-RS API's and the lightweight HTTP server bundled in JDK. + + + + org.glassfish.jersey.containers + jersey-container-jdk-http + + + org.glassfish.jersey.core + jersey-client + + + org.glassfish.jersey.ext + jersey-microprofile-rest-client + + + org.glassfish.jersey.inject + jersey-hk2 + + + junit + junit + test + + + + + + + org.codehaus.mojo + exec-maven-plugin + + org.glassfish.jersey.examples.helloworld.jaxrs.App + + + + + + + + release + + + + org.apache.maven.plugins + maven-assembly-plugin + + + + + + + diff --git a/examples/helloworld-microprofile-rest-client/src/main/java/org/glassfish/jersey/examples/helloworld/jaxrs/App.java b/examples/helloworld-microprofile-rest-client/src/main/java/org/glassfish/jersey/examples/helloworld/jaxrs/App.java new file mode 100644 index 0000000000..3bb193c98e --- /dev/null +++ b/examples/helloworld-microprofile-rest-client/src/main/java/org/glassfish/jersey/examples/helloworld/jaxrs/App.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v. 1.0, which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +package org.glassfish.jersey.examples.helloworld.jaxrs; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.URI; + +import javax.ws.rs.core.UriBuilder; +import javax.ws.rs.ext.RuntimeDelegate; + +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; + +/** + * Hello world application using only the standard JAX-RS API and lightweight HTTP server bundled in JDK. + * + * @author Martin Matula + */ +public class App { + + /** + * Starts the lightweight HTTP server serving the JAX-RS application. + * + * @return new instance of the lightweight HTTP server + * @throws IOException + */ + static HttpServer startServer() throws IOException { + // create a new server listening at port 8080 + final HttpServer server = HttpServer.create(new InetSocketAddress(getBaseURI().getPort()), 0); + Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { + @Override + public void run() { + server.stop(0); + } + })); + + // create a handler wrapping the JAX-RS application + HttpHandler handler = RuntimeDelegate.getInstance().createEndpoint(new JaxRsApplication(), HttpHandler.class); + + // map JAX-RS handler to the server root + server.createContext(getBaseURI().getPath(), handler); + + // start the server + server.start(); + + return server; + } + + public static void main(String[] args) throws IOException, InterruptedException { + System.out.println("\"Hello World\" Jersey Example Application"); + + startServer(); + + System.out.println("Application started.\n" + + "Try accessing " + getBaseURI() + "helloworld in the browser.\n" + + "Hit enter to stop the application..."); + + Thread.currentThread().join(); + } + + private static int getPort(int defaultPort) { + final String port = System.getProperty("jersey.config.test.container.port"); + if (null != port) { + try { + return Integer.parseInt(port); + } catch (NumberFormatException e) { + System.out.println("Value of jersey.config.test.container.port property" + + " is not a valid positive integer [" + port + "]." + + " Reverting to default [" + defaultPort + "]."); + } + } + return defaultPort; + } + + /** + * Gets base {@link URI}. + * + * @return base {@link URI}. + */ + public static URI getBaseURI() { + return UriBuilder.fromUri("http://localhost/").port(getPort(8080)).build(); + } +} diff --git a/examples/helloworld-microprofile-rest-client/src/main/java/org/glassfish/jersey/examples/helloworld/jaxrs/HelloWorldResource.java b/examples/helloworld-microprofile-rest-client/src/main/java/org/glassfish/jersey/examples/helloworld/jaxrs/HelloWorldResource.java new file mode 100644 index 0000000000..856f233525 --- /dev/null +++ b/examples/helloworld-microprofile-rest-client/src/main/java/org/glassfish/jersey/examples/helloworld/jaxrs/HelloWorldResource.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v. 1.0, which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +package org.glassfish.jersey.examples.helloworld.jaxrs; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +/** + * + * @author Jakub Podlesak (jakub.podlesak at oracle.com) + */ +@Path("helloworld") +public class HelloWorldResource { + public static final String CLICHED_MESSAGE = "Hello World!"; + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String getHello() { + return CLICHED_MESSAGE; + } + +} diff --git a/examples/helloworld-microprofile-rest-client/src/main/java/org/glassfish/jersey/examples/helloworld/jaxrs/JaxRsApplication.java b/examples/helloworld-microprofile-rest-client/src/main/java/org/glassfish/jersey/examples/helloworld/jaxrs/JaxRsApplication.java new file mode 100644 index 0000000000..240ea1c711 --- /dev/null +++ b/examples/helloworld-microprofile-rest-client/src/main/java/org/glassfish/jersey/examples/helloworld/jaxrs/JaxRsApplication.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Distribution License v. 1.0, which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +package org.glassfish.jersey.examples.helloworld.jaxrs; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import javax.ws.rs.core.Application; + +/** + * JAX-RS Application class for this example. + * + * @author Martin Matula + */ +public class JaxRsApplication extends Application { + private final Set> classes; + + public JaxRsApplication() { + HashSet> c = new HashSet>(); + c.add(HelloWorldResource.class); + classes = Collections.unmodifiableSet(c); + } + + @Override + public Set> getClasses() { + return classes; + } +} diff --git a/examples/helloworld-microprofile-rest-client/src/test/java/org/glassfish/jersey/examples/helloworld/jaxrs/HelloWorldClient.java b/examples/helloworld-microprofile-rest-client/src/test/java/org/glassfish/jersey/examples/helloworld/jaxrs/HelloWorldClient.java new file mode 100644 index 0000000000..3942ebb37a --- /dev/null +++ b/examples/helloworld-microprofile-rest-client/src/test/java/org/glassfish/jersey/examples/helloworld/jaxrs/HelloWorldClient.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.glassfish.jersey.examples.helloworld.jaxrs; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + +/** + * Client interface represents the HelloWorldResource rest service + * + * @author Gaurav Gupta + */ +@Path("helloworld") +@RegisterRestClient +interface HelloWorldClient { + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String getHello(); + +} diff --git a/examples/helloworld-microprofile-rest-client/src/test/java/org/glassfish/jersey/examples/helloworld/jaxrs/HelloWorldClientTest.java b/examples/helloworld-microprofile-rest-client/src/test/java/org/glassfish/jersey/examples/helloworld/jaxrs/HelloWorldClientTest.java new file mode 100644 index 0000000000..4197c00dff --- /dev/null +++ b/examples/helloworld-microprofile-rest-client/src/test/java/org/glassfish/jersey/examples/helloworld/jaxrs/HelloWorldClientTest.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ +package org.glassfish.jersey.examples.helloworld.jaxrs; + + +import org.junit.Test; +import static org.junit.Assert.assertEquals; + +import com.sun.net.httpserver.HttpServer; +import org.eclipse.microprofile.rest.client.RestClientBuilder; + +/** + * Simple test to call HelloWorldResource REST API using HelloWorldClient proxy client. + * + * @author Gaurav Gupta + */ +public class HelloWorldClientTest { + + @Test + public void testHelloWorld() throws Exception { + HttpServer server = App.startServer(); + + HelloWorldClient simpleGetApi = RestClientBuilder.newBuilder() + .baseUri(App.getBaseURI()) + .build(HelloWorldClient.class); + + assertEquals(HelloWorldResource.CLICHED_MESSAGE, simpleGetApi.getHello()); + + server.stop(0); + } +} diff --git a/examples/managed-client-simple-webapp/src/main/java/org/glassfish/jersey/examples/managedclientsimple/resources/ClientResource.java b/examples/managed-client-simple-webapp/src/main/java/org/glassfish/jersey/examples/managedclientsimple/resources/ClientResource.java index daa752d8bb..16fd072ce8 100644 --- a/examples/managed-client-simple-webapp/src/main/java/org/glassfish/jersey/examples/managedclientsimple/resources/ClientResource.java +++ b/examples/managed-client-simple-webapp/src/main/java/org/glassfish/jersey/examples/managedclientsimple/resources/ClientResource.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -19,7 +20,7 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.glassfish.jersey.server.Uri; +import org.glassfish.jersey.uri.Uri; /** * A resource which use managed client injected by {@link org.glassfish.jersey.server.Uri @Uri annotation} to query diff --git a/examples/managed-client-webapp/src/main/java/org/glassfish/jersey/examples/managedclient/PublicResource.java b/examples/managed-client-webapp/src/main/java/org/glassfish/jersey/examples/managedclient/PublicResource.java index 17454bcf89..d1b5a4957a 100644 --- a/examples/managed-client-webapp/src/main/java/org/glassfish/jersey/examples/managedclient/PublicResource.java +++ b/examples/managed-client-webapp/src/main/java/org/glassfish/jersey/examples/managedclient/PublicResource.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -17,7 +18,7 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.glassfish.jersey.server.Uri; +import org.glassfish.jersey.uri.Uri; /** * A resource that uses managed clients to retrieve values of internal diff --git a/examples/managed-client/src/main/java/org/glassfish/jersey/examples/managedclient/PublicResource.java b/examples/managed-client/src/main/java/org/glassfish/jersey/examples/managedclient/PublicResource.java index 3340c16f65..d2d13a8875 100644 --- a/examples/managed-client/src/main/java/org/glassfish/jersey/examples/managedclient/PublicResource.java +++ b/examples/managed-client/src/main/java/org/glassfish/jersey/examples/managedclient/PublicResource.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -17,7 +18,7 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.glassfish.jersey.server.Uri; +import org.glassfish.jersey.uri.Uri; /** * A resource that uses managed clients to retrieve values of internal diff --git a/examples/open-tracing/src/main/java/org/glassfish/jersey/examples/opentracing/TracedResource.java b/examples/open-tracing/src/main/java/org/glassfish/jersey/examples/opentracing/TracedResource.java index ce8e83b919..2d665aa199 100644 --- a/examples/open-tracing/src/main/java/org/glassfish/jersey/examples/opentracing/TracedResource.java +++ b/examples/open-tracing/src/main/java/org/glassfish/jersey/examples/opentracing/TracedResource.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -26,7 +27,7 @@ import org.glassfish.jersey.opentracing.OpenTracingFeature; import org.glassfish.jersey.opentracing.OpenTracingUtils; import org.glassfish.jersey.server.ManagedAsync; -import org.glassfish.jersey.server.Uri; +import org.glassfish.jersey.uri.Uri; import io.opentracing.Span; diff --git a/examples/pom.xml b/examples/pom.xml index 2354e7d2b2..d4cd8b464e 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -80,6 +80,7 @@ helloworld-weld helloworld-spring-webapp helloworld-spring-annotations + helloworld-microprofile-rest-client http-patch http-trace https-clientserver-grizzly diff --git a/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/AsyncAgentResource.java b/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/AsyncAgentResource.java index a7353a28a8..125a15f064 100644 --- a/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/AsyncAgentResource.java +++ b/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/AsyncAgentResource.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -41,7 +42,7 @@ import org.glassfish.jersey.internal.guava.ThreadFactoryBuilder; import org.glassfish.jersey.process.JerseyProcessingUncaughtExceptionHandler; import org.glassfish.jersey.server.ManagedAsync; -import org.glassfish.jersey.server.Uri; +import org.glassfish.jersey.uri.Uri; /** * Obtain information about visited (destination) and recommended (destination, forecast, price) places for "Async" user. Uses diff --git a/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/CompletionStageAgentResource.java b/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/CompletionStageAgentResource.java index fd9f410e9e..350fd8f14b 100644 --- a/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/CompletionStageAgentResource.java +++ b/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/CompletionStageAgentResource.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -34,7 +35,7 @@ import org.glassfish.jersey.examples.rx.domain.Forecast; import org.glassfish.jersey.examples.rx.domain.Recommendation; import org.glassfish.jersey.internal.guava.ThreadFactoryBuilder; -import org.glassfish.jersey.server.Uri; +import org.glassfish.jersey.uri.Uri; /** * Obtain information about visited (destination) and recommended (destination, forecast, price) places for diff --git a/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/FlowableAgentResource.java b/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/FlowableAgentResource.java index d5ffaef07f..30981647d9 100644 --- a/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/FlowableAgentResource.java +++ b/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/FlowableAgentResource.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -32,7 +33,7 @@ import org.glassfish.jersey.examples.rx.domain.Destination; import org.glassfish.jersey.examples.rx.domain.Forecast; import org.glassfish.jersey.examples.rx.domain.Recommendation; -import org.glassfish.jersey.server.Uri; +import org.glassfish.jersey.uri.Uri; import io.reactivex.Flowable; import io.reactivex.schedulers.Schedulers; diff --git a/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/ListenableFutureAgentResource.java b/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/ListenableFutureAgentResource.java index 9dc3d5f4d6..875c23d744 100644 --- a/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/ListenableFutureAgentResource.java +++ b/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/ListenableFutureAgentResource.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -29,7 +30,7 @@ import org.glassfish.jersey.examples.rx.domain.Forecast; import org.glassfish.jersey.examples.rx.domain.Recommendation; import org.glassfish.jersey.server.ManagedAsync; -import org.glassfish.jersey.server.Uri; +import org.glassfish.jersey.uri.Uri; import com.google.common.collect.Lists; import com.google.common.util.concurrent.AsyncFunction; diff --git a/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/ObservableAgentResource.java b/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/ObservableAgentResource.java index f23aa66b93..4a3a3b776c 100644 --- a/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/ObservableAgentResource.java +++ b/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/ObservableAgentResource.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -32,7 +33,7 @@ import org.glassfish.jersey.examples.rx.domain.Destination; import org.glassfish.jersey.examples.rx.domain.Forecast; import org.glassfish.jersey.examples.rx.domain.Recommendation; -import org.glassfish.jersey.server.Uri; +import org.glassfish.jersey.uri.Uri; import rx.Observable; import rx.schedulers.Schedulers; diff --git a/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/SyncAgentResource.java b/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/SyncAgentResource.java index 102d46550b..3600fd0299 100644 --- a/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/SyncAgentResource.java +++ b/examples/rx-client-webapp/src/main/java/org/glassfish/jersey/examples/rx/agent/SyncAgentResource.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -29,7 +30,7 @@ import org.glassfish.jersey.examples.rx.domain.Destination; import org.glassfish.jersey.examples.rx.domain.Forecast; import org.glassfish.jersey.examples.rx.domain.Recommendation; -import org.glassfish.jersey.server.Uri; +import org.glassfish.jersey.uri.Uri; /** * Obtain information about visited (destination) and recommended (destination, forecast, price) places for "Sync" user. Uses diff --git a/ext/cdi/jersey-cdi1x/src/main/java/org/glassfish/jersey/ext/cdi1x/internal/CdiComponentProvider.java b/ext/cdi/jersey-cdi1x/src/main/java/org/glassfish/jersey/ext/cdi1x/internal/CdiComponentProvider.java index 7dd258d71d..c3949a2c73 100644 --- a/ext/cdi/jersey-cdi1x/src/main/java/org/glassfish/jersey/ext/cdi1x/internal/CdiComponentProvider.java +++ b/ext/cdi/jersey-cdi1x/src/main/java/org/glassfish/jersey/ext/cdi1x/internal/CdiComponentProvider.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -81,7 +82,7 @@ import org.glassfish.jersey.internal.inject.SupplierInstanceBinding; import org.glassfish.jersey.internal.util.collection.Cache; import org.glassfish.jersey.server.ContainerRequest; -import org.glassfish.jersey.server.model.Parameter; +import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.server.model.Resource; import org.glassfish.jersey.server.spi.ComponentProvider; import org.glassfish.jersey.server.spi.internal.ValueParamProvider; diff --git a/ext/microprofile-rest-client/pom.xml b/ext/microprofile-rest-client/pom.xml new file mode 100644 index 0000000000..2f6a3b205f --- /dev/null +++ b/ext/microprofile-rest-client/pom.xml @@ -0,0 +1,81 @@ + + + + + 4.0.0 + + + org.glassfish.jersey.ext + project + 2.28-SNAPSHOT + + + jersey-microprofile-rest-client + jersey-ext-microprofile-rest-client + + Jersey extension module providing support for MicroProfile Rest Client + + + + + + org.apache.felix + maven-bundle-plugin + true + true + + + org.glassfish.jersey.microprofile.rest.client.*;version=${project.version} + + true + + + + + + + + org.eclipse.microprofile.rest.client + microprofile-rest-client-api + + + org.eclipse.microprofile.config + microprofile-config-api + + + org.glassfish.jersey.core + jersey-client + ${project.version} + + + org.glassfish.jersey.ext + jersey-proxy-client + ${project.version} + + + org.glassfish.jersey.core + jersey-common + ${project.version} + + + javax.enterprise + cdi-api + + + diff --git a/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/Constant.java b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/Constant.java new file mode 100644 index 0000000000..bf9041b31c --- /dev/null +++ b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/Constant.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ +package org.glassfish.jersey.microprofile.rest.client; + +public class Constant { + + public static final String DISABLE_DEFAULT_EXCEPTION_MAPPER = "microprofile.rest.client.disable.default.mapper"; + + public static final String REST_URL_FORMAT = "%s/mp-rest/url"; + + public static final String REST_URI_FORMAT = "%s/mp-rest/uri"; + + public static final String REST_SCOPE_FORMAT = "%s/mp-rest/scope"; + +} diff --git a/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/RestClientBuilderImpl.java b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/RestClientBuilderImpl.java new file mode 100644 index 0000000000..d2d70fbb21 --- /dev/null +++ b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/RestClientBuilderImpl.java @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ +package org.glassfish.jersey.microprofile.rest.client; + +import org.glassfish.jersey.microprofile.rest.client.ext.DefaultResponseExceptionMapper; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.Map; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.Configuration; +import org.eclipse.microprofile.rest.client.RestClientBuilder; +import org.eclipse.microprofile.rest.client.RestClientDefinitionException; +import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; +import org.glassfish.jersey.client.proxy.WebResourceFactory; +import static org.glassfish.jersey.microprofile.rest.client.Constant.DISABLE_DEFAULT_EXCEPTION_MAPPER; +import org.glassfish.jersey.microprofile.rest.client.config.ConfigController; +import static java.lang.Boolean.FALSE; +import java.net.URI; +import java.util.concurrent.ExecutorService; + +public class RestClientBuilderImpl implements RestClientBuilder { + + private URI baseUri; + + private final ClientBuilder clientBuilder; + + public RestClientBuilderImpl() { + clientBuilder = ClientBuilder.newBuilder(); + } + + @Override + public RestClientBuilder baseUrl(URL url) { + try { + this.baseUri = url.toURI(); + } catch (URISyntaxException ex) { + throw new IllegalArgumentException( + String.format("Rest Client url is invalid [%s] ", url), ex + ); + } + return this; + } + + @Override + public RestClientBuilder baseUri(URI uri) { + this.baseUri = uri; + return this; + } + + @Override + public RestClientBuilder executorService(ExecutorService executor) { + if (executor == null) { + throw new IllegalArgumentException("ExecutorService is null"); + } + clientBuilder.executorService(executor); + return this; + } + + @Override + public T build(Class restClientInterface) throws IllegalStateException, RestClientDefinitionException { + if (baseUri == null) { + throw new IllegalStateException("Base URI or URL can't be null"); + } + + // interface validity + RestClientValidator.getInstance().validate(restClientInterface); + + registerDefaultExceptionMapper(); + registerProviders(restClientInterface); + + Client client = clientBuilder.build(); + WebTarget webTarget = client.target(baseUri); + return WebResourceFactory.newResource(restClientInterface, webTarget); + } + + private void registerDefaultExceptionMapper() { + // Default exception mapper check per client basis + Object disableDefaultExceptionMapperProp = getConfiguration() + .getProperty(DISABLE_DEFAULT_EXCEPTION_MAPPER); + if (disableDefaultExceptionMapperProp == null) { + //check MicroProfile Config + boolean disableDefaultExceptionMapper = ConfigController + .getOptionalValue(DISABLE_DEFAULT_EXCEPTION_MAPPER, Boolean.class) + .orElse(FALSE); + if (!disableDefaultExceptionMapper) { + register(DefaultResponseExceptionMapper.class); + } + } else if (FALSE.equals(disableDefaultExceptionMapperProp)) { + register(DefaultResponseExceptionMapper.class); + } + } + + private void registerProviders(Class restClient) { + RegisterProvider[] providers = restClient.getAnnotationsByType(RegisterProvider.class); + for (RegisterProvider provider : providers) { + register(provider.value(), provider.priority()); + } + } + + @Override + public Configuration getConfiguration() { + return clientBuilder.getConfiguration(); + } + + @Override + public RestClientBuilder property(String name, Object value) { + clientBuilder.property(name, value); + return this; + } + + @Override + public RestClientBuilder register(Class componentClass) { + clientBuilder.register(componentClass); + return this; + } + + @Override + public RestClientBuilder register(Class type, int priority) { + clientBuilder.register(type, priority); + return this; + } + + @Override + public RestClientBuilder register(Class type, Class... contracts) { + clientBuilder.register(type, contracts); + return this; + } + + @Override + public RestClientBuilder register(Class type, Map, Integer> contracts) { + clientBuilder.register(type, contracts); + return this; + } + + @Override + public RestClientBuilder register(Object component) { + clientBuilder.register(component); + return this; + } + + @Override + public RestClientBuilder register(Object component, int priority) { + clientBuilder.register(component, priority); + return this; + } + + @Override + public RestClientBuilder register(Object component, Class... contracts) { + clientBuilder.register(component, contracts); + return this; + } + + @Override + public RestClientBuilder register(Object component, Map, Integer> contracts) { + clientBuilder.register(component, contracts); + return this; + } + +} diff --git a/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/RestClientBuilderResolverImpl.java b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/RestClientBuilderResolverImpl.java new file mode 100644 index 0000000000..f554ec4b95 --- /dev/null +++ b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/RestClientBuilderResolverImpl.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ +package org.glassfish.jersey.microprofile.rest.client; + +import javax.enterprise.inject.Vetoed; +import org.eclipse.microprofile.rest.client.RestClientBuilder; +import org.eclipse.microprofile.rest.client.spi.RestClientBuilderResolver; + +@Vetoed +public class RestClientBuilderResolverImpl extends RestClientBuilderResolver { + + @Override + public RestClientBuilder newBuilder() { + return new RestClientBuilderImpl(); + } +} diff --git a/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/RestClientValidator.java b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/RestClientValidator.java new file mode 100644 index 0000000000..c6da18ce9e --- /dev/null +++ b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/RestClientValidator.java @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ +package org.glassfish.jersey.microprofile.rest.client; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; +import java.lang.reflect.Parameter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.ws.rs.HttpMethod; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.core.UriBuilder; +import org.eclipse.microprofile.rest.client.RestClientDefinitionException; + +public class RestClientValidator { + + private static volatile RestClientValidator instance; + + private RestClientValidator() { + } + + public static RestClientValidator getInstance() { + if (instance == null) { + synchronized (RestClientValidator.class) { + if (instance == null) { + instance = new RestClientValidator(); + } + } + } + return instance; + } + + /** + * Invalid client interfaces will result in a RestClientDefinitionException + * + * @param restClient + */ + public void validate(Class restClient) { + if (!restClient.isInterface()) { + throw new IllegalArgumentException( + String.format("Rest Client [%s] must be interface", restClient) + ); + } + Method[] methods = restClient.getMethods(); + checkMethodsForMultipleHTTPMethodAnnotations(restClient, methods); + checkMethodsForInvalidURITemplates(restClient, methods); + } + + private void checkMethodsForMultipleHTTPMethodAnnotations(Class restClient, Method[] methods) + throws RestClientDefinitionException { + // using multiple HTTP method annotations on the same method + for (Method method : methods) { + List httpMethods = new ArrayList<>(); + for (Annotation annotation : method.getAnnotations()) { + if (annotation.annotationType() + .getAnnotation(HttpMethod.class) != null) { + httpMethods.add(annotation.annotationType().getSimpleName()); + } + if (httpMethods.size() > 1) { + throw new RestClientDefinitionException( + String.format( + "Rest Client [%s] method [%s] contains multiple HTTP method annotations %s", + restClient, + method.getName(), + httpMethods + ) + ); + } + + } + } + } + + private void checkMethodsForInvalidURITemplates(Class restClient, Method[] methods) + throws RestClientDefinitionException { + + // invalid parameter + Path classLevelPath = restClient.getAnnotation(Path.class); + + final Set classLevelVariables = new HashSet<>(); + UriBuilder classBuilder = null; + if (classLevelPath != null) { + classBuilder = UriBuilder.fromUri(classLevelPath.value()); + classLevelVariables.addAll(getPathParams(classLevelPath)); + } + + // invalid URI templates + for (Method method : methods) { + UriBuilder builder; + + Set pathParam = new HashSet<>(classLevelVariables); + Path methodLevelPath = method.getAnnotation(Path.class); + if (classLevelPath == null && methodLevelPath == null) { + continue; + } else if (methodLevelPath != null) { + builder = UriBuilder.fromUri(classLevelPath == null + ? methodLevelPath.value() : classLevelPath.value() + "/" + methodLevelPath.value() + ); + pathParam.addAll(getPathParams(methodLevelPath)); + } else { + builder = classBuilder; + } + + Map variableParam = getVariableParam(method); + if (pathParam.size() != variableParam.size()) { + throw new RestClientDefinitionException( + String.format( + "Rest Client [%s] method [%s] parameters %s are not matched with path variables %s", + restClient, method.getName(), variableParam.keySet(), pathParam + ) + ); + } + try { + builder.resolveTemplates(variableParam, false).build(); + } catch (IllegalArgumentException ex) { + throw new RestClientDefinitionException( + String.format( + "Rest Client [%s] method [%s] parameters %s are not matched with path variables %s", + restClient, method.getName(), variableParam.keySet(), pathParam + ), ex + ); + } + + } + } + + private Map getVariableParam(Method method) { + Map params = new HashMap<>(); + for (Parameter p : method.getParameters()) { + PathParam pathParam = p.getAnnotation(PathParam.class); + if (pathParam != null) { + params.put(pathParam.value(), ""); + } + } + return params; + } + + private List getPathParams(Path path) { + List params = new ArrayList<>(); + Pattern p = Pattern.compile("\\{(.*?)\\}"); + Matcher m = p.matcher(path.value()); + + while (m.find()) { + params.add(m.group(1)); + } + return params; + } + +} diff --git a/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/cdi/AbstractBeanProducer.java b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/cdi/AbstractBeanProducer.java new file mode 100644 index 0000000000..5f014dcb02 --- /dev/null +++ b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/cdi/AbstractBeanProducer.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ +package org.glassfish.jersey.microprofile.rest.client.cdi; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.util.Collections; +import static java.util.Collections.emptySet; +import java.util.Set; +import javax.enterprise.inject.spi.Bean; +import javax.enterprise.inject.spi.BeanManager; +import javax.enterprise.inject.spi.InjectionPoint; +import javax.enterprise.inject.spi.PassivationCapable; + +public abstract class AbstractBeanProducer implements Bean, PassivationCapable { + + protected final Class beanClass; + + protected final BeanManager beanManager; + + public AbstractBeanProducer(Class typeDef, BeanManager beanManager) { + this.beanClass = typeDef; + this.beanManager = beanManager; + } + + @Override + public String getId() { + return beanClass.getName(); + } + + @Override + public String getName() { + return beanClass.getName(); + } + + @Override + public Class getBeanClass() { + return beanClass; + } + + @Override + public Set getTypes() { + return Collections.singleton(beanClass); + } + + @Override + public Set> getStereotypes() { + return emptySet(); + } + + @Override + public Set getInjectionPoints() { + return emptySet(); + } + + @Override + public boolean isAlternative() { + return false; + } + + @Override + public boolean isNullable() { + return false; + } + +} diff --git a/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/cdi/RestClientCDIExtension.java b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/cdi/RestClientCDIExtension.java new file mode 100644 index 0000000000..d03fa92d90 --- /dev/null +++ b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/cdi/RestClientCDIExtension.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ +package org.glassfish.jersey.microprofile.rest.client.cdi; + +import java.util.LinkedHashSet; +import java.util.Set; +import javax.enterprise.event.Observes; +import javax.enterprise.inject.spi.AfterBeanDiscovery; +import javax.enterprise.inject.spi.AfterDeploymentValidation; +import javax.enterprise.inject.spi.BeanManager; +import javax.enterprise.inject.spi.Extension; +import javax.enterprise.inject.spi.ProcessAnnotatedType; +import javax.enterprise.inject.spi.WithAnnotations; +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + +public class RestClientCDIExtension implements Extension { + + private final Set> validRestClientClasses = new LinkedHashSet<>(); + + private final Set> invalidRestClientClasses = new LinkedHashSet<>(); + + public void registerClient( + @Observes + @WithAnnotations(RegisterRestClient.class) + ProcessAnnotatedType processAnnotatedType) { + Class restClient = processAnnotatedType.getAnnotatedType().getJavaClass(); + if (restClient.isInterface()) { + validRestClientClasses.add(restClient); + processAnnotatedType.veto(); + } else { + invalidRestClientClasses.add(restClient); + } + } + + public void createProxy(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager) { + validRestClientClasses.stream() + .map(restClient -> new RestClientProducer(restClient, beanManager)) + .forEach(afterBeanDiscovery::addBean); + } + + public void reportErrors(@Observes AfterDeploymentValidation afterDeploymentValidation) { + invalidRestClientClasses.stream() + .map(restClient -> new IllegalArgumentException( + String.format("Rest Client [%s] must be interface", restClient) + )) + .forEach(afterDeploymentValidation::addDeploymentProblem); + } +} diff --git a/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/cdi/RestClientProducer.java b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/cdi/RestClientProducer.java new file mode 100644 index 0000000000..b1c870cbfa --- /dev/null +++ b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/cdi/RestClientProducer.java @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ +package org.glassfish.jersey.microprofile.rest.client.cdi; + +import static org.glassfish.jersey.microprofile.rest.client.Constant.REST_SCOPE_FORMAT; +import static org.glassfish.jersey.microprofile.rest.client.Constant.REST_URL_FORMAT; +import org.glassfish.jersey.microprofile.rest.client.config.ConfigController; +import java.lang.annotation.Annotation; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import javax.enterprise.context.Dependent; +import javax.enterprise.context.spi.CreationalContext; +import javax.enterprise.inject.Any; +import javax.enterprise.inject.Default; +import javax.enterprise.inject.spi.BeanManager; +import javax.enterprise.util.AnnotationLiteral; +import org.eclipse.microprofile.rest.client.RestClientBuilder; +import org.eclipse.microprofile.rest.client.inject.RestClient; +import static org.glassfish.jersey.microprofile.rest.client.Constant.REST_URI_FORMAT; + +public class RestClientProducer extends AbstractBeanProducer { + + private final Class scope; + + public RestClientProducer(Class restClient, BeanManager beanManager) { + super(restClient, beanManager); + this.scope = findScope(); + } + + @Override + public Class getScope() { + return scope; + } + + @Override + public Set getQualifiers() { + Set qualifiers = new HashSet(); + qualifiers.add(new AnnotationLiteral() { + }); + qualifiers.add(new AnnotationLiteral() { + }); + qualifiers.add(RestClient.LITERAL); + return qualifiers; + } + + @Override + public Object create(CreationalContext creationalContext) { + return RestClientBuilder + .newBuilder() + .baseUri(getBaseUri()) + .build(beanClass); + } + + @Override + public void destroy(Object instance, CreationalContext creationalContext) { + } + + private URI getBaseUri() { + String uriProperty = String.format(REST_URI_FORMAT, getName()); + Optional baseUri = ConfigController.getOptionalValue(uriProperty); + if (!baseUri.isPresent()) { + String urlProperty = String.format(REST_URL_FORMAT, getName()); + Optional baseUrl = ConfigController.getOptionalValue(urlProperty); + if (!baseUrl.isPresent()) { + throw new IllegalArgumentException( + String.format("Rest Client [%s] url not found in configuration", beanClass) + ); + } else { + try { + return new URL(baseUrl.get()).toURI(); + } catch (MalformedURLException | URISyntaxException ex) { + throw new IllegalArgumentException( + String.format("Rest Client [%s] url is invalid [%s] ", beanClass, baseUri), ex + ); + } + } + } else { + try { + return new URI(baseUri.get()); + } catch (URISyntaxException ex) { + throw new IllegalArgumentException( + String.format("Rest Client [%s] uri is invalid [%s] ", beanClass, baseUri), ex + ); + } + } + } + + private Class findScope() { + + String scopeProperty = String.format(REST_SCOPE_FORMAT, getName()); + Optional configuredScope = ConfigController.getOptionalValue(scopeProperty); + if (configuredScope.isPresent()) { + try { + PrivilegedAction action = () -> Thread.currentThread().getContextClassLoader(); + ClassLoader classLoader = AccessController.doPrivileged(action); + if (classLoader == null) { + action = () -> this.getClass().getClassLoader(); + classLoader = AccessController.doPrivileged(action); + } + return (Class) Class.forName(configuredScope.get(), true, classLoader); + } catch (ClassNotFoundException ex) { + throw new IllegalArgumentException( + String.format("Rest Client [%s] scope is invalid [%s] ", beanClass, configuredScope.get()), ex + ); + } + } + + List definedScopes = new ArrayList<>(); + Annotation[] annotations = beanClass.getDeclaredAnnotations(); + for (Annotation annotation : annotations) { + if (beanManager.isScope(annotation.annotationType())) { + definedScopes.add(annotation); + } + } + if (definedScopes.isEmpty()) { + return Dependent.class; + } else if (definedScopes.size() == 1) { + return definedScopes.get(0).annotationType(); + } else { + throw new IllegalArgumentException( + String.format("Multiple scope definition [%s] found on the Rest Client [%s]", definedScopes, beanClass) + ); + } + } +} diff --git a/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/config/ConfigController.java b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/config/ConfigController.java new file mode 100644 index 0000000000..56a871cf31 --- /dev/null +++ b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/config/ConfigController.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ +package org.glassfish.jersey.microprofile.rest.client.config; + +import java.util.Optional; +import org.eclipse.microprofile.config.Config; +import org.eclipse.microprofile.config.ConfigProvider; + +public final class ConfigController { + + private ConfigController() { + } + + private static Config getConfig() { + Config config; + try { + config = ConfigProvider.getConfig(); + } catch (ExceptionInInitializerError | IllegalStateException | NoClassDefFoundError ex) { + // if MicroProfile Config module not found + config = null; + } + return config; + } + + public static Optional getOptionalValue(String propertyName) { + return getOptionalValue(propertyName, String.class); + } + + public static Optional getOptionalValue(String propertyName, Class clazz) { + Config config = getConfig(); + return config != null ? config.getOptionalValue(propertyName, clazz) : Optional.empty(); + } + + public static String getValue(String propertyName) { + return getValue(propertyName, String.class); + } + + public static T getValue(String propertyName, Class clazz) { + Config config = getConfig(); + return config != null ? config.getValue(propertyName, clazz) : null; + } + +} diff --git a/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/ext/DefaultResponseExceptionMapper.java b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/ext/DefaultResponseExceptionMapper.java new file mode 100644 index 0000000000..9ec198f1e5 --- /dev/null +++ b/ext/microprofile-rest-client/src/main/java/org/glassfish/jersey/microprofile/rest/client/ext/DefaultResponseExceptionMapper.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ +package org.glassfish.jersey.microprofile.rest.client.ext; + +import javax.enterprise.inject.Vetoed; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; +import org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper; + +@Vetoed +public class DefaultResponseExceptionMapper implements ResponseExceptionMapper { + + @Override + public Throwable toThrowable(Response response) { + return new WebApplicationException(response); + } + + @Override + public int getPriority() { + return Integer.MAX_VALUE; + } +} diff --git a/ext/microprofile-rest-client/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/ext/microprofile-rest-client/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension new file mode 100644 index 0000000000..5b722d6f8e --- /dev/null +++ b/ext/microprofile-rest-client/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension @@ -0,0 +1 @@ +org.glassfish.jersey.microprofile.rest.client.cdi.RestClientCDIExtension \ No newline at end of file diff --git a/ext/microprofile-rest-client/src/main/resources/META-INF/services/org.eclipse.microprofile.rest.client.spi.RestClientBuilderResolver b/ext/microprofile-rest-client/src/main/resources/META-INF/services/org.eclipse.microprofile.rest.client.spi.RestClientBuilderResolver new file mode 100644 index 0000000000..863696ed04 --- /dev/null +++ b/ext/microprofile-rest-client/src/main/resources/META-INF/services/org.eclipse.microprofile.rest.client.spi.RestClientBuilderResolver @@ -0,0 +1 @@ +org.glassfish.jersey.microprofile.rest.client.RestClientBuilderResolverImpl \ No newline at end of file diff --git a/ext/pom.xml b/ext/pom.xml index 0e56abfa33..bd49c131e4 100644 --- a/ext/pom.xml +++ b/ext/pom.xml @@ -2,6 +2,7 @@ + + + 4.0.0 + + + org.glassfish.jersey.tests + project + 2.28-SNAPSHOT + + + microprofile-rest-client-tck + jar + microprofile-rest-client-tck + MicroProfile Rest Client TCK + + + + org.glassfish.jersey.core + jersey-client + + + org.glassfish.jersey.ext + jersey-microprofile-rest-client + + + org.eclipse.microprofile.rest.client + microprofile-rest-client-tck + ${microprofile.rest.client.api.version} + test + + + org.jboss.weld.se + weld-se-core + 2.4.7.Final + test + + + org.jboss.arquillian.container + arquillian-weld-embedded + 2.0.0.Final + test + + + io.smallrye + smallrye-config + 1.3.1 + + + org.glassfish + javax.json + test + + + org.glassfish.jersey.media + jersey-media-json-processing + test + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + 1 + false + false + ${skip.e2e} + + org.eclipse.microprofile.rest.client:microprofile-rest-client-tck + + + **/InvokeWithBuiltProvidersTest.java + **/InvokeWithRegisteredProvidersTest.java + **/CDIInvokeWithRegisteredProvidersTest.java + **/AsyncMethodTest.java + + + + + uk.co.deliverymind + wiremock-maven-plugin + 2.7.0 + + + generate-test-sources + + run + + + target/classes + --port=8765 --verbose + + + + + + + + + + sonar + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + + + + + + + + diff --git a/tests/pom.xml b/tests/pom.xml index 9d6e92a49d..4b7b015fbb 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -39,6 +39,7 @@ e2e e2e-client + microprofile-rest-client-tck e2e-core-common e2e-entity e2e-inject