Skip to content

Commit

Permalink
merge of the actual 3.0 into the 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
senivam authored Oct 3, 2024
2 parents 77c4da5 + c0a140d commit 737add9
Show file tree
Hide file tree
Showing 55 changed files with 1,724 additions and 228 deletions.
14 changes: 7 additions & 7 deletions NOTICE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Notice for Jersey
# Notice for Jersey
This content is produced and maintained by the Eclipse Jersey project.

* Project home: https://projects.eclipse.org/projects/ee4j.jersey
Expand Down Expand Up @@ -57,25 +57,25 @@ Bootstrap v3.3.7
* Project: http://getbootstrap.com
* Copyright: 2011-2016 Twitter, Inc

Google Guava Version 18.0
Google Guava Version 33.3.0-jre
* License: Apache License, 2.0
* Copyright (C) 2009 The Guava Authors
* Copyright (C) 2009, 2024 The Guava Authors

jakarta.inject Version: 1
jakarta.inject Version: 2.0.1
* License: Apache License, 2.0
* Copyright (C) 2009 The JSR-330 Expert Group
* Copyright (C) 2009, 2021 The JSR-330 Expert Group

Javassist Version 3.30.2-GA
* License: Apache License, 2.0
* Project: http://www.javassist.org/
* Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.

Jackson JAX-RS Providers Version 2.17.1
Jackson JAX-RS Providers Version 2.17.2
* License: Apache License, 2.0
* Project: https://github.com/FasterXML/jackson-jaxrs-providers
* Copyright: (c) 2009-2024 FasterXML, LLC. All rights reserved unless otherwise indicated.

jQuery v1.12.4
jQuery v3.7.1
* License: jquery.org/license
* Project: jquery.org
* Copyright: (c) jQuery Foundation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,34 @@ public final class ClientProperties {
@PropertyAlias
public static final String OUTBOUND_CONTENT_LENGTH_BUFFER = CommonProperties.OUTBOUND_CONTENT_LENGTH_BUFFER_CLIENT;

/**
* If {@code true} then disable configuration of Json Binding (JSR-367)
* feature on client.
* <p>
* By default, Json Binding on client is automatically enabled if global
* property
* {@value org.glassfish.jersey.CommonProperties#JSON_BINDING_FEATURE_DISABLE}
* is not disabled. If set then the client property value overrides the
* global property value.
* <p>
* The default value is {@code false}.
* </p>
* <p>
* The name of the configuration property is <tt>{@value}</tt>.
* </p>
* <p>This constant is an alias for {@link CommonProperties#JSON_BINDING_FEATURE_DISABLE_CLIENT}.</p>
*
* @see org.glassfish.jersey.CommonProperties#JSON_BINDING_FEATURE_DISABLE
* @since 2.45
*/
@PropertyAlias
public static final String JSON_BINDING_FEATURE_DISABLE = CommonProperties.JSON_BINDING_FEATURE_DISABLE_CLIENT;

/**
* If {@code true} then disable configuration of Json Processing (JSR-353)
* feature on client.
* <p>
* By default Json Processing on client is automatically enabled if global
* By default, Json Processing on client is automatically enabled if global
* property
* {@value org.glassfish.jersey.CommonProperties#JSON_PROCESSING_FEATURE_DISABLE}
* is not disabled. If set then the client property value overrides the
Expand All @@ -265,7 +288,7 @@ public final class ClientProperties {
/**
* If {@code true} then disable META-INF/services lookup on client.
* <p>
* By default Jersey looks up SPI implementations described by {@code META-INF/services/*} files.
* By default, Jersey looks up SPI implementations described by {@code META-INF/services/*} files.
* Then you can register appropriate provider classes by {@link jakarta.ws.rs.core.Application}.
* </p>
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import java.net.Proxy;
import java.net.URL;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Logger;

import jakarta.ws.rs.client.Client;
Expand Down Expand Up @@ -295,9 +298,26 @@ default HttpURLConnection getConnection(URL url, Proxy proxy) throws IOException

private static class DefaultConnectionFactory implements ConnectionFactory {

private final ConcurrentHashMap<URL, Lock> locks = new ConcurrentHashMap<>();

@Override
public HttpURLConnection getConnection(final URL url) throws IOException {
return (HttpURLConnection) url.openConnection();
return connect(url, null);
}

@Override
public HttpURLConnection getConnection(URL url, Proxy proxy) throws IOException {
return connect(url, proxy);
}

private HttpURLConnection connect(URL url, Proxy proxy) throws IOException {
Lock lock = locks.computeIfAbsent(url, u -> new ReentrantLock());
lock.lock();
try {
return (proxy == null) ? (HttpURLConnection) url.openConnection() : (HttpURLConnection) url.openConnection(proxy);
} finally {
lock.unlock();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2024 Oracle 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;

import jakarta.ws.rs.core.Application;

/**
* Implementation of this interface is capable of returning {@link Application}.
*/
public interface ApplicationSupplier {
/**
* Get Application.
*
* @return Application.
*/
Application getApplication();

}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public final class CommonProperties {
/**
* If {@code true} then disable feature auto discovery globally on client/server.
* <p>
* By default auto discovery is automatically enabled. The value of this property may be overridden by the client/server
* By default, auto discovery is automatically enabled. The value of this property may be overridden by the client/server
* variant of this property.
* <p>
* The default value is {@code false}.
Expand All @@ -98,10 +98,55 @@ public final class CommonProperties {
*/
public static final String FEATURE_AUTO_DISCOVERY_DISABLE_SERVER = "jersey.config.server.disableAutoDiscovery";


/**
* If {@code true} then disable configuration of Json Binding (JSR-367) feature.
* <p>
* By default, Json Binding is automatically enabled. The value of this property may be overridden by the client/server
* variant of this property.
* <p>
* The default value is {@code false}.
* </p>
* <p>
* The name of the configuration property is <tt>{@value}</tt>.
* </p>
* @since 2.45
*/
public static final String JSON_BINDING_FEATURE_DISABLE = "jersey.config.disableJsonBinding";

/**
* Client-specific version of {@link CommonProperties#JSON_BINDING_FEATURE_DISABLE}.
*
* If present, it overrides the generic one for the client environment.
* @since 2.45
*/
public static final String JSON_BINDING_FEATURE_DISABLE_CLIENT = "jersey.config.client.disableJsonBinding";

/**
* Server-specific version of {@link CommonProperties#JSON_BINDING_FEATURE_DISABLE}.
*
* If present, it overrides the generic one for the server environment.
* @since 2.45
*/
public static final String JSON_BINDING_FEATURE_DISABLE_SERVER = "jersey.config.server.disableJsonBinding";

/**
* Disables configuration of Json Binding (JSR-367) feature for {@link jakarta.ws.rs.core.Application} subclasses whose
* package names are specified as a value. The value is comma-separated string defining prefixes of the application
* package names.
* <p>
* By default, Json Binding is automatically enabled.
* <p>
* The name of the configuration property is <tt>{@value}</tt>.
* </p>
* @since 2.45
*/
public static final String JSON_BINDING_FEATURE_DISABLE_APPLICATION = "jersey.config.application.disableJsonBinding";

/**
* If {@code true} then disable configuration of Json Processing (JSR-353) feature.
* <p>
* By default Json Processing is automatically enabled. The value of this property may be overridden by the client/server
* By default, Json Processing is automatically enabled. The value of this property may be overridden by the client/server
* variant of this property.
* <p>
* The default value is {@code false}.
Expand Down Expand Up @@ -131,7 +176,7 @@ public final class CommonProperties {
/**
* If {@code true} then disable META-INF/services lookup globally on client/server.
* <p>
* By default Jersey looks up SPI implementations described by META-INF/services/* files.
* By default, Jersey looks up SPI implementations described by META-INF/services/* files.
* Then you can register appropriate provider classes by {@link jakarta.ws.rs.core.Application}.
* </p>
* <p>
Expand Down Expand Up @@ -164,7 +209,7 @@ public final class CommonProperties {
/**
* If {@code true} then disable configuration of MOXy Json feature.
* <p>
* By default MOXy Json is automatically enabled. The value of this property may be overridden by the client/server
* By default, MOXy Json is automatically enabled. The value of this property may be overridden by the client/server
* variant of this property.
* <p>
* The default value is {@code false}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2024 Oracle 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
Expand Down Expand Up @@ -389,6 +389,27 @@ public static boolean isProperty(final Object value) {
}
}

/**
* Converts the property value to {@code boolean} and checks it is {@code true} or empty.
* Returns {@code true} if the value is {@code true} or empty but not {@code null}.
*
* <p>
* The rationale behind this is that system property {@code -Dprop=true} is the same as {@code -Dprop}.
* The property {@code -Dprop=false} behaves as if the {@code -Dprop} is not set at all.
* </p>
*
* @param value property value.
* @return {@code boolean} property value or {@code true} if the property value is not set or {@code false} if the property
* is otherwise not convertible.
*/
public static boolean isPropertyOrNotSet(final Object value) {
if (value instanceof Boolean) {
return Boolean.class.cast(value);
} else {
return value != null && ("".equals(value.toString()) || Boolean.parseBoolean(value.toString()));
}
}

/**
* Faster replacement of {@code RuntimeType#name().toLowerCase(Locale.ROOT)}
* @param runtimeType The runtime type to lower case
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024 Oracle 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
Expand All @@ -24,13 +24,12 @@
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;

import static org.glassfish.jersey.internal.guava.Preconditions.checkNotNull;

/**
* Collections utils, which provide transforming views for {@link List} and {@link Map}.
*
Expand Down Expand Up @@ -197,8 +196,8 @@ public int size() {
* @return union view of given sets.
*/
public static <E> Set<E> setUnionView(final Set<? extends E> set1, final Set<? extends E> set2) {
checkNotNull(set1, "set1");
checkNotNull(set2, "set2");
Objects.requireNonNull(set1, "set1");
Objects.requireNonNull(set2, "set2");

return new AbstractSet<E>() {
@Override
Expand All @@ -220,18 +219,19 @@ private Set<E> getUnion(Set<? extends E> set1, Set<? extends E> set2) {
}

/**
* Create a view of a difference of provided sets.
* Create a view of a difference of provided sets, i.e. the diff filters out from the first set the items included
* in the second set.
* <p>
* View is updated whenever any of the provided set changes.
*
* @param set1 first set.
* @param set2 second set.
* @param <E> set item type.
* @return union view of given sets.
* @return view that is a difference of given sets.
*/
public static <E> Set<E> setDiffView(final Set<? extends E> set1, final Set<? extends E> set2) {
checkNotNull(set1, "set1");
checkNotNull(set2, "set2");
Objects.requireNonNull(set1, "set1");
Objects.requireNonNull(set2, "set2");

return new AbstractSet<E>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright (c) 2024 Oracle 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
*/

/**
* Common Jersey core io classes.
*/
package org.glassfish.jersey.io;
Loading

0 comments on commit 737add9

Please sign in to comment.