merge of the current 3.0 into the 3.1
diff --git a/NOTICE.md b/NOTICE.md index 38fdd34..f3a2c0d 100644 --- a/NOTICE.md +++ b/NOTICE.md
@@ -70,7 +70,7 @@ * Project: http://www.javassist.org/ * Copyright (C) 1999- Shigeru Chiba. All Rights Reserved. -Jackson JAX-RS Providers Version 2.18.0 +Jackson JAX-RS Providers Version 2.19.1 * 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. @@ -95,7 +95,7 @@ * Project: http://www.kineticjs.com, https://github.com/ericdrowell/KineticJS * Copyright: Eric Rowell -org.objectweb.asm Version 9.8 +org.objectweb.asm Version 9.9 * License: Modified BSD (https://asm.ow2.io/license.html) * Copyright (c) 2000-2011 INRIA, France Telecom. All rights reserved.
diff --git a/bom/pom.xml b/bom/pom.xml index ffdfa03..8ac70ec 100644 --- a/bom/pom.xml +++ b/bom/pom.xml
@@ -180,6 +180,11 @@ </dependency> <dependency> <groupId>org.glassfish.jersey.ext</groupId> + <artifactId>jersey-constants</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.ext</groupId> <artifactId>jersey-entity-filtering</artifactId> <version>${project.version}</version> </dependency>
diff --git a/connectors/helidon-connector/pom.xml b/connectors/helidon-connector/pom.xml index 734bba0..1fada29 100644 --- a/connectors/helidon-connector/pom.xml +++ b/connectors/helidon-connector/pom.xml
@@ -76,14 +76,6 @@ <artifactId>maven-compiler-plugin</artifactId> <inherited>false</inherited> </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <configuration> - <source>8</source> - <detectJavaApiLink>false</detectJavaApiLink> - </configuration> - </plugin> </plugins> </build>
diff --git a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/Expect100ContinueConnectorExtension.java b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/Expect100ContinueConnectorExtension.java index 471321f..6072a52 100644 --- a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/Expect100ContinueConnectorExtension.java +++ b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/Expect100ContinueConnectorExtension.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025 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 @@ -30,20 +30,21 @@ class Expect100ContinueConnectorExtension implements ConnectorExtension<HttpRequest, IOException> { + + private final NettyConnectorProvider.Config.RW requestConfiguration; + + Expect100ContinueConnectorExtension(NettyConnectorProvider.Config.RW requestConfiguration) { + this.requestConfiguration = requestConfiguration; + } + private static final String EXCEPTION_MESSAGE = "Server rejected operation"; @Override public void invoke(ClientRequest request, HttpRequest extensionParam) { final long length = request.getLengthLong(); - final RequestEntityProcessing entityProcessing = request.resolveProperty( - ClientProperties.REQUEST_ENTITY_PROCESSING, RequestEntityProcessing.class); - - final Boolean expectContinueActivated = request.resolveProperty( - ClientProperties.EXPECT_100_CONTINUE, Boolean.class); - final Long expectContinueSizeThreshold = request.resolveProperty( - ClientProperties.EXPECT_100_CONTINUE_THRESHOLD_SIZE, - ClientProperties.DEFAULT_EXPECT_100_CONTINUE_THRESHOLD_SIZE); - + final RequestEntityProcessing entityProcessing = requestConfiguration.requestEntityProcessing(request); + final Boolean expectContinueActivated = requestConfiguration.expect100Continue(request); + final long expectContinueSizeThreshold = requestConfiguration.expect100ContinueThreshold(request); final boolean allowStreaming = length > expectContinueSizeThreshold || entityProcessing == RequestEntityProcessing.CHUNKED;
diff --git a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/JerseyClientHandler.java b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/JerseyClientHandler.java index 7f5bb9b..1efebc2 100644 --- a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/JerseyClientHandler.java +++ b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/JerseyClientHandler.java
@@ -31,7 +31,6 @@ import jakarta.ws.rs.core.MultivaluedMap; import jakarta.ws.rs.core.Response; -import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.ClientRequest; import org.glassfish.jersey.client.ClientResponse; import org.glassfish.jersey.http.HttpHeaders; @@ -56,17 +55,14 @@ */ class JerseyClientHandler extends SimpleChannelInboundHandler<HttpObject> { - private static final int DEFAULT_MAX_REDIRECTS = 5; - // Modified only by the same thread. No need to synchronize it. private final Set<URI> redirectUriHistory; private final ClientRequest jerseyRequest; private final CompletableFuture<ClientResponse> responseAvailable; private final CompletableFuture<?> responseDone; - private final boolean followRedirects; - private final int maxRedirects; private final NettyConnector connector; private final NettyHttpRedirectController redirectController; + private final NettyConnectorProvider.Config.RW requestConfiguration; private NettyInputStream nis; private ClientResponse jerseyResponse; @@ -74,19 +70,20 @@ private boolean readTimedOut; JerseyClientHandler(ClientRequest request, CompletableFuture<ClientResponse> responseAvailable, - CompletableFuture<?> responseDone, Set<URI> redirectUriHistory, NettyConnector connector) { + CompletableFuture<?> responseDone, Set<URI> redirectUriHistory, NettyConnector connector, + NettyConnectorProvider.Config.RW requestConfiguration) { this.redirectUriHistory = redirectUriHistory; this.jerseyRequest = request; this.responseAvailable = responseAvailable; this.responseDone = responseDone; - // Follow redirects by default - this.followRedirects = jerseyRequest.resolveProperty(ClientProperties.FOLLOW_REDIRECTS, true); - this.maxRedirects = jerseyRequest.resolveProperty(NettyClientProperties.MAX_REDIRECTS, DEFAULT_MAX_REDIRECTS); + this.requestConfiguration = requestConfiguration; this.connector = connector; + // Follow redirects by default + requestConfiguration.followRedirects(jerseyRequest); + requestConfiguration.maxRedirects(jerseyRequest); - final NettyHttpRedirectController customRedirectController = jerseyRequest - .resolveProperty(NettyClientProperties.HTTP_REDIRECT_CONTROLLER, NettyHttpRedirectController.class); - this.redirectController = customRedirectController == null ? new NettyHttpRedirectController() : customRedirectController; + this.redirectController = requestConfiguration.redirectController(jerseyRequest); + this.redirectController.init(requestConfiguration); } @Override @@ -112,7 +109,7 @@ ClientResponse cr = jerseyResponse; jerseyResponse = null; int responseStatus = cr.getStatus(); - if (followRedirects + if (Boolean.TRUE.equals(requestConfiguration.followRedirects()) && (responseStatus == ResponseStatus.Redirect3xx.MOVED_PERMANENTLY_301.getStatusCode() || responseStatus == ResponseStatus.Redirect3xx.FOUND_302.getStatusCode() || responseStatus == ResponseStatus.Redirect3xx.SEE_OTHER_303.getStatusCode() @@ -139,16 +136,17 @@ // infinite loop detection responseAvailable.completeExceptionally( new RedirectException(LocalizationMessages.REDIRECT_INFINITE_LOOP())); - } else if (redirectUriHistory.size() > maxRedirects) { + } else if (redirectUriHistory.size() > requestConfiguration.maxRedirects.get()) { // maximal number of redirection - responseAvailable.completeExceptionally( - new RedirectException(LocalizationMessages.REDIRECT_LIMIT_REACHED(maxRedirects))); + responseAvailable.completeExceptionally(new RedirectException( + LocalizationMessages.REDIRECT_LIMIT_REACHED(requestConfiguration.maxRedirects.get()))); } else { ClientRequest newReq = new ClientRequest(jerseyRequest); newReq.setUri(newUri); ctx.close(); if (redirectController.prepareRedirect(newReq, cr)) { - final NettyConnector newConnector = new NettyConnector(newReq.getClient()); + final NettyConnector newConnector = + new NettyConnector(newReq.getClient(), connector.clientConfiguration); newConnector.execute(newReq, redirectUriHistory, new CompletableFuture<ClientResponse>() { @Override public boolean complete(ClientResponse value) {
diff --git a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyClientProperties.java b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyClientProperties.java index 4b2e4c9..7dc3495 100644 --- a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyClientProperties.java +++ b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyClientProperties.java
@@ -73,6 +73,11 @@ public static final String IDLE_CONNECTION_PRUNE_TIMEOUT = "jersey.config.client.idleConnectionPruneTimeout"; /** + * Enable or disable the Netty logging by {@code LoggingHandler(Level.DEBUG)}. Disabled by default. + */ + public static final String LOGGING_ENABLED = "jersey.config.client.netty.loggingEnabled"; + + /** * <p> * This property determines the maximum number of idle connections that will be simultaneously kept alive, per destination. * The default is 5. @@ -157,7 +162,8 @@ DEFAULT_HEADER_SIZE = 8192; /** - * Parameter which allows extending of the initial line length for the Netty connector + * Parameter which allows extending of the first line length of the HTTP header for the Netty connector. + * Taken from {@link io.netty.handler.codec.http.HttpClientCodec#HttpClientCodec(int, int, int)}. * * @since 2.44 */ @@ -166,12 +172,12 @@ /** * Default initial line length for Netty Connector. - * Taken from {@link io.netty.handler.codec.http.HttpClientCodec#HttpClientCodec(int, int, int)} + * Typically, set this to the same value as {@link #MAX_HEADER_SIZE}. * * @since 2.44 */ public static final Integer - DEFAULT_INITIAL_LINE_LENGTH = 4096; + DEFAULT_INITIAL_LINE_LENGTH = 8192; /** * Parameter which allows extending of the chunk size for the Netty connector
diff --git a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyConnectionController.java b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyConnectionController.java new file mode 100644 index 0000000..5d8725c --- /dev/null +++ b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyConnectionController.java
@@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 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.netty.connector; + +import org.glassfish.jersey.client.ClientRequest; + +import java.net.URI; + +/** + * Adjustable connection pooling controller. + */ +public class NettyConnectionController { + /** + * Get the group of connections to be pooled, purged idle, and reused together. + * + * @param clientRequest the HTTP client request. + * @param uri the uri for the HTTP client request. + * @param hostName the hostname for the request. Can differ from the hostname in the uri based on other request attributes. + * @param port the real port for the request. Can differ from the port in the uri based on other request attributes. + * @return the group of connections identifier. + */ + public String getConnectionGroup(ClientRequest clientRequest, URI uri, String hostName, int port) { + return uri.getScheme() + "://" + hostName + ":" + port; + } +}
diff --git a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyConnector.java b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyConnector.java index a65560c..ba80967 100644 --- a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyConnector.java +++ b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyConnector.java
@@ -18,8 +18,6 @@ import java.io.IOException; import java.io.OutputStream; -import java.net.InetSocketAddress; -import java.net.SocketAddress; import java.net.URI; import java.util.ArrayList; import java.util.HashMap; @@ -36,7 +34,6 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import java.util.function.Supplier; import javax.net.ssl.SSLContext; @@ -56,10 +53,8 @@ import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.handler.codec.http.DefaultFullHttpRequest; -import io.netty.handler.codec.http.DefaultHttpHeaders; import io.netty.handler.codec.http.DefaultHttpRequest; import io.netty.handler.codec.http.HttpChunkedInput; -import io.netty.handler.codec.http.HttpClientCodec; import io.netty.handler.codec.http.HttpContentDecompressor; import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpHeaders; @@ -68,8 +63,8 @@ import io.netty.handler.codec.http.HttpUtil; import io.netty.handler.codec.http.HttpVersion; import io.netty.handler.codec.http.LastHttpContent; -import io.netty.handler.proxy.HttpProxyHandler; -import io.netty.handler.proxy.ProxyHandler; +import io.netty.handler.logging.LogLevel; +import io.netty.handler.logging.LoggingHandler; import io.netty.handler.ssl.ApplicationProtocolConfig; import io.netty.handler.ssl.ClientAuth; import io.netty.handler.ssl.IdentityCipherSuiteFilter; @@ -81,7 +76,6 @@ import io.netty.handler.timeout.IdleStateHandler; import io.netty.resolver.NoopAddressResolverGroup; import io.netty.util.concurrent.GenericFutureListener; -import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.ClientRequest; import org.glassfish.jersey.client.ClientResponse; import org.glassfish.jersey.client.innate.ClientProxy; @@ -106,6 +100,7 @@ final EventLoopGroup group; final Client client; final HashMap<String, ArrayList<Channel>> connections = new HashMap<>(); + final NettyConnectorProvider.Config.RW clientConfiguration; private static final LazyValue<String> NETTY_VERSION = Values.lazy( (Value<String>) () -> { @@ -118,63 +113,29 @@ return "Netty " + nettyVersion; }); - // If HTTP keepalive is enabled the value of "http.maxConnections" determines the maximum number - // of idle connections that will be simultaneously kept alive, per destination. - private static final String HTTP_KEEPALIVE_STRING = System.getProperty("http.keepAlive"); - // http.keepalive (default: true) - private static final Boolean HTTP_KEEPALIVE = - HTTP_KEEPALIVE_STRING == null ? Boolean.TRUE : Boolean.parseBoolean(HTTP_KEEPALIVE_STRING); - - // http.maxConnections (default: 5) - private static final int DEFAULT_MAX_POOL_SIZE = 5; - private static final int MAX_POOL_SIZE = Integer.getInteger("http.maxConnections", DEFAULT_MAX_POOL_SIZE); - private static final int DEFAULT_MAX_POOL_IDLE = 60; // seconds - private static final int DEFAULT_MAX_POOL_SIZE_TOTAL = 60; // connections - - - private final Integer maxPoolSize; // either from system property, or from Jersey config, or default - private final Integer maxPoolSizeTotal; //either from Jersey config, or default - private final Integer maxPoolIdle; // either from Jersey config, or default - static final String INACTIVE_POOLED_CONNECTION_HANDLER = "inactive_pooled_connection_handler"; private static final String PRUNE_INACTIVE_POOL = "prune_inactive_pool"; private static final String READ_TIMEOUT_HANDLER = "read_timeout_handler"; private static final String REQUEST_HANDLER = "request_handler"; private static final String EXPECT_100_CONTINUE_HANDLER = "expect_100_continue_handler"; - NettyConnector(Client client) { + NettyConnector(Client client, NettyConnectorProvider.Config.RW connectorConfiguration) { + this.client = client; + this.clientConfiguration = connectorConfiguration.fromClient(client); final Configuration configuration = client.getConfiguration(); - final Map<String, Object> properties = configuration.getProperties(); - final Object threadPoolSize = properties.get(ClientProperties.ASYNC_THREADPOOL_SIZE); - - if (threadPoolSize != null && threadPoolSize instanceof Integer && (Integer) threadPoolSize > 0) { - executorService = VirtualThreadUtil.withConfig(configuration).newFixedThreadPool((Integer) threadPoolSize); - this.group = new NioEventLoopGroup((Integer) threadPoolSize); + final Integer threadPoolSize = this.clientConfiguration.asyncThreadPoolSize(); + if (threadPoolSize != null && threadPoolSize > 0) { + executorService = VirtualThreadUtil + .withConfig(clientConfiguration.prefixedConfiguration(configuration)) + .newFixedThreadPool(threadPoolSize); + this.group = new NioEventLoopGroup(threadPoolSize); } else { - executorService = VirtualThreadUtil.withConfig(configuration).newCachedThreadPool(); + executorService = VirtualThreadUtil + .withConfig(clientConfiguration.prefixedConfiguration(configuration)) + .newCachedThreadPool(); this.group = new NioEventLoopGroup(); } - - this.client = client; - - final Object maxPoolSizeTotalProperty = properties.get(NettyClientProperties.MAX_CONNECTIONS_TOTAL); - final Object maxPoolIdleProperty = properties.get(NettyClientProperties.IDLE_CONNECTION_PRUNE_TIMEOUT); - final Object maxPoolSizeProperty = properties.get(NettyClientProperties.MAX_CONNECTIONS); - - maxPoolSizeTotal = maxPoolSizeTotalProperty != null ? (Integer) maxPoolSizeTotalProperty : DEFAULT_MAX_POOL_SIZE_TOTAL; - maxPoolIdle = maxPoolIdleProperty != null ? (Integer) maxPoolIdleProperty : DEFAULT_MAX_POOL_IDLE; - maxPoolSize = maxPoolSizeProperty != null - ? (Integer) maxPoolSizeProperty - : (HTTP_KEEPALIVE ? MAX_POOL_SIZE : DEFAULT_MAX_POOL_SIZE); - - if (maxPoolSizeTotal < 0) { - throw new ProcessingException(LocalizationMessages.WRONG_MAX_POOL_TOTAL(maxPoolSizeTotal)); - } - - if (maxPoolSize < 0) { - throw new ProcessingException(LocalizationMessages.WRONG_MAX_POOL_SIZE(maxPoolSize)); - } } @Override @@ -207,25 +168,31 @@ protected void execute(final ClientRequest jerseyRequest, final Set<URI> redirectUriHistory, final CompletableFuture<ClientResponse> responseAvailable) { - Integer timeout = jerseyRequest.resolveProperty(ClientProperties.READ_TIMEOUT, 0); - final Integer expect100ContinueTimeout = jerseyRequest.resolveProperty( - NettyClientProperties.EXPECT_100_CONTINUE_TIMEOUT, - NettyClientProperties.DEFAULT_EXPECT_100_CONTINUE_TIMEOUT_VALUE); - if (timeout == null || timeout < 0) { - throw new ProcessingException(LocalizationMessages.WRONG_READ_TIMEOUT(timeout)); + final NettyConnectorProvider.Config.RW requestConfiguration = + clientConfiguration + .fromRequest(jerseyRequest) + .readTimeout(jerseyRequest) + .expect100ContinueTimeout(jerseyRequest); + final int readTimeout = requestConfiguration.readTimeout(); + if (readTimeout < 0) { + throw new ProcessingException(LocalizationMessages.WRONG_READ_TIMEOUT(readTimeout)); } final CompletableFuture<?> responseDone = new CompletableFuture<>(); final URI requestUri = jerseyRequest.getUri(); - String host = requestUri.getHost(); - int port = requestUri.getPort() != -1 ? requestUri.getPort() : "https".equals(requestUri.getScheme()) ? 443 : 80; + final String host = requestUri.getHost(); + final int port = requestUri.getPort() != -1 + ? requestUri.getPort() + : "https".equalsIgnoreCase(requestUri.getScheme()) ? 443 : 80; try { - final SSLParamConfigurator sslConfig = SSLParamConfigurator.builder() + final SSLParamConfigurator sslConfig = SSLParamConfigurator.builder(requestConfiguration) .request(jerseyRequest).setSNIAlways(true).setSNIHostName(jerseyRequest).build(); - String key = requestUri.getScheme() + "://" + sslConfig.getSNIHostName() + ":" + port; + final String key = requestConfiguration + .connectionController() + .getConnectionGroup(jerseyRequest, requestUri, sslConfig.getSNIHostName(), port); ArrayList<Channel> conns; synchronized (connections) { conns = connections.get(key); @@ -245,8 +212,8 @@ } catch (NoSuchElementException e) { /* * Eat it. - * It could happen that the channel was closed, pipeline cleared and - * then it will fail to remove the names with this exception. + * It could happen that the channel was closed, pipeline cleared, + * and then it will fail to remove the names with this exception. */ } if (!chan.isOpen()) { @@ -258,20 +225,15 @@ final JerseyExpectContinueHandler expect100ContinueHandler = new JerseyExpectContinueHandler(); if (chan == null) { - Integer connectTimeout = jerseyRequest.resolveProperty(ClientProperties.CONNECT_TIMEOUT, 0); + requestConfiguration.connectTimeout(jerseyRequest); Bootstrap b = new Bootstrap(); // http proxy - Optional<ClientProxy> proxy = ClientProxy.proxyFromRequest(jerseyRequest); - if (!proxy.isPresent()) { - proxy = ClientProxy.proxyFromProperties(requestUri); - } - proxy.ifPresent(clientProxy -> { + final Optional<ClientProxy> handlerProxy = requestConfiguration.proxy(jerseyRequest, requestUri); + handlerProxy.ifPresent(clientProxy -> { b.resolver(NoopAddressResolverGroup.INSTANCE); // request hostname resolved by the HTTP proxy }); - final Optional<ClientProxy> handlerProxy = proxy; - b.group(group) .channel(NioSocketChannel.class) .handler(new ChannelInitializer<SocketChannel>() { @@ -283,19 +245,14 @@ // http proxy handlerProxy.ifPresent(clientProxy -> { - final URI u = clientProxy.uri(); - InetSocketAddress proxyAddr = new InetSocketAddress(u.getHost(), - u.getPort() == -1 ? 8080 : u.getPort()); - ProxyHandler proxy1 = createProxyHandler(jerseyRequest, proxyAddr, - clientProxy.userName(), clientProxy.password(), connectTimeout); - p.addLast(proxy1); + p.addLast(requestConfiguration.createProxyHandler(clientProxy, jerseyRequest)); }); // Enable HTTPS if necessary. if ("https".equals(requestUri.getScheme())) { // making client authentication optional for now; it could be extracted to configurable property JdkSslContext jdkSslContext = new JdkSslContext( - getSslContext(client, jerseyRequest), + requestConfiguration.sslContext(client, jerseyRequest), true, (Iterable) null, IdentityCipherSuiteFilter.INSTANCE, @@ -310,8 +267,7 @@ final SslHandler sslHandler = jdkSslContext.newHandler( ch.alloc(), sslConfig.getSNIHostName(), port <= 0 ? 443 : port, executorService ); - if (ClientProperties.getValue(config.getProperties(), - NettyClientProperties.ENABLE_SSL_HOSTNAME_VERIFICATION, true)) { + if (requestConfiguration.isSslHostnameVerificationEnabled(config.getProperties())) { sslConfig.setEndpointIdentificationAlgorithm(sslHandler.engine()); } @@ -320,16 +276,10 @@ p.addLast(sslHandler); } - final Integer maxHeaderSize = ClientProperties.getValue(config.getProperties(), - NettyClientProperties.MAX_HEADER_SIZE, - NettyClientProperties.DEFAULT_HEADER_SIZE); - final Integer maxChunkSize = ClientProperties.getValue(config.getProperties(), - NettyClientProperties.MAX_CHUNK_SIZE, - NettyClientProperties.DEFAULT_CHUNK_SIZE); - final Integer maxInitialLineLength = ClientProperties.getValue(config.getProperties(), - NettyClientProperties.MAX_INITIAL_LINE_LENGTH, - NettyClientProperties.DEFAULT_INITIAL_LINE_LENGTH); - p.addLast(new HttpClientCodec(maxInitialLineLength, maxHeaderSize, maxChunkSize)); + if (requestConfiguration.loggingEnabled.get()) { + p.addLast(new LoggingHandler(LogLevel.INFO)); + } + p.addLast(requestConfiguration.createHttpClientCodec(config.getProperties())); p.addLast(EXPECT_100_CONTINUE_HANDLER, expect100ContinueHandler); p.addLast(new ChunkedWriteHandler()); p.addLast(new HttpContentDecompressor()); @@ -337,8 +287,8 @@ }); // connect timeout - if (connectTimeout > 0) { - b.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, connectTimeout); + if (requestConfiguration.connectTimeout() > 0) { + b.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, requestConfiguration.connectTimeout()); } // Make the connection attempt. @@ -357,12 +307,12 @@ // assert: it is ok to abort the entire response, if responseDone is completed exceptionally - in particular, nothing // will leak final Channel ch = chan; - JerseyClientHandler clientHandler = - new JerseyClientHandler(jerseyRequest, responseAvailable, responseDone, redirectUriHistory, this); + JerseyClientHandler clientHandler = new JerseyClientHandler( + jerseyRequest, responseAvailable, responseDone, redirectUriHistory, this, requestConfiguration); // read timeout makes sense really as an inactivity timeout ch.pipeline().addLast(READ_TIMEOUT_HANDLER, - new IdleStateHandler(0, 0, timeout, TimeUnit.MILLISECONDS)); + new IdleStateHandler(0, 0, requestConfiguration.readTimeout(), TimeUnit.MILLISECONDS)); ch.pipeline().addLast(REQUEST_HANDLER, clientHandler); responseDone.whenComplete((_r, th) -> { @@ -370,7 +320,8 @@ ch.pipeline().remove(clientHandler); if (th == null) { - ch.pipeline().addLast(INACTIVE_POOLED_CONNECTION_HANDLER, new IdleStateHandler(0, 0, maxPoolIdle)); + ch.pipeline().addLast(INACTIVE_POOLED_CONNECTION_HANDLER, + new IdleStateHandler(0, 0, requestConfiguration.maxPoolIdle.get())); ch.pipeline().addLast(PRUNE_INACTIVE_POOL, new PruneIdlePool(connections, key)); boolean added = true; synchronized (connections) { @@ -381,7 +332,9 @@ connections.put(key, conns1); } else { synchronized (conns1) { - if ((maxPoolSizeTotal == 0 || connections.size() < maxPoolSizeTotal) && conns1.size() < maxPoolSize) { + if ((requestConfiguration.maxPoolSizeTotal.get() == 0 + || connections.size() < requestConfiguration.maxPoolSizeTotal.get()) + && conns1.size() < requestConfiguration.maxPoolSize.get()) { conns1.add(ch); } else { // else do not add the Channel to the idle pool added = false; @@ -433,7 +386,7 @@ }; ch.closeFuture().addListener(closeListener); - final NettyEntityWriter entityWriter = nettyEntityWriter(jerseyRequest, ch); + final NettyEntityWriter entityWriter = nettyEntityWriter(jerseyRequest, ch, requestConfiguration); switch (entityWriter.getType()) { case CHUNKED: HttpUtil.setTransferEncodingChunked(nettyRequest, true); @@ -493,7 +446,7 @@ }); headersSet.await(); - new Expect100ContinueConnectorExtension().invoke(jerseyRequest, nettyRequest); + new Expect100ContinueConnectorExtension(requestConfiguration).invoke(jerseyRequest, nettyRequest); boolean continueExpected = HttpUtil.is100ContinueExpected(nettyRequest); boolean expectationsFailed = false; @@ -503,7 +456,7 @@ expect100ContinueHandler.attachCountDownLatch(expect100ContinueLatch); //send expect request, sync and wait till either response or timeout received entityWriter.writeAndFlush(nettyRequest); - expect100ContinueLatch.await(expect100ContinueTimeout, TimeUnit.MILLISECONDS); + expect100ContinueLatch.await(requestConfiguration.expect100ContTimeout.get(), TimeUnit.MILLISECONDS); try { expect100ContinueHandler.processExpectationStatus(); } catch (TimeoutException e) { @@ -543,13 +496,10 @@ } } - /* package */ NettyEntityWriter nettyEntityWriter(ClientRequest clientRequest, Channel channel) { - return NettyEntityWriter.getInstance(clientRequest, channel); - } - - private SSLContext getSslContext(Client client, ClientRequest request) { - Supplier<SSLContext> supplier = request.resolveProperty(ClientProperties.SSL_CONTEXT_SUPPLIER, Supplier.class); - return supplier == null ? client.getSslContext() : supplier.get(); + /* package */ NettyEntityWriter nettyEntityWriter( + ClientRequest clientRequest, Channel channel, NettyConnectorProvider.Config.RW requestConfiguration) { + return NettyEntityWriter + .getInstance(clientRequest, channel, () -> requestConfiguration.requestEntityProcessing(clientRequest)); } private String buildPathWithQueryParameters(URI requestUri) { @@ -602,21 +552,7 @@ } } - private static ProxyHandler createProxyHandler(ClientRequest jerseyRequest, SocketAddress proxyAddr, - String userName, String password, long connectTimeout) { - final Boolean filter = jerseyRequest.resolveProperty(NettyClientProperties.FILTER_HEADERS_FOR_PROXY, Boolean.TRUE); - HttpHeaders httpHeaders = setHeaders(jerseyRequest, new DefaultHttpHeaders(), Boolean.TRUE.equals(filter)); - - ProxyHandler proxy = userName == null ? new HttpProxyHandler(proxyAddr, httpHeaders) - : new HttpProxyHandler(proxyAddr, userName, password, httpHeaders); - if (connectTimeout > 0) { - proxy.setConnectTimeoutMillis(connectTimeout); - } - - return proxy; - } - - private static HttpHeaders setHeaders(ClientRequest jerseyRequest, HttpHeaders headers, boolean proxyOnly) { + /* package */ static HttpHeaders setHeaders(ClientRequest jerseyRequest, HttpHeaders headers, boolean proxyOnly) { for (final Map.Entry<String, List<String>> e : jerseyRequest.getStringHeaders().entrySet()) { final String key = e.getKey(); if (!proxyOnly || JerseyClientHandler.ProxyHeaders.INSTANCE.test(key) || additionalProxyHeadersToKeep(key)) {
diff --git a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyConnectorConfiguration.java b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyConnectorConfiguration.java new file mode 100644 index 0000000..99f763c --- /dev/null +++ b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyConnectorConfiguration.java
@@ -0,0 +1,503 @@ +/* + * Copyright (c) 2025 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.netty.connector; + +import io.netty.handler.codec.http.DefaultHttpHeaders; +import io.netty.handler.codec.http.HttpClientCodec; +import io.netty.handler.codec.http.HttpHeaders; +import io.netty.handler.proxy.HttpProxyHandler; +import io.netty.handler.proxy.ProxyHandler; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.ClientRequest; +import org.glassfish.jersey.client.innate.ClientProxy; +import org.glassfish.jersey.internal.util.collection.Ref; +import org.glassfish.jersey.client.innate.ConnectorConfiguration; + +import jakarta.ws.rs.ProcessingException; +import jakarta.ws.rs.client.Client; +import java.net.InetSocketAddress; +import java.net.URI; +import java.util.Map; + +class NettyConnectorConfiguration<N extends NettyConnectorConfiguration<N>> extends ConnectorConfiguration<N> { + + /* package */ final NullableRef<NettyConnectionController> connectionController = NullableRef.empty(); + /* package */ final NullableRef<Boolean> enableHostnameVerification = NullableRef.empty(); + /* package */ final Ref<Integer> expect100ContTimeout = NullableRef.empty(); + /* package */ final NullableRef<Boolean> filterHeadersForProxy = NullableRef.empty(); + /* package */ final NullableRef<Integer> firstHttpHeaderLineLength = NullableRef.empty(); + /* package */ final Ref<Boolean> loggingEnabled = NullableRef.empty(); + /* package */ final NullableRef<Integer> maxChunkSize = NullableRef.empty(); + /* package */ final NullableRef<Integer> maxHeaderSize = NullableRef.empty(); + // either from Jersey config, or default + /* package */ final Ref<Integer> maxPoolSizeTotal = NullableRef.empty(); + // either from Jersey config, or default + /* package */ final Ref<Integer> maxPoolIdle = NullableRef.empty(); + // either from system property, or from Jersey config, or default + /* package */ final Ref<Integer> maxPoolSize = NullableRef.empty(); + /* package */ final Ref<Integer> maxRedirects = NullableRef.empty(); + /* package */ final NullableRef<Boolean> preserveMethodOnRedirect = NullableRef.empty(); + /* package */ final NullableRef<NettyHttpRedirectController> redirectController = NullableRef.empty(); + + // If HTTP keepalive is enabled the value of "http.maxConnections" determines the maximum number + // of idle connections that will be simultaneously kept alive, per destination. + private static final String HTTP_KEEPALIVE_STRING = System.getProperty("http.keepAlive"); + // http.keepalive (default: true) + private static final Boolean HTTP_KEEPALIVE = + HTTP_KEEPALIVE_STRING == null ? Boolean.TRUE : Boolean.parseBoolean(HTTP_KEEPALIVE_STRING); + + // http.maxConnections (default: 5) + private static final int DEFAULT_MAX_POOL_SIZE = 5; + private static final int MAX_POOL_SIZE = Integer.getInteger("http.maxConnections", DEFAULT_MAX_POOL_SIZE); + private static final int DEFAULT_MAX_POOL_IDLE = 60; // seconds + private static final int DEFAULT_MAX_POOL_SIZE_TOTAL = 60; // connections + + private static final int DEFAULT_MAX_REDIRECTS = 5; + + /** + * Set the connection pooling controller for the Netty Connector. + * + * @param controller the connection pooling controller. + * @return updated configuration. + */ + public N connectionController(NettyConnectionController controller) { + connectionController.set(controller); + return self(); + } + + /** + * This setting determines waiting time in milliseconds for 100-Continue response when 100-Continue is sent by the client. + * The property {@link NettyClientProperties#EXPECT_100_CONTINUE_TIMEOUT} has precedence over this setting. + * + * @param millis the timeout for 100-Continue response. + * @return updated configuration. + */ + public N expect100ContinueTimeout(int millis) { + expect100ContTimeout.set(millis); + return self(); + } + + /** + * Enable or disable the endpoint identification algorithm to HTTPS. The property + * {@link NettyClientProperties#ENABLE_SSL_HOSTNAME_VERIFICATION} takes precedence over this setting. + * + * @param enable enable or disable the hostname verification. + * @return updated configuration. + */ + public N enableSslHostnameVerification(boolean enable) { + enableHostnameVerification.set(enable); + return self(); + } + + /** + * Enable or disable the Netty logging by {@code LoggingHandler(Level.DEBUG)}. Disabled by default. + * The property {@link NettyClientProperties#LOGGING_ENABLED} takes precedence over this setting. + * + * @param enable to enable or disable. + * @return updated configuration. + */ + public N enableLoggingHandler(boolean enable) { + loggingEnabled.set(enable); + return self(); + } + + /** + * Filter the HTTP headers for requests (CONNECT) towards the proxy except for PROXY-prefixed + * and HOST headers when {@code true}. + * The property {@link NettyClientProperties#FILTER_HEADERS_FOR_PROXY} has precedence over this setting. + * + * @param filter to filter or not. The default is {@code true}. + * @return updated configuration. + */ + public N filterHeadersForProxy(boolean filter) { + filterHeadersForProxy.set(filter); + return self(); + } + + /** + * This property determines the number of seconds the idle connections are kept in the pool before pruned. + * The default is 60. Specify 0 to disable. The property {@link NettyClientProperties#IDLE_CONNECTION_PRUNE_TIMEOUT} + * has precedence over this setting. + * + * @param seconds the timeout in seconds. + * @return updated configuration. + */ + public N idleConnectionPruneTimeout(int seconds) { + maxPoolIdle.set(seconds); + return self(); + } + + /** + * Set the maximum length of the first line of the HTTP header. + * The property {@link NettyClientProperties#MAX_INITIAL_LINE_LENGTH} has precedence over this setting. + * + * @param length the length of the first line of the HTTP header. + * @return updated configuration. + */ + public N initialHttpHeaderLineLength(int length) { + firstHttpHeaderLineLength.set(length); + return self(); + } + + /** + * Set the maximum chunk size for the Netty connector. The property {@link NettyClientProperties#MAX_CHUNK_SIZE} + * has precedence over this setting. + * + * @param size the new size of chunks. + * @return updated configuration. + */ + public N maxChunkSize(int size) { + maxChunkSize.set(size); + return self(); + } + + /** + * This setting determines the maximum number of idle connections that will be simultaneously kept alive, per destination. + * The default is 5. The property {@link NettyClientProperties#MAX_CONNECTIONS} takes precedence over this setting. + * + * @param maxCount maximum number of idle connections per destination. + * @return updated configuration. + */ + public N maxConnectionsPerDestination(int maxCount) { + maxPoolSize.set(maxCount); + return self(); + } + + /** + * Set the maximum header size in bytes for the HTTP headers processed by Netty. + * The property {@link NettyClientProperties#MAX_HEADER_SIZE} has precedence over this setting. + * + * @param size the new maximum header size. + * @return updated configuration. + */ + public N maxHeaderSize(int size) { + maxHeaderSize.set(size); + return self(); + } + + /** + * Set the maximum number of redirects to prevent infinite redirect loop. The default is 5. + * The property {@link NettyClientProperties#MAX_REDIRECTS} has precedence over this setting. + * + * @param max the maximum number of redirects. + * @return updated configuration. + */ + public N maxRedirects(int max) { + maxRedirects.set(max); + return self(); + } + + /** + * Set the maximum number of idle connections that will be simultaneously kept alive. The property + * {@link NettyClientProperties#MAX_CONNECTIONS_TOTAL} has precedence over this setting. + * + * @param max the maximum number of idle connections. + * @return updated configuration. + */ + public N maxTotalConnections(int max) { + maxPoolSizeTotal.set(max); + return self(); + } + + /** + * Set the preservation of methods during HTTP redirect. + * By default, the HTTP POST request are not transformed into HTTP GET for status 301 & 302. + * The property {@link NettyClientProperties#PRESERVE_METHOD_ON_REDIRECT} has precedence over this setting. + * + * @param preserve to preserve or not to preserve. + * @return updated configuration. + */ + public N preserveMethodOnRedirect(boolean preserve) { + preserveMethodOnRedirect.set(preserve); + return self(); + } + + /** + * Set the Netty Connector HTTP redirect controller. + * The property {@link NettyClientProperties#HTTP_REDIRECT_CONTROLLER} has precedence over this setting. + * + * @param controller the HTTP redirect controller. + * @return updated configuration. + */ + public N redirectController(NettyHttpRedirectController controller) { + redirectController.set(controller); + return self(); + } + + @SuppressWarnings("unchecked") + protected N self() { + return (N) this; + } + + abstract static class ReadWrite<N extends ReadWrite<N>> + extends NettyConnectorConfiguration<N> + implements ConnectorConfiguration.Read<N> { + + @Override + public <X extends ConnectorConfiguration<?>> void setNonEmpty(X otherCC) { + NettyConnectorConfiguration<?> other = (NettyConnectorConfiguration<?>) otherCC; + ConnectorConfiguration.Read.super.setNonEmpty(other); + this.connectionController.setNonEmpty(other.connectionController); + this.redirectController.setNonEmpty(other.redirectController); + this.connectionController.setNonEmpty(other.connectionController); + this.enableHostnameVerification.setNonEmpty(other.enableHostnameVerification); + ((NullableRef<Integer>) this.expect100ContTimeout).setNonEmpty((NullableRef<Integer>) other.expect100ContTimeout); + this.filterHeadersForProxy.setNonEmpty(other.filterHeadersForProxy); + this.firstHttpHeaderLineLength.setNonEmpty(other.firstHttpHeaderLineLength); + ((NullableRef<Boolean>) this.loggingEnabled).setNonEmpty((NullableRef<Boolean>) other.loggingEnabled); + this.maxChunkSize.setNonEmpty(other.maxChunkSize); + this.maxHeaderSize.setNonEmpty(other.maxHeaderSize); + ((NullableRef<Integer>) this.maxPoolIdle).setNonEmpty((NullableRef<Integer>) other.maxPoolIdle); + ((NullableRef<Integer>) this.maxPoolSize).setNonEmpty((NullableRef<Integer>) other.maxPoolSize); + ((NullableRef<Integer>) this.maxPoolSizeTotal).setNonEmpty((NullableRef<Integer>) other.maxPoolSizeTotal); + ((NullableRef<Integer>) this.maxRedirects).setNonEmpty((NullableRef<Integer>) other.maxRedirects); + this.preserveMethodOnRedirect.setNonEmpty(other.preserveMethodOnRedirect); + this.redirectController.setNonEmpty(other.redirectController); + } + + @Override + public N init() { + Read.super.init(); + enableSslHostnameVerification(Boolean.TRUE); + expect100ContinueTimeout(NettyClientProperties.DEFAULT_EXPECT_100_CONTINUE_TIMEOUT_VALUE); + filterHeadersForProxy(Boolean.TRUE); + initialHttpHeaderLineLength(NettyClientProperties.DEFAULT_INITIAL_LINE_LENGTH); + enableLoggingHandler(Boolean.FALSE); + maxChunkSize(NettyClientProperties.DEFAULT_CHUNK_SIZE); + maxHeaderSize(NettyClientProperties.DEFAULT_HEADER_SIZE); + // either from Jersey config, or default + maxTotalConnections(DEFAULT_MAX_POOL_SIZE_TOTAL); + // either from Jersey config, or default + maxPoolIdle.set(DEFAULT_MAX_POOL_IDLE); + // either from system property, or from Jersey config, or default + maxPoolSize.set(HTTP_KEEPALIVE ? MAX_POOL_SIZE : DEFAULT_MAX_POOL_SIZE); + maxRedirects(DEFAULT_MAX_REDIRECTS); + preserveMethodOnRedirect(Boolean.TRUE); + return self(); + } + + /** + * Get the preset {@link NettyConnectionController} or create an instance of the default one, if not preset. + * @return the {@link NettyConnectionController} instance. + */ + /* package */ NettyConnectionController connectionController() { + return connectionController.isPresent() ? connectionController.get() : new NettyConnectionController(); + } + + /** + * Update {@link #expect100ContinueTimeout(int) expect 100-Continue timeout} based on current http request properties. + * + * @param clientRequest the current http client request. + * @return updated configuration. + */ + /* package */ N expect100ContinueTimeout(ClientRequest clientRequest) { + expect100ContTimeout.set( + clientRequest.resolveProperty( + prefixed(NettyClientProperties.EXPECT_100_CONTINUE_TIMEOUT), expect100ContTimeout.get())); + return this.self(); + } + + /** + * Return value of {@link #enableSslHostnameVerification(boolean)} setting either from the configuration of from the + * HTTP client request properties. The default is {@code true}. + * + * @param properties the HTTP client request properties. + * @return the value of SSL hostname verification setting. + */ + /* package */ boolean isSslHostnameVerificationEnabled(Map<String, Object> properties) { + return ClientProperties.getValue(properties, + prefixed(NettyClientProperties.ENABLE_SSL_HOSTNAME_VERIFICATION), + enableHostnameVerification.get()); + } + + /** + * Update {@link #maxRedirects(int)} value from the HTTP Client request. + * @param request the HTTP Client request. + * @return maximum redirects value. + */ + /* package */ int maxRedirects(ClientRequest request) { + maxRedirects.set( + request.resolveProperty(prefixed(NettyClientProperties.MAX_REDIRECTS), maxRedirects.get())); + return maxRedirects.get(); + } + + /** + * Update the {@link #preserveMethodOnRedirect(boolean) preservation} of HTTP method during HTTP redirect + * by HTTP client request properties. + * + * @param request HTTP client request. + * @return the value of preservation. + */ + /* package */ boolean preserveMethodOnRedirect(ClientRequest request) { + preserveMethodOnRedirect.set( + request.resolveProperty( + prefixed(NettyClientProperties.PRESERVE_METHOD_ON_REDIRECT), preserveMethodOnRedirect.get())); + return preserveMethodOnRedirect.get(); + } + + /** + * Get the instance of preset {@link NettyHttpRedirectController} either from configuration, + * or from the HTTP client request, or the default if non set. + * @param request the HTTP client request. + * @return an instance of {@link NettyHttpRedirectController}. + */ + /* package */ NettyHttpRedirectController redirectController(ClientRequest request) { + NettyHttpRedirectController customRedirectController = + request.resolveProperty( + prefixed(NettyClientProperties.HTTP_REDIRECT_CONTROLLER), NettyHttpRedirectController.class); + if (customRedirectController == null) { + customRedirectController = redirectController.get(); + } + if (customRedirectController == null) { + customRedirectController = new NettyHttpRedirectController(); + } + + return customRedirectController; + } + + /** + * <p> + * Return a new instance of configuration updated by the merged settings from this and client properties. + * Only properties unresolved during the request are updated. + * </p><p> + * {@code This} is meant to be settings from the connector. + * The priorities should go DEFAULTS -> CONNECTOR -> CLIENT -> REQUEST. + * </p> + * + * @param client the REST client. + * @return a new instance of configuration. + */ + /* package */ N fromClient(Client client) { + final Map<String, Object> properties = client.getConfiguration().getProperties(); + final N clientConfiguration = copyFromClient(client.getConfiguration()); + + final Object threadPoolSize = properties.get(clientConfiguration.prefixed(ClientProperties.ASYNC_THREADPOOL_SIZE)); + if (threadPoolSize instanceof Integer && (Integer) threadPoolSize > 0) { + clientConfiguration.asyncThreadPoolSize((Integer) threadPoolSize); + } + + final Object maxPoolSizeTotalProperty = properties.get( + clientConfiguration.prefixed(NettyClientProperties.MAX_CONNECTIONS_TOTAL)); + final Object maxPoolIdleProperty = properties.get( + clientConfiguration.prefixed(NettyClientProperties.IDLE_CONNECTION_PRUNE_TIMEOUT)); + final Object maxPoolSizeProperty = properties.get( + clientConfiguration.prefixed(NettyClientProperties.MAX_CONNECTIONS)); + + if (maxPoolSizeTotalProperty != null) { + clientConfiguration.maxPoolSizeTotal.set((Integer) maxPoolSizeTotalProperty); + } + + if (maxPoolIdleProperty != null) { + clientConfiguration.maxPoolIdle.set((Integer) maxPoolIdleProperty); + } + + if (maxPoolSizeProperty != null) { + clientConfiguration.maxPoolSize.set((Integer) maxPoolSizeProperty); + } + + if (clientConfiguration.maxPoolSizeTotal.get() < 0) { + throw new ProcessingException(LocalizationMessages.WRONG_MAX_POOL_TOTAL(maxPoolSizeTotal.get())); + } + + if (clientConfiguration.maxPoolSize.get() < 0) { + throw new ProcessingException(LocalizationMessages.WRONG_MAX_POOL_SIZE(maxPoolSize.get())); + } + + final Object logging = properties.get(clientConfiguration.prefixed(NettyClientProperties.LOGGING_ENABLED)); + if (logging instanceof Boolean) { + clientConfiguration.loggingEnabled.set((Boolean) logging); + } else if (logging instanceof String) { + clientConfiguration.loggingEnabled.set(Boolean.valueOf((String) logging)); + } + + return clientConfiguration; + } + + /** + * <p> + * Return a new instance of configuration updated by the merged settings from this and HTTP client request properties. + * Only properties unresolved during the request are updated. + * </p><p> + * {@code This} is meant to be settings from the connector. + * The priorities should go DEFAULTS -> CONNECTOR -> CLIENT -> REQUEST. + * </p> + + * @param request the HTTP client request. + * @return a new instance of configuration. + */ + /* package */ N fromRequest(ClientRequest request) { + final N requestConfiguration = copyFromRequest(request); + + final Boolean logging = request.resolveProperty(prefixed(NettyClientProperties.LOGGING_ENABLED), Boolean.class); + if (logging != null) { + requestConfiguration.loggingEnabled.set(logging); + } + + return requestConfiguration; + } + + + /** + * Create an instance of {@link HttpClientCodec} based on preset settings {@link #initialHttpHeaderLineLength(int)}, + * {@link #maxHeaderSize} and {@link #maxChunkSize}. The settings can be preset in the configuration or + * on the HTTP client request. + * + * @param properties The HTTP client request properties. + * @return the {@link HttpClientCodec} instance. + */ + /* package */ HttpClientCodec createHttpClientCodec(Map<String, Object> properties) { + firstHttpHeaderLineLength.set(ClientProperties.getValue(properties, + prefixed(NettyClientProperties.MAX_INITIAL_LINE_LENGTH), firstHttpHeaderLineLength.get())); + maxHeaderSize.set( + ClientProperties.getValue(properties, prefixed(NettyClientProperties.MAX_HEADER_SIZE), maxHeaderSize.get())); + maxChunkSize.set( + ClientProperties.getValue(properties, prefixed(NettyClientProperties.MAX_CHUNK_SIZE), maxChunkSize.get())); + + return new HttpClientCodec(firstHttpHeaderLineLength.get(), maxHeaderSize.get(), maxChunkSize.get()); + } + + /** + * Create an instance of {@link ProxyHandler} based on HTTP request URI's port and address, + * the preset proxy {@link #proxyUri(URI) uri}, {@link #proxyUserName(String) username}, + * and {@link #proxyPassword(String) password}. + * + * Can filter headers {@link #filterHeadersForProxy(boolean)}. + * + * @param clientProxy the Jersey {@link ClientProxy} instance. + * @param jerseyRequest the HTTP client request containing HTTP headers to be filtered. + * @return a Netty {@link ProxyHandler} instance. + */ + /* package */ ProxyHandler createProxyHandler(ClientProxy clientProxy, ClientRequest jerseyRequest) { + final URI u = clientProxy.uri(); + InetSocketAddress proxyAddr = new InetSocketAddress(u.getHost(), u.getPort() == -1 ? 8080 : u.getPort()); + + filterHeadersForProxy.set(jerseyRequest + .resolveProperty(prefixed(NettyClientProperties.FILTER_HEADERS_FOR_PROXY), filterHeadersForProxy.get())); + HttpHeaders httpHeaders = NettyConnector.setHeaders( + jerseyRequest, new DefaultHttpHeaders(), Boolean.TRUE.equals(filterHeadersForProxy.get())); + + ProxyHandler proxy = clientProxy.userName() == null ? new HttpProxyHandler(proxyAddr, httpHeaders) + : new HttpProxyHandler(proxyAddr, clientProxy.userName(), clientProxy.password(), httpHeaders); + if (connectTimeout.get() > 0) { + proxy.setConnectTimeoutMillis(connectTimeout.get()); + } + + return proxy; + } + } + +}
diff --git a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyConnectorProvider.java b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyConnectorProvider.java index cdf90dd..46f27a7 100644 --- a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyConnectorProvider.java +++ b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyConnectorProvider.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025 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 @@ -51,8 +51,53 @@ @Beta public class NettyConnectorProvider implements ConnectorProvider { + private final Config config; + + public NettyConnectorProvider() { + this.config = config(); + } + + private NettyConnectorProvider(Config config) { + this.config = config; + } + @Override public Connector getConnector(Client client, Configuration runtimeConfig) { - return new NettyConnector(client); + return new NettyConnector(client, config.rw()); + } + + /** + * Instantiate a builder allowing to configure the NettyConnectorProvider. + * @return a new {@link Config} instance. + */ + public static Config config() { + return new Config(); + } + + public static final class Config extends NettyConnectorConfiguration<Config> { + + private Config() { + } + + /* package */ RW rw() { + RW rw = new RW(); + rw.setNonEmpty(this); + return rw; + } + + public NettyConnectorProvider build() { + return new NettyConnectorProvider(this); + } + + /* package */ static class RW extends ReadWrite<RW> { + @Override + public RW instance() { + return new RW(); + } + + public RW me() { + return this; + } + } } }
diff --git a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyHttpRedirectController.java b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyHttpRedirectController.java index 670be3e..6c4c41c 100644 --- a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyHttpRedirectController.java +++ b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyHttpRedirectController.java
@@ -34,9 +34,15 @@ */ public class NettyHttpRedirectController { + private NettyConnectorProvider.Config.RW configuration; + + /* package */ void init(NettyConnectorProvider.Config.RW configuration) { + this.configuration = configuration; + } + /** * Configure the HTTP request after HTTP Redirect response has been received. - * By default, the HTTP POST request is transformed into HTTP GET for status 301 & 302. + * By default, the HTTP POST request is not transformed into HTTP GET for status 301 & 302. * Also, HTTP Headers described by RFC 9110 Section 15.4 are removed from the new HTTP Request. * * @param request The new {@link ClientRequest} to be sent to the redirected URI. @@ -44,7 +50,7 @@ * @return {@code true} when the new request should be sent. */ public boolean prepareRedirect(ClientRequest request, ClientResponse response) { - final Boolean keepMethod = request.resolveProperty(NettyClientProperties.PRESERVE_METHOD_ON_REDIRECT, Boolean.TRUE); + final boolean keepMethod = configuration.preserveMethodOnRedirect(request); if (Boolean.FALSE.equals(keepMethod) && request.getMethod().equals(HttpMethod.POST)) { switch (response.getStatus()) {
diff --git a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/internal/NettyEntityWriter.java b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/internal/NettyEntityWriter.java index bcd3fd8..f758f95 100644 --- a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/internal/NettyEntityWriter.java +++ b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/internal/NettyEntityWriter.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025 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 @@ -16,9 +16,9 @@ package org.glassfish.jersey.netty.connector.internal; +import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; import io.netty.handler.stream.ChunkedInput; -import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.ClientRequest; import org.glassfish.jersey.client.RequestEntityProcessing; @@ -28,6 +28,7 @@ import java.util.LinkedList; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Supplier; /** * The Entity Writer is used to write entity in Netty. One implementation is delayed, @@ -60,7 +61,7 @@ /** * Flushes the writen objects. Can throw IOException. - * @throws IOException + * @throws IOException exception. */ void flush() throws IOException; @@ -68,7 +69,7 @@ * Get the netty Chunked Input to be written. * @return The Chunked input instance */ - ChunkedInput getChunkedInput(); + ChunkedInput<ByteBuf> getChunkedInput(); /** * Get the {@link OutputStream} used to write an entity @@ -78,20 +79,20 @@ /** * Get the length of the entity written to the {@link OutputStream} - * @return + * @return length of the entity. */ long getLength(); /** - * Return Type of - * @return + * Return Type of the {@link NettyEntityWriter}. + * @return type of the writer. */ Type getType(); - static NettyEntityWriter getInstance(ClientRequest clientRequest, Channel channel) { + static NettyEntityWriter getInstance( + ClientRequest clientRequest, Channel channel, Supplier<RequestEntityProcessing> requestEntityProcessingSupplier) { final long lengthLong = clientRequest.getLengthLong(); - final RequestEntityProcessing entityProcessing = clientRequest.resolveProperty( - ClientProperties.REQUEST_ENTITY_PROCESSING, RequestEntityProcessing.class); + final RequestEntityProcessing entityProcessing = requestEntityProcessingSupplier.get(); if ((entityProcessing == null && lengthLong == -1) || entityProcessing == RequestEntityProcessing.CHUNKED) { return new DirectEntityWriter(channel, Type.CHUNKED); @@ -129,7 +130,7 @@ } @Override - public ChunkedInput getChunkedInput() { + public ChunkedInput<ByteBuf> getChunkedInput() { return stream; } @@ -203,7 +204,7 @@ } @Override - public ChunkedInput getChunkedInput() { + public ChunkedInput<ByteBuf> getChunkedInput() { return writer.getChunkedInput(); } @@ -226,7 +227,7 @@ private class DelayedOutputStream extends OutputStream { private final List<WriteAction> actions = new ArrayList<>(); private int writeLen = 0; - private AtomicBoolean streamFlushed = new AtomicBoolean(false); + private final AtomicBoolean streamFlushed = new AtomicBoolean(false); @Override public void write(int b) throws IOException {
diff --git a/connectors/netty-connector/src/test/java/org/glassfish/jersey/netty/connector/ChunkedInputClosedOnErrorTest.java b/connectors/netty-connector/src/test/java/org/glassfish/jersey/netty/connector/ChunkedInputClosedOnErrorTest.java index 1d0135d..22ce8d3 100644 --- a/connectors/netty-connector/src/test/java/org/glassfish/jersey/netty/connector/ChunkedInputClosedOnErrorTest.java +++ b/connectors/netty-connector/src/test/java/org/glassfish/jersey/netty/connector/ChunkedInputClosedOnErrorTest.java
@@ -83,10 +83,11 @@ ConnectorProvider provider = new ConnectorProvider() { @Override public Connector getConnector(Client client, Configuration runtimeConfig) { - return new NettyConnector(client) { + return new NettyConnector(client, NettyConnectorProvider.config().rw()) { @Override - NettyEntityWriter nettyEntityWriter(ClientRequest clientRequest, Channel channel) { - writer.set(super.nettyEntityWriter(clientRequest, channel)); + NettyEntityWriter nettyEntityWriter(ClientRequest clientRequest, Channel channel, + NettyConnectorProvider.Config.RW config) { + writer.set(super.nettyEntityWriter(clientRequest, channel, config)); writerSetLatch.countDown(); return new NettyEntityWriter() { private boolean slept = false;
diff --git a/connectors/netty-connector/src/test/java/org/glassfish/jersey/netty/connector/ChunkedInputWriteErrorSimulationTest.java b/connectors/netty-connector/src/test/java/org/glassfish/jersey/netty/connector/ChunkedInputWriteErrorSimulationTest.java index 78a3448..fed5f61 100644 --- a/connectors/netty-connector/src/test/java/org/glassfish/jersey/netty/connector/ChunkedInputWriteErrorSimulationTest.java +++ b/connectors/netty-connector/src/test/java/org/glassfish/jersey/netty/connector/ChunkedInputWriteErrorSimulationTest.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025 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 @@ -223,9 +223,12 @@ return new ConnectorProvider() { @Override public Connector getConnector(Client client, Configuration runtimeConfig) { - return new NettyConnector(client) { - NettyEntityWriter nettyEntityWriter(ClientRequest clientRequest, Channel channel) { - NettyEntityWriter wrapped = NettyEntityWriter.getInstance(clientRequest, channel); + return new NettyConnector(client, NettyConnectorProvider.config().rw()) { + @Override + NettyEntityWriter nettyEntityWriter( + ClientRequest clientRequest, Channel channel, NettyConnectorProvider.Config.RW config) { + NettyEntityWriter wrapped = NettyEntityWriter.getInstance( + clientRequest, channel, () -> config.requestEntityProcessing(clientRequest)); JerseyChunkedInput chunkedInput = (JerseyChunkedInput) wrapped.getChunkedInput(); try {
diff --git a/connectors/netty-connector/src/test/java/org/glassfish/jersey/netty/connector/ConnectorConfigTest.java b/connectors/netty-connector/src/test/java/org/glassfish/jersey/netty/connector/ConnectorConfigTest.java new file mode 100644 index 0000000..6dd9b03 --- /dev/null +++ b/connectors/netty-connector/src/test/java/org/glassfish/jersey/netty/connector/ConnectorConfigTest.java
@@ -0,0 +1,1683 @@ +/* + * Copyright (c) 2025 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.netty.connector; + +import io.netty.handler.codec.http.HttpClientCodec; +import io.netty.handler.codec.http.HttpRequest; +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.ClientRequest; +import org.glassfish.jersey.client.ClientResponse; +import org.glassfish.jersey.client.RequestEntityProcessing; +import org.glassfish.jersey.client.innate.ClientProxy; +import org.glassfish.jersey.http.HttpHeaders; +import org.glassfish.jersey.internal.MapPropertiesDelegate; +import org.glassfish.jersey.internal.util.collection.Ref; +import org.glassfish.jersey.client.innate.ConnectorConfiguration; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import javax.net.ssl.SSLContext; +import jakarta.ws.rs.ProcessingException; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.core.Configuration; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.net.InetSocketAddress; +import java.net.URI; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; +import java.util.function.Supplier; + +public class ConnectorConfigTest { + + private static final String PREFIX = "test."; + + private static ClientRequest createRequest(Client client) { + return new ClientRequest(URI.create("http://localhost:8080"), + (ClientConfig) client.getConfiguration(), new MapPropertiesDelegate()) { + }; + } + + @Test + public void testPrefixedConfig() { + ConnectorConfig.RW r = new ConnectorConfig.RW(); + Configuration prefixed, unprefixed; + + unprefixed = r.config(); + unprefixed.getProperties().put(ClientProperties.CONNECT_TIMEOUT, 1000); + prefixed = r.prefix(PREFIX).prefixedConfiguration(unprefixed); + Assertions.assertNull(prefixed.getProperty(ClientProperties.CONNECT_TIMEOUT)); + Assertions.assertNull(prefixed.getProperties().get(ClientProperties.CONNECT_TIMEOUT)); + + unprefixed = r.config(); + unprefixed.getProperties().put(PREFIX + ClientProperties.CONNECT_TIMEOUT, 2000); + prefixed = r.prefix(PREFIX).prefixedConfiguration(unprefixed); + Assertions.assertEquals(2000, prefixed.getProperty(ClientProperties.CONNECT_TIMEOUT)); + Assertions.assertEquals(2000, prefixed.getProperties().get(ClientProperties.CONNECT_TIMEOUT)); + + unprefixed = r.config(); + prefixed = r.prefix(PREFIX).prefixedConfiguration(unprefixed); + unprefixed.getProperties().put(ClientProperties.CONNECT_TIMEOUT, 2000); + prefixed.getProperties().putAll(unprefixed.getProperties()); + Assertions.assertNull(prefixed.getProperty(ClientProperties.CONNECT_TIMEOUT)); + Assertions.assertNull(prefixed.getProperties().get(ClientProperties.CONNECT_TIMEOUT)); + + unprefixed = r.config(); + prefixed = r.prefix(PREFIX).prefixedConfiguration(unprefixed); + unprefixed.getProperties().put(PREFIX + ClientProperties.CONNECT_TIMEOUT, 2000); + prefixed.getProperties().putAll(unprefixed.getProperties()); + Assertions.assertEquals(2000, prefixed.getProperty(ClientProperties.CONNECT_TIMEOUT)); + Assertions.assertEquals(2000, prefixed.getProperties().get(ClientProperties.CONNECT_TIMEOUT)); + + unprefixed = r.config(); + prefixed = r.prefix(PREFIX).prefixedConfiguration(unprefixed); + prefixed.getProperties().put(PREFIX + ClientProperties.PROXY_USERNAME, "USERNAME"); + Assertions.assertEquals("USERNAME", prefixed.getProperty(ClientProperties.PROXY_USERNAME)); + prefixed.getProperties().put(ClientProperties.PROXY_PASSWORD, "PASSWORD"); + Assertions.assertNull(prefixed.getProperty(ClientProperties.PROXY_PASSWORD)); + } + + @Test + public void testAsyncThreadPoolSize() { + AtomicInteger result = new AtomicInteger(0); + class RWAsync extends RW { + @Override + public Integer asyncThreadPoolSize() { + result.set(super.asyncThreadPoolSize()); + return super.asyncThreadPoolSize(); + } + + @Override + public RWAsync instance() { + return new RWAsync(); + } + } + + Client client = ClientBuilder.newClient(); + NettyConnectorProvider.Config.RW rw0 = new RWAsync().asyncThreadPoolSize(10); + new NettyConnector(client, rw0); + Assertions.assertEquals(10, result.get()); + + result.set(0); + NettyConnectorProvider.Config.RW rw1 = new RWAsync().asyncThreadPoolSize(20); + client.property(ClientProperties.CONNECTOR_CONFIGURATION, rw1); + new NettyConnector(client, rw0); + Assertions.assertEquals(20, result.get()); + + result.set(0); + client.property(ClientProperties.ASYNC_THREADPOOL_SIZE, 30); + new NettyConnector(client, rw0); + Assertions.assertEquals(30, result.get()); + } + + @Test + public void testConnectTimeout() { + final AtomicInteger result = new AtomicInteger(0); + class RWConnect extends NettyConnectorProvider.Config.RW { + @Override + public int connectTimeout() { + result.set(super.connectTimeout()); + throw new IllegalStateException(); + } + + @Override + public RWConnect instance() { + return new RWConnect(); + } + } + new TestClient(new RWConnect()).rw(rw -> rw.connectTimeout(1000)).request().apply(); + Assertions.assertEquals(1000, result.get()); + + result.set(0); + new TestClient(new RWConnect()).rw(rw -> rw.connectTimeout(1000)) + .client(c -> c.property(ClientProperties.CONNECT_TIMEOUT, 3000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWConnect().connectTimeout(2000))) + .request().apply(); + Assertions.assertEquals(3000, result.get()); + + result.set(0); + new TestClient(new RWConnect()).rw(rw -> rw.connectTimeout(1000)) + .client(c -> c.property(ClientProperties.CONNECT_TIMEOUT, 3000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWConnect().connectTimeout(2000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, new RWConnect().connectTimeout(4000))) + .apply(); + Assertions.assertEquals(3000, result.get()); + + result.set(0); + new TestClient(new RWConnect()).rw(rw -> rw.connectTimeout(1000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWConnect().connectTimeout(2000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, new RWConnect().connectTimeout(4000))) + .apply(); + Assertions.assertEquals(4000, result.get()); + + result.set(0); + new TestClient(new RWConnect()).rw(rw -> rw.connectTimeout(1000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWConnect().connectTimeout(2000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, new RWConnect().connectTimeout(4000))) + .request(r -> r.setProperty(ClientProperties.CONNECT_TIMEOUT, 5000)) + .apply(); + Assertions.assertEquals(5000, result.get()); + + result.set(0); + new TestClient(new RWConnect().prefix(PREFIX)).rw(rw -> rw.connectTimeout(1000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + new RWConnect().connectTimeout(2000).prefix(PREFIX))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWConnect().connectTimeout(4000))) + .apply(); + Assertions.assertEquals(2000, result.get()); + + result.set(0); + new TestClient(new RWConnect()).rw(rw -> rw.connectTimeout(1000).prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWConnect().connectTimeout(2000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWConnect().connectTimeout(4000).prefix(PREFIX))) + .request(r -> r.setProperty(ClientProperties.CONNECT_TIMEOUT, 5000)) + .apply(); + Assertions.assertEquals(4000, result.get()); + } + + @Test + public void testExpect100Continue() { + final AtomicReference<Boolean> result = new AtomicReference<>(); + final AtomicReference<NettyConnectorProvider.Config.RW> config = new AtomicReference<>(); + class RWExpect extends RW { + + @Override + public Boolean expect100Continue(ClientRequest request) { + result.set(super.expect100Continue(request)); + return result.get(); + } + + @Override + public int connectTimeout() { + config.set(this); + return super.connectTimeout(); + } + + @Override + public RWExpect instance() { + return new RWExpect(); + } + } + + Request req = new TestClient(new RWExpect()).request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, null); + } catch (NullPointerException expected) { + } + Assertions.assertNull(result.get()); + + result.set(null); + req = new TestClient(new RWExpect().expect100Continue(true)).request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(true, result.get()); + + result.set(null); + req = new TestClient(new RWExpect().expect100Continue(true).prefix(PREFIX)) + .request(r -> r.setProperty(PREFIX + ClientProperties.EXPECT_100_CONTINUE, false)) + .request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(false, result.get()); + + result.set(null); + req = new TestClient(new RWExpect().expect100Continue(true).prefix(PREFIX)) + .request(r -> r.setProperty( + PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, new RWExpect().expect100Continue(false))) + .request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(false, result.get()); + + result.set(null); + req = new TestClient(new RWExpect()) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWExpect().expect100Continue(true))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, new RWExpect().expect100Continue(false))) + .request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(false, result.get()); + + result.set(null); + req = new TestClient(new RWExpect().prefix(PREFIX)) + .client(c -> c.property(PREFIX + ClientProperties.EXPECT_100_CONTINUE, true)) + .request(r -> r.setProperty(PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, + new RWExpect().expect100Continue(false))) + .request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(true, result.get()); + } + + @Test + public void testExpect100ContinueThreshold() { + final AtomicReference<Long> result = new AtomicReference<>(); + final AtomicReference<NettyConnectorProvider.Config.RW> config = new AtomicReference<>(); + class RWExpect extends RW { + + @Override + public long expect100ContinueThreshold(ClientRequest request) { + result.set(super.expect100ContinueThreshold(request)); + return result.get(); + } + + @Override + public int connectTimeout() { + config.set(this); + return super.connectTimeout(); + } + + @Override + public RWExpect instance() { + return new RWExpect(); + } + } + + Request req = new TestClient(new RWExpect()).request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, (HttpRequest) null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(ClientProperties.DEFAULT_EXPECT_100_CONTINUE_THRESHOLD_SIZE, result.get()); + + result.set(null); + req = new TestClient(new RWExpect().expect100ContinueThreshold(1000)).request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, (HttpRequest) null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(1000, result.get()); + + result.set(null); + req = new TestClient(new RWExpect().expect100ContinueThreshold(1000).prefix(PREFIX)) + .request(r -> r.setProperty(PREFIX + ClientProperties.EXPECT_100_CONTINUE_THRESHOLD_SIZE, 2000)) + .request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, (HttpRequest) null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(2000, result.get()); + + result.set(null); + req = new TestClient(new RWExpect().expect100ContinueThreshold(1000).prefix(PREFIX)) + .request(r -> r.setProperty( + PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, new RWExpect().expect100ContinueThreshold(2000))) + .request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, (HttpRequest) null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(2000, result.get()); + + result.set(null); + req = new TestClient(new RWExpect()) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + new RWExpect().expect100ContinueThreshold(1000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWExpect().expect100ContinueThreshold(2000))) + .request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, (HttpRequest) null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(2000, result.get()); + + result.set(null); + req = new TestClient(new RWExpect().prefix(PREFIX)) + .client(c -> c.property(PREFIX + ClientProperties.EXPECT_100_CONTINUE_THRESHOLD_SIZE, 1000)) + .request(r -> r.setProperty(PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, + new RWExpect().expect100ContinueThreshold(2000))) + .request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, (HttpRequest) null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(1000, result.get()); + } + + @Test + public void testExpect100ContinueTimeout() { + final AtomicReference<Integer> result = new AtomicReference<>(); + final AtomicReference<NettyConnectorProvider.Config.RW> config = new AtomicReference<>(); + class RWExpect extends RW { + + @Override + public NettyConnectorProvider.Config.RW expect100ContinueTimeout(ClientRequest request) { + super.expect100ContinueTimeout(request); + result.set(this.expect100ContTimeout.get()); + return this; + } + + @Override + public int connectTimeout() { + config.set(this); + return super.connectTimeout(); + } + + @Override + public RWExpect instance() { + return new RWExpect(); + } + } + + Request req = new TestClient(new RWExpect()).request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, (HttpRequest) null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(NettyClientProperties.DEFAULT_EXPECT_100_CONTINUE_TIMEOUT_VALUE, result.get()); + + result.set(null); + req = new TestClient(new RWExpect().expect100ContinueTimeout(1000)).request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, (HttpRequest) null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(1000, result.get()); + + result.set(null); + req = new TestClient(new RWExpect().expect100ContinueTimeout(1000).prefix(PREFIX)) + .request(r -> r.setProperty(PREFIX + NettyClientProperties.EXPECT_100_CONTINUE_TIMEOUT, 2000)) + .request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, (HttpRequest) null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(2000, result.get()); + + result.set(null); + req = new TestClient(new RWExpect().expect100ContinueTimeout(1000).prefix(PREFIX)) + .request(r -> r.setProperty( + PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, new RWExpect().expect100ContinueTimeout(2000))) + .request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, (HttpRequest) null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(2000, result.get()); + + result.set(null); + req = new TestClient(new RWExpect()) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWExpect().expect100ContinueTimeout(1000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWExpect().expect100ContinueTimeout(2000))) + .request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(2000, result.get()); + + result.set(null); + req = new TestClient(new RWExpect().prefix(PREFIX)) + .client(c -> c.property(PREFIX + NettyClientProperties.EXPECT_100_CONTINUE_TIMEOUT, 1000)) + .request(r -> r.setProperty(PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, + new RWExpect().expect100ContinueTimeout(2000))) + .request(r -> r.setEntity(PREFIX)).apply(); + try { + new Expect100ContinueConnectorExtension(config.get()).invoke(req.request, null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(1000, result.get()); + } + + @Test + public void testFollowRedirects() { + final AtomicReference<Boolean> result = new AtomicReference<>(); + final AtomicReference<NettyConnectorProvider.Config.RW> config = new AtomicReference<>(); + class RWFollow extends RW { + + @Override + public boolean followRedirects() { + result.set(super.followRedirects()); + return result.get(); + } + + @Override + public int connectTimeout() { + config.set(this); + return super.connectTimeout(); + } + + @Override + public RWFollow instance() { + return new RWFollow(); + } + } + + Request req; + req = new TestClient(new RWFollow()).request().apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + config.get().followRedirects(); + Assertions.assertEquals(new RWFollow().copy().followRedirects(), result.get()); + + result.set(null); + req = new TestClient(new RWFollow().followRedirects(false)).request().apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + config.get().followRedirects(); + Assertions.assertEquals(false, result.get()); + + result.set(null); + req = new TestClient(new RWFollow().followRedirects(false).prefix(PREFIX)) + .request(r -> r.setProperty(PREFIX + ClientProperties.FOLLOW_REDIRECTS, true)) + .request(r -> r.setEntity(PREFIX)).apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + config.get().followRedirects(); + Assertions.assertEquals(true, result.get()); + + result.set(null); + req = new TestClient(new RWFollow().followRedirects(false).prefix(PREFIX)) + .request(r -> r.setProperty( + PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, new RWFollow().followRedirects(true))) + .apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + config.get().followRedirects(); + Assertions.assertEquals(true, result.get()); + + result.set(null); + req = new TestClient(new RWFollow()) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWFollow().followRedirects(false))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWFollow().followRedirects(true))) + .request(r -> r.setEntity(PREFIX)).apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + config.get().followRedirects(); + Assertions.assertEquals(true, result.get()); + + result.set(null); + req = new TestClient(new RWFollow().prefix(PREFIX)) + .client(c -> c.property(PREFIX + ClientProperties.FOLLOW_REDIRECTS, false)) + .request(r -> r.setProperty(PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, + new RWFollow().followRedirects(true))) + .request(r -> r.setEntity(PREFIX)).apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + config.get().followRedirects(); + Assertions.assertEquals(false, result.get()); + } + + @Test + public void testProxy() { + final AtomicReference<ClientProxy> result = new AtomicReference<>(); + final AtomicReference<NettyConnectorProvider.Config.RW> config = new AtomicReference<>(); + class RWProxy extends RW { + + @Override + public Optional<ClientProxy> proxy(ClientRequest request, URI requestUri) { + Optional<ClientProxy> proxy = super.proxy(request, requestUri); + result.set(proxy.orElse(null)); + return proxy; + } + + @Override + public RWProxy instance() { + return new RWProxy(); + } + } + String proxyUri = "http://proxy.org:8080"; + String userName = "USERNAME"; + String password = "PASSWORD"; + + new TestClient(new RWProxy()).request().apply(); + Assertions.assertNull(result.get()); + + result.set(null); + new TestClient(new RWProxy().proxyUri(proxyUri).proxyUserName(userName).proxyPassword(password)).request().apply(); + Assertions.assertEquals(proxyUri, result.get().uri().toASCIIString()); + Assertions.assertEquals(userName, result.get().userName()); + Assertions.assertEquals(password, result.get().password()); + + result.set(null); + new TestClient(new RWProxy().prefix(PREFIX).proxyUri(proxyUri).proxyUserName("XXX").proxyPassword(password)) + .request(r -> r.setProperty(PREFIX + ClientProperties.PROXY_USERNAME, userName)) + .request(r -> r.setProperty(ClientProperties.PROXY_PASSWORD, "XXX")) + .apply(); + Assertions.assertEquals(proxyUri, result.get().uri().toASCIIString()); + Assertions.assertEquals(userName, result.get().userName()); + Assertions.assertEquals(password, result.get().password()); + + result.set(null); + new TestClient(new RWProxy().prefix(PREFIX).proxyUri(proxyUri).proxyUserName("XXX").proxyPassword(password)) + .request(r -> r.setProperty(PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, + new RWProxy().proxyUserName(userName).proxyPassword(null))) + .apply(); + Assertions.assertEquals(proxyUri, result.get().uri().toASCIIString()); + Assertions.assertEquals(userName, result.get().userName()); + Assertions.assertNull(result.get().password()); + + result.set(null); + new TestClient(new RWProxy().prefix(PREFIX) + .proxy(new java.net.Proxy(java.net.Proxy.Type.HTTP, + new InetSocketAddress(proxyUri.split("g:")[0] + "g", Integer.parseInt(proxyUri.split("g:")[1]))))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWProxy().proxyUserName(userName).proxyPassword(password).prefix(PREFIX))) + .apply(); + Assertions.assertEquals(proxyUri, result.get().uri().toASCIIString()); + Assertions.assertEquals(userName, result.get().userName()); + Assertions.assertEquals(password, result.get().password()); + } + + @Test + public void testReadTimeout() { + final AtomicInteger result = new AtomicInteger(0); + class RWRead extends NettyConnectorProvider.Config.RW { + + @Override + public int readTimeout() { + result.set(super.readTimeout()); + throw new IllegalStateException(); + } + + @Override + public RWRead instance() { + return new RWRead(); + } + } + new TestClient(new RWRead()).rw(rw -> rw.readTimeout(1000)).request().apply(); + Assertions.assertEquals(1000, result.get()); + + result.set(0); + new TestClient(new RWRead()).rw(rw -> rw.readTimeout(1000)) + .client(c -> c.property(ClientProperties.READ_TIMEOUT, 3000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWRead().readTimeout(2000))) + .request().apply(); + Assertions.assertEquals(3000, result.get()); + + result.set(0); + new TestClient(new RWRead()).rw(rw -> rw.readTimeout(1000)) + .client(c -> c.property(ClientProperties.READ_TIMEOUT, 3000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWRead().connectTimeout(2000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, new RWRead().readTimeout(4000))) + .apply(); + Assertions.assertEquals(3000, result.get()); + + result.set(0); + new TestClient(new RWRead()).rw(rw -> rw.readTimeout(1000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWRead().readTimeout(2000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, new RWRead().readTimeout(4000))) + .apply(); + Assertions.assertEquals(4000, result.get()); + + result.set(0); + new TestClient(new RWRead()).rw(rw -> rw.readTimeout(1000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWRead().readTimeout(2000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, new RWRead().readTimeout(4000))) + .request(r -> r.setProperty(ClientProperties.READ_TIMEOUT, 5000)) + .apply(); + Assertions.assertEquals(5000, result.get()); + + result.set(0); + new TestClient(new RWRead()).rw(rw -> rw.readTimeout(1000).prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + new RWRead().readTimeout(2000).prefix(PREFIX))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWRead().readTimeout(4000))) + .apply(); + Assertions.assertEquals(2000, result.get()); + + result.set(0); + new TestClient(new RWRead()).rw(rw -> rw.readTimeout(1000).prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWRead().readTimeout(2000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWRead().readTimeout(4000).prefix(PREFIX))) + .request(r -> r.setProperty(ClientProperties.READ_TIMEOUT, 5000)) + .apply(); + Assertions.assertEquals(4000, result.get()); + } + + @Test + public void testRequestEntityProcessing() { + final AtomicReference<RequestEntityProcessing> result = new AtomicReference<>(); + final AtomicReference<RW> config = new AtomicReference<>(); + class RWRP extends RW { + + @Override + public RequestEntityProcessing requestEntityProcessing(ClientRequest request) { + result.set(super.requestEntityProcessing(request)); + return result.get(); + } + + @Override + public RWRP instance() { + config.set(new RWRP()); + return (RWRP) config.get(); + } + } + + Request req; + req = new TestClient(new RWRP().requestEntityProcessing(RequestEntityProcessing.CHUNKED)) + .request(r -> r.setEntity(PREFIX)).apply(); + try { + req.connector.nettyEntityWriter(req.request, null, config.get()); + } catch (NullPointerException ignore) { + } + Assertions.assertEquals(RequestEntityProcessing.CHUNKED, result.get()); + + result.set(null); + req = new TestClient(new RWRP().prefix(PREFIX).requestEntityProcessing(RequestEntityProcessing.CHUNKED)) + .request(r -> r.setEntity(PREFIX)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWRP().requestEntityProcessing(RequestEntityProcessing.BUFFERED).prefix(PREFIX))) + .apply(); + try { + req.connector.nettyEntityWriter(req.request, null, config.get()); + } catch (NullPointerException ignore) { + } + Assertions.assertEquals(RequestEntityProcessing.BUFFERED, result.get()); + + result.set(null); + req = new TestClient(new RWRP().prefix(PREFIX).requestEntityProcessing(RequestEntityProcessing.CHUNKED)) + .request(r -> r.setEntity(PREFIX)) + .request(r -> r.setProperty(PREFIX + ClientProperties.REQUEST_ENTITY_PROCESSING, + RequestEntityProcessing.BUFFERED)) + .apply(); + try { + req.connector.nettyEntityWriter(req.request, null, config.get()); + } catch (NullPointerException ignore) { + } + Assertions.assertEquals(RequestEntityProcessing.BUFFERED, result.get()); + } + + @Test + public void testSniHostName() { + final String sniHost = "sun.oracle.com"; + final AtomicReference<String> sniRef = new AtomicReference<>(); + final NettyConnectionController controller = new NettyConnectionController() { + @Override + public String getConnectionGroup(ClientRequest clientRequest, URI uri, String hostName, int port) { + sniRef.set(hostName); + return super.getConnectionGroup(clientRequest, uri, hostName, port); + } + }; + + final class RWSni extends RW { + @Override + public RWSni instance() { + return new RWSni(); + } + } + + new TestClient(new RWSni().connectionController(controller)) + .request(r -> r.getRequestHeaders().add(HttpHeaders.HOST, sniHost)) + .apply(); + Assertions.assertEquals(sniHost, sniRef.get()); + + new TestClient(new RWSni().connectionController(controller).sniHostName(sniHost)) + .request(r -> r.getRequestHeaders().add(HttpHeaders.HOST, "moon.oracle.com")) + .apply(); + Assertions.assertEquals(sniHost, sniRef.get()); + + new TestClient(new RWSni().connectionController(controller).prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + NettyConnectorProvider.config().sniHostName("moon.oracle.com"))) + .request(r -> r.getRequestHeaders().add(HttpHeaders.HOST, sniHost)) + .apply(); + Assertions.assertEquals(sniHost, sniRef.get()); + + new TestClient(new RWSni().connectionController(controller).prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + NettyConnectorProvider.config().sniHostName(sniHost).prefix(PREFIX))) + .request(r -> r.getRequestHeaders().add(HttpHeaders.HOST, "moon.oracle.com")) + .apply(); + Assertions.assertEquals(sniHost, sniRef.get()); + + new TestClient(new RWSni().connectionController(controller).prefix(PREFIX)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + NettyConnectorProvider.config().sniHostName("moon.oracle.com"))) + .request(r -> r.getRequestHeaders().add(HttpHeaders.HOST, sniHost)) + .apply(); + Assertions.assertEquals(sniHost, sniRef.get()); + + new TestClient(new RWSni().connectionController(controller).prefix(PREFIX)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + NettyConnectorProvider.config().sniHostName(sniHost).prefix(PREFIX))) + .request(r -> r.getRequestHeaders().add(HttpHeaders.HOST, "moon.oracle.com")) + .apply(); + Assertions.assertEquals(sniHost, sniRef.get()); + } + + @Test + public void testSslContext() { + final SSLContext testContext = new SSLContext(null, null, null){}; + final AtomicReference<SSLContext> result = new AtomicReference<>(); + final AtomicReference<RW> config = new AtomicReference<>(); + class RWSsl extends RW { + + @Override + public SSLContext sslContext(Client client, ClientRequest request) { + result.set(super.sslContext(client, request)); + return result.get(); + } + + @Override + public RWSsl instance() { + RWSsl rw = new RWSsl(); + config.set(rw); + return rw; + } + } + + Request req; + req = new TestClient(new RWSsl().sslContextSupplier(() -> testContext)).request().apply(); + config.get().sslContext(req.client, req.request); + Assertions.assertEquals(testContext, result.get()); + + result.set(null); + req = new TestClient(new RWSsl().prefix(PREFIX)) + .request(r -> r.setProperty(PREFIX + ClientProperties.SSL_CONTEXT_SUPPLIER, + (Supplier<SSLContext>) () -> testContext)).apply(); + config.get().sslContext(req.client, req.request); + Assertions.assertEquals(testContext, result.get()); + + result.set(null); + req = new TestClient(new RWSsl().prefix(PREFIX)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWSsl().prefix(PREFIX).sslContextSupplier(() -> testContext))).apply(); + config.get().sslContext(req.client, req.request); + Assertions.assertEquals(testContext, result.get()); + } + + @Test + public void testConnectionController() { + final NettyConnectionController connectionController = new NettyConnectionController(); + final AtomicReference<NettyConnectionController> result = new AtomicReference<>(); + + class RWController extends RW { + + @Override + NettyConnectionController connectionController() { + result.set(super.connectionController()); + return result.get(); + } + + @Override + public RWController instance() { + return new RWController(); + } + } + + new TestClient(new RWController().connectionController(connectionController)).request().apply(); + Assertions.assertEquals(connectionController, result.get()); + + result.set(null); + new TestClient(new RWController().prefix(PREFIX).connectionController(new NettyConnectionController())) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWController().connectionController(connectionController).prefix(PREFIX))).apply(); + Assertions.assertEquals(connectionController, result.get()); + } + + @Test + public void testEnableSslHostnameVerification() { + final AtomicReference<Boolean> result = new AtomicReference<>(); + final AtomicReference<NettyConnectorProvider.Config.RW> config = new AtomicReference<>(); + class RWEnabled extends RW { + + @Override + boolean isSslHostnameVerificationEnabled(Map<String, Object> properties) { + result.set(super.isSslHostnameVerificationEnabled(properties)); + return result.get(); + } + + @Override + public RWEnabled instance() { + RWEnabled enabled = new RWEnabled(); + config.set(enabled); + return enabled; + } + } + + Request req; + req = new TestClient(new RWEnabled()).request().apply(); + config.get().isSslHostnameVerificationEnabled(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(new RWEnabled().copy().followRedirects(), result.get()); + + result.set(null); + req = new TestClient(new RWEnabled().enableSslHostnameVerification(false)).request().apply(); + config.get().isSslHostnameVerificationEnabled(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(false, result.get()); + +// NOT PER REQUEST +// result.set(null); +// req = new TestClient(new RWEnabled().enableSslHostnameVerification(false).prefix(PREFIX)) +// .request(r -> r.setProperty(PREFIX + NettyClientProperties.ENABLE_SSL_HOSTNAME_VERIFICATION, true)) +// .apply(); +// config.get().isSslHostnameVerificationEnabled(req.request.getConfiguration().getProperties()); +// Assertions.assertEquals(true, result.get()); + + result.set(null); + req = new TestClient(new RWEnabled().enableSslHostnameVerification(false).prefix(PREFIX)) + .request(r -> r.setProperty( + PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, new RWEnabled().enableSslHostnameVerification(true))) + .apply(); + config.get().isSslHostnameVerificationEnabled(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(true, result.get()); + + result.set(null); + req = new TestClient(new RWEnabled()) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + new RWEnabled().enableSslHostnameVerification(false))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWEnabled().enableSslHostnameVerification(true))) + .apply(); + config.get().isSslHostnameVerificationEnabled(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(true, result.get()); + + result.set(null); + req = new TestClient(new RWEnabled().prefix(PREFIX)) + .client(c -> c.property(PREFIX + NettyClientProperties.ENABLE_SSL_HOSTNAME_VERIFICATION, false)) + .request(r -> r.setProperty(PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, + new RWEnabled().enableSslHostnameVerification(true))) + .request(r -> r.setEntity(PREFIX)).apply(); + config.get().isSslHostnameVerificationEnabled(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(false, result.get()); + } + + @Test + public void testMaxRedirects() { + final AtomicReference<Integer> result = new AtomicReference<>(); + final AtomicReference<NettyConnectorProvider.Config.RW> config = new AtomicReference<>(); + class RWMaxRed extends RW { + + @Override + int maxRedirects(ClientRequest request) { + result.set(super.maxRedirects(request)); + return result.get(); + } + + @Override + public RWMaxRed instance() { + RWMaxRed max = new RWMaxRed(); + config.set(max); + return max; + } + } + + Request req = new TestClient(new RWMaxRed()).request().apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + Assertions.assertEquals(new RWMaxRed().copy().maxRedirects(req.request), result.get()); + + result.set(null); + req = new TestClient(new RWMaxRed().maxRedirects(2)).request().apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + Assertions.assertEquals(2, result.get()); + + result.set(null); + req = new TestClient(new RWMaxRed().maxRedirects(2).prefix(PREFIX)) + .request(r -> r.setProperty(PREFIX + NettyClientProperties.MAX_REDIRECTS, 3)) + .request(r -> r.setEntity(PREFIX)).apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + Assertions.assertEquals(3, result.get()); + + result.set(null); + req = new TestClient(new RWMaxRed().maxRedirects(2).prefix(PREFIX)) + .request(r -> r.setProperty( + PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, new RWMaxRed().maxRedirects(3))) + .apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + Assertions.assertEquals(3, result.get()); + + result.set(null); + req = new TestClient(new RWMaxRed()) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWMaxRed().maxRedirects(2))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWMaxRed().maxRedirects(3))) + .request(r -> r.setEntity(PREFIX)).apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + Assertions.assertEquals(3, result.get()); + + result.set(null); + req = new TestClient(new RWMaxRed().prefix(PREFIX)) + .client(c -> c.property(PREFIX + NettyClientProperties.MAX_REDIRECTS, 2)) + .request(r -> r.setProperty(PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, + new RWMaxRed().maxRedirects(3))) + .request(r -> r.setEntity(PREFIX)).apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + Assertions.assertEquals(2, result.get()); + } + + @Test + public void testRedirectController() { + final NettyHttpRedirectController controller = new NettyHttpRedirectController(); + final AtomicReference<NettyHttpRedirectController> result = new AtomicReference<>(); + final AtomicReference<NettyConnectorProvider.Config.RW> config = new AtomicReference<>(); + class RWController extends RW { + + @Override + NettyHttpRedirectController redirectController(ClientRequest request) { + result.set(super.redirectController(request)); + return result.get(); + } + + @Override + public RWController instance() { + RWController max = new RWController(); + config.set(max); + return max; + } + } + + Request req; + + result.set(null); + req = new TestClient(new RWController().redirectController(controller)).request().apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + config.get().redirectController(req.request); + Assertions.assertEquals(controller, result.get()); + + result.set(null); + req = new TestClient(new RWController().redirectController(new NettyHttpRedirectController()).prefix(PREFIX)) + .request(r -> r.setProperty(PREFIX + NettyClientProperties.HTTP_REDIRECT_CONTROLLER, controller)) + .request(r -> r.setEntity(PREFIX)).apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + config.get().redirectController(req.request); + Assertions.assertEquals(controller, result.get()); + + result.set(null); + req = new TestClient(new RWController().redirectController(new NettyHttpRedirectController()).prefix(PREFIX)) + .request(r -> r.setProperty( + PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, new RWController().redirectController(controller))) + .apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + config.get().redirectController(req.request); + Assertions.assertEquals(controller, result.get()); + + result.set(null); + req = new TestClient(new RWController()) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + new RWController().redirectController(new NettyHttpRedirectController()))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWController().redirectController(controller))) + .request(r -> r.setEntity(PREFIX)).apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); +// config.get().redirectController(req.request); + Assertions.assertEquals(controller, result.get()); + + result.set(null); + req = new TestClient(new RWController().prefix(PREFIX)) + .client(c -> c.property(PREFIX + NettyClientProperties.HTTP_REDIRECT_CONTROLLER, controller)) + .request(r -> r.setProperty(PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, + new RWController().redirectController(new NettyHttpRedirectController()))) + .request(r -> r.setEntity(PREFIX)).apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); +// config.get().redirectController(req.request); + Assertions.assertEquals(controller, result.get()); + } + + @Test + public void testPreserveMethodOnRedirect() { + final AtomicReference<Boolean> result = new AtomicReference<>(); + final AtomicReference<NettyHttpRedirectController> controller = new AtomicReference<>(); + final AtomicReference<NettyConnectorProvider.Config.RW> config = new AtomicReference<>(); + class RWController extends RW { + + @Override + boolean preserveMethodOnRedirect(ClientRequest request) { + result.set(super.preserveMethodOnRedirect(request)); + return result.get(); + } + + @Override + NettyHttpRedirectController redirectController(ClientRequest request) { + controller.set(super.redirectController(request)); + return controller.get(); + } + + @Override + public RWController instance() { + RWController max = new RWController(); + config.set(max); + return max; + } + } + + Request req; + req = new TestClient(new RWController()).request().apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + try { + controller.get().prepareRedirect(req.request, null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(new RWController().copy().preserveMethodOnRedirect(req.request), result.get()); + + result.set(null); + req = new TestClient(new RWController().preserveMethodOnRedirect(false)).request().apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + try { + controller.get().prepareRedirect(req.request, null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(false, result.get()); + + result.set(null); + req = new TestClient(new RWController().preserveMethodOnRedirect(true).prefix(PREFIX)) + .request(r -> r.setProperty(PREFIX + NettyClientProperties.PRESERVE_METHOD_ON_REDIRECT, false)) + .request(r -> r.setEntity(PREFIX)).apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + try { + controller.get().prepareRedirect(req.request, null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(false, result.get()); + + result.set(null); + req = new TestClient(new RWController().preserveMethodOnRedirect(true).prefix(PREFIX)) + .request(r -> r.setProperty( + PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, new RWController().preserveMethodOnRedirect(false))) + .apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + try { + controller.get().prepareRedirect(req.request, null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(false, result.get()); + + result.set(null); + req = new TestClient(new RWController()) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + new RWController().preserveMethodOnRedirect(true))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWController().preserveMethodOnRedirect(false))) + .request(r -> r.setEntity(PREFIX)).apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + try { + controller.get().prepareRedirect(req.request, null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(false, result.get()); + + result.set(null); + req = new TestClient(new RWController().prefix(PREFIX)) + .client(c -> c.property(PREFIX + NettyClientProperties.PRESERVE_METHOD_ON_REDIRECT, false)) + .request(r -> r.setProperty(PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, + new RWController().preserveMethodOnRedirect(true))) + .request(r -> r.setEntity(PREFIX)).apply(); + new JerseyClientHandler(req.request, new CompletableFuture<ClientResponse>(), + new CompletableFuture<Object>(), new HashSet<>(), req.connector, config.get()); + try { + controller.get().prepareRedirect(req.request, null); + } catch (NullPointerException expected) { + } + Assertions.assertEquals(false, result.get()); + } + + @Test + public void testFilterHeadersForProxy() { + final AtomicReference<ClientProxy> proxy = new AtomicReference<>(); + final AtomicReference<NettyConnectorProvider.Config.RW> config = new AtomicReference<>(); + class RWProxy extends RW { + @Override + public Optional<ClientProxy> proxy(ClientRequest request, URI requestUri) { + Optional<ClientProxy> oProxy = super.proxy(request, requestUri); + proxy.set(oProxy.orElse(null)); + return oProxy; + } + + @Override + public RWProxy instance() { + RWProxy rw = new RWProxy(); + config.set(rw); + return rw; + } + } + String proxyUri = "http://proxy.org:8080"; + String userName = "USERNAME"; + String password = "PASSWORD"; + + Request req; + req = new TestClient(new RWProxy().proxyUri(proxyUri).proxyUserName(userName).proxyPassword(password)).request().apply(); + config.get().createProxyHandler(proxy.get(), req.request); + Assertions.assertEquals(((Ref<Boolean>) new RWProxy().copy().filterHeadersForProxy).get(), + ((Ref<Boolean>) config.get().filterHeadersForProxy).get()); + + config.set(null); + req = new TestClient(new RWProxy().proxyUri(proxyUri).proxyUserName(userName).proxyPassword(password) + .filterHeadersForProxy(false)).request().apply(); + config.get().createProxyHandler(proxy.get(), req.request); + Assertions.assertEquals(false, ((Ref<Boolean>) config.get().filterHeadersForProxy).get()); + + config.set(null); + req = new TestClient(new RWProxy().proxyUri(proxyUri).proxyUserName(userName).proxyPassword(password) + .prefix(PREFIX)) + .request(r -> r.setProperty(PREFIX + NettyClientProperties.FILTER_HEADERS_FOR_PROXY, false)) + .apply(); + config.get().createProxyHandler(proxy.get(), req.request); + Assertions.assertEquals(false, ((Ref<Boolean>) config.get().filterHeadersForProxy).get()); + + config.set(null); + new TestClient(new RWProxy().proxyUri(proxyUri).proxyUserName(userName).proxyPassword(password) + .prefix(PREFIX)) + .client(c -> c.property(PREFIX + NettyClientProperties.FILTER_HEADERS_FOR_PROXY, false)) + .request().apply(); + config.get().createProxyHandler(proxy.get(), req.request); + Assertions.assertEquals(false, ((Ref<Boolean>) config.get().filterHeadersForProxy).get()); + + config.set(null); + new TestClient(new RWProxy().proxyUri(proxyUri).proxyUserName(userName).proxyPassword(password) + .prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + NettyConnectorProvider.config().filterHeadersForProxy(false).prefix(PREFIX))) + .request().apply(); + config.get().createProxyHandler(proxy.get(), req.request); + Assertions.assertEquals(false, ((Ref<Boolean>) config.get().filterHeadersForProxy).get()); + + config.set(null); + new TestClient(new RWProxy().proxyUri(proxyUri).proxyUserName(userName).proxyPassword(password) + .prefix(PREFIX)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + NettyConnectorProvider.config().filterHeadersForProxy(false).prefix(PREFIX))) + .apply(); + config.get().createProxyHandler(proxy.get(), req.request); + Assertions.assertEquals(false, ((Ref<Boolean>) config.get().filterHeadersForProxy).get()); + } + + @Test + public void testFirstHttpHeaderLineLength() { + final AtomicReference<NettyConnectorProvider.Config.RW> config = new AtomicReference<>(); + final AtomicReference<Integer> result = new AtomicReference<>(); + class RWFHHLL extends RW { + + @Override + HttpClientCodec createHttpClientCodec(Map<String, Object> properties) { + HttpClientCodec codec = super.createHttpClientCodec(properties); + result.set(firstHttpHeaderLineLength.get()); + return codec; + } + + @Override + public RWFHHLL instance() { + RWFHHLL rw = new RWFHHLL(); + config.set(rw); + return rw; + } + } + + Request req; + req = new TestClient(new RWFHHLL()).request().apply(); + config.get().createHttpClientCodec(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(NettyClientProperties.DEFAULT_INITIAL_LINE_LENGTH, result.get()); + + result.set(null); + req = new TestClient(new RWFHHLL().initialHttpHeaderLineLength(5555)).request().apply(); + config.get().createHttpClientCodec(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(5555, result.get()); + + result.set(null); + req = new TestClient(new RWFHHLL().initialHttpHeaderLineLength(1111).prefix(PREFIX)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWFHHLL().initialHttpHeaderLineLength(5555).prefix(PREFIX))).apply(); + config.get().createHttpClientCodec(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(5555, result.get()); + + result.set(null); + req = new TestClient(new RWFHHLL().initialHttpHeaderLineLength(1111).prefix(PREFIX)) + .client(c -> c.property(PREFIX + NettyClientProperties.MAX_INITIAL_LINE_LENGTH, 5555)) + .request().apply(); + config.get().createHttpClientCodec(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(5555, result.get()); + + result.set(null); + req = new TestClient(new RWFHHLL().prefix(PREFIX)) + .client(c -> c.property(PREFIX + NettyClientProperties.MAX_INITIAL_LINE_LENGTH, 5555)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWFHHLL().initialHttpHeaderLineLength(8888).prefix(PREFIX))) + .apply(); + config.get().createHttpClientCodec(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(5555, result.get()); + } + + @Test + public void testLoggingHandler() { + final AtomicReference<NettyConnectorProvider.Config.RW> config = new AtomicReference<>(); + class RWLog extends RW { + @Override + public RWLog instance() { + RWLog rw = new RWLog(); + config.set(rw); + return rw; + } + } + + new TestClient(new RWLog()).request().apply(); + Assertions.assertFalse(config.get().loggingEnabled.get()); + + new TestClient(new RWLog().enableLoggingHandler(true)).request().apply(); + Assertions.assertTrue(config.get().loggingEnabled.get()); + + new TestClient(new RWLog().enableLoggingHandler(false).prefix(PREFIX)) + .request(r -> r.setProperty(NettyClientProperties.LOGGING_ENABLED, true)) + .apply(); + Assertions.assertFalse(config.get().loggingEnabled.get()); + + new TestClient(new RWLog().enableLoggingHandler(false).prefix(PREFIX)) + .client(c -> c.property(PREFIX + NettyClientProperties.LOGGING_ENABLED, true)) + .request() + .apply(); + Assertions.assertTrue(config.get().loggingEnabled.get()); + + new TestClient(new RWLog().enableLoggingHandler(false).prefix(PREFIX)) + .request(r -> r.setProperty(PREFIX + NettyClientProperties.LOGGING_ENABLED, true)) + .apply(); + Assertions.assertTrue(config.get().loggingEnabled.get()); + + new TestClient(new RWLog().enableLoggingHandler(false).prefix(PREFIX)) + .client(c -> c.property(PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, + new RWLog().enableLoggingHandler(true))) + .request() + .apply(); + Assertions.assertTrue(config.get().loggingEnabled.get()); + + new TestClient(new RWLog().enableLoggingHandler(false).prefix(PREFIX)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWLog().enableLoggingHandler(true).prefix(PREFIX))) + .apply(); + Assertions.assertTrue(config.get().loggingEnabled.get()); + } + + @Test + public void testMaxHeaderSize() { + final AtomicReference<NettyConnectorProvider.Config.RW> config = new AtomicReference<>(); + final AtomicReference<Integer> result = new AtomicReference<>(); + class RWSize extends RW { + + @Override + HttpClientCodec createHttpClientCodec(Map<String, Object> properties) { + HttpClientCodec codec = super.createHttpClientCodec(properties); + result.set(maxHeaderSize.get()); + return codec; + } + + @Override + public RWSize instance() { + RWSize rw = new RWSize(); + config.set(rw); + return rw; + } + } + + Request req; + req = new TestClient(new RWSize()).request().apply(); + config.get().createHttpClientCodec(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(NettyClientProperties.DEFAULT_HEADER_SIZE, result.get()); + + result.set(null); + req = new TestClient(new RWSize().maxHeaderSize(5555)).request().apply(); + config.get().createHttpClientCodec(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(5555, result.get()); + + result.set(null); + req = new TestClient(new RWSize().maxHeaderSize(1111).prefix(PREFIX)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWSize().maxHeaderSize(5555).prefix(PREFIX))).apply(); + config.get().createHttpClientCodec(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(5555, result.get()); + + result.set(null); + req = new TestClient(new RWSize().maxHeaderSize(1111).prefix(PREFIX)) + .client(c -> c.property(PREFIX + NettyClientProperties.MAX_HEADER_SIZE, 5555)) + .request().apply(); + config.get().createHttpClientCodec(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(5555, result.get()); + + result.set(null); + req = new TestClient(new RWSize().prefix(PREFIX)) + .client(c -> c.property(PREFIX + NettyClientProperties.MAX_HEADER_SIZE, 5555)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWSize().maxHeaderSize(8888).prefix(PREFIX))) + .apply(); + config.get().createHttpClientCodec(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(5555, result.get()); + } + + @Test + public void testMaxChunkSize() { + final AtomicReference<NettyConnectorProvider.Config.RW> config = new AtomicReference<>(); + final AtomicReference<Integer> result = new AtomicReference<>(); + class RWSize extends RW { + + @Override + HttpClientCodec createHttpClientCodec(Map<String, Object> properties) { + HttpClientCodec codec = super.createHttpClientCodec(properties); + result.set(maxChunkSize.get()); + return codec; + } + + @Override + public RWSize instance() { + RWSize rw = new RWSize(); + config.set(rw); + return rw; + } + } + + Request req; + req = new TestClient(new RWSize()).request().apply(); + config.get().createHttpClientCodec(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(NettyClientProperties.DEFAULT_CHUNK_SIZE, result.get()); + + result.set(null); + req = new TestClient(new RWSize().maxChunkSize(5555)).request().apply(); + config.get().createHttpClientCodec(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(5555, result.get()); + + result.set(null); + req = new TestClient(new RWSize().maxChunkSize(1111).prefix(PREFIX)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWSize().maxChunkSize(5555).prefix(PREFIX))).apply(); + config.get().createHttpClientCodec(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(5555, result.get()); + + result.set(null); + req = new TestClient(new RWSize().maxChunkSize(1111).prefix(PREFIX)) + .client(c -> c.property(PREFIX + NettyClientProperties.MAX_CHUNK_SIZE, 5555)) + .request().apply(); + config.get().createHttpClientCodec(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(5555, result.get()); + + result.set(null); + req = new TestClient(new RWSize().prefix(PREFIX)) + .client(c -> c.property(PREFIX + NettyClientProperties.MAX_CHUNK_SIZE, 5555)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWSize().maxChunkSize(8888).prefix(PREFIX))) + .apply(); + config.get().createHttpClientCodec(req.request.getConfiguration().getProperties()); + Assertions.assertEquals(5555, result.get()); + } + + @Test + public void testMaxTotalConnections() { + final AtomicReference<Integer> result = new AtomicReference<>(); + class RWConn extends RW { + + @Override + NettyConnectorProvider.Config.RW fromClient(Client client) { + NettyConnectorProvider.Config.RW rw = super.fromClient(client); + result.set(rw.maxPoolSizeTotal.get()); + return rw; + } + + @Override + public RWConn instance() { + return new RWConn(); + } + } + + new TestClient(new RWConn().maxTotalConnections(55)).request().apply(); + Assertions.assertEquals(55, result.get()); + + result.set(null); + new TestClient(new RWConn().prefix(PREFIX)) + .client(c -> c.property(PREFIX + NettyClientProperties.MAX_CONNECTIONS_TOTAL, 55)) + .request().apply(); + Assertions.assertEquals(55, result.get()); + + result.set(null); + new TestClient(new RWConn().prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + NettyConnectorProvider.config().prefix(PREFIX).maxTotalConnections(55))) + .request().apply(); + Assertions.assertEquals(55, result.get()); + + result.set(null); + new TestClient(new RWConn().prefix(PREFIX)) + // NOT PER REQUEST + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + NettyConnectorProvider.config().prefix(PREFIX).maxTotalConnections(55))) + .apply(); + Assertions.assertEquals(new RWConn().copy().maxPoolSizeTotal.get(), result.get()); + } + + @Test + public void testMaxConnectionsPerDestination() { + final AtomicReference<Integer> result = new AtomicReference<>(); + class RWConn extends RW { + + @Override + NettyConnectorProvider.Config.RW fromClient(Client client) { + NettyConnectorProvider.Config.RW rw = super.fromClient(client); + result.set(rw.maxPoolSize.get()); + return rw; + } + + @Override + public RWConn instance() { + return new RWConn(); + } + } + + new TestClient(new RWConn().maxConnectionsPerDestination(15)).request().apply(); + Assertions.assertEquals(15, result.get()); + + result.set(null); + new TestClient(new RWConn().prefix(PREFIX)) + .client(c -> c.property(PREFIX + NettyClientProperties.MAX_CONNECTIONS, 15)) + .request().apply(); + Assertions.assertEquals(15, result.get()); + + result.set(null); + new TestClient(new RWConn().prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + NettyConnectorProvider.config().prefix(PREFIX).maxConnectionsPerDestination(15))) + .request().apply(); + Assertions.assertEquals(15, result.get()); + + result.set(null); + new TestClient(new RWConn().prefix(PREFIX)) + // NOT PER REQUEST + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + NettyConnectorProvider.config().prefix(PREFIX).maxConnectionsPerDestination(15))) + .apply(); + Assertions.assertEquals(new RWConn().copy().maxPoolSize.get(), result.get()); + } + + @Test + public void testIdleConnectionPruneTimeout() { + final AtomicReference<Integer> result = new AtomicReference<>(); + class RWConn extends RW { + + @Override + NettyConnectorProvider.Config.RW fromClient(Client client) { + NettyConnectorProvider.Config.RW rw = super.fromClient(client); + result.set(rw.maxPoolIdle.get()); + return rw; + } + + @Override + public RWConn instance() { + return new RWConn(); + } + } + + new TestClient(new RWConn().idleConnectionPruneTimeout(15)).request().apply(); + Assertions.assertEquals(15, result.get()); + + result.set(null); + new TestClient(new RWConn().prefix(PREFIX)) + .client(c -> c.property(PREFIX + NettyClientProperties.IDLE_CONNECTION_PRUNE_TIMEOUT, 15)) + .request().apply(); + Assertions.assertEquals(15, result.get()); + + result.set(null); + new TestClient(new RWConn().prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + NettyConnectorProvider.config().prefix(PREFIX).idleConnectionPruneTimeout(15))) + .request().apply(); + Assertions.assertEquals(15, result.get()); + + result.set(null); + new TestClient(new RWConn().prefix(PREFIX)) + // NOT PER REQUEST + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + NettyConnectorProvider.config().prefix(PREFIX).idleConnectionPruneTimeout(15))) + .apply(); + Assertions.assertEquals(new RWConn().copy().maxPoolIdle.get(), result.get()); + } + + @Test + public void testPrecedence() { + NettyConnectorProvider.Config.RW builderLower = NettyConnectorProvider.config().rw(); + builderLower.maxTotalConnections(55); + + NettyConnectorProvider.Config.RW builderUpper = builderLower.copy(); + builderUpper.maxTotalConnections(56); + Assertions.assertEquals(56, builderUpper.maxPoolSizeTotal.get()); + + Client client = ClientBuilder.newClient(); + client.property(NettyClientProperties.MAX_CONNECTIONS_TOTAL, 57); + NettyConnectorProvider.Config.RW result = builderUpper.fromClient(client); + Assertions.assertEquals(57, result.maxPoolSizeTotal.get()); + Assertions.assertEquals(60, result.maxPoolIdle.get()); + } + + private static class ConnectorConfig extends ConnectorConfiguration<ConnectorConfig> { + private static class RW extends ConnectorConfiguration<RW> implements Read<RW> { + @Override + public RW instance() { + return new RW(); + } + + @Override + public RW me() { + return this; + } + + public Configuration config() { + Map<String, Object> empty = new HashMap<>(); + Configuration configuration = (Configuration) Proxy.newProxyInstance( + getClass().getClassLoader(), + new Class[]{Configuration.class}, new InvocationHandler() { + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + switch (method.getName()) { + case "getProperties": + return empty; + case "getProperty": + return empty.get(args[0]); + } + return null; + } + }); + + return configuration; + } + } + } + + private static class RW extends NettyConnectorProvider.Config.RW { + @Override + public int connectTimeout() { + throw new IllegalStateException(); + } + } + + + private static class TestClient { + private final NettyConnectorProvider.Config.RW rw; + private final Client client; + + private TestClient(NettyConnectorProvider.Config.RW rw) { + this.rw = rw; + this.client = ClientBuilder.newClient(new ClientConfig().connectorProvider(new NettyConnectorProvider())); + } + + public TestClient client(Consumer<Client> consumer) { + consumer.accept(client); + return this; + } + + public TestClient rw(Consumer<NettyConnectorProvider.Config.RW> consumer) { + consumer.accept(rw); + return this; + } + + public Request request() { + return new Request(client, rw); + } + + public Request request(Consumer<ClientRequest> consumer) { + return request().request(consumer); + } + } + + private static class Request { + final ClientRequest request; + final Client client; + final NettyConnectorProvider.Config.RW rw; + NettyConnector connector; + + Request(Client client, NettyConnectorProvider.Config.RW rw) { + this.client = client; + this.rw = rw; + request = createRequest(client); + } + + public Request request(Consumer<ClientRequest> consumer) { + consumer.accept(request); + return this; + } + + public Request apply() { + try { + connector = new NettyConnector(client, rw); + connector.apply(request); + } catch (ProcessingException expected) { + } + return this; + } + } +}
diff --git a/connectors/netty-connector/src/test/java/org/glassfish/jersey/netty/connector/CustomConnectionControllerTest.java b/connectors/netty-connector/src/test/java/org/glassfish/jersey/netty/connector/CustomConnectionControllerTest.java new file mode 100644 index 0000000..abf23e5 --- /dev/null +++ b/connectors/netty-connector/src/test/java/org/glassfish/jersey/netty/connector/CustomConnectionControllerTest.java
@@ -0,0 +1,71 @@ +/* + * Copyright (c) 2025 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.netty.connector; + +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientRequest; +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.test.JerseyTest; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Application; +import jakarta.ws.rs.core.Response; +import java.net.URI; +import java.util.concurrent.atomic.AtomicBoolean; + +public class CustomConnectionControllerTest extends JerseyTest { + final AtomicBoolean hit = new AtomicBoolean(false); + + @Path("/") + public static class CustomConnectionControllerTestResource { + @GET + public String get() { + return "ok"; + } + } + + @Override + protected Application configure() { + return new ResourceConfig(CustomConnectionControllerTestResource.class); + } + + @Override + protected void configureClient(ClientConfig config) { + NettyConnectorProvider provider = NettyConnectorProvider.config().connectionController(new NettyConnectionController() { + @Override + public String getConnectionGroup(ClientRequest clientRequest, URI uri, String hostName, int port) { + hit.set(true); + return super.getConnectionGroup(clientRequest, uri, hostName, port); + } + }).build(); + + config.connectorProvider(provider); + } + + @Test + public void testCustomConnectionControllerIsInvoked() { + try (Response response = target().request().get()) { + Assertions.assertEquals(200, response.getStatus()); + } + client().close(); + Assertions.assertEquals(true, hit.get()); + + } +}
diff --git a/containers/jersey-servlet-core/src/main/java/org/glassfish/jersey/servlet/ServletContainer.java b/containers/jersey-servlet-core/src/main/java/org/glassfish/jersey/servlet/ServletContainer.java index 19810fa..da8ce0a 100644 --- a/containers/jersey-servlet-core/src/main/java/org/glassfish/jersey/servlet/ServletContainer.java +++ b/containers/jersey-servlet-core/src/main/java/org/glassfish/jersey/servlet/ServletContainer.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025 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 @@ -25,7 +25,6 @@ import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; -import jakarta.ws.rs.ProcessingException; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.UriBuilder; import jakarta.ws.rs.core.UriBuilderException;
diff --git a/core-client/src/main/java/org/glassfish/jersey/client/ClientProperties.java b/core-client/src/main/java/org/glassfish/jersey/client/ClientProperties.java index 364bff0..552b1ac 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/ClientProperties.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/ClientProperties.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025 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 @@ -155,6 +155,15 @@ public static final String BACKGROUND_SCHEDULER_THREADPOOL_SIZE = "jersey.config.client.backgroundScheduler.threadPoolSize"; /** + * The connector configuration object available through connector provider configuration methods. + * + * <p> + * The name of the configuration property is <tt>{@value}</tt>. + * </p> + */ + public static final String CONNECTOR_CONFIGURATION = "jersey.config.client.ConnectorConfiguration"; + + /** * If {@link org.glassfish.jersey.client.filter.EncodingFilter} is * registered, this property indicates the value of Content-Encoding * property the filter should be adding.
diff --git a/core-client/src/main/java/org/glassfish/jersey/client/HttpUrlConnectorProvider.java b/core-client/src/main/java/org/glassfish/jersey/client/HttpUrlConnectorProvider.java index dd96928..b8ec60b 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/HttpUrlConnectorProvider.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/HttpUrlConnectorProvider.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025 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 @@ -20,14 +20,12 @@ import java.net.HttpURLConnection; import java.net.Proxy; import java.net.URL; -import java.util.Map; -import java.util.logging.Logger; import jakarta.ws.rs.client.Client; import jakarta.ws.rs.core.Configuration; import org.glassfish.jersey.client.internal.HttpUrlConnector; -import org.glassfish.jersey.client.internal.LocalizationMessages; +import org.glassfish.jersey.client.internal.HttpUrlConnectorConfiguration; import org.glassfish.jersey.client.spi.Connector; import org.glassfish.jersey.client.spi.ConnectorProvider; @@ -110,26 +108,22 @@ */ public static final String SET_METHOD_WORKAROUND = "jersey.config.client.httpUrlConnection.setMethodWorkaround"; - /** - * Default connection factory to be used. - */ - private static final ConnectionFactory DEFAULT_CONNECTION_FACTORY = new DefaultConnectionFactory(); - private static final Logger LOGGER = Logger.getLogger(HttpUrlConnectorProvider.class.getName()); - - private ConnectionFactory connectionFactory; - private int chunkSize; - private boolean useFixedLengthStreaming; - private boolean useSetMethodWorkaround; + protected final Config config; /** * Create new {@link java.net.HttpURLConnection}-based Jersey client connector provider. */ public HttpUrlConnectorProvider() { - this.connectionFactory = DEFAULT_CONNECTION_FACTORY; - this.chunkSize = ClientProperties.DEFAULT_CHUNK_SIZE; - this.useFixedLengthStreaming = false; - this.useSetMethodWorkaround = false; + this.config = new Config(); + } + + private HttpUrlConnectorProvider(Config config) { + this.config = config; + } + + public static Config config() { + return new Config(); } /** @@ -140,11 +134,7 @@ * @throws java.lang.NullPointerException in case the supplied connectionFactory is {@code null}. */ public HttpUrlConnectorProvider connectionFactory(final ConnectionFactory connectionFactory) { - if (connectionFactory == null) { - throw new NullPointerException(LocalizationMessages.NULL_INPUT_PARAMETER("connectionFactory")); - } - - this.connectionFactory = connectionFactory; + config.connectionFactory(connectionFactory); return this; } @@ -164,10 +154,7 @@ * @throws java.lang.IllegalArgumentException in case the specified chunk size is negative. */ public HttpUrlConnectorProvider chunkSize(final int chunkSize) { - if (chunkSize < 0) { - throw new IllegalArgumentException(LocalizationMessages.NEGATIVE_INPUT_PARAMETER("chunkSize")); - } - this.chunkSize = chunkSize; + config.chunkSize(chunkSize); return this; } @@ -183,7 +170,7 @@ * @return updated connector provider instance. */ public HttpUrlConnectorProvider useFixedLengthStreaming() { - this.useFixedLengthStreaming = true; + config.useFixedLengthStreaming(true); return this; } @@ -199,28 +186,18 @@ * @return updated connector provider instance. */ public HttpUrlConnectorProvider useSetMethodWorkaround() { - this.useSetMethodWorkaround = true; + config.useSetMethodWorkaround(true); return this; } @Override - public Connector getConnector(final Client client, final Configuration config) { - final Map<String, Object> properties = config.getProperties(); - - int computedChunkSize = ClientProperties.getValue(properties, - ClientProperties.CHUNKED_ENCODING_SIZE, chunkSize, Integer.class); - if (computedChunkSize < 0) { - LOGGER.warning(LocalizationMessages.NEGATIVE_CHUNK_SIZE(computedChunkSize, chunkSize)); - computedChunkSize = chunkSize; - } - - final boolean computedUseFixedLengthStreaming = ClientProperties.getValue(properties, - USE_FIXED_LENGTH_STREAMING, useFixedLengthStreaming, Boolean.class); - final boolean computedUseSetMethodWorkaround = ClientProperties.getValue(properties, - SET_METHOD_WORKAROUND, useSetMethodWorkaround, Boolean.class); - - return createHttpUrlConnector(client, connectionFactory, computedChunkSize, computedUseFixedLengthStreaming, - computedUseSetMethodWorkaround); + public Connector getConnector(final Client client, final Configuration configuration) { + this.config.preInit(configuration); + return createHttpUrlConnector(client, + this.config.connectionFactory(), + this.config.chunkSize(), + this.config.fixLengthStreaming(), + this.config.setMethodWorkaround()); } /** @@ -230,7 +207,7 @@ * @param connectionFactory {@link javax.net.ssl.HttpsURLConnection} factory to be used when creating * connections. * @param chunkSize chunk size to use when using HTTP chunked transfer coding. - * @param fixLengthStreaming specify if the the {@link java.net.HttpURLConnection#setFixedLengthStreamingMode(int) + * @param fixLengthStreaming specify if the {@link java.net.HttpURLConnection#setFixedLengthStreamingMode(int) * fixed-length streaming mode} on the underlying HTTP URL connection instances should * be used when sending requests. * @param setMethodWorkaround specify if the reflection workaround should be used to set HTTP URL connection method @@ -240,12 +217,33 @@ protected Connector createHttpUrlConnector(Client client, ConnectionFactory connectionFactory, int chunkSize, boolean fixLengthStreaming, boolean setMethodWorkaround) { - return new HttpUrlConnector( - client, - connectionFactory, - chunkSize, - fixLengthStreaming, - setMethodWorkaround); + return new HttpUrlConnector(client, client.getConfiguration(), config); + } + + public static final class Config extends HttpUrlConnectorConfiguration<Config> { + public HttpUrlConnectorProvider build() { + return new HttpUrlConnectorProvider(this); + } + + /* package */ ConnectionFactory connectionFactory() { + return connectionFactory.get(); + } + + /* package */ int chunkSize() { + return chunkSize.get(); + } + + /* package */ boolean fixLengthStreaming() { + return useFixedLengthStreaming.get(); + } + + /* package */ boolean setMethodWorkaround() { + return useSetMethodWorkaround.get(); + } + + /* package */ void preInit(Configuration configuration) { + super.preInit(configuration.getProperties()); + } } /** @@ -291,23 +289,6 @@ } } - private static class DefaultConnectionFactory implements ConnectionFactory { - - @Override - public HttpURLConnection getConnection(final URL url) throws IOException { - 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 { - return (proxy == null) ? (HttpURLConnection) url.openConnection() : (HttpURLConnection) url.openConnection(proxy); - } - } - @Override public boolean equals(final Object o) { if (this == o) { @@ -318,22 +299,11 @@ } final HttpUrlConnectorProvider that = (HttpUrlConnectorProvider) o; - - if (chunkSize != that.chunkSize) { - return false; - } - if (useFixedLengthStreaming != that.useFixedLengthStreaming) { - return false; - } - - return connectionFactory.equals(that.connectionFactory); + return config.equals(that.config); } @Override public int hashCode() { - int result = connectionFactory.hashCode(); - result = 31 * result + chunkSize; - result = 31 * result + (useFixedLengthStreaming ? 1 : 0); - return result; + return config.hashCode(); } }
diff --git a/core-client/src/main/java/org/glassfish/jersey/client/InvocationBuilderListenerStage.java b/core-client/src/main/java/org/glassfish/jersey/client/InvocationBuilderListenerStage.java index 7f5d455..67bad95 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/InvocationBuilderListenerStage.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/InvocationBuilderListenerStage.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025 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 @@ -40,18 +40,18 @@ * would be created, this class is utilized. */ /* package */ class InvocationBuilderListenerStage { - final Iterator<InvocationBuilderListener> invocationBuilderListenerIterator; + private final Iterable<InvocationBuilderListener> invocationBuilderListenerIterable; /* package */ InvocationBuilderListenerStage(InjectionManager injectionManager) { final RankedComparator<InvocationBuilderListener> comparator = new RankedComparator<>(RankedComparator.Order.ASCENDING); - invocationBuilderListenerIterator = Providers - .getAllProviders(injectionManager, InvocationBuilderListener.class, comparator).iterator(); + invocationBuilderListenerIterable = Providers + .getAllProviders(injectionManager, InvocationBuilderListener.class, comparator); } /* package */ void invokeListener(JerseyInvocation.Builder builder) { - while (invocationBuilderListenerIterator.hasNext()) { - invocationBuilderListenerIterator.next().onNewBuilder(new InvocationBuilderContextImpl(builder)); + for (InvocationBuilderListener invocationBuilderListener : invocationBuilderListenerIterable) { + invocationBuilderListener.onNewBuilder(new InvocationBuilderContextImpl(builder)); } }
diff --git a/core-client/src/main/java/org/glassfish/jersey/client/innate/ClientProxy.java b/core-client/src/main/java/org/glassfish/jersey/client/innate/ClientProxy.java index 68ab324..1d82b06 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/innate/ClientProxy.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/innate/ClientProxy.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025 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 @@ -16,8 +16,8 @@ package org.glassfish.jersey.client.innate; import org.glassfish.jersey.client.ClientProperties; -import org.glassfish.jersey.client.ClientRequest; import org.glassfish.jersey.client.internal.LocalizationMessages; +import org.glassfish.jersey.internal.PropertiesResolver; import jakarta.ws.rs.ProcessingException; import jakarta.ws.rs.core.Configuration; @@ -31,6 +31,7 @@ import java.util.Arrays; import java.util.Base64; import java.util.Locale; +import java.util.Map; import java.util.Optional; /** @@ -42,16 +43,20 @@ // do not instantiate }; - public static Optional<ClientProxy> proxyFromRequest(ClientRequest request) { + public static Optional<ClientProxy> proxyFromRequest(PropertiesResolver request) { return getProxy(request); } - public static Optional<ClientProxy> proxyFromProperties(URI requestUri) { + public static Optional<ClientProxy> proxyFromUri(URI requestUri) { return getSystemPropertiesProxy(requestUri); } + public static Optional<ClientProxy> proxyFromProperties(Map<String, Object> properties) { + return getProxy(properties); + } + public static Optional<ClientProxy> proxyFromConfiguration(Configuration configuration) { - return getProxy(configuration); + return getProxy(configuration.getProperties()); } public static ClientProxy proxy(Proxy proxy) { @@ -103,7 +108,7 @@ return userName; }; - private static Optional<ClientProxy> getProxy(ClientRequest request) { + private static Optional<ClientProxy> getProxy(PropertiesResolver request) { Object proxyUri = request.resolveProperty(ClientProperties.PROXY_URI, Object.class); if (proxyUri != null) { ClientProxy proxy = toProxy(proxyUri); @@ -118,13 +123,13 @@ return Optional.empty(); } - private static Optional<ClientProxy> getProxy(Configuration config) { - Object proxyUri = config.getProperties().get(ClientProperties.PROXY_URI); + private static Optional<ClientProxy> getProxy(Map<String, Object> properties) { + Object proxyUri = properties.get(ClientProperties.PROXY_URI); if (proxyUri != null) { ClientProxy proxy = toProxy(proxyUri); if (proxy != null) { - proxy.userName = ClientProperties.getValue(config.getProperties(), ClientProperties.PROXY_USERNAME, String.class); - proxy.password = ClientProperties.getValue(config.getProperties(), ClientProperties.PROXY_PASSWORD, String.class); + proxy.userName = ClientProperties.getValue(properties, ClientProperties.PROXY_USERNAME, String.class); + proxy.password = ClientProperties.getValue(properties, ClientProperties.PROXY_PASSWORD, String.class); return Optional.of(proxy); } else { return Optional.empty();
diff --git a/core-client/src/main/java/org/glassfish/jersey/client/innate/ConnectorConfiguration.java b/core-client/src/main/java/org/glassfish/jersey/client/innate/ConnectorConfiguration.java new file mode 100644 index 0000000..48e9244 --- /dev/null +++ b/core-client/src/main/java/org/glassfish/jersey/client/innate/ConnectorConfiguration.java
@@ -0,0 +1,895 @@ +/* + * Copyright (c) 2025 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.client.innate; + +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.ClientRequest; +import org.glassfish.jersey.client.RequestEntityProcessing; +import org.glassfish.jersey.client.innate.http.SSLParamConfigurator; +import org.glassfish.jersey.internal.PropertiesResolver; + +import javax.net.ssl.SSLContext; +import jakarta.ws.rs.RuntimeType; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.core.Configuration; +import jakarta.ws.rs.core.Feature; +import java.net.Proxy; +import java.net.URI; +import java.util.Collection; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.function.Consumer; +import java.util.function.Predicate; +import java.util.function.Supplier; + +/** + * Configuration object to use for configuring the client connectors and HTTP request processing. + * This configuration provides settings to be handled by the connectors, mainly declared by {@link ClientProperties}. + * + * @param <E> the connector configuration subtype. + */ +public class ConnectorConfiguration<E extends ConnectorConfiguration<E>> { + protected final NullableRef<Integer> connectTimeout = NullableRef.empty(); + protected final NullableRef<Boolean> expect100Continue = NullableRef.empty(); + protected final NullableRef<Long> expect100continueThreshold = NullableRef.empty(); + protected final NullableRef<Boolean> followRedirects = NullableRef.empty(); + protected final NullableRef<String> prefix = NullableRef.empty(); + protected final NullableRef<Object> proxyUri = NullableRef.empty(); + protected final NullableRef<String> proxyUserName = NullableRef.empty(); + protected final NullableRef<String> proxyPassword = NullableRef.empty(); + protected final NullableRef<Integer> readTimeout = NullableRef.empty(); + protected final NullableRef<RequestEntityProcessing> requestEntityProcessing = NullableRef.empty(); + protected final NullableRef<String> sniHostname = NullableRef.empty(); + protected final NullableRef<Supplier<SSLContext>> sslContextSupplier = NullableRef.empty(); + protected final NullableRef<Integer> threadPoolSize = NullableRef.empty(); + + /** + * Use factory methods provided by each connector supporting this configuration object and its subclass instead. + */ + protected ConnectorConfiguration() { + } + + /** + * Set the asynchronous thread-pool size. The property {@link ClientProperties#ASYNC_THREADPOOL_SIZE} + * has precedence over this setting. + * + * @param threadPoolSize the size of the asynchronous thread-pool. + * @return updated configuration. + */ + public E asyncThreadPoolSize(int threadPoolSize) { + this.threadPoolSize.set(threadPoolSize); + return self(); + } + + /** + * Set connect timeout. The property {@link ClientProperties#CONNECT_TIMEOUT} + * has precedence over this setting. + * + * @param millis timeout in milliseconds. + * @return updated configuration. + */ + public E connectTimeout(int millis) { + connectTimeout.set(millis); + return self(); + } + + /** + * Allows for HTTP Expect:100-Continue. + * The property {@link ClientProperties#EXPECT_100_CONTINUE} has precedence over this setting. + * + * @param enable allows for HTTP Expect:100-Continue or not. + * @return updated configuration. + */ + public E expect100Continue(boolean enable) { + expect100Continue.set(enable); + return self(); + } + + /** + * Set the Expect:100-Continue content-length threshold size. + * The {@link ClientProperties#EXPECT_100_CONTINUE_THRESHOLD_SIZE} property has precedence over this setting. + * + * @param size the content-length threshold. + * @return updated configuration. + */ + public E expect100ContinueThreshold(long size) { + expect100continueThreshold.set(size); + return self(); + } + + /** + * Set to follow redirects. The property {@link ClientProperties#FOLLOW_REDIRECTS} has precedence over this setting. + * + * @param follow to follow or not to follow. + * @return updated configuration. + */ + public E followRedirects(boolean follow) { + followRedirects.set(follow); + return self(); + } + + /** + * <p> + * Set the prefix for the configuration properties used by Client/Request to configure and override the settings. + * For instance, if the prefix would be {@code com.example.MyProject.}, the property {@link #connectTimeout(int)} + * is overridden only by properties with key starting by the prefix, + * i.e. for {@link ClientProperties#CONNECT_TIMEOUT}, + * the property key {@code com.example.MyProject.jersey.config.client.connectTimeout} would override the setting. + * </p> + * <p> + * The prefix can be used to override the settings by the System property set specifically for the + * prefixed connector. See {@link org.glassfish.jersey.CommonProperties#ALLOW_SYSTEM_PROPERTIES_PROVIDER} + * for enabling System properties usage. + * </p> + * <p> + * The default configuration prefix is empty. + * </p> + * + * @param prefix the non-null prefix. + * @throws NullPointerException if the prefix is null. + * @return updated configuration. + */ + public E prefix(String prefix) { + this.prefix.set(Objects.requireNonNull(prefix)); + return self(); + } + + /** + * Set proxy password. The property {@link ClientProperties#PROXY_PASSWORD} + * has precedence over this setting. + * + * @param proxyPassword the proxy password. + * @return updated configuration. + */ + public E proxyPassword(String proxyPassword) { + this.proxyPassword.set(proxyPassword); + return self(); + } + + /** + * Set proxy username. The property {@link ClientProperties#PROXY_USERNAME} + * has precedence over this setting. + * + * @param userName the proxy username. + * @return updated configuration. + */ + public E proxyUserName(String userName) { + proxyUserName.set(userName); + return self(); + } + + /** + * Set proxy URI. The property {@link ClientProperties#PROXY_URI} + * has precedence over this setting. + * + * @param proxyUri the proxy URI. + * @return updated configuration. + */ + public E proxyUri(String proxyUri) { + this.proxyUri.set(proxyUri); + return self(); + } + + /** + * Set proxy URI. The property {@link ClientProperties#PROXY_URI} + * has precedence over this setting. + * + * @param proxyUri the proxy URI. + * @return updated configuration. + */ + public E proxyUri(URI proxyUri) { + this.proxyUri.set(proxyUri); + return self(); + } + + /** + * Set HTTP proxy. The property {@link ClientProperties#PROXY_URI} + * has precedence over this setting. + * + * @param proxy the HTTP proxy. + * @return updated configuration. + */ + public E proxy(Proxy proxy) { + this.proxyUri.set(proxy); + return self(); + } + + /** + * Set read timeout. The property {@link ClientProperties#READ_TIMEOUT} + * has precedence over this setting. + * + * @param millis timeout in milliseconds. + * @return updated configuration. + */ + public E readTimeout(int millis) { + readTimeout.set(millis); + return self(); + } + + /** + * Set the request entity processing type. + * + * @param requestEntityProcessing the request entity processing type. + * @return the updated configuration. + */ + public E requestEntityProcessing(RequestEntityProcessing requestEntityProcessing) { + this.requestEntityProcessing.set(requestEntityProcessing); + return self(); + } + + public E sniHostName(String sniHostname) { + this.sniHostname.set(sniHostname); + return self(); + } + + /** + * Set the {@link SSLContext} supplier. The property {@link ClientProperties#SSL_CONTEXT_SUPPLIER} has precedence over + * this setting. + * + * @param sslContextSupplier the {@link SSLContext} supplier. + * @return the updated configuration. + */ + public E sslContextSupplier(Supplier<SSLContext> sslContextSupplier) { + this.sslContextSupplier.set(sslContextSupplier); + return self(); + } + + /** + * Return type-cast self. + * @return self. + */ + @SuppressWarnings("unchecked") + protected E self() { + return (E) this; + } + + /** + * <p> + * A reference to a value. The reference can be empty, but unlike the {@code Optional}, once a value is set, + * it never can be empty again. The {@code null} value is treated as a non-empty value of null. + * </p><p> + * This {@code null} + * can be used to override some previous configuration value, to distinguish the intentional {@code null} override + * from an empty (non-set) configuration value. + * </p> + * @param <T> type of the value. + */ + protected static class NullableRef<T> implements org.glassfish.jersey.internal.util.collection.Ref<T> { + + private NullableRef() { + // use factory methods; + } + + /** + * Return a new empty reference. + * + * @return an empty reference. + * @param <T> The type of the empty value. + */ + public static <T> NullableRef<T> empty() { + return new NullableRef<>(); + } + + /** + * Return a reference of a given value. + * + * @param value the value this reference refers to.* + * @return a new reference to a given value. + * @param <T> type of the value. + */ + public static <T> NullableRef<T> of(T value) { + NullableRef<T> ref = new NullableRef<>(); + ref.set(value); + return ref; + } + + private boolean empty = true; + private T ref = null; + + @Override + public void set(T value) { + empty = false; + ref = value; + } + + /** + * Set or replace the value if other value is set. + * @param other a reference to another value. + */ + public void setNonEmpty(NullableRef<T> other) { + other.ifPresent(this::set); + } + + @Override + public T get() { + return ref; + } + + /** + * Run action if and only if the condition applies. + * + * @param predicate the condition to be met. + * @param action the action to run if condition is met. + */ + public void iff(Predicate<T> predicate, Runnable action) { + if (predicate.test(ref)) { + action.run(); + } + } + + /** + * If it is empty, sets the {@code value} value. Keeps the original value, otherwise. + * + * @param value the value to be set if empty. + */ + public void ifEmptySet(T value) { + if (empty) { + set(value); + } + } + + /** + * If a value is present, performs the given action with the value, + * otherwise does nothing. + * + * @param action the action to be performed, if a value is present + * @throws NullPointerException if value is present and the given action is + * {@code null} + */ + public void ifPresent(Consumer<? super T> action) { + if (!empty) { + action.accept(ref); + } + } + + /** + * If a value is present, performs the given action with the value, + * otherwise performs the given empty-based action. + * + * @param action the action to be performed, if a value is present + * @param emptyAction the empty-based action to be performed, if no value is + * present + * @throws NullPointerException if a value is present and the given action + * is {@code null}, or no value is present and the given empty-based + * action is {@code null}. + */ + public void ifPresentOrElse(Consumer<? super T> action, Runnable emptyAction) { + if (!empty) { + action.accept(ref); + } else { + emptyAction.run(); + } + } + + /** + * Return the value if present, the {@code other} otherwise. + * + * @param other the value if not present + * @return inner value if present or the other otherwise. + */ + public T ifPresentOrElse(T other) { + return empty ? other : ref; + } + + /** + * If a value is not present, returns {@code true}, otherwise + * {@code false}. + * + * @return {@code true} if a value is not present, otherwise {@code false} + */ + public boolean isEmpty() { + return empty; + } + + /** + * If a value is present, returns {@code true}, otherwise {@code false}. + * + * @return {@code true} if a value is present, otherwise {@code false} + */ + public boolean isPresent() { + return !empty; + } + + + @Override + public int hashCode() { + return Objects.hash(ref, empty); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (!(o instanceof NullableRef)) { + return false; + } + + NullableRef<?> that = (NullableRef<?>) o; + return Objects.equals(empty, that.empty) && Objects.equals(ref, that.ref); + } + + @Override + public String toString() { + return empty ? "<empty>" : ref == null ? "<null>" : ref.toString(); + } + } + + protected interface Read<CC extends ConnectorConfiguration<CC> & Read<CC>> + extends SSLParamConfigurator.SSLParamConfiguratorConfiguration { + + /** + * Set and replace the values of current configuration by values of other configuration + * if and only if the values of other configuration are set. + * + * @param other another configuration instance. + */ + public default <X extends ConnectorConfiguration<?>> void setNonEmpty(X other) { + me().connectTimeout.setNonEmpty(other.connectTimeout); + me().expect100Continue.setNonEmpty(other.expect100Continue); + me().expect100continueThreshold.setNonEmpty(other.expect100continueThreshold); + me().followRedirects.setNonEmpty(other.followRedirects); + me().prefix.setNonEmpty(other.prefix); + me().proxyUri.setNonEmpty(other.proxyUri); + me().proxyUserName.setNonEmpty(other.proxyUserName); + me().proxyPassword.setNonEmpty(other.proxyPassword); + me().readTimeout.setNonEmpty(other.readTimeout); + me().requestEntityProcessing.setNonEmpty(other.requestEntityProcessing); + me().sniHostname.setNonEmpty(other.sniHostname); + me().sslContextSupplier.setNonEmpty(other.sslContextSupplier); + me().threadPoolSize.setNonEmpty(other.threadPoolSize); + } + + /** + * Return the thread-pool size setting. + * + * @return the thread pool size setting. + */ + public default Integer asyncThreadPoolSize() { + return me().threadPoolSize.get(); + } + + /** + * Update connect timeout value based on request properties settings. + * + * @param request the current HTTP client request. + * @return the updated configuration. + */ + public default int connectTimeout(ClientRequest request) { + me().connectTimeout.set( + request.resolveProperty(prefixed(ClientProperties.CONNECT_TIMEOUT), me().connectTimeout.get()) + ); + return me().connectTimeout.get(); + } + + /** + * Get the value of connect timeout setting. + * + * @return connect timeout value. + */ + public default int connectTimeout() { + return me().connectTimeout.get(); + } + + /** + * Sets the default value. The default methods cannot be set on instances passed by the customers using + * {@link ClientProperties#CONNECTOR_CONFIGURATION} since they would override the values previously set + * by the connector configuration object. + * @return the initialized configuration object. + */ + public default CC init() { + me().connectTimeout(0) + .expect100ContinueThreshold(ClientProperties.DEFAULT_EXPECT_100_CONTINUE_THRESHOLD_SIZE) + .followRedirects(Boolean.TRUE) + .prefix("") + .readTimeout(0); + return me(); + } + + /** + * Utility method to create a new instance of configuration to preserve the settings of previous configuration. + * + * @return a new instance of the configuration. + */ + public default CC copy() { + CC config = instance(); + config.init(); + config.setNonEmpty(me()); + return config; + } + + public default CC copyFromClient(Configuration configuration) { + CC clientConfiguration = copy(); + final Map<String, Object> properties = configuration.getProperties(); + Object configProp = properties.get(clientConfiguration.prefixed(ClientProperties.CONNECTOR_CONFIGURATION)); + if (configProp != null) { + ConnectorConfiguration<?> clientCfg = (ConnectorConfiguration<?>) configProp; + if (me().prefix.equals(clientCfg.prefix) || clientCfg.prefix.get() == null) { + clientConfiguration.setNonEmpty(clientCfg); + } + } else { + configProp = properties.get(ClientProperties.CONNECTOR_CONFIGURATION); + if (configProp != null && me().prefix.equals(((ConnectorConfiguration<?>) configProp).prefix)) { + clientConfiguration.setNonEmpty((ConnectorConfiguration<?>) configProp); + } + } + return clientConfiguration; + } + + public default CC copyFromRequest(ClientRequest request) { + CC requestConfiguration = copy(); + Object configProp = request.getProperty(prefixed(ClientProperties.CONNECTOR_CONFIGURATION)); + if (configProp != null) { + ConnectorConfiguration<?> requestCfg = (ConnectorConfiguration<?>) configProp; + if (me().prefix.equals(requestCfg.prefix) || requestCfg.prefix.get() == null) { + requestConfiguration.setNonEmpty(requestCfg); + } + } else { + configProp = request.getProperty(ClientProperties.CONNECTOR_CONFIGURATION); + if (configProp != null && me().prefix.equals(((ConnectorConfiguration<?>) configProp).prefix)) { + requestConfiguration.setNonEmpty((ConnectorConfiguration<?>) configProp); + } + } + return requestConfiguration; + } + + @Override + default String getSniHostNameProperty(Configuration configuration) { + Object property = configuration.getProperty(prefixed(ClientProperties.SNI_HOST_NAME)); + if (property == null) { + property = configuration.getProperty(prefixed(ClientProperties.SNI_HOST_NAME.toLowerCase(Locale.ROOT))); + } + return property == null ? me().sniHostname.get() : (String) property; + } + + /** + * Update the {@link #expect100Continue(boolean)} from the HTTP client request. + * + * @param request the HTTP client request. + * @return the Expect: 100-Continue support value. + */ + public default Boolean expect100Continue(ClientRequest request) { + final Boolean expectContinueActivated = + request.resolveProperty(prefixed(ClientProperties.EXPECT_100_CONTINUE), Boolean.class); + if (expectContinueActivated != null) { + me().expect100Continue.set(expectContinueActivated); + } + return me().expect100Continue.get(); + } + + /** + * Update the {@link #expect100ContinueThreshold(long)} from the HTTP client request. + * + * @param request the HTTP client request. + * @return the content length threshold size. + */ + public default long expect100ContinueThreshold(ClientRequest request) { + me().expect100continueThreshold.set( + request.resolveProperty(prefixed(ClientProperties.EXPECT_100_CONTINUE_THRESHOLD_SIZE), + me().expect100continueThreshold.get()) + ); + return me().expect100continueThreshold.get(); + } + + /** + * Update the {@link #followRedirects(boolean)} setting from the HTTP client request. The default is {@code true}. + * + * @param request the HTTP client request. + * @return follow redirects setting. + */ + public default boolean followRedirects(ClientRequest request) { + me().followRedirects.set( + request.resolveProperty(prefixed(ClientProperties.FOLLOW_REDIRECTS), me().followRedirects.get()) + ); + return me().followRedirects.get(); + } + + /** + * Get the value of the follow redirects setting. The default is {@code true}. + * + * @return whether to follow redirects or not. + */ + public default boolean followRedirects() { + return me().followRedirects.get(); + } + + public default Configuration prefixedConfiguration(Configuration configuration) { + return me().prefix.get().isEmpty() ? configuration : new PrefixedConfiguration(me().prefix.get(), configuration); + } + + /** + * Create optional client proxy information based on the proxy information set in the configuration + * or the HTTP client request. The used settings are {@link #proxy(Proxy)}, + * {@link #proxyUri(URI)}, {@link #proxyUri(String)}, {@link #proxyUserName(String)}, + * and {@link #proxyPassword(String)}. + * + * @param request the HTTP client request, + * @param requestUri the HTTP request URI. It can differ from the URI used in the request, based on other + * information set by the HTTP client request. + * @return the optional client proxy. + */ + public default Optional<ClientProxy> proxy(ClientRequest request, URI requestUri) { + Optional<ClientProxy> proxy = ClientProxy.proxyFromRequest( + me().prefix.get().isEmpty() + ? request + : new PrefixedPropertiesResolver(me().prefix.get(), request) + ); + if (!proxy.isPresent() && me().proxyUri.isPresent()) { + final Map<String, Object> properties = me().prefix.get().isEmpty() + ? new HashMap<>() + : new PrefixedMap<>(me().prefix.get(), new HashMap<>()); + properties.put(me().prefix.get() + ClientProperties.PROXY_URI, me().proxyUri.get()); + properties.put(me().prefix.get() + ClientProperties.PROXY_USERNAME, me().proxyUserName.get()); + properties.put(me().prefix.get() + ClientProperties.PROXY_PASSWORD, me().proxyPassword.get()); + request.getPropertyNames().forEach(k -> properties.put(k, request.getProperty(k))); + proxy = ClientProxy.proxyFromProperties(properties); + } + if (!proxy.isPresent()) { + proxy = ClientProxy.proxyFromUri(requestUri); + } + return proxy; + } + + /** + * Update {@link #readTimeout(int) read timeout} based on the HTTP request properties. + * + * @param request the current HTTP client request. + * @return updated configuration. + */ + public default CC readTimeout(ClientRequest request) { + me().readTimeout.set(request.resolveProperty(prefixed(ClientProperties.READ_TIMEOUT), me().readTimeout.get())); + return me(); + } + + /** + * Get the value of preset {@link #readTimeout(int)}. + * + * @return the read timeout milliseconds. + */ + public default int readTimeout() { + return me().readTimeout.get(); + } + + /** + * Get the {@link RequestEntityProcessing} updated by the HTTP client request. + * + * @param request the HTTP client request. + * @return the RequestEntityProcessing type. + */ + public default RequestEntityProcessing requestEntityProcessing(ClientRequest request) { + RequestEntityProcessing entityProcessing = + request.resolveProperty(prefixed(ClientProperties.REQUEST_ENTITY_PROCESSING), RequestEntityProcessing.class); + if (entityProcessing == null) { + entityProcessing = me().requestEntityProcessing.get(); + } + return entityProcessing; + } + + @Override + default String resolveSniHostNameProperty(PropertiesResolver resolver) { + String property = resolver.resolveProperty(prefixed(ClientProperties.SNI_HOST_NAME), String.class); + if (property == null) { + property = resolver.resolveProperty( + prefixed(ClientProperties.SNI_HOST_NAME.toLowerCase(Locale.ROOT)), String.class); + } + return property == null ? me().sniHostname.get() : property; + } + + /** + * Get {@link SSLContext} either from the {@link ClientProperties#SSL_CONTEXT_SUPPLIER}, or from this configuration, + * or from the {@link Client#getSslContext()} in this order. + * + * @param client the client used to get the {@link SSLContext}. + * @param request the request used to get the {@link SSLContext}. + * @return the {@link SSLContext}. + */ + public default SSLContext sslContext(Client client, ClientRequest request) { + @SuppressWarnings("unchecked") + Supplier<SSLContext> supplier = + request.resolveProperty(prefixed(ClientProperties.SSL_CONTEXT_SUPPLIER), Supplier.class); + if (supplier == null) { + supplier = me().sslContextSupplier.get(); + } + return supplier == null ? client.getSslContext() : supplier.get(); + } + + public default String prefixed(String propertyName) { + return me().prefix.get() + propertyName; + } + + /** + * Return a new instance of configuration. + * @return a new instance of configuration. + */ + public CC instance(); + + /** + * Return typed-cast self. + * @return self. + */ + public CC me(); + } + + + /** + * A properties map that works with prefixed properties. + * + * @param <V> Object type. + */ + private static class PrefixedMap<V> implements Map<String, V> { + private final Map<String, V> inner; + private final String prefix; + + private PrefixedMap(String prefix, Map<String, V> inner) { + this.inner = inner; + this.prefix = prefix; + } + + @Override + public int size() { + return inner.size(); + } + + @Override + public boolean isEmpty() { + return inner.isEmpty(); + } + + @Override + public boolean containsKey(Object key) { + return inner.containsKey(prefix + key); + } + + @Override + public boolean containsValue(Object value) { + return inner.containsValue(value); + } + + @Override + public V get(Object key) { + return inner.get(prefix + key); + } + + @Override + public V put(String key, V value) { + return inner.put(key, value); + } + + @Override + public V remove(Object key) { + return inner.remove(prefix + key); + } + + @Override + public void putAll(Map<? extends String, ? extends V> m) { + inner.putAll(m); + } + + @Override + public void clear() { + inner.clear(); + } + + @Override + public Set<String> keySet() { + return inner.keySet(); + } + + @Override + public Collection<V> values() { + return inner.values(); + } + + @Override + public Set<Entry<String, V>> entrySet() { + return inner.entrySet(); + } + } + + /** + * Properties resolver that resolves prefixed properties. + */ + private static class PrefixedPropertiesResolver implements PropertiesResolver { + private final String prefix; + private final PropertiesResolver resolver; + + private PrefixedPropertiesResolver(String prefix, PropertiesResolver resolver) { + this.prefix = prefix; + this.resolver = resolver; + } + + @Override + public <T> T resolveProperty(String name, Class<T> type) { + return resolver.resolveProperty(prefix + name, type); + } + + @Override + public <T> T resolveProperty(String name, T defaultValue) { + return resolver.resolveProperty(prefix + name, defaultValue); + } + } + + protected static class PrefixedConfiguration implements Configuration { + private final String prefix; + private final Configuration inner; + + private PrefixedConfiguration(String prefix, Configuration inner) { + this.prefix = prefix; + this.inner = inner; + } + + @Override + public RuntimeType getRuntimeType() { + return inner.getRuntimeType(); + } + + @Override + public Map<String, Object> getProperties() { + return new PrefixedMap<>(prefix, inner.getProperties()); + } + + @Override + public Object getProperty(String name) { + return inner.getProperty(prefix + name); + } + + @Override + public Collection<String> getPropertyNames() { + return inner.getPropertyNames(); + } + + @Override + public boolean isEnabled(Feature feature) { + return inner.isEnabled(feature); + } + + @Override + public boolean isEnabled(Class<? extends Feature> featureClass) { + return inner.isEnabled(featureClass); + } + + @Override + public boolean isRegistered(Object component) { + return inner.isRegistered(component); + } + + @Override + public boolean isRegistered(Class<?> componentClass) { + return inner.isRegistered(componentClass); + } + + @Override + public Map<Class<?>, Integer> getContracts(Class<?> componentClass) { + return inner.getContracts(componentClass); + } + + @Override + public Set<Class<?>> getClasses() { + return inner.getClasses(); + } + + @Override + public Set<Object> getInstances() { + return inner.getInstances(); + } + } +}
diff --git a/core-client/src/main/java/org/glassfish/jersey/client/innate/http/SSLParamConfigurator.java b/core-client/src/main/java/org/glassfish/jersey/client/innate/http/SSLParamConfigurator.java index 67d4a63..6667213 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/innate/http/SSLParamConfigurator.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/innate/http/SSLParamConfigurator.java
@@ -20,7 +20,6 @@ import org.glassfish.jersey.client.ClientRequest; import org.glassfish.jersey.http.HttpHeaders; import org.glassfish.jersey.internal.PropertiesResolver; -import org.glassfish.jersey.internal.guava.InetAddresses; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLParameters; @@ -52,6 +51,11 @@ private String sniHostNameHeader = null; private String sniHostPrecedence = null; private boolean setAlways = false; + private final SSLParamConfiguratorConfiguration configConfiguration; + + public Builder(SSLParamConfiguratorConfiguration configuration) { + this.configConfiguration = configuration; + } /** @@ -61,7 +65,7 @@ */ public Builder request(ClientRequest clientRequest) { this.sniHostNameHeader = getSniHostNameHeader(clientRequest.getHeaders()); - this.sniHostPrecedence = resolveSniHostNameProperty(clientRequest); + this.sniHostPrecedence = configConfiguration.resolveSniHostNameProperty(clientRequest); this.uri = clientRequest.getUri(); return this; } @@ -72,7 +76,7 @@ * @return the builder instance */ public Builder configuration(Configuration configuration) { - this.sniHostPrecedence = getSniHostNameProperty(configuration); + this.sniHostPrecedence = this.configConfiguration.getSniHostNameProperty(configuration); return this; } @@ -141,7 +145,7 @@ * @return the builder instance. */ public Builder setSNIHostName(Configuration configuration) { - return setSNIHostName(getSniHostNameProperty(configuration)); + return setSNIHostName(this.configConfiguration.getSniHostNameProperty(configuration)); } /** @@ -160,7 +164,7 @@ * @return the builder instance. */ public Builder setSNIHostName(PropertiesResolver resolver) { - return setSNIHostName(resolveSniHostNameProperty(resolver)); + return setSNIHostName(configConfiguration.resolveSniHostNameProperty(resolver)); } /** @@ -180,22 +184,6 @@ final String hostHeader = hostHeaders.get(0).toString(); return hostHeader; } - - private static String resolveSniHostNameProperty(PropertiesResolver resolver) { - String property = resolver.resolveProperty(ClientProperties.SNI_HOST_NAME, String.class); - if (property == null) { - property = resolver.resolveProperty(ClientProperties.SNI_HOST_NAME.toLowerCase(Locale.ROOT), String.class); - } - return property; - } - - private static String getSniHostNameProperty(Configuration configuration) { - Object property = configuration.getProperty(ClientProperties.SNI_HOST_NAME); - if (property == null) { - property = configuration.getProperty(ClientProperties.SNI_HOST_NAME.toLowerCase(Locale.ROOT)); - } - return (String) property; - } } private SSLParamConfigurator(SSLParamConfigurator.Builder builder) { @@ -212,7 +200,14 @@ * Create a new instance of TlsSupport class **/ public static SSLParamConfigurator.Builder builder() { - return new SSLParamConfigurator.Builder(); + return new SSLParamConfigurator.Builder(DEFAULT_CONFIGURATION); + } + + /** + * Create a new instance of TlsSupport class + **/ + public static SSLParamConfigurator.Builder builder(SSLParamConfiguratorConfiguration configuration) { + return new SSLParamConfigurator.Builder(configuration); } /** @@ -299,4 +294,25 @@ sslParameters.setEndpointIdentificationAlgorithm("HTTPS"); sslEngine.setSSLParameters(sslParameters); } + + public static interface SSLParamConfiguratorConfiguration { + public default String getSniHostNameProperty(Configuration configuration) { + Object property = configuration.getProperty(ClientProperties.SNI_HOST_NAME); + if (property == null) { + property = configuration.getProperty(ClientProperties.SNI_HOST_NAME.toLowerCase(Locale.ROOT)); + } + return (String) property; + } + + public default String resolveSniHostNameProperty(PropertiesResolver resolver) { + String property = resolver.resolveProperty(ClientProperties.SNI_HOST_NAME, String.class); + if (property == null) { + property = resolver.resolveProperty(ClientProperties.SNI_HOST_NAME.toLowerCase(Locale.ROOT), String.class); + } + return property; + } + } + + private static final SSLParamConfiguratorConfiguration DEFAULT_CONFIGURATION = new SSLParamConfiguratorConfiguration() { + }; }
diff --git a/core-client/src/main/java/org/glassfish/jersey/client/internal/HttpUrlConnector.java b/core-client/src/main/java/org/glassfish/jersey/client/internal/HttpUrlConnector.java index 630cb96..e1fd816 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/internal/HttpUrlConnector.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/internal/HttpUrlConnector.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025 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 @@ -52,6 +52,7 @@ import javax.net.ssl.SSLSocketFactory; import jakarta.ws.rs.ProcessingException; import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.core.Configuration; import jakarta.ws.rs.core.MultivaluedMap; import jakarta.ws.rs.core.Response; @@ -81,7 +82,6 @@ public class HttpUrlConnector implements Connector { private static final Logger LOGGER = Logger.getLogger(HttpUrlConnector.class.getName()); - private static final String ALLOW_RESTRICTED_HEADERS_SYSTEM_PROPERTY = "sun.net.http.allowRestrictedHeaders"; // Avoid multi-thread uses of HttpsURLConnection.getDefaultSSLSocketFactory() because it does not implement a // proper lazy-initialization. See https://github.com/jersey/jersey/issues/3293 private static final LazyValue<SSLSocketFactory> DEFAULT_SSL_SOCKET_FACTORY = @@ -110,11 +110,7 @@ } } - private final HttpUrlConnectorProvider.ConnectionFactory connectionFactory; - private final int chunkSize; - private final boolean fixLengthStreaming; - private final boolean setMethodWorkaround; - private final boolean isRestrictedHeaderPropertySet; + private final HttpUrlConnectorConfiguration.ReadWrite clientConfig; private Value<SSLSocketFactory> sslSocketFactory; // SSLContext#getSocketFactory not idempotent @@ -131,7 +127,7 @@ * @param client JAX-RS client instance for which the connector is being created. * @param connectionFactory {@link javax.net.ssl.HttpsURLConnection} factory to be used when creating connections. * @param chunkSize chunk size to use when using HTTP chunked transfer coding. - * @param fixLengthStreaming specify if the the {@link java.net.HttpURLConnection#setFixedLengthStreamingMode(int) + * @param fixLengthStreaming specify if the {@link java.net.HttpURLConnection#setFixedLengthStreamingMode(int) * fixed-length streaming mode} on the underlying HTTP URL connection instances should be * used when sending requests. * @param setMethodWorkaround specify if the reflection workaround should be used to set HTTP URL connection method @@ -144,29 +140,23 @@ final boolean fixLengthStreaming, final boolean setMethodWorkaround) { - this.connectionFactory = connectionFactory; - this.chunkSize = chunkSize; - this.fixLengthStreaming = fixLengthStreaming; - this.setMethodWorkaround = setMethodWorkaround; + this(client, client.getConfiguration(), + HttpUrlConnectorProvider.config() + .connectionFactory(connectionFactory) + .chunkSize(chunkSize) + .useFixedLengthStreaming(fixLengthStreaming) + .useSetMethodWorkaround(setMethodWorkaround) + ); + } + public HttpUrlConnector(Client client, Configuration configuration, HttpUrlConnectorConfiguration<?> config) { + this.clientConfig = config.rw().fromClient(configuration); this.sslSocketFactory = Values.lazy(new Value<SSLSocketFactory>() { @Override public SSLSocketFactory get() { return client.getSslContext().getSocketFactory(); } }); - - // check if sun.net.http.allowRestrictedHeaders system property has been set and log the result - // the property is being cached in the HttpURLConnection, so this is only informative - there might - // already be some connection(s), that existed before the property was set/changed. - isRestrictedHeaderPropertySet = Boolean.valueOf(AccessController.doPrivileged( - PropertiesHelper.getSystemProperty(ALLOW_RESTRICTED_HEADERS_SYSTEM_PROPERTY, "false") - )); - - LOGGER.config(isRestrictedHeaderPropertySet - ? LocalizationMessages.RESTRICTED_HEADER_PROPERTY_SETTING_TRUE(ALLOW_RESTRICTED_HEADERS_SYSTEM_PROPERTY) - : LocalizationMessages.RESTRICTED_HEADER_PROPERTY_SETTING_FALSE(ALLOW_RESTRICTED_HEADERS_SYSTEM_PROPERTY) - ); } private static InputStream getInputStream(final HttpURLConnection uc, final ClientRequest clientRequest) throws IOException { @@ -342,9 +332,15 @@ * @param clientRequest the actual client request. * @param uc http connection to be secured. */ - private void secureConnection( - final ClientRequest clientRequest, final HttpURLConnection uc, final SSLParamConfigurator sniConfig) { - setSslContextFactory(clientRequest.getClient(), clientRequest); + private void secureConnection(final ClientRequest clientRequest, + final HttpURLConnection uc, + final SSLParamConfigurator sniConfig, + final HttpUrlConnectorConfiguration.ReadWrite config) { + if (config.isSslContextSupplier() || config.isPrefixed()) { + setSslContextFactory(clientRequest.getClient(), clientRequest, config.sslContext(clientRequest)); + } else { + setSslContextFactory(clientRequest.getClient(), clientRequest); + } secureConnection(clientRequest.getClient(), uc); // keep this for compatibility if (sniConfig.isSNIRequired() && uc instanceof HttpsURLConnection) { // set SNI @@ -355,9 +351,17 @@ } } + @Deprecated protected void setSslContextFactory(Client client, ClientRequest request) { - final Supplier<SSLContext> supplier = request.resolveProperty(ClientProperties.SSL_CONTEXT_SUPPLIER, Supplier.class); + setSslContextFactory(client, request, request.resolveProperty(ClientProperties.SSL_CONTEXT_SUPPLIER, Supplier.class)); + } + protected void setSslContextFactory(Client client, ClientRequest request, + HttpUrlConnectorConfiguration.ReadWrite requestConfig) { + setSslContextFactory(client, request, requestConfig.sslContext(request)); + } + + private void setSslContextFactory(Client client, ClientRequest request, Supplier<SSLContext> supplier) { if (supplier != null) { sslSocketFactory = Values.lazy(new Value<SSLSocketFactory>() { // lazy for double-check locking if multiple requests @Override @@ -375,9 +379,10 @@ } private ClientResponse _apply(final ClientRequest request) throws IOException { + HttpUrlConnectorConfiguration.ReadWrite requestConfiguration = clientConfig.fromRequest(request); + final HttpURLConnection uc; - final Optional<ClientProxy> proxy = ClientProxy.proxyFromRequest(request); - final SSLParamConfigurator sniConfig = SSLParamConfigurator.builder().request(request) + final SSLParamConfigurator sniConfig = SSLParamConfigurator.builder(requestConfiguration).request(request) .setSNIHostName(request).build(); final URI sniUri; if (sniConfig.isSNIRequired()) { @@ -391,39 +396,45 @@ DEFAULT_SSL_SOCKET_FACTORY.get(); } + final Optional<ClientProxy> proxy = requestConfiguration.proxy(request, sniUri); proxy.ifPresent(clientProxy -> ClientProxy.setBasicAuthorizationHeader(request.getHeaders(), proxy.get())); - uc = this.connectionFactory.getConnection(sniUri.toURL(), proxy.isPresent() ? proxy.get().proxy() : null); + uc = ((Supplier<HttpUrlConnectorProvider.ConnectionFactory>) requestConfiguration.connectionFactory) + .get().getConnection(sniUri.toURL(), proxy.isPresent() ? proxy.get().proxy() : null); uc.setDoInput(true); final String httpMethod = request.getMethod(); - if (request.resolveProperty(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, setMethodWorkaround)) { + if (requestConfiguration.isMethodWorkaround(request)) { setRequestMethodViaJreBugWorkaround(uc, httpMethod); } else { uc.setRequestMethod(httpMethod); } - uc.setInstanceFollowRedirects(request.resolveProperty(ClientProperties.FOLLOW_REDIRECTS, true)); + uc.setInstanceFollowRedirects(requestConfiguration.followRedirects(request)); - uc.setConnectTimeout(request.resolveProperty(ClientProperties.CONNECT_TIMEOUT, uc.getConnectTimeout())); + if (requestConfiguration.connectTimeout() == 0) { + requestConfiguration.connectTimeout(uc.getConnectTimeout()); + } + uc.setConnectTimeout(requestConfiguration.connectTimeout(request)); - uc.setReadTimeout(request.resolveProperty(ClientProperties.READ_TIMEOUT, uc.getReadTimeout())); + if (requestConfiguration.readTimeout() == 0) { + requestConfiguration.readTimeout(uc.getReadTimeout()); + } + uc.setReadTimeout(requestConfiguration.readTimeout(request).readTimeout()); - secureConnection(request, uc, sniConfig); + secureConnection(request, uc, sniConfig, requestConfiguration); final Object entity = request.getEntity(); Exception storedException = null; try { if (entity != null) { - RequestEntityProcessing entityProcessing = request.resolveProperty( - ClientProperties.REQUEST_ENTITY_PROCESSING, RequestEntityProcessing.class); - + RequestEntityProcessing entityProcessing = requestConfiguration.requestEntityProcessing(request); final long length = request.getLengthLong(); - if (entityProcessing == null || entityProcessing != RequestEntityProcessing.BUFFERED) { - if (fixLengthStreaming && length > 0) { + if (entityProcessing != RequestEntityProcessing.BUFFERED) { + if (requestConfiguration.useFixedLengthStreaming.get() && length > 0) { uc.setFixedLengthStreamingMode(length); } else if (entityProcessing == RequestEntityProcessing.CHUNKED) { - uc.setChunkedStreamingMode(chunkSize); + uc.setChunkedStreamingMode(requestConfiguration.chunkSize.get()); } } uc.setDoOutput(true); @@ -438,13 +449,13 @@ processExtensions(request, uc); request.setStreamProvider(contentLength -> { - setOutboundHeaders(request.getStringHeaders(), uc); + setOutboundHeaders(request.getStringHeaders(), uc, requestConfiguration); return uc.getOutputStream(); }); request.writeEntity(); } else { - setOutboundHeaders(request.getStringHeaders(), uc); + setOutboundHeaders(request.getStringHeaders(), uc, requestConfiguration); } } catch (IOException ioe) { storedException = handleException(request, ioe, uc); @@ -496,7 +507,9 @@ return responseContext; } - private void setOutboundHeaders(MultivaluedMap<String, String> headers, HttpURLConnection uc) { + private void setOutboundHeaders(MultivaluedMap<String, String> headers, + HttpURLConnection uc, + HttpUrlConnectorConfiguration.ReadWrite requestConfiguration) { boolean restrictedSent = false; for (Map.Entry<String, List<String>> header : headers.entrySet()) { String headerName = header.getKey(); @@ -520,14 +533,15 @@ uc.setRequestProperty(headerName, headerValue); } // if (at least one) restricted header was added and the allowRestrictedHeaders - if (!isRestrictedHeaderPropertySet && !restrictedSent) { + if (!requestConfiguration.isRestrictedHeaderPropertySet.get() && !restrictedSent) { if (isHeaderRestricted(headerName, headerValue)) { restrictedSent = true; } } } if (restrictedSent) { - LOGGER.warning(LocalizationMessages.RESTRICTED_HEADER_POSSIBLY_IGNORED(ALLOW_RESTRICTED_HEADERS_SYSTEM_PROPERTY)); + LOGGER.warning(LocalizationMessages.RESTRICTED_HEADER_POSSIBLY_IGNORED( + HttpUrlConnectorConfiguration.ALLOW_RESTRICTED_HEADERS_SYSTEM_PROPERTY)); } } @@ -635,7 +649,7 @@ private static class SniSSLSocketFactory extends SSLSocketFactory { private final SSLSocketFactory socketFactory; - private ThreadLocal<SSLParamConfigurator> sniConfigs = new ThreadLocal<>(); + private final ThreadLocal<SSLParamConfigurator> sniConfigs = new ThreadLocal<>(); public void setSniConfig(SSLParamConfigurator sniConfigs) { this.sniConfigs.set(sniConfigs);
diff --git a/core-client/src/main/java/org/glassfish/jersey/client/internal/HttpUrlConnectorConfiguration.java b/core-client/src/main/java/org/glassfish/jersey/client/internal/HttpUrlConnectorConfiguration.java new file mode 100644 index 0000000..20c31f7 --- /dev/null +++ b/core-client/src/main/java/org/glassfish/jersey/client/internal/HttpUrlConnectorConfiguration.java
@@ -0,0 +1,312 @@ +/* + * Copyright (c) 2025 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.client.internal; + +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.ClientRequest; +import org.glassfish.jersey.client.HttpUrlConnectorProvider; +import org.glassfish.jersey.client.innate.ConnectorConfiguration; +import org.glassfish.jersey.internal.util.PropertiesHelper; +import org.glassfish.jersey.internal.util.collection.Ref; + +import javax.net.ssl.SSLContext; +import jakarta.ws.rs.core.Configuration; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.Proxy; +import java.net.URL; +import java.security.AccessController; +import java.util.Collections; +import java.util.Map; +import java.util.Objects; +import java.util.function.Supplier; +import java.util.logging.Logger; + +public abstract class HttpUrlConnectorConfiguration<C extends HttpUrlConnectorConfiguration<C>> + extends ConnectorConfiguration<C> { + private static final Logger LOGGER = Logger.getLogger(HttpUrlConnectorConfiguration.class.getName()); + /* package */ static final String ALLOW_RESTRICTED_HEADERS_SYSTEM_PROPERTY = "sun.net.http.allowRestrictedHeaders"; + /** + * Default connection factory to be used. + */ + protected static final HttpUrlConnectorProvider.ConnectionFactory DEFAULT_CONNECTION_FACTORY = + new DefaultConnectionFactory(); + + protected NullableRef<HttpUrlConnectorProvider.ConnectionFactory> connectionFactory = NullableRef.empty(); + protected Ref<Integer> chunkSize = NullableRef.empty(); + /* package */ Ref<Boolean> isRestrictedHeaderPropertySet = NullableRef.empty(); + protected Ref<Boolean> useFixedLengthStreaming = NullableRef.empty(); + protected Ref<Boolean> useSetMethodWorkaround = NullableRef.empty(); + + protected void preInit(Map<String, Object> properties) { + connectionFactory.ifEmptySet(DEFAULT_CONNECTION_FACTORY); + ((NullableRef<Integer>) chunkSize).ifEmptySet(ClientProperties.DEFAULT_CHUNK_SIZE); + ((NullableRef<Boolean>) useFixedLengthStreaming).ifEmptySet(Boolean.FALSE); + ((NullableRef<Boolean>) useSetMethodWorkaround).ifEmptySet(Boolean.FALSE); + + int computedChunkSize = ClientProperties.getValue(properties, + _prefixed(ClientProperties.CHUNKED_ENCODING_SIZE), chunkSize.get(), Integer.class); + if (computedChunkSize < 0) { + LOGGER.warning(LocalizationMessages.NEGATIVE_CHUNK_SIZE(computedChunkSize, chunkSize.get())); + } else { + chunkSize.set(computedChunkSize); + } + + useFixedLengthStreaming(ClientProperties.getValue(properties, + _prefixed(HttpUrlConnectorProvider.USE_FIXED_LENGTH_STREAMING), + useFixedLengthStreaming.get(), Boolean.class)); + useSetMethodWorkaround(ClientProperties.getValue(properties, + _prefixed(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND), + useSetMethodWorkaround.get(), Boolean.class)); + } + + private String _prefixed(String property) { + return prefix.ifPresentOrElse("") + property; + } + + /** + * Set a custom {@link java.net.HttpURLConnection} factory. + * + * @param connectionFactory custom HTTP URL connection factory. Must not be {@code null}. + * @return updated configuration. + * @throws java.lang.NullPointerException in case the supplied connectionFactory is {@code null}. + */ + public C connectionFactory(final HttpUrlConnectorProvider.ConnectionFactory connectionFactory) { + if (connectionFactory == null) { + throw new NullPointerException(LocalizationMessages.NULL_INPUT_PARAMETER("connectionFactory")); + } + + this.connectionFactory.set(connectionFactory); + return self(); + } + + /** + * Set chunk size for requests transferred using a + * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1">HTTP chunked transfer coding</a>. + * + * If no value is set, the default chunk size of 4096 bytes will be used. + * <p> + * Note that this programmatically set value can be overridden by + * setting the {@link org.glassfish.jersey.client.ClientProperties#CHUNKED_ENCODING_SIZE} property + * specified in the Jersey client instance configuration. + * </p> + * + * @param chunkSize chunked transfer coding chunk size to be used. + * @return updated configuration. + * @throws java.lang.IllegalArgumentException in case the specified chunk size is negative. + */ + public C chunkSize(final int chunkSize) { + if (chunkSize < 0) { + throw new IllegalArgumentException(LocalizationMessages.NEGATIVE_INPUT_PARAMETER("chunkSize")); + } + this.chunkSize.set(chunkSize); + return self(); + } + + /** + * Instruct the provided connectors to use the {@link java.net.HttpURLConnection#setFixedLengthStreamingMode(int) + * fixed-length streaming mode} on the underlying HTTP URL connection instance when sending requests. + * See {@link HttpUrlConnectorProvider#USE_FIXED_LENGTH_STREAMING} property documentation for more details. + * <p> + * Note that this programmatically set value can be overridden by + * setting the {@code USE_FIXED_LENGTH_STREAMING} property specified in the Jersey client instance configuration. + * </p> + * + * @return updated configuration. + */ + public C useFixedLengthStreaming(boolean use) { + this.useFixedLengthStreaming.set(use); + return self(); + } + + /** + * Instruct the provided connectors to use reflection when setting the + * HTTP method value. See {@link HttpUrlConnectorProvider#SET_METHOD_WORKAROUND} property documentation for more details. + * <p> + * Note that this programmatically set value can be overridden by + * setting the {@code SET_METHOD_WORKAROUND} property specified in the Jersey client instance configuration + * or in the request properties. + * </p> + * + * @return updated configuration. + */ + public C useSetMethodWorkaround(boolean use) { + this.useSetMethodWorkaround.set(use); + return self(); + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + final HttpUrlConnectorConfiguration<?> that = (HttpUrlConnectorConfiguration<?>) o; + + if (!chunkSize.equals(that.chunkSize)) { + return false; + } + if (!useFixedLengthStreaming.equals(that.useFixedLengthStreaming)) { + return false; + } + if (!useSetMethodWorkaround.equals(that.useSetMethodWorkaround)) { + return false; + } + if (!isRestrictedHeaderPropertySet.equals(that.isRestrictedHeaderPropertySet)) { + return false; + } + + return connectionFactory.equals(that.connectionFactory); + } + + @Override + public int hashCode() { + return Objects.hash(connectionFactory, chunkSize, useFixedLengthStreaming, + useSetMethodWorkaround, isRestrictedHeaderPropertySet); + } + + /* package */ ReadWrite rw() { + final ReadWrite readWrite = this instanceof ReadWrite ? ((ReadWrite) this).instance() : new ReadWrite(); + readWrite.setNonEmpty(this); + return readWrite; + } + + protected static class ReadWrite + extends HttpUrlConnectorConfiguration<ReadWrite> + implements ConnectorConfiguration.Read<ReadWrite> { + + @Override + public <X extends ConnectorConfiguration<?>> void setNonEmpty(X otherC) { + HttpUrlConnectorConfiguration<?> other = (HttpUrlConnectorConfiguration<?>) otherC; + Read.super.setNonEmpty(other); + + this.connectionFactory.setNonEmpty(other.connectionFactory); + ((NullableRef<Integer>) this.chunkSize).setNonEmpty((NullableRef<Integer>) other.chunkSize); + ((NullableRef<Boolean>) this.isRestrictedHeaderPropertySet).setNonEmpty( + (NullableRef<Boolean>) other.isRestrictedHeaderPropertySet); + ((NullableRef<Boolean>) this.useFixedLengthStreaming).setNonEmpty( + (NullableRef<Boolean>) other.useFixedLengthStreaming); + ((NullableRef<Boolean>) this.useSetMethodWorkaround).setNonEmpty((NullableRef<Boolean>) other.useSetMethodWorkaround); + } + + @Override + public ReadWrite init() { + ConnectorConfiguration.Read.super.init(); + preInit(Collections.emptyMap()); + isRestrictedHeaderPropertySet.set(Boolean.FALSE); + return self(); + } + + ReadWrite fromClient(Configuration configuration) { + ReadWrite clientConfiguration = copyFromClient(configuration); + clientConfiguration.preInit(configuration.getProperties()); + + // check if sun.net.http.allowRestrictedHeaders system property has been set and log the result + // the property is being cached in the HttpURLConnection, so this is only informative - there might + // already be some connection(s), that existed before the property was set/changed. + isRestrictedHeaderPropertySet.set(Boolean.valueOf(AccessController.doPrivileged( + PropertiesHelper.getSystemProperty(ALLOW_RESTRICTED_HEADERS_SYSTEM_PROPERTY, "false") + ))); + + LOGGER.config(isRestrictedHeaderPropertySet.get() + ? LocalizationMessages.RESTRICTED_HEADER_PROPERTY_SETTING_TRUE(ALLOW_RESTRICTED_HEADERS_SYSTEM_PROPERTY) + : LocalizationMessages.RESTRICTED_HEADER_PROPERTY_SETTING_FALSE(ALLOW_RESTRICTED_HEADERS_SYSTEM_PROPERTY) + ); + + return clientConfiguration; + } + + ReadWrite fromRequest(ClientRequest request) { + ReadWrite requestConfiguration = copyFromRequest(request); + requestConfiguration.chunkSize( + request.resolveProperty(prefixed(ClientProperties.CHUNKED_ENCODING_SIZE), + requestConfiguration.chunkSize.get())); + requestConfiguration.useFixedLengthStreaming( + request.resolveProperty(prefixed(HttpUrlConnectorProvider.USE_FIXED_LENGTH_STREAMING), + requestConfiguration.useFixedLengthStreaming.get())); + requestConfiguration.useSetMethodWorkaround( + request.resolveProperty(prefixed(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND), + requestConfiguration.useSetMethodWorkaround.get())); + + return requestConfiguration; + } + + @Override + public ReadWrite instance() { + return new ReadWrite(); + } + + @Override + public ReadWrite me() { + return this; + } + + public boolean isMethodWorkaround(ClientRequest request) { + return request.resolveProperty( + prefixed(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND), useSetMethodWorkaround.get()); + } + + public boolean isPrefixed() { + return !prefix.get().isEmpty(); + } + + public boolean isSslContextSupplier() { + return sslContextSupplier.get() != null; + } + + /** + * Get {@link SSLContext} either from the {@link ClientProperties#SSL_CONTEXT_SUPPLIER}, or from this configuration. + * + * @param request the request used to get the {@link SSLContext}. + * @return the {@link SSLContext} supplier. + */ + public Supplier<SSLContext> sslContext(ClientRequest request) { + @SuppressWarnings("unchecked") + Supplier<SSLContext> supplier = + request.resolveProperty(prefixed(ClientProperties.SSL_CONTEXT_SUPPLIER), Supplier.class); + if (supplier == null) { + supplier = self().sslContextSupplier.get(); + } + return supplier; + } + + @Override + public ReadWrite self() { + return this; + } + } + + private static class DefaultConnectionFactory implements HttpUrlConnectorProvider.ConnectionFactory { + + @Override + public HttpURLConnection getConnection(final URL url) throws IOException { + 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 { + return (proxy == null) ? (HttpURLConnection) url.openConnection() : (HttpURLConnection) url.openConnection(proxy); + } + } +}
diff --git a/core-client/src/test/java/org/glassfish/jersey/client/AbortTest.java b/core-client/src/test/java/org/glassfish/jersey/client/AbortTest.java index 1bac330..974cbe9 100644 --- a/core-client/src/test/java/org/glassfish/jersey/client/AbortTest.java +++ b/core-client/src/test/java/org/glassfish/jersey/client/AbortTest.java
@@ -53,6 +53,7 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.concurrent.CompletionStage; import java.util.concurrent.atomic.AtomicReference; @@ -225,6 +226,43 @@ } } + @Test + public void testResponseContextCaseInsensitiveKeys() { + try (Response response = ClientBuilder.newClient() + .register(new ClientRequestFilter() { + @Override + public void filter(ClientRequestContext requestContext) throws IOException { + requestContext.abortWith(Response.ok() + .header("header1", "value") + .header("header1", "value1 , value2") + .header("header1", "Value3,white space ") + .header("header2", "Value4;;Value5") + .build()); + } + }) + .register(new ClientResponseFilter() { + @Override + public void filter(ClientRequestContext requestContext, ClientResponseContext context) { + Assertions.assertTrue(context.getHeaderString("header1").contains("value")); + Assertions.assertTrue(context.getHeaderString("HEADER1").contains("value2")); + //White space in value not trimmed + Assertions.assertFalse(context.getHeaderString("header1").contains("whitespace")); + //Multiple character separator + Assertions.assertTrue(context.getHeaderString("header2").contains("Value5")); + + Assertions.assertTrue(context.getHeaders().containsKey("HEADer1")); + Assertions.assertFalse(context.getHeaders().get("HEADer1").isEmpty()); + Assertions.assertFalse(context.getHeaders().remove("HeAdEr1").isEmpty()); + Assertions.assertFalse(context.getHeaders().containsKey("header1")); + } + }) + .target("http://localhost:8080") + .request() + .get()) { + Assertions.assertEquals(200, response.getStatus()); + } + } + private static class StringHeader extends AtomicReference<String> { }
diff --git a/core-client/src/test/java/org/glassfish/jersey/client/HttpUrlConnectorConfigurationTest.java b/core-client/src/test/java/org/glassfish/jersey/client/HttpUrlConnectorConfigurationTest.java new file mode 100644 index 0000000..5e31e48 --- /dev/null +++ b/core-client/src/test/java/org/glassfish/jersey/client/HttpUrlConnectorConfigurationTest.java
@@ -0,0 +1,793 @@ +/* + * Copyright (c) 2025 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.client; + +import org.glassfish.jersey.client.innate.ClientProxy; +import org.glassfish.jersey.client.innate.ConnectorConfiguration; +import org.glassfish.jersey.client.internal.HttpUrlConnector; +import org.glassfish.jersey.client.internal.HttpUrlConnectorConfiguration; +import org.glassfish.jersey.http.HttpHeaders; +import org.glassfish.jersey.internal.MapPropertiesDelegate; +import org.glassfish.jersey.internal.util.JdkVersion; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import javax.net.ssl.SSLContext; +import jakarta.ws.rs.ProcessingException; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.core.MultivaluedMap; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.InetSocketAddress; +import java.net.ProtocolException; +import java.net.URI; +import java.net.URL; +import java.util.Optional; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; +import java.util.function.Supplier; + +public class HttpUrlConnectorConfigurationTest { + + public static final String PREFIX = "test."; + + @Test + public void testConnectTimeout() { + final AtomicInteger result = new AtomicInteger(0); + class RWConnect extends Conf.RW { + @Override + public int connectTimeout(ClientRequest request) { + result.set(super.connectTimeout(request)); + throw new IllegalStateException(); + } + + @Override + public RWConnect instance() { + return new RWConnect(); + } + + } + new TestClient(new RWConnect()).rw(rw -> rw.connectTimeout(1000)).request().apply(); + Assertions.assertEquals(1000, result.get()); + + result.set(0); + new TestClient(new RWConnect()).rw(rw -> rw.connectTimeout(1000)) + .client(c -> c.property(ClientProperties.CONNECT_TIMEOUT, 3000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWConnect().connectTimeout(2000))) + .request().apply(); + Assertions.assertEquals(3000, result.get()); + + result.set(0); + new TestClient(new RWConnect()).rw(rw -> rw.connectTimeout(1000)) + .client(c -> c.property(ClientProperties.CONNECT_TIMEOUT, 3000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWConnect().connectTimeout(2000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWConnect().connectTimeout(4000))) + .apply(); + Assertions.assertEquals(3000, result.get()); + + result.set(0); + new TestClient(new RWConnect()).rw(rw -> rw.connectTimeout(1000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWConnect().connectTimeout(2000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWConnect().connectTimeout(4000))) + .apply(); + Assertions.assertEquals(4000, result.get()); + + result.set(0); + new TestClient(new RWConnect()).rw(rw -> rw.connectTimeout(1000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWConnect().connectTimeout(2000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWConnect().connectTimeout(4000))) + .request(r -> r.setProperty(ClientProperties.CONNECT_TIMEOUT, 5000)) + .apply(); + Assertions.assertEquals(5000, result.get()); + + result.set(0); + new TestClient(new RWConnect()).rw(rw -> rw.connectTimeout(1000).prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + HttpUrlConnectorProvider.config().connectTimeout(2000).prefix(PREFIX))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWConnect().connectTimeout(4000))) + .apply(); + Assertions.assertEquals(2000, result.get()); + + result.set(0); + new TestClient(new RWConnect()).rw(rw -> rw.connectTimeout(1000).prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWConnect().connectTimeout(2000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + HttpUrlConnectorProvider.config().connectTimeout(4000).prefix(PREFIX))) + .request(r -> r.setProperty(ClientProperties.CONNECT_TIMEOUT, 5000)) + .apply(); + Assertions.assertEquals(4000, result.get()); + } + + @Test + public void testFollowRedirects() { + final AtomicReference<Boolean> result = new AtomicReference<>(); + class RWFollow extends Conf.RW { + + @Override + public boolean followRedirects(ClientRequest request) { + result.set(super.followRedirects(request)); + throw new IllegalStateException(); + } + + @Override + public RWFollow instance() { + return new RWFollow(); + } + } + + Request req; + req = new TestClient(new RWFollow()).request().apply(); + Assertions.assertEquals(((RWFollow) new RWFollow().copy()).followRedirects(), result.get()); + + result.set(null); + req = new TestClient(new RWFollow().followRedirects(false)).request().apply(); + Assertions.assertEquals(false, result.get()); + + result.set(null); + req = new TestClient(new RWFollow().prefix(PREFIX).followRedirects(false)) + .request(r -> r.setProperty(PREFIX + ClientProperties.FOLLOW_REDIRECTS, true)) + .apply(); + Assertions.assertEquals(true, result.get()); + + result.set(null); + req = new TestClient(new RWFollow().prefix(PREFIX).followRedirects(false)) + .request(r -> r.setProperty( + PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, new RWFollow().followRedirects(true))) + .apply(); + Assertions.assertEquals(true, result.get()); + + result.set(null); + req = new TestClient(new RWFollow()) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWFollow().followRedirects(false))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWFollow().followRedirects(true))) + .request(r -> r.setEntity(PREFIX)).apply(); + Assertions.assertEquals(true, result.get()); + + result.set(null); + req = new TestClient(new RWFollow().prefix(PREFIX)) + .client(c -> c.property(PREFIX + ClientProperties.FOLLOW_REDIRECTS, false)) + .request(r -> r.setProperty(PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, + new RWFollow().followRedirects(true))) + .request(r -> r.setEntity(PREFIX)).apply(); + Assertions.assertEquals(false, result.get()); + } + + @Test + public void testProxy() { + final AtomicReference<ClientProxy> result = new AtomicReference<>(); + class RWProxy extends Conf.RW { + + @Override + public Optional<ClientProxy> proxy(ClientRequest request, URI requestUri) { + Optional<ClientProxy> proxy = super.proxy(request, requestUri); + result.set(proxy.orElse(null)); + throw new IllegalStateException(); + } + + @Override + public RWProxy instance() { + return new RWProxy(); + } + } + String proxyUri = "http://proxy.org:8080"; + String userName = "USERNAME"; + String password = "PASSWORD"; + + new TestClient(new RWProxy()).request().apply(); + Assertions.assertNull(result.get()); + + result.set(null); + new TestClient(new RWProxy()).rw(rw -> rw.proxyUri(proxyUri).proxyUserName(userName).proxyPassword(password)) + .request().apply(); + Assertions.assertEquals(proxyUri, result.get().uri().toASCIIString()); + Assertions.assertEquals(userName, result.get().userName()); + Assertions.assertEquals(password, result.get().password()); + + result.set(null); + new TestClient(new RWProxy()).rw(rw -> rw.prefix(PREFIX).proxyUri(proxyUri).proxyUserName("XXX").proxyPassword(password)) + .request(r -> r.setProperty(PREFIX + ClientProperties.PROXY_USERNAME, userName)) + .request(r -> r.setProperty(ClientProperties.PROXY_PASSWORD, "XXX")) + .apply(); + Assertions.assertEquals(proxyUri, result.get().uri().toASCIIString()); + Assertions.assertEquals(userName, result.get().userName()); + Assertions.assertEquals(password, result.get().password()); + + result.set(null); + new TestClient(new RWProxy()).rw(rw -> rw.prefix(PREFIX).proxyUri(proxyUri).proxyUserName("XXX").proxyPassword(password)) + .request(r -> r.setProperty(PREFIX + ClientProperties.CONNECTOR_CONFIGURATION, + HttpUrlConnectorProvider.config().proxyUserName(userName).proxyPassword(null))) + .apply(); + Assertions.assertEquals(proxyUri, result.get().uri().toASCIIString()); + Assertions.assertEquals(userName, result.get().userName()); + Assertions.assertNull(result.get().password()); + + result.set(null); + new TestClient(new RWProxy().prefix(PREFIX) + .proxy(new java.net.Proxy(java.net.Proxy.Type.HTTP, + new InetSocketAddress(proxyUri.split("g:")[0] + "g", Integer.parseInt(proxyUri.split("g:")[1]))))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + HttpUrlConnectorProvider.config().proxyUserName(userName).proxyPassword(password).prefix(PREFIX))) + .apply(); + Assertions.assertEquals(proxyUri, result.get().uri().toASCIIString()); + Assertions.assertEquals(userName, result.get().userName()); + Assertions.assertEquals(password, result.get().password()); + } + + @Test + public void testReadTimeout() { + final AtomicInteger result = new AtomicInteger(0); + class RWRead extends Conf.RW { + + @Override + public RWRead readTimeout(ClientRequest clientRequest) { + super.readTimeout(clientRequest); + result.set(readTimeout()); + throw new IllegalStateException(); + } + + @Override + public RWRead instance() { + return new RWRead(); + } + } + new TestClient(new RWRead()).rw(rw -> rw.readTimeout(1000)).request().apply(); + Assertions.assertEquals(1000, result.get()); + + result.set(0); + new TestClient(new RWRead()).rw(rw -> rw.readTimeout(1000)) + .client(c -> c.property(ClientProperties.READ_TIMEOUT, 3000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWRead().readTimeout(2000))) + .request().apply(); + Assertions.assertEquals(3000, result.get()); + + result.set(0); + new TestClient(new RWRead()).rw(rw -> rw.readTimeout(1000)) + .client(c -> c.property(ClientProperties.READ_TIMEOUT, 3000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWRead().connectTimeout(2000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, new RWRead().readTimeout(4000))) + .apply(); + Assertions.assertEquals(3000, result.get()); + + result.set(0); + new TestClient(new RWRead()).rw(rw -> rw.readTimeout(1000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWRead().readTimeout(2000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, new RWRead().readTimeout(4000))) + .apply(); + Assertions.assertEquals(4000, result.get()); + + result.set(0); + new TestClient(new RWRead()).rw(rw -> rw.readTimeout(1000)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWRead().readTimeout(2000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, new RWRead().readTimeout(4000))) + .request(r -> r.setProperty(ClientProperties.READ_TIMEOUT, 5000)) + .apply(); + Assertions.assertEquals(5000, result.get()); + + result.set(0); + new TestClient(new RWRead()).rw(rw -> rw.readTimeout(1000).prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + HttpUrlConnectorProvider.config().readTimeout(2000).prefix(PREFIX))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWRead().readTimeout(4000))) + .apply(); + Assertions.assertEquals(2000, result.get()); + + result.set(0); + new TestClient(new RWRead()).rw(rw -> rw.readTimeout(1000).prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, new RWRead().readTimeout(2000))) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + HttpUrlConnectorProvider.config().readTimeout(4000).prefix(PREFIX))) + .request(r -> r.setProperty(ClientProperties.READ_TIMEOUT, 5000)) + .apply(); + Assertions.assertEquals(4000, result.get()); + } + + @Test + public void testRequestEntityProcessing() { + final AtomicReference<RequestEntityProcessing> result = new AtomicReference<>(); + final AtomicReference<Conf.RW> config = new AtomicReference<>(); + class RWRP extends Conf.RW { + + @Override + public RequestEntityProcessing requestEntityProcessing(ClientRequest request) { + result.set(super.requestEntityProcessing(request)); + throw new IllegalStateException(); + } + + @Override + public RWRP instance() { + config.set(new RWRP()); + return (RWRP) config.get(); + } + } + + Request req; + req = new TestClient(new RWRP().requestEntityProcessing(RequestEntityProcessing.CHUNKED)) + .request(r -> r.setEntity(PREFIX)).apply(); + Assertions.assertEquals(RequestEntityProcessing.CHUNKED, result.get()); + + result.set(null); + req = new TestClient(new RWRP().prefix(PREFIX).requestEntityProcessing(RequestEntityProcessing.CHUNKED)) + .request(r -> r.setEntity(PREFIX)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + HttpUrlConnectorProvider.config() + .requestEntityProcessing(RequestEntityProcessing.BUFFERED).prefix(PREFIX))) + .apply(); + Assertions.assertEquals(RequestEntityProcessing.BUFFERED, result.get()); + + result.set(null); + req = new TestClient(new RWRP().prefix(PREFIX).requestEntityProcessing(RequestEntityProcessing.CHUNKED)) + .request(r -> r.setEntity(PREFIX)) + .request(r -> r.setProperty(PREFIX + ClientProperties.REQUEST_ENTITY_PROCESSING, + RequestEntityProcessing.BUFFERED)) + .apply(); + Assertions.assertEquals(RequestEntityProcessing.BUFFERED, result.get()); + } + + @Test + public void testSslContext() { + final SSLContext testContext = new SSLContext(null, null, null){}; + final AtomicReference<SSLContext> result = new AtomicReference<>(); + final AtomicReference<Conf.RW> config = new AtomicReference<>(); + class RWSsl extends Conf.RW { + + @Override + public SSLContext sslContext(Client client, ClientRequest request) { + result.set(super.sslContext(client, request)); + return result.get(); + } + + @Override + public boolean isSslContextSupplier() { + throw new IllegalStateException(); + } + + @Override + public RWSsl instance() { + RWSsl rw = new RWSsl(); + config.set(rw); + return rw; + } + } + + Request req; + req = new TestClient(new RWSsl().sslContextSupplier(() -> testContext)).request().apply(); + config.get().sslContext(req.client, req.request); + Assertions.assertEquals(testContext, result.get()); + + result.set(null); + req = new TestClient(new RWSsl().prefix(PREFIX)) + .request(r -> r.setProperty(PREFIX + ClientProperties.SSL_CONTEXT_SUPPLIER, + (Supplier<SSLContext>) () -> testContext)).apply(); + config.get().sslContext(req.client, req.request); + Assertions.assertEquals(testContext, result.get()); + + result.set(null); + req = new TestClient(new RWSsl().prefix(PREFIX)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + new RWSsl().prefix(PREFIX).sslContextSupplier(() -> testContext))).apply(); + config.get().sslContext(req.client, req.request); + Assertions.assertEquals(testContext, result.get()); + } + + @Test + public void testConnectionFactory() { + final AtomicReference<Boolean> result = new AtomicReference<>(); + final HttpUrlConnectorProvider.ConnectionFactory connectionFactory = new HttpUrlConnectorProvider.ConnectionFactory() { + @Override + public HttpURLConnection getConnection(URL url) throws IOException { + result.set(true); + throw new IllegalStateException(); + } + }; + + new TestClient(HttpUrlConnectorProvider.config().connectionFactory(connectionFactory)).request().apply(); + Assertions.assertTrue(result.get()); + + result.set(null); + new TestClient(HttpUrlConnectorProvider.config().prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + HttpUrlConnectorProvider.config().connectionFactory(connectionFactory))) + .request().apply(); + Assertions.assertNull(result.get()); + + result.set(null); + new TestClient(HttpUrlConnectorProvider.config().prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + HttpUrlConnectorProvider.config().connectionFactory(connectionFactory).prefix(PREFIX))) + .request().apply(); + Assertions.assertTrue(result.get()); + + result.set(null); + new TestClient(HttpUrlConnectorProvider.config().prefix(PREFIX)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + HttpUrlConnectorProvider.config().connectionFactory(connectionFactory).prefix(PREFIX))) + .apply(); + Assertions.assertTrue(result.get()); + + result.set(null); + Client client = ClientBuilder.newClient(); + try { + HttpUrlConnectorProvider.config().build() + .connectionFactory(connectionFactory) + .getConnector(client, client.getConfiguration()).apply(Request.createRequest(client)); + } catch (IllegalStateException ise) { + // expected + } + Assertions.assertTrue(result.get()); + } + + @Test + public void testChunkSize() { + final AtomicReference<Integer> result = new AtomicReference<>(); + final HttpUrlConnectorProvider.ConnectionFactory connectionFactory = new HttpUrlConnectorProvider.ConnectionFactory() { + @Override + public HttpURLConnection getConnection(URL url) throws IOException { + return new HttpURLConnection(url) { + @Override + public void disconnect() { + + } + + @Override + public boolean usingProxy() { + return false; + } + + @Override + public void connect() throws IOException { + + } + + @Override + public void setChunkedStreamingMode(int chunklen) { + result.set(chunklen); + throw new IllegalStateException(); + } + }; + } + }; + + new TestClient(HttpUrlConnectorProvider.config() + .requestEntityProcessing(RequestEntityProcessing.CHUNKED) + .connectionFactory(connectionFactory)) + .request(r -> r.setEntity(PREFIX)).apply(); + Assertions.assertEquals(ClientProperties.DEFAULT_CHUNK_SIZE, result.get()); + + result.set(null); + new TestClient(HttpUrlConnectorProvider.config() + .requestEntityProcessing(RequestEntityProcessing.CHUNKED) + .connectionFactory(connectionFactory) + .chunkSize(1000)) + .request(r -> r.setEntity(PREFIX)).apply(); + Assertions.assertEquals(1000, result.get()); + + result.set(null); + new TestClient(HttpUrlConnectorProvider.config() + .requestEntityProcessing(RequestEntityProcessing.CHUNKED) + .connectionFactory(connectionFactory) + .chunkSize(1000) + .prefix(PREFIX)) + .client(c -> c.property(PREFIX + ClientProperties.CHUNKED_ENCODING_SIZE, 2000)) + .request(r -> r.setEntity(PREFIX)).apply(); + Assertions.assertEquals(2000, result.get()); + + result.set(null); + new TestClient(HttpUrlConnectorProvider.config() + .requestEntityProcessing(RequestEntityProcessing.CHUNKED) + .connectionFactory(connectionFactory) + .chunkSize(1000) + .prefix(PREFIX)) + .request(r -> r.setProperty(PREFIX + ClientProperties.CHUNKED_ENCODING_SIZE, 2000)) + .request(r -> r.setEntity(PREFIX)).apply(); + Assertions.assertEquals(2000, result.get()); + + result.set(null); + new TestClient(HttpUrlConnectorProvider.config() + .requestEntityProcessing(RequestEntityProcessing.CHUNKED) + .connectionFactory(connectionFactory) + .chunkSize(1000) + .prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + HttpUrlConnectorProvider.config().chunkSize(2000).prefix(PREFIX))) + .request(r -> r.setEntity(PREFIX)).apply(); + Assertions.assertEquals(2000, result.get()); + + result.set(null); + new TestClient(HttpUrlConnectorProvider.config() + .requestEntityProcessing(RequestEntityProcessing.CHUNKED) + .connectionFactory(connectionFactory) + .chunkSize(1000) + .prefix(PREFIX)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + HttpUrlConnectorProvider.config().chunkSize(2000).prefix(PREFIX))) + .request(r -> r.setEntity(PREFIX)).apply(); + Assertions.assertEquals(2000, result.get()); + } + + @Test + public void testUseFixedLengthStreaming() { + final AtomicReference<Integer> result = new AtomicReference<>(); + final class FixedLengthStreamingUrlConnection extends HttpURLConnection { + private FixedLengthStreamingUrlConnection(URL u) { + super(u); + } + + @Override + public void disconnect() { + + } + + @Override + public boolean usingProxy() { + return false; + } + + @Override + public void connect() throws IOException { + + } + + @Override + public void setFixedLengthStreamingMode(long contentLength) { + super.setFixedLengthStreamingMode(contentLength); + result.set((int) contentLength); + throw new IllegalStateException(); + } + } + final HttpUrlConnectorProvider.ConnectionFactory connectionFactory = new HttpUrlConnectorProvider.ConnectionFactory() { + @Override + public HttpURLConnection getConnection(URL url) throws IOException { + return new FixedLengthStreamingUrlConnection(url); + } + }; + + new TestClient(HttpUrlConnectorProvider.config() + .connectionFactory(connectionFactory)) + .request(r -> r.getRequestHeaders().add(HttpHeaders.CONTENT_LENGTH, String.valueOf(PREFIX.length()))) + .request(r -> r.setEntity(PREFIX)).apply(); + Assertions.assertNull(result.get()); + + result.set(null); + new TestClient(HttpUrlConnectorProvider.config() + .connectionFactory(connectionFactory) + .useFixedLengthStreaming(true)) + .request(r -> r.getRequestHeaders().add(HttpHeaders.CONTENT_LENGTH, String.valueOf(PREFIX.length()))) + .request(r -> r.setEntity(PREFIX)).apply(); + Assertions.assertEquals(PREFIX.length(), result.get()); + + result.set(null); + new TestClient(HttpUrlConnectorProvider.config() + .connectionFactory(connectionFactory) + .useFixedLengthStreaming(false) + .prefix(PREFIX)) + .client(c -> c.property(PREFIX + HttpUrlConnectorProvider.USE_FIXED_LENGTH_STREAMING, true)) + .request(r -> r.getRequestHeaders().add(HttpHeaders.CONTENT_LENGTH, String.valueOf(PREFIX.length()))) + .request(r -> r.setEntity(PREFIX)).apply(); + Assertions.assertEquals(PREFIX.length(), result.get()); + + result.set(null); + new TestClient(HttpUrlConnectorProvider.config() + .connectionFactory(connectionFactory) + .useFixedLengthStreaming(false) + .prefix(PREFIX)) + .request(r -> r.setProperty(PREFIX + HttpUrlConnectorProvider.USE_FIXED_LENGTH_STREAMING, true)) + .request(r -> r.getRequestHeaders().add(HttpHeaders.CONTENT_LENGTH, String.valueOf(PREFIX.length()))) + .request(r -> r.setEntity(PREFIX)).apply(); + Assertions.assertEquals(PREFIX.length(), result.get()); + + result.set(null); + new TestClient(HttpUrlConnectorProvider.config() + .connectionFactory(connectionFactory) + .useFixedLengthStreaming(false) + .prefix(PREFIX)) + .client(c -> c.property(ClientProperties.CONNECTOR_CONFIGURATION, + HttpUrlConnectorProvider.config().useFixedLengthStreaming(true).prefix(PREFIX))) + .request(r -> r.getRequestHeaders().add(HttpHeaders.CONTENT_LENGTH, String.valueOf(PREFIX.length()))) + .request(r -> r.setEntity(PREFIX)).apply(); + Assertions.assertEquals(PREFIX.length(), result.get()); + + result.set(null); + new TestClient(HttpUrlConnectorProvider.config() + .connectionFactory(connectionFactory) + .useFixedLengthStreaming(false) + .prefix(PREFIX)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + HttpUrlConnectorProvider.config().useFixedLengthStreaming(true).prefix(PREFIX))) + .request(r -> r.getRequestHeaders().add(HttpHeaders.CONTENT_LENGTH, String.valueOf(PREFIX.length()))) + .request(r -> r.setEntity(PREFIX)).apply(); + Assertions.assertEquals(PREFIX.length(), result.get()); + } + + @Test + public void testUseMethodWorkaround() { + JdkVersion version = JdkVersion.getJdkVersion(); + if (!version.isReflectiveAccessToJdkSupported()) { + return; + } + final String method = "XYZ"; + final AtomicReference<HttpURLConnection> result = new AtomicReference<>(); + final HttpUrlConnectorProvider.ConnectionFactory connectionFactory = new HttpUrlConnectorProvider.ConnectionFactory() { + @Override + public HttpURLConnection getConnection(URL url) throws IOException { + return new HttpURLConnection(url) { + @Override + public void disconnect() { + + } + + @Override + public boolean usingProxy() { + return false; + } + + @Override + public void connect() throws IOException { + + } + + @Override + public void setRequestMethod(String method) throws ProtocolException { + result.set(this); + super.setRequestMethod(method); + throw new IllegalStateException(); + } + }; + } + }; + + new TestClient(HttpUrlConnectorProvider.config() + .connectionFactory(connectionFactory)) + .request(r -> r.setMethod(method)) + .apply(); + Assertions.assertNotEquals(method, result.get().getRequestMethod()); + + new TestClient(HttpUrlConnectorProvider.config() + .connectionFactory(connectionFactory) + .useSetMethodWorkaround(true)) + .request(r -> r.setMethod(method)) + .apply(); + Assertions.assertEquals(method, result.get().getRequestMethod()); + + HttpUrlConnectorProvider.Config config = HttpUrlConnectorProvider.config(); + config.build().useSetMethodWorkaround(); + new TestClient(config + .connectionFactory(connectionFactory)) + .request(r -> r.setMethod(method)) + .apply(); + Assertions.assertEquals(method, result.get().getRequestMethod()); + + new TestClient(HttpUrlConnectorProvider.config().prefix(PREFIX) + .connectionFactory(connectionFactory)) + .request(r -> r.setMethod(method)) + .request(r -> r.setProperty(ClientProperties.CONNECTOR_CONFIGURATION, + HttpUrlConnectorProvider.config().useSetMethodWorkaround(true).prefix(PREFIX))) + .apply(); + Assertions.assertEquals(method, result.get().getRequestMethod()); + + new TestClient(HttpUrlConnectorProvider.config().prefix(PREFIX) + .connectionFactory(connectionFactory)) + .client(c -> c.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true)) + .request(r -> r.setMethod(method)) + .apply(); + Assertions.assertNotEquals(method, result.get().getRequestMethod()); + + new TestClient(HttpUrlConnectorProvider.config().prefix(PREFIX) + .connectionFactory(connectionFactory)) + .client(c -> c.property(PREFIX + HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true)) + .request(r -> r.setMethod(method)) + .apply(); + Assertions.assertEquals(method, result.get().getRequestMethod()); + } + + private static class Conf extends HttpUrlConnectorConfiguration<Conf> { + private static class RW extends ReadWrite { + @Override + public <X extends ConnectorConfiguration<?>> void setNonEmpty(X otherC) { + super.setNonEmpty(otherC); + } + + @Override + public RW prefix(String prefix) { + super.prefix(prefix); + return this; + } + } + } + + private static class TestClient { + final Conf.RW rw; + final Client client; + + private TestClient(ConnectorConfiguration<?> config) { + this.rw = config instanceof Conf.RW ? (Conf.RW) config : new Conf.RW() { + { + setNonEmpty(config); + } + }; + this.client = ClientBuilder.newClient(new ClientConfig()); + } + + public TestClient client(Consumer<Client> consumer) { + consumer.accept(client); + return this; + } + + public TestClient rw(Consumer<HttpUrlConnectorConfiguration<?>> consumer) { + consumer.accept(rw); + return this; + } + + public Request request() { + return new Request(client, rw); + } + + public Request request(Consumer<ClientRequest> consumer) { + return request().request(consumer); + } + } + + private static class Request { + final ClientRequest request; + final Client client; + final Conf.RW rw; + + Request(Client client, Conf.RW rw) { + this.client = client; + this.rw = rw; + request = createRequest(client); + } + + private static ClientRequest createRequest(Client client) { + ClientRequest request = new ClientRequest(URI.create("http://localhost:8080"), + (ClientConfig) client.getConfiguration(), new MapPropertiesDelegate()) { + @Override + public void writeEntity() throws IOException { + throw new IllegalStateException(); + } + + @Override + public MultivaluedMap<String, String> getStringHeaders() { + throw new IllegalStateException(); + } + }; + request.setMethod("POST"); + return request; + } + + public Request request(Consumer<ClientRequest> consumer) { + consumer.accept(request); + return this; + } + + public Request apply() { + try { + HttpUrlConnector connector = new HttpUrlConnector(client, client.getConfiguration(), rw); + connector.apply(request); + } catch (ProcessingException | IllegalStateException expected) { + } + return this; + } + } +}
diff --git a/core-client/src/test/java/org/glassfish/jersey/client/spi/InvocationBuilderListenerTest.java b/core-client/src/test/java/org/glassfish/jersey/client/spi/InvocationBuilderListenerTest.java index ef45853..c8bf6fa 100644 --- a/core-client/src/test/java/org/glassfish/jersey/client/spi/InvocationBuilderListenerTest.java +++ b/core-client/src/test/java/org/glassfish/jersey/client/spi/InvocationBuilderListenerTest.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025 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 @@ -16,22 +16,17 @@ package org.glassfish.jersey.client.spi; -import org.glassfish.jersey.internal.PropertiesDelegate; import org.hamcrest.Matchers; import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import jakarta.annotation.Priority; import jakarta.ws.rs.client.ClientBuilder; import jakarta.ws.rs.client.ClientRequestContext; import jakarta.ws.rs.client.ClientRequestFilter; -import jakarta.ws.rs.client.Entity; import jakarta.ws.rs.client.WebTarget; import jakarta.ws.rs.core.CacheControl; -import jakarta.ws.rs.core.Configuration; -import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.HttpHeaders; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; @@ -95,6 +90,20 @@ } } + @Test + public void testCounter() { + CountingInvocationBuilderListener listener = new CountingInvocationBuilderListener(); + target = target.register(listener); + try (Response r = target.request().get()) { + assertDefault(r); + Assertions.assertEquals(1, listener.getCount()); + } + try (Response r = target.request().get()) { + assertDefault(r); + Assertions.assertEquals(2, listener.getCount()); + } + } + private void assertDefault(Response response) { Assertions.assertEquals(key(ONE) + "=" + ONE, response.readEntity(String.class)); } @@ -193,4 +202,17 @@ MatcherAssert.assertThat(context.getCookies().get("Cookie"), Matchers.notNullValue()); } } + + private static class CountingInvocationBuilderListener implements InvocationBuilderListener { + private int counter = 0; + + @Override + public void onNewBuilder(InvocationBuilderContext context) { + counter++; + } + + public int getCount() { + return counter; + } + } }
diff --git a/core-common/src/main/java/org/glassfish/jersey/AbstractFeatureConfigurator.java b/core-common/src/main/java/org/glassfish/jersey/AbstractFeatureConfigurator.java index a73b185..36a3712 100644 --- a/core-common/src/main/java/org/glassfish/jersey/AbstractFeatureConfigurator.java +++ b/core-common/src/main/java/org/glassfish/jersey/AbstractFeatureConfigurator.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025 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 @@ -49,9 +49,11 @@ * @param loader specific classloader (must not be NULL) * @return list of found classes */ + protected List<Class<T>> loadImplementations(Map<String, Object> applicationProperties, ClassLoader loader) { if (PropertiesHelper.isMetaInfServicesEnabled(applicationProperties, getRuntimeType())) { - return Stream.of(ServiceFinder.find(getContract(), loader, true).toClassArray()) + return Stream.of(ServiceFinder.service(getContract()).loader(loader).ignoreNotFound(true) + .runtimeType(getRuntimeType()).find().toClassArray()) .collect(Collectors.toList()); } return Collections.emptyList();
diff --git a/core-common/src/main/java/org/glassfish/jersey/internal/AbstractServiceFinderConfigurator.java b/core-common/src/main/java/org/glassfish/jersey/internal/AbstractServiceFinderConfigurator.java index ea7c62c..4a4972b 100644 --- a/core-common/src/main/java/org/glassfish/jersey/internal/AbstractServiceFinderConfigurator.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/AbstractServiceFinderConfigurator.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025 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 @@ -60,8 +60,8 @@ */ protected List<Class<T>> loadImplementations(Map<String, Object> applicationProperties) { if (PropertiesHelper.isMetaInfServicesEnabled(applicationProperties, runtimeType)) { - return Stream.of(ServiceFinder.find(contract, true).toClassArray()) - .collect(Collectors.toList()); + return Stream.of(ServiceFinder.service(contract).ignoreNotFound(true).runtimeType(runtimeType) + .find().toClassArray()).collect(Collectors.toList()); } return Collections.emptyList(); }
diff --git a/core-common/src/main/java/org/glassfish/jersey/internal/RuntimeDelegateDecorator.java b/core-common/src/main/java/org/glassfish/jersey/internal/RuntimeDelegateDecorator.java index b21616d..db6a02e 100644 --- a/core-common/src/main/java/org/glassfish/jersey/internal/RuntimeDelegateDecorator.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/RuntimeDelegateDecorator.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025 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 @@ -139,7 +139,8 @@ static { Set<HeaderDelegateProvider> hps = new HashSet<HeaderDelegateProvider>(); - for (HeaderDelegateProvider provider : ServiceFinder.find(HeaderDelegateProvider.class, true)) { + for (HeaderDelegateProvider provider : ServiceFinder + .service(HeaderDelegateProvider.class).ignoreNotFound(true).find()) { hps.add(provider); } headerDelegateProviders = Collections.unmodifiableSet(hps);
diff --git a/core-common/src/main/java/org/glassfish/jersey/internal/ServiceFinder.java b/core-common/src/main/java/org/glassfish/jersey/internal/ServiceFinder.java index 03d15d3..bdce062 100644 --- a/core-common/src/main/java/org/glassfish/jersey/internal/ServiceFinder.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/ServiceFinder.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2024 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025 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 @@ -24,6 +24,7 @@ import java.lang.reflect.ReflectPermission; import java.net.URL; import java.net.URLConnection; +import java.nio.charset.StandardCharsets; import java.security.AccessController; import java.security.PrivilegedActionException; import java.util.ArrayList; @@ -40,6 +41,9 @@ import org.glassfish.jersey.internal.util.ReflectionHelper; +import jakarta.ws.rs.ConstrainedTo; +import jakarta.ws.rs.RuntimeType; + /** * A simple service-provider lookup mechanism. A <i>service</i> is a * well-known set of interfaces and (usually abstract) classes. A <i>service @@ -108,7 +112,7 @@ * sun.io.StandardCodec # Standard codecs for the platform * </pre> * <p/> - * To locate an codec for a given encoding name, the internal I/O code would + * To locate a codec for a given encoding name, the internal I/O code would * do something like this: * <p/> * <pre> @@ -135,10 +139,98 @@ private static final Logger LOGGER = Logger.getLogger(ServiceFinder.class.getName()); private static final String PREFIX = "META-INF/services/"; - private final Class<T> serviceClass; - private final String serviceName; - private final ClassLoader classLoader; - private final boolean ignoreOnClassNotFound; + + public static final class Builder<T> { + final Class<T> service; + String serviceName; + private ClassLoader loader; + private Boolean ignoreOnClassNotFound; + RuntimeType runtimeType = null; + + private Builder(Class<T> serviceClass) { + this.service = serviceClass; + } + + private Builder(Builder<T> builder) { + this.service = builder.service; + this.serviceName = builder.serviceName; + this.loader = builder.loader; + this.ignoreOnClassNotFound = builder.ignoreOnClassNotFound; + this.runtimeType = builder.runtimeType; + } + + /** + * Create the service finder capable of locating the services with information specified by the builder. + * @return the service finder instance. + */ + public ServiceFinder<T> find() { + if (serviceName == null) { + serviceName = service.getName(); + } + if (loader == null) { + loader = _getContextClassLoader(); + } + if (ignoreOnClassNotFound == null) { + ignoreOnClassNotFound = false; + } + + return new ServiceFinder<T>(this); + } + + /** + * Set the service name the service finder use to locate the services. + * @param serviceName the service name correspond to a file in + * META-INF/services that contains a list of fully qualified class + * names. + * @return the updated builder. + */ + public Builder<T> serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the service finder to use the given {@code Classloader}. By default, the context classloader is used. + * @param loader the given classloader for the service finder to use when searching for the service. + * @return the updated builder. + */ + public Builder<T> loader(ClassLoader loader) { + this.loader = loader; + return this; + } + + /** + * Set the service finder to ignore the service if not found. The default is {@code false}. + * @param ignoreOnClassNotFound whether to ignore the service not found or not. + * @return the updated builder. + */ + public Builder<T> ignoreNotFound(boolean ignoreOnClassNotFound) { + this.ignoreOnClassNotFound = ignoreOnClassNotFound; + return this; + } + + /** + * Update the builder with a specified runtime type the searched services are constrained to it. + * @param runtimeType the specified runtime type. + * @return the updated builder. + */ + public Builder<T> runtimeType(RuntimeType runtimeType) { + this.runtimeType = runtimeType; + return this; + } + } + + /** + * Start configuring {@link Builder} with a specific service class to find. + * @param serviceClass the service class to find. + * @return a new instance of service finder builder. + * @param <T> type of the service class the service finder builder is created for. + */ + public static <T> ServiceFinder.Builder<T> service(Class<T> serviceClass) { + return new Builder<>(serviceClass); + } + + private final Builder<T> builder; static { final OsgiRegistry osgiRegistry = ReflectionHelper.getOsgiRegistryInstance(); @@ -203,11 +295,10 @@ * @param <T> the type of the service instance. * @return the service finder */ + @Deprecated public static <T> ServiceFinder<T> find(final Class<T> service, final ClassLoader loader) throws ServiceConfigurationError { - return find(service, - loader, - false); + return service(service).loader(loader).find(); } /** @@ -238,12 +329,11 @@ * @param <T> the type of the service instance. * @return the service finder */ + @Deprecated public static <T> ServiceFinder<T> find(final Class<T> service, final ClassLoader loader, final boolean ignoreOnClassNotFound) throws ServiceConfigurationError { - return new ServiceFinder<T>(service, - loader, - ignoreOnClassNotFound); + return service(service).loader(loader).ignoreNotFound(ignoreOnClassNotFound).find(); } /** @@ -253,7 +343,7 @@ * <p/> * <pre> * ClassLoader cl = Thread.currentThread().getContextClassLoader(); - * return Service.providers(service, cl, false); + * return ServiceFinder.service(service).loader(cl).ignoreNotFound(false).find(); * </pre> * @param service The service's abstract service class * @throws ServiceConfigurationError If a provider-configuration file violates the specified format @@ -264,9 +354,7 @@ */ public static <T> ServiceFinder<T> find(final Class<T> service) throws ServiceConfigurationError { - return find(service, - _getContextClassLoader(), - false); + return ServiceFinder.service(service).find(); } /** @@ -277,7 +365,7 @@ * <pre> * ClassLoader cl = Thread.currentThread().getContextClassLoader(); * boolean ingore = ... - * return Service.providers(service, cl, ignore); + * return ServiceFinder.service(service).loader(cl).ignoreNotFound(ignore).find(); * </pre> * @param service The service's abstract service class * @param ignoreOnClassNotFound If a provider cannot be loaded by the class loader @@ -288,11 +376,10 @@ * @param <T> the type of the service instance. * @return the service finder */ + @Deprecated public static <T> ServiceFinder<T> find(final Class<T> service, final boolean ignoreOnClassNotFound) throws ServiceConfigurationError { - return find(service, - _getContextClassLoader(), - ignoreOnClassNotFound); + return ServiceFinder.service(service).ignoreNotFound(ignoreOnClassNotFound).find(); } /** @@ -307,7 +394,7 @@ * @return the service finder */ public static ServiceFinder<?> find(final String serviceName) throws ServiceConfigurationError { - return new ServiceFinder<Object>(Object.class, serviceName, _getContextClassLoader(), false); + return service(Object.class).serviceName(serviceName).find(); } /** @@ -327,22 +414,8 @@ ServiceIteratorProvider.setInstance(sip); } - private ServiceFinder( - final Class<T> service, - final ClassLoader loader, - final boolean ignoreOnClassNotFound) { - this(service, service.getName(), loader, ignoreOnClassNotFound); - } - - private ServiceFinder( - final Class<T> service, - final String serviceName, - final ClassLoader loader, - final boolean ignoreOnClassNotFound) { - this.serviceClass = service; - this.serviceName = serviceName; - this.classLoader = loader; - this.ignoreOnClassNotFound = ignoreOnClassNotFound; + private ServiceFinder(Builder<T> builder) { + this.builder = new Builder<>(builder); } /** @@ -356,8 +429,7 @@ */ @Override public Iterator<T> iterator() { - return ServiceIteratorProvider.getInstance() - .createIterator(serviceClass, serviceName, classLoader, ignoreOnClassNotFound); + return createIterator(); } /** @@ -375,7 +447,7 @@ for (final T t : this) { result.add(t); } - return result.toArray((T[]) Array.newInstance(serviceClass, result.size())); + return result.toArray((T[]) Array.newInstance(builder.service, result.size())); } /** @@ -390,16 +462,68 @@ @SuppressWarnings("unchecked") public Class<T>[] toClassArray() throws ServiceConfigurationError { final List<Class<T>> result = new ArrayList<Class<T>>(); - - final ServiceIteratorProvider iteratorProvider = ServiceIteratorProvider.getInstance(); - final Iterator<Class<T>> i = iteratorProvider - .createClassIterator(serviceClass, serviceName, classLoader, ignoreOnClassNotFound); + final Iterator<Class<T>> i = createClassIterator(); while (i.hasNext()) { result.add(i.next()); } return result.toArray((Class<T>[]) Array.newInstance(Class.class, result.size())); } + /** + * Return true iff the service class is not constrained to other runtime type. + * @param clazz the service class. + * @param runtimeType the expected constraint runtime type. + * @return {@code true} when the service class is constrained to configurator's runtime type or {@code false} otherwise. + */ + private static boolean isConstrained(Class<?> clazz, RuntimeType runtimeType) { + final ConstrainedTo annotation = clazz.getAnnotation(ConstrainedTo.class); + return annotation == null || annotation.value() == runtimeType; + } + + private Iterator<Class<T>> createClassIterator() { + final Iterator<Class<T>> it = ServiceIteratorProvider.getInstance().createClassIterator( + builder.service, builder.serviceName, builder.loader, builder.ignoreOnClassNotFound); + return builder.runtimeType == null ? it : new ConstrainedIterator<Class<T>>(it, builder.runtimeType); + } + + private Iterator<T> createIterator() { + final Iterator<T> it = ServiceIteratorProvider.getInstance().createIterator( + builder.service, builder.serviceName, builder.loader, builder.ignoreOnClassNotFound); + return builder.runtimeType == null ? it : new ConstrainedIterator<T>(it, builder.runtimeType); + } + + private static final class ConstrainedIterator<IT> implements Iterator<IT> { + private final Iterator<IT> i; + private final RuntimeType runtimeType; + private IT next; + + private ConstrainedIterator(Iterator<IT> i, RuntimeType runtimeType) { + this.i = i; + this.runtimeType = runtimeType; + } + + @Override + public boolean hasNext() { + while (next == null && i.hasNext()) { + next = i.next(); + if (!isConstrained(next.getClass() == Class.class ? (Class<?>) next : next.getClass(), runtimeType)) { + next = null; + } + } + return next != null; + } + + @Override + public IT next() { + if (next == null && !hasNext()) { + throw new NoSuchElementException(); + } + final IT n = next; + next = null; + return n; + } + } + private static void fail(final String serviceName, final String msg, final Throwable cause) throws ServiceConfigurationError { final ServiceConfigurationError sce = new ServiceConfigurationError(serviceName + ": " + msg); @@ -482,7 +606,7 @@ final URLConnection uConn = u.openConnection(); uConn.setUseCaches(false); in = uConn.getInputStream(); - r = new BufferedReader(new InputStreamReader(in, "utf-8")); + r = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); int lc = 1; while ((lc = parseLine(serviceName, u, r, lc, names, returned)) >= 0) { // continue @@ -871,7 +995,7 @@ * The default service iterator provider that looks up provider classes in * META-INF/services files. * <p> - * This class may utilized if a {@link ServiceIteratorProvider} needs to + * This class may be utilized if a {@link ServiceIteratorProvider} needs to * reuse the default implementation. */ public static final class DefaultServiceIteratorProvider extends ServiceIteratorProvider {
diff --git a/core-common/src/main/java/org/glassfish/jersey/internal/ServiceFinderBinder.java b/core-common/src/main/java/org/glassfish/jersey/internal/ServiceFinderBinder.java index 223d32b..670562d 100644 --- a/core-common/src/main/java/org/glassfish/jersey/internal/ServiceFinderBinder.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/ServiceFinderBinder.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025 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 @@ -58,7 +58,8 @@ @Override protected void configure() { if (PropertiesHelper.isMetaInfServicesEnabled(applicationProperties, runtimeType)) { - for (Class<T> t : ServiceFinder.find(contract, true).toClassArray()) { + for (Class<T> t : ServiceFinder.service(contract).ignoreNotFound(true).runtimeType(runtimeType).find() + .toClassArray()) { bind(t).to(contract); } }
diff --git a/core-common/src/main/java/org/glassfish/jersey/internal/guava/Ordering.java b/core-common/src/main/java/org/glassfish/jersey/internal/guava/Ordering.java index a544e36..c87d6a5 100644 --- a/core-common/src/main/java/org/glassfish/jersey/internal/guava/Ordering.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/guava/Ordering.java
@@ -203,7 +203,7 @@ * @throws ClassCastException if the parameters are not <i>mutually * comparable</i> under this ordering. */ - <E extends T> E min(E a, E b) { + public <E extends T> E min(E a, E b) { return (compare(a, b) <= 0) ? a : b; } @@ -278,7 +278,7 @@ * @throws ClassCastException if the parameters are not <i>mutually * comparable</i> under this ordering. */ - <E extends T> E max(E a, E b) { + public <E extends T> E max(E a, E b) { return (compare(a, b) >= 0) ? a : b; }
diff --git a/core-common/src/main/java/org/glassfish/jersey/internal/inject/Injections.java b/core-common/src/main/java/org/glassfish/jersey/internal/inject/Injections.java index 1750dd8..9444e9c 100644 --- a/core-common/src/main/java/org/glassfish/jersey/internal/inject/Injections.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/inject/Injections.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025 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 @@ -93,16 +93,12 @@ * @param clazz type of service to look for. * @param <T> type of service to look for. * @param type {@link RuntimeType} the {@link InjectionManagerFactory} must be {@link ConstrainedTo} if annotated. - * @return instance of service with highest priority or {@code null} if service of given type cannot be found. + * @return instance of service with the highest priority or {@code null} if service of given type cannot be found. * @see jakarta.annotation.Priority */ private static <T> Optional<T> lookupService(final Class<T> clazz, RuntimeType type) { List<RankedProvider<T>> providers = new LinkedList<>(); - for (T provider : ServiceFinder.find(clazz)) { - ConstrainedTo constrain = provider.getClass().getAnnotation(ConstrainedTo.class); - if (constrain != null && type != constrain.value()) { - continue; - } + for (T provider : ServiceFinder.service(clazz).runtimeType(type).find()) { providers.add(new RankedProvider<>(provider)); } providers.sort(new RankedComparator<>(RankedComparator.Order.DESCENDING));
diff --git a/core-common/src/main/java/org/glassfish/jersey/internal/inject/ParamConverters.java b/core-common/src/main/java/org/glassfish/jersey/internal/inject/ParamConverters.java index aafb278..f2e8136 100644 --- a/core-common/src/main/java/org/glassfish/jersey/internal/inject/ParamConverters.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/inject/ParamConverters.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025 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 @@ -363,7 +363,8 @@ final List<ClassTypePair> ctps = ReflectionHelper.getTypeArgumentAndClass(genericType); final ClassTypePair ctp = (ctps.size() == 1) ? ctps.get(0) : null; final boolean empty = value.isEmpty(); - for (ParamConverterProvider provider : Providers.getProviders(manager, ParamConverterProvider.class)) { + for (final ParamConverterProvider provider + : Providers.getAllProviders(manager, ParamConverterProvider.class)) { final ParamConverter<?> converter = provider.getConverter(ctp.rawClass(), ctp.type(), annotations); if (converter != null) { if (empty) {
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 f5c467a..e0aa5bf 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,5 @@ /* - * Copyright (c) 2012, 2024 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025 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 @@ -107,7 +107,8 @@ interfaces.put(Binder.class, ProviderRuntime.BOTH); try { - ServiceFinder<ExternalRegistrables> registerables = ServiceFinder.find(ExternalRegistrables.class, true); + ServiceFinder<ExternalRegistrables> registerables = + ServiceFinder.service(ExternalRegistrables.class).ignoreNotFound(true).find(); registerables.forEach(regs -> regs.registrableContracts() .forEach(pair -> interfaces.put(pair.getContract(), ProviderRuntime.fromRuntimeType(pair.getRuntimeType())))); } catch (Throwable t) {
diff --git a/core-common/src/main/java/org/glassfish/jersey/internal/util/JdkVersion.java b/core-common/src/main/java/org/glassfish/jersey/internal/util/JdkVersion.java index 9b8ec40..d7c478c 100644 --- a/core-common/src/main/java/org/glassfish/jersey/internal/util/JdkVersion.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/util/JdkVersion.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025 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 @@ -119,6 +119,19 @@ } /** + * <p> + * Returns <tt>true</tt> if the reflective access to JDK classes is supported. It was disabled by JDK 16+. + * </p> + * <p> + * This can be used to verify the property <tt>HttpUrlConnectorProvider#SET_METHOD_WORKAROUND</tt> still works, + * for instance. + * </p> + */ + public boolean isReflectiveAccessToJdkSupported() { + return getMajor() < 16; + } + + /** * Returns <tt>true</tt> if {@code sun.misc.Unsafe} is present in the * current JDK version, or <tt>false</tt> otherwise. *
diff --git a/core-common/src/main/java/org/glassfish/jersey/internal/util/collection/Views.java b/core-common/src/main/java/org/glassfish/jersey/internal/util/collection/Views.java index 75b1987..d1480d2 100644 --- a/core-common/src/main/java/org/glassfish/jersey/internal/util/collection/Views.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/util/collection/Views.java
@@ -230,6 +230,76 @@ final List<Object> old = originalMap.put(key, (List<Object>) (List<?>) value); return valuesTransformer.apply(old); } + + @Override + public boolean containsKey(Object key) { + Iterator<Entry<String, List<String>>> i = entrySet().iterator(); + if (key == null) { + while (i.hasNext()) { + Entry<String, List<String>> e = i.next(); + if (e.getKey() == null) { + return true; + } + } + } else { + while (i.hasNext()) { + Entry<String, List<String>> e = i.next(); + if (((String) key).equalsIgnoreCase(e.getKey())) { + return true; + } + } + } + return false; + } + + @Override + public List<String> get(Object key) { + Iterator<Entry<String, List<String>>> i = entrySet().iterator(); + if (key == null) { + while (i.hasNext()) { + Entry<String, List<String>> e = i.next(); + if (e.getKey() == null) { + return e.getValue(); + } + } + } else { + while (i.hasNext()) { + Entry<String, List<String>> e = i.next(); + if (((String) key).equalsIgnoreCase(e.getKey())) { + return e.getValue(); + } + } + } + return null; + } + + @Override + public List<String> remove(Object key) { + Iterator<Entry<String, List<String>>> i = entrySet().iterator(); + Entry<String, List<String>> correctEntry = null; + if (key == null) { + while (correctEntry == null && i.hasNext()) { + Entry<String, List<String>> e = i.next(); + if (e.getKey() == null) { + correctEntry = e; + } + } + } else { + while (correctEntry == null && i.hasNext()) { + Entry<String, List<String>> e = i.next(); + if (((String) key).equalsIgnoreCase(e.getKey())) { + correctEntry = e; + } + } + } + + List<String> oldValue = null; + if (correctEntry != null) { + oldValue = correctEntry.getValue(); + i.remove(); + } + return oldValue; + } } /**
diff --git a/core-common/src/main/java/org/glassfish/jersey/io/spi/FlushedCloseable.java b/core-common/src/main/java/org/glassfish/jersey/io/spi/FlushedCloseable.java index 12aa714..e22dd16 100644 --- a/core-common/src/main/java/org/glassfish/jersey/io/spi/FlushedCloseable.java +++ b/core-common/src/main/java/org/glassfish/jersey/io/spi/FlushedCloseable.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025 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 @@ -27,8 +27,8 @@ * That way, {@link #flush()} method is not called twice. * * <p> - * Usable by {@link javax.ws.rs.client.ClientRequestContext#setEntityStream(OutputStream)}. - * Usable by {@link javax.ws.rs.container.ContainerResponseContext#setEntityStream(OutputStream)}. + * Usable by {@link jakarta.ws.rs.client.ClientRequestContext#setEntityStream(OutputStream)}. + * Usable by {@link jakarta.ws.rs.container.ContainerResponseContext#setEntityStream(OutputStream)}. * </p> * * <p>
diff --git a/core-common/src/main/java/org/glassfish/jersey/message/internal/InboundMessageContext.java b/core-common/src/main/java/org/glassfish/jersey/message/internal/InboundMessageContext.java index 46446a4..5cb0ba7 100644 --- a/core-common/src/main/java/org/glassfish/jersey/message/internal/InboundMessageContext.java +++ b/core-common/src/main/java/org/glassfish/jersey/message/internal/InboundMessageContext.java
@@ -166,8 +166,8 @@ * @param configuration the related client/server side {@link Configuration}. If {@code null}, * the default behaviour is expected. * @param httpHeaders the http headers map. - * @param translateNce if {@code true}, the {@link javax.ws.rs.core.NoContentException} thrown by a - * selected message body reader will be translated into a {@link javax.ws.rs.BadRequestException} + * @param translateNce if {@code true}, the {@link jakarta.ws.rs.core.NoContentException} thrown by a + * selected message body reader will be translated into a {@link jakarta.ws.rs.BadRequestException} * as required by JAX-RS specification on the server side. */ public InboundMessageContext(Configuration configuration, MultivaluedMap<String, String> httpHeaders, boolean translateNce) {
diff --git a/core-common/src/main/java/org/glassfish/jersey/model/internal/CommonConfig.java b/core-common/src/main/java/org/glassfish/jersey/model/internal/CommonConfig.java index 1afa8c1..41d0868 100644 --- a/core-common/src/main/java/org/glassfish/jersey/model/internal/CommonConfig.java +++ b/core-common/src/main/java/org/glassfish/jersey/model/internal/CommonConfig.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025 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 @@ -596,8 +596,8 @@ // Forced (always invoked). final List<ForcedAutoDiscoverable> forcedAutoDiscroverables = new LinkedList<>(); - for (Class<ForcedAutoDiscoverable> forcedADType : ServiceFinder.find(ForcedAutoDiscoverable.class, true) - .toClassArray()) { + for (Class<ForcedAutoDiscoverable> forcedADType : ServiceFinder.service(ForcedAutoDiscoverable.class) + .ignoreNotFound(true).runtimeType(getRuntimeType()).find().toClassArray()) { forcedAutoDiscroverables.add(injectionManager.createAndInitialize(forcedADType)); } providers.addAll(forcedAutoDiscroverables); @@ -608,15 +608,11 @@ } for (final AutoDiscoverable autoDiscoverable : providers) { - final ConstrainedTo constrainedTo = autoDiscoverable.getClass().getAnnotation(ConstrainedTo.class); - - if (constrainedTo == null || type.equals(constrainedTo.value())) { - try { - autoDiscoverable.configure(this); - } catch (final Exception e) { - LOGGER.log(Level.FINE, - LocalizationMessages.AUTODISCOVERABLE_CONFIGURATION_FAILED(autoDiscoverable.getClass()), e); - } + try { + autoDiscoverable.configure(this); + } catch (final Exception e) { + LOGGER.log(Level.FINE, + LocalizationMessages.AUTODISCOVERABLE_CONFIGURATION_FAILED(autoDiscoverable.getClass()), e); } } }
diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassReader.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassReader.java index e027bdc..8b08000 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassReader.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/ClassReader.java
@@ -195,7 +195,7 @@ this.b = classFileBuffer; // Check the class' major_version. This field is after the magic and minor_version fields, which // use 4 and 2 bytes respectively. - if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V25) { + if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V26) { throw new IllegalArgumentException( "Unsupported class file major version " + readShort(classFileOffset + 6)); }
diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Opcodes.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Opcodes.java index 8a6ca40..7fc7335 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Opcodes.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/Opcodes.java
@@ -291,6 +291,7 @@ int V23 = 0 << 16 | 67; int V24 = 0 << 16 | 68; int V25 = 0 << 16 | 69; + int V26 = 0 << 16 | 70; /** * Version flag indicating that the class is using 'preview' features.
diff --git a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/SymbolTable.java b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/SymbolTable.java index e5e16be..3ac59a1 100644 --- a/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/SymbolTable.java +++ b/core-server/src/main/java/jersey/repackaged/org/objectweb/asm/SymbolTable.java
@@ -1473,7 +1473,7 @@ /** * Another entry (and so on recursively) having the same hash code (modulo the size of {@link - * SymbolTable#labelEntries}}) as this one. + * SymbolTable#labelEntries}) as this one. */ LabelEntry next;
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 730d1ce..158ef0e 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,5 @@ /* - * Copyright (c) 2011, 2023 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025 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 @@ -378,7 +378,7 @@ if (!disableValidation()) { ComponentModelValidator validator = new ComponentModelValidator( - bootstrapBag.getValueParamProviders(), bootstrapBag.getMessageBodyWorkers()); + bootstrapBag.getValueParamProviders(), bootstrapBag.getMessageBodyWorkers(), runtimeConfig); validator.validate(bootstrapBag.getResourceModel()); }
diff --git a/core-server/src/main/java/org/glassfish/jersey/server/ExternalRequestScopeConfigurator.java b/core-server/src/main/java/org/glassfish/jersey/server/ExternalRequestScopeConfigurator.java index d3d67d2..7619fcf 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/ExternalRequestScopeConfigurator.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/ExternalRequestScopeConfigurator.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025 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 @@ -43,7 +43,8 @@ public void init(InjectionManager injectionManager, BootstrapBag bootstrapBag) { ServerBootstrapBag serverBag = (ServerBootstrapBag) bootstrapBag; - Class<ExternalRequestScope>[] extScopes = ServiceFinder.find(ExternalRequestScope.class, true).toClassArray(); + Class<ExternalRequestScope>[] extScopes = + ServiceFinder.service(ExternalRequestScope.class).ignoreNotFound(true).find().toClassArray(); boolean extScopeBound = false; if (extScopes.length == 1) {
diff --git a/core-server/src/main/java/org/glassfish/jersey/server/ServerProperties.java b/core-server/src/main/java/org/glassfish/jersey/server/ServerProperties.java index 3ef8565..fa7cf93 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/ServerProperties.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/ServerProperties.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025 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 @@ -464,6 +464,23 @@ "jersey.config.server.resource.validation.ignoreErrors"; /** + * If {@code true} then validation of application resource models will not log a warning when a get resource method consumes an entity. + * + * This impacts both the validation of root resources during deployment as well as validation of any sub resources + * returned from sub-resource locators. + * <p> + * The default value is {@code false}. + * </p> + * <p> + * The name of the configuration property is <tt>{@value}</tt>. + * </p> + * + * @see #RESOURCE_VALIDATION_DISABLE + */ + public static final String RESOURCE_VALIDATION_IGNORE_GET_CONSUMES_ENTITY_WARNINGS = + "jersey.config.server.resource.validation.ignoreGetConsumesEntityWarnings"; + + /** * If {@code true} then application monitoring will be enabled. * * This will enable the possibility
diff --git a/core-server/src/main/java/org/glassfish/jersey/server/ServerRuntime.java b/core-server/src/main/java/org/glassfish/jersey/server/ServerRuntime.java index 531e927..1cf7e0a 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/ServerRuntime.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/ServerRuntime.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025 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 @@ -762,7 +762,7 @@ // output streams writes out bytes only on close (for example GZipOutputStream). response.close(); } catch (final Exception e) { - LOGGER.log(Level.SEVERE, LocalizationMessages.ERROR_CLOSING_COMMIT_OUTPUT_STREAM(), e); + LOGGER.log(Level.FINER, LocalizationMessages.ERROR_CLOSING_COMMIT_OUTPUT_STREAM(), e); } } }
diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/routing/RuntimeLocatorModelBuilder.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/routing/RuntimeLocatorModelBuilder.java index aa5c0f3..23b926f 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/routing/RuntimeLocatorModelBuilder.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/routing/RuntimeLocatorModelBuilder.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025 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 @@ -228,7 +228,7 @@ Errors.process(new Runnable() { @Override public void run() { - final ComponentModelValidator validator = new ComponentModelValidator(valueSuppliers, messageBodyWorkers); + final ComponentModelValidator validator = new ComponentModelValidator(valueSuppliers, messageBodyWorkers, config); validator.validate(component); if (Errors.fatalIssuesFound() && !ignoreValidationErrors) {
diff --git a/core-server/src/main/java/org/glassfish/jersey/server/internal/scanning/AnnotationAcceptingListener.java b/core-server/src/main/java/org/glassfish/jersey/server/internal/scanning/AnnotationAcceptingListener.java index 807252c..3881ba1 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/internal/scanning/AnnotationAcceptingListener.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/internal/scanning/AnnotationAcceptingListener.java
@@ -309,7 +309,7 @@ private static class ClassReaderWrapper { private static final Logger LOGGER = Logger.getLogger(ClassReader.class.getName()); - private static final int WARN_VERSION = Opcodes.V25; + private static final int WARN_VERSION = Opcodes.V26; private static final int INPUT_STREAM_DATA_CHUNK_SIZE = 4096; private final byte[] b;
diff --git a/core-server/src/main/java/org/glassfish/jersey/server/model/ComponentModelValidator.java b/core-server/src/main/java/org/glassfish/jersey/server/model/ComponentModelValidator.java index b93b172..5cd6878 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/model/ComponentModelValidator.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/model/ComponentModelValidator.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025 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 @@ -26,6 +26,8 @@ import org.glassfish.jersey.server.model.internal.ModelErrors; import org.glassfish.jersey.server.spi.internal.ValueParamProvider; +import jakarta.ws.rs.core.Configuration; + /** * A resource model validator that checks the given resource model. * @@ -57,10 +59,16 @@ private final List<ResourceModelIssue> issueList = new LinkedList<>(); public ComponentModelValidator(Collection<ValueParamProvider> valueParamProviders, MessageBodyWorkers msgBodyWorkers) { + this(valueParamProviders, msgBodyWorkers, null); + } + + public ComponentModelValidator(Collection<ValueParamProvider> valueParamProviders, + MessageBodyWorkers msgBodyWorkers, + Configuration configuration) { validators = new ArrayList<>(); validators.add(new ResourceValidator()); validators.add(new RuntimeResourceModelValidator(msgBodyWorkers)); - validators.add(new ResourceMethodValidator(valueParamProviders)); + validators.add(new ResourceMethodValidator(valueParamProviders, configuration)); validators.add(new InvocableValidator()); }
diff --git a/core-server/src/main/java/org/glassfish/jersey/server/model/ResourceMethodInvoker.java b/core-server/src/main/java/org/glassfish/jersey/server/model/ResourceMethodInvoker.java index 7cf46ee..1a8f1b4 100644 --- a/core-server/src/main/java/org/glassfish/jersey/server/model/ResourceMethodInvoker.java +++ b/core-server/src/main/java/org/glassfish/jersey/server/model/ResourceMethodInvoker.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025 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 @@ -21,7 +21,6 @@ import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.LinkedList; @@ -280,13 +279,8 @@ model.getPriority(ContainerResponseFilter.class))); } } - - _readerInterceptors.addAll( - StreamSupport.stream(processingProviders.getGlobalReaderInterceptors().spliterator(), false) - .collect(Collectors.toList())); - _writerInterceptors.addAll( - StreamSupport.stream(processingProviders.getGlobalWriterInterceptors().spliterator(), false) - .collect(Collectors.toList())); + processingProviders.getGlobalReaderInterceptors().forEach(_readerInterceptors::add); + processingProviders.getGlobalWriterInterceptors().forEach(_writerInterceptors::add); if (resourceMethod != null) { addNameBoundFiltersAndInterceptors( @@ -458,9 +452,7 @@ if (entityAnn.length == 0) { response.setEntityAnnotations(methodAnnotations); } else { - final Annotation[] mergedAnn = Arrays.copyOf(methodAnnotations, - methodAnnotations.length + entityAnn.length); - System.arraycopy(entityAnn, 0, mergedAnn, methodAnnotations.length, entityAnn.length); + final Annotation[] mergedAnn = mergeDistinctAnnotations(methodAnnotations, entityAnn); response.setEntityAnnotations(mergedAnn); } } @@ -487,6 +479,22 @@ return jaxrsResponse; } + private static Annotation[] mergeDistinctAnnotations(Annotation[] existing, Annotation[] newOnes) { + List<Annotation> merged = new ArrayList<>(existing.length + newOnes.length); + Collections.addAll(merged, existing); + + newOnesLoop: + for (Annotation n : newOnes) { + for (Annotation ex : existing) { + if (ex == n) { + continue newOnesLoop; + } + } + merged.add(n); + } + return merged.toArray(new Annotation[0]); + } + private Type unwrapInvocableResponseType(ContainerRequest request, Type entityType) { if (isCompletionStageResponseType && request.resolveProperty(ServerProperties.UNWRAP_COMPLETION_STAGE_IN_WRITER_ENABLE, Boolean.TRUE)) {
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 ac0c1da..2ab0707 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,5 @@ /* - * Copyright (c) 2012, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025 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 @@ -37,10 +37,11 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.sse.SseEventSink; +import jakarta.ws.rs.core.Configuration; import org.glassfish.jersey.internal.Errors; import org.glassfish.jersey.server.ContainerRequest; +import org.glassfish.jersey.server.ServerProperties; import org.glassfish.jersey.server.internal.LocalizationMessages; import org.glassfish.jersey.server.model.internal.SseTypeResolver; import org.glassfish.jersey.server.spi.internal.ParameterValueHelper; @@ -55,9 +56,15 @@ class ResourceMethodValidator extends AbstractResourceModelVisitor { private final Collection<ValueParamProvider> valueParamProviders; + private final Configuration configuration; ResourceMethodValidator(Collection<ValueParamProvider> valueParamProviders) { + this(valueParamProviders, null); + } + + ResourceMethodValidator(Collection<ValueParamProvider> valueParamProviders, Configuration configuration) { this.valueParamProviders = valueParamProviders; + this.configuration = configuration; } @Override @@ -100,7 +107,7 @@ } // ensure GET does not consume an entity parameter, if not inflector-based - if (invocable.requiresEntity() && !invocable.isInflector()) { + if (invocable.requiresEntity() && !invocable.isInflector() && !shouldIgnoreGetConsumesEntityWarnings(configuration)) { Errors.warning(method, LocalizationMessages.GET_CONSUMES_ENTITY(invocable.getHandlingMethod())); } // ensure GET does not consume any @FormParam annotated parameter @@ -154,6 +161,16 @@ } } + private static Boolean shouldIgnoreGetConsumesEntityWarnings(Configuration configuration) { + if (configuration == null) { + return Boolean.FALSE; + } + return ServerProperties.getValue(configuration.getProperties(), + ServerProperties.RESOURCE_VALIDATION_IGNORE_GET_CONSUMES_ENTITY_WARNINGS, + Boolean.FALSE, + Boolean.class); + } + private void checkUnexpectedAnnotations(ResourceMethod resourceMethod) { Invocable invocable = resourceMethod.getInvocable(); for (Annotation annotation : invocable.getHandlingMethod().getDeclaredAnnotations()) {
diff --git a/core-server/src/main/resources/META-INF/NOTICE.markdown b/core-server/src/main/resources/META-INF/NOTICE.markdown index ab6fea0..a1216f6 100644 --- a/core-server/src/main/resources/META-INF/NOTICE.markdown +++ b/core-server/src/main/resources/META-INF/NOTICE.markdown
@@ -36,7 +36,7 @@ * Copyright (c) 2015-2018 Oracle and/or its affiliates. All rights reserved. * Copyright 2010-2013 Coda Hale and Yammer, Inc. -org.objectweb.asm Version 9.8 +org.objectweb.asm Version 9.9 * License: Modified BSD (https://asm.ow2.io/license.html) * Copyright: (c) 2000-2011 INRIA, France Telecom. All rights reserved.
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 9e53639..06df1b6 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,5 @@ /* - * Copyright (c) 2012, 2023 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025 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 @@ -29,8 +29,11 @@ import java.util.Date; import java.util.List; import java.util.concurrent.ExecutionException; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; +import jakarta.annotation.Priority; +import jakarta.inject.Singleton; import jakarta.ws.rs.DefaultValue; import jakarta.ws.rs.GET; import jakarta.ws.rs.HeaderParam; @@ -107,6 +110,15 @@ assertEquals(404, responseContext.getStatus()); } + @Test + public void testCustomEnumResource() throws ExecutionException, InterruptedException { + initiateWebApplication(BadEnumResource.class, EnumParamConverterProvider.class); + final ContainerResponse responseContext = getResponseContext(UriBuilder.fromPath("/") + .queryParam("d", "A").build().toString()); + assertEquals(1, counter.get()); + assertEquals(200, responseContext.getStatus()); + } + public static class URIStringReaderProvider implements ParamConverterProvider { @Override @@ -191,6 +203,40 @@ } } + static final AtomicInteger counter = new AtomicInteger(0); + @Singleton + @Priority(1) + public static class EnumParamConverterProvider implements ParamConverterProvider { + + @Override + public <T> ParamConverter<T> getConverter(Class<T> rawType, Type genericType, Annotation[] annotations) { + if (Enum.class.isAssignableFrom(rawType)) { + return new ParamConverter<T>() { + @Override + public T fromString(final String value) { + counter.addAndGet(1); + if (value == null) { + return null; + } + Class<? extends Enum> enumClass = null; + try { + enumClass = (Class<Enum>) Class.forName(genericType.getTypeName()); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } + return (T) Enum.valueOf(enumClass, value.toUpperCase()); + } + + @Override + public String toString(final T value) { + return String.valueOf(value); + } + }; + } + return null; + } + } + @Path("/") public static class ListOfStringResource {
diff --git a/examples/NOTICE.md b/examples/NOTICE.md index c4fb81d..91ad805 100644 --- a/examples/NOTICE.md +++ b/examples/NOTICE.md
@@ -71,7 +71,7 @@ * Project: http://www.javassist.org/ * Copyright (C) 1999- Shigeru Chiba. All Rights Reserved. -Jackson JAX-RS Providers Version 2.18.0 +Jackson JAX-RS Providers Version 2.19.1 * License: Apache License, 2.0 * Project: https://github.com/FasterXML/jackson-jaxrs-providers * Copyright: (c) 2009-2023 FasterXML, LLC. All rights reserved unless otherwise indicated. @@ -96,7 +96,7 @@ * Project: http://www.kineticjs.com, https://github.com/ericdrowell/KineticJS * Copyright: Eric Rowell -org.objectweb.asm Version 9.8 +org.objectweb.asm Version 9.9 * License: Modified BSD (https://asm.ow2.io/license.html) * Copyright (c) 2000-2011 INRIA, France Telecom. All rights reserved.
diff --git a/examples/cdi-webapp/src/main/resources/META-INF/beans.xml b/examples/cdi-webapp/src/main/resources/META-INF/beans.xml index 77e336a..ecf04c0 100644 --- a/examples/cdi-webapp/src/main/resources/META-INF/beans.xml +++ b/examples/cdi-webapp/src/main/resources/META-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2025 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
diff --git a/examples/cdi-webapp/src/main/webapp/WEB-INF/beans.xml b/examples/cdi-webapp/src/main/webapp/WEB-INF/beans.xml index 77e336a..ecf04c0 100644 --- a/examples/cdi-webapp/src/main/webapp/WEB-INF/beans.xml +++ b/examples/cdi-webapp/src/main/webapp/WEB-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2025 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
diff --git a/examples/helloworld-weld/src/main/resources/META-INF/beans.xml b/examples/helloworld-weld/src/main/resources/META-INF/beans.xml index 77e336a..ecf04c0 100644 --- a/examples/helloworld-weld/src/main/resources/META-INF/beans.xml +++ b/examples/helloworld-weld/src/main/resources/META-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2025 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
diff --git a/examples/osgi-helloworld-webapp/functional-test/src/test/resources/felix.policy b/examples/osgi-helloworld-webapp/functional-test/src/test/resources/felix.policy index d8348f9..51a40bb 100644 --- a/examples/osgi-helloworld-webapp/functional-test/src/test/resources/felix.policy +++ b/examples/osgi-helloworld-webapp/functional-test/src/test/resources/felix.policy
@@ -1,5 +1,5 @@ // -// Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2014, 2025 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 @@ -33,6 +33,7 @@ allow { [org.osgi.service.condpermadmin.BundleLocationCondition "*jersey-common*"] (org.osgi.framework.PackagePermission) } "packagePermissionToJerseyCommon"; allow { [org.osgi.service.condpermadmin.BundleLocationCondition "*jersey-common*"] (java.lang.reflect.ReflectPermission "suppressAccessChecks") } "suppressAccessChecksToJerseyCommon"; allow { [org.osgi.service.condpermadmin.BundleLocationCondition "*jersey-common*"] (java.net.SocketPermission "*" "connect,resolve") } "socketPermissionToJerseyCommon"; +allow { [org.osgi.service.condpermadmin.BundleLocationCondition "*jersey-common*"] (java.net.NetPermission "*" "getProxySelector") } "proxySelectorToClientProxy"; allow { [org.osgi.service.condpermadmin.BundleLocationCondition "*jersey-common*"] (java.lang.RuntimePermission "accessDeclaredMembers") } "accessDeclaredMembersToJerseyCommon"; allow { [org.osgi.service.condpermadmin.BundleLocationCondition "*jersey-common*"] (java.lang.RuntimePermission "accessClassInPackage.sun.misc") } "accessClassInPackageSunMisc"; allow { [org.osgi.service.condpermadmin.BundleLocationCondition "*jersey-common*"] (java.lang.RuntimePermission "getClassLoader") } "getCLToJerseyCommon";
diff --git a/ext/cdi/jersey-cdi1x-servlet/src/main/java/org/glassfish/jersey/ext/cdi1x/servlet/internal/CdiExternalRequestScopeExtension.java b/ext/cdi/jersey-cdi1x-servlet/src/main/java/org/glassfish/jersey/ext/cdi1x/servlet/internal/CdiExternalRequestScopeExtension.java index ce367f5..e19ba4b 100644 --- a/ext/cdi/jersey-cdi1x-servlet/src/main/java/org/glassfish/jersey/ext/cdi1x/servlet/internal/CdiExternalRequestScopeExtension.java +++ b/ext/cdi/jersey-cdi1x-servlet/src/main/java/org/glassfish/jersey/ext/cdi1x/servlet/internal/CdiExternalRequestScopeExtension.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025 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 @@ -14,6 +14,7 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ + package org.glassfish.jersey.ext.cdi1x.servlet.internal; import java.lang.annotation.Annotation;
diff --git a/ext/cdi/jersey-cdi1x-validation/src/main/java/org/glassfish/jersey/ext/cdi1x/validation/internal/CdiInterceptorWrapperExtension.java b/ext/cdi/jersey-cdi1x-validation/src/main/java/org/glassfish/jersey/ext/cdi1x/validation/internal/CdiInterceptorWrapperExtension.java index 875f63c..30af36c 100644 --- a/ext/cdi/jersey-cdi1x-validation/src/main/java/org/glassfish/jersey/ext/cdi1x/validation/internal/CdiInterceptorWrapperExtension.java +++ b/ext/cdi/jersey-cdi1x-validation/src/main/java/org/glassfish/jersey/ext/cdi1x/validation/internal/CdiInterceptorWrapperExtension.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025 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
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 a47aced..45fc11b 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,5 @@ /* - * Copyright (c) 2013, 2024 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2022 Payara Foundation and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the
diff --git a/ext/constants/pom.xml b/ext/constants/pom.xml new file mode 100644 index 0000000..68c4d6d --- /dev/null +++ b/ext/constants/pom.xml
@@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<!-- + + Copyright (c) 2025 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 + +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.glassfish.jersey.ext</groupId> + <artifactId>project</artifactId> + <version>3.1.99-SNAPSHOT</version> + </parent> + + <artifactId>jersey-constants</artifactId> + <name>jersey-ext-constants</name> + + <description> + Jersey extension module providing well know constants. + </description> + + <dependencies> + <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-common</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> +</project>
diff --git a/ext/constants/src/main/java/org/glassfish/jersey/constants/http/MediaTypes.java b/ext/constants/src/main/java/org/glassfish/jersey/constants/http/MediaTypes.java new file mode 100644 index 0000000..fcad02e --- /dev/null +++ b/ext/constants/src/main/java/org/glassfish/jersey/constants/http/MediaTypes.java
@@ -0,0 +1,9253 @@ +/* + * Copyright (c) 2025 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.constants.http; + +import jakarta.ws.rs.core.MediaType; + +/** + * <p> + * List of well know media types representations defined by various sources. + * The media types are grouped by main types into {@link Application}, {@link Audio}, + * {@link Font}, {@link Haptics}, {@link Image}, {@link Message}, {@link Model}, + * {@link Multipart}, {@link Text}, and {@link Video} subclasses. + * </p> + * <p> + * Subtracted from {@code https://www.iana.org/assignments/media-types/media-types.xml}. + * </p> + */ +public final class MediaTypes { + + /** + * Application type media subtypes. + */ + public static class Application { + /** + * A {@code String} constant representing {@value #APPLICATION_1D_INTERLEAVED_PARITYFEC} media + * type defined by RFC 6015. + */ + public static final String APPLICATION_1D_INTERLEAVED_PARITYFEC = + "application/1d-interleaved-parityfec"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_1D_INTERLEAVED_PARITYFEC} media + * type defined by RFC 6015. + */ + public static final MediaType APPLICATION_1D_INTERLEAVED_PARITYFEC_TYPE = + new MediaType("application", "1d-interleaved-parityfec"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ACE_GROUPCOMM_CBOR} media + * type defined by RFC 9594. + */ + public static final String APPLICATION_ACE_GROUPCOMM_CBOR = + "application/ace-groupcomm+cbor"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ACE_GROUPCOMM_CBOR} media + * type defined by RFC 9594. + */ + public static final MediaType APPLICATION_ACE_GROUPCOMM_CBOR_TYPE = + new MediaType("application", "ace-groupcomm+cbor"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ACE_TRL_CBOR} media + * type defined by RFC 9770. + */ + public static final String APPLICATION_ACE_TRL_CBOR = + "application/ace-trl+cbor"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ACE_TRL_CBOR} media + * type defined by RFC 9770. + */ + public static final MediaType APPLICATION_ACE_TRL_CBOR_TYPE = + new MediaType("application", "ace-trl+cbor"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ACE_CBOR} media + * type defined by RFC 9200. + */ + public static final String APPLICATION_ACE_CBOR = + "application/ace+cbor"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ACE_CBOR} media + * type defined by RFC 9200. + */ + public static final MediaType APPLICATION_ACE_CBOR_TYPE = + new MediaType("application", "ace+cbor"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ACE_JSON} media + * type defined by RFC 9431. + */ + public static final String APPLICATION_ACE_JSON = + "application/ace+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ACE_JSON} media + * type defined by RFC 9431. + */ + public static final MediaType APPLICATION_ACE_JSON_TYPE = + new MediaType("application", "ace+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_AIF_CBOR} media + * type defined by RFC 9237. + */ + public static final String APPLICATION_AIF_CBOR = + "application/aif+cbor"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_AIF_CBOR} media + * type defined by RFC 9237. + */ + public static final MediaType APPLICATION_AIF_CBOR_TYPE = + new MediaType("application", "aif+cbor"); + + /** + * A {@code String} constant representing {@value #APPLICATION_AIF_JSON} media + * type defined by RFC 9237. + */ + public static final String APPLICATION_AIF_JSON = + "application/aif+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_AIF_JSON} media + * type defined by RFC 9237. + */ + public static final MediaType APPLICATION_AIF_JSON_TYPE = + new MediaType("application", "aif+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_CDNI_JSON} media + * type defined by RFC 9241. + */ + public static final String APPLICATION_ALTO_CDNI_JSON = + "application/alto-cdni+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_CDNI_JSON} media + * type defined by RFC 9241. + */ + public static final MediaType APPLICATION_ALTO_CDNI_JSON_TYPE = + new MediaType("application", "alto-cdni+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_CDNIFILTER_JSON} media + * type defined by RFC 9241. + */ + public static final String APPLICATION_ALTO_CDNIFILTER_JSON = + "application/alto-cdnifilter+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_CDNIFILTER_JSON} media + * type defined by RFC 9241. + */ + public static final MediaType APPLICATION_ALTO_CDNIFILTER_JSON_TYPE = + new MediaType("application", "alto-cdnifilter+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_COSTMAP_JSON} media + * type defined by RFC 7285. + */ + public static final String APPLICATION_ALTO_COSTMAP_JSON = + "application/alto-costmap+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_COSTMAP_JSON} media + * type defined by RFC 7285. + */ + public static final MediaType APPLICATION_ALTO_COSTMAP_JSON_TYPE = + new MediaType("application", "alto-costmap+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_COSTMAPFILTER_JSON} media + * type defined by RFC 7285. + */ + public static final String APPLICATION_ALTO_COSTMAPFILTER_JSON = + "application/alto-costmapfilter+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_COSTMAPFILTER_JSON} media + * type defined by RFC 7285. + */ + public static final MediaType APPLICATION_ALTO_COSTMAPFILTER_JSON_TYPE = + new MediaType("application", "alto-costmapfilter+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_DIRECTORY_JSON} media + * type defined by RFC 7285. + */ + public static final String APPLICATION_ALTO_DIRECTORY_JSON = + "application/alto-directory+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_DIRECTORY_JSON} media + * type defined by RFC 7285. + */ + public static final MediaType APPLICATION_ALTO_DIRECTORY_JSON_TYPE = + new MediaType("application", "alto-directory+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_ENDPOINTPROP_JSON} media + * type defined by RFC 7285. + */ + public static final String APPLICATION_ALTO_ENDPOINTPROP_JSON = + "application/alto-endpointprop+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_ENDPOINTPROP_JSON} media + * type defined by RFC 7285. + */ + public static final MediaType APPLICATION_ALTO_ENDPOINTPROP_JSON_TYPE = + new MediaType("application", "alto-endpointprop+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_ENDPOINTPROPPARAMS_JSON} media + * type defined by RFC 7285. + */ + public static final String APPLICATION_ALTO_ENDPOINTPROPPARAMS_JSON = + "application/alto-endpointpropparams+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_ENDPOINTPROPPARAMS_JSON} media + * type defined by RFC 7285. + */ + public static final MediaType APPLICATION_ALTO_ENDPOINTPROPPARAMS_JSON_TYPE = + new MediaType("application", "alto-endpointpropparams+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_ENDPOINTCOST_JSON} media + * type defined by RFC 7285. + */ + public static final String APPLICATION_ALTO_ENDPOINTCOST_JSON = + "application/alto-endpointcost+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_ENDPOINTCOST_JSON} media + * type defined by RFC 7285. + */ + public static final MediaType APPLICATION_ALTO_ENDPOINTCOST_JSON_TYPE = + new MediaType("application", "alto-endpointcost+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_ENDPOINTCOSTPARAMS_JSON} media + * type defined by RFC 7285. + */ + public static final String APPLICATION_ALTO_ENDPOINTCOSTPARAMS_JSON = + "application/alto-endpointcostparams+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_ENDPOINTCOSTPARAMS_JSON} media + * type defined by RFC 7285. + */ + public static final MediaType APPLICATION_ALTO_ENDPOINTCOSTPARAMS_JSON_TYPE = + new MediaType("application", "alto-endpointcostparams+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_ERROR_JSON} media + * type defined by RFC 7285. + */ + public static final String APPLICATION_ALTO_ERROR_JSON = + "application/alto-error+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_ERROR_JSON} media + * type defined by RFC 7285. + */ + public static final MediaType APPLICATION_ALTO_ERROR_JSON_TYPE = + new MediaType("application", "alto-error+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_NETWORKMAPFILTER_JSON} media + * type defined by RFC 7285. + */ + public static final String APPLICATION_ALTO_NETWORKMAPFILTER_JSON = + "application/alto-networkmapfilter+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_NETWORKMAPFILTER_JSON} media + * type defined by RFC 7285. + */ + public static final MediaType APPLICATION_ALTO_NETWORKMAPFILTER_JSON_TYPE = + new MediaType("application", "alto-networkmapfilter+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_NETWORKMAP_JSON} media + * type defined by RFC 7285. + */ + public static final String APPLICATION_ALTO_NETWORKMAP_JSON = + "application/alto-networkmap+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_NETWORKMAP_JSON} media + * type defined by RFC 7285. + */ + public static final MediaType APPLICATION_ALTO_NETWORKMAP_JSON_TYPE = + new MediaType("application", "alto-networkmap+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_PROPMAP_JSON} media + * type defined by RFC 9240. + */ + public static final String APPLICATION_ALTO_PROPMAP_JSON = + "application/alto-propmap+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_PROPMAP_JSON} media + * type defined by RFC 9240. + */ + public static final MediaType APPLICATION_ALTO_PROPMAP_JSON_TYPE = + new MediaType("application", "alto-propmap+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_PROPMAPPARAMS_JSON} media + * type defined by RFC 9240. + */ + public static final String APPLICATION_ALTO_PROPMAPPARAMS_JSON = + "application/alto-propmapparams+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_PROPMAPPARAMS_JSON} media + * type defined by RFC 9240. + */ + public static final MediaType APPLICATION_ALTO_PROPMAPPARAMS_JSON_TYPE = + new MediaType("application", "alto-propmapparams+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_TIPS_JSON} media + * type defined by RFC 9569. + */ + public static final String APPLICATION_ALTO_TIPS_JSON = + "application/alto-tips+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_TIPS_JSON} media + * type defined by RFC 9569. + */ + public static final MediaType APPLICATION_ALTO_TIPS_JSON_TYPE = + new MediaType("application", "alto-tips+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_TIPSPARAMS_JSON} media + * type defined by RFC 9569. + */ + public static final String APPLICATION_ALTO_TIPSPARAMS_JSON = + "application/alto-tipsparams+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_TIPSPARAMS_JSON} media + * type defined by RFC 9569. + */ + public static final MediaType APPLICATION_ALTO_TIPSPARAMS_JSON_TYPE = + new MediaType("application", "alto-tipsparams+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_UPDATESTREAMCONTROL_JSON} media + * type defined by RFC 8895. + */ + public static final String APPLICATION_ALTO_UPDATESTREAMCONTROL_JSON = + "application/alto-updatestreamcontrol+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_UPDATESTREAMCONTROL_JSON} media + * type defined by RFC 8895. + */ + public static final MediaType APPLICATION_ALTO_UPDATESTREAMCONTROL_JSON_TYPE = + new MediaType("application", "alto-updatestreamcontrol+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ALTO_UPDATESTREAMPARAMS_JSON} media + * type defined by RFC 8895. + */ + public static final String APPLICATION_ALTO_UPDATESTREAMPARAMS_JSON = + "application/alto-updatestreamparams+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ALTO_UPDATESTREAMPARAMS_JSON} media + * type defined by RFC 8895. + */ + public static final MediaType APPLICATION_ALTO_UPDATESTREAMPARAMS_JSON_TYPE = + new MediaType("application", "alto-updatestreamparams+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_AT_JWT} media + * type defined by RFC 9068. + */ + public static final String APPLICATION_AT_JWT = + "application/at+jwt"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_AT_JWT} media + * type defined by RFC 9068. + */ + public static final MediaType APPLICATION_AT_JWT_TYPE = + new MediaType("application", "at+jwt"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ATOM_XML} media + * type defined by RFC 4287, and RFC 5023. + */ + public static final String APPLICATION_ATOM_XML = + "application/atom+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ATOM_XML} media + * type defined by RFC 4287, and RFC 5023. + */ + public static final MediaType APPLICATION_ATOM_XML_TYPE = + new MediaType("application", "atom+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ATOMCAT_XML} media + * type defined by RFC 5023. + */ + public static final String APPLICATION_ATOMCAT_XML = + "application/atomcat+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ATOMCAT_XML} media + * type defined by RFC 5023. + */ + public static final MediaType APPLICATION_ATOMCAT_XML_TYPE = + new MediaType("application", "atomcat+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ATOMDELETED_XML} media + * type defined by RFC 6721. + */ + public static final String APPLICATION_ATOMDELETED_XML = + "application/atomdeleted+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ATOMDELETED_XML} media + * type defined by RFC 6721. + */ + public static final MediaType APPLICATION_ATOMDELETED_XML_TYPE = + new MediaType("application", "atomdeleted+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ATOMSVC_XML} media + * type defined by RFC 5023. + */ + public static final String APPLICATION_ATOMSVC_XML = + "application/atomsvc+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ATOMSVC_XML} media + * type defined by RFC 5023. + */ + public static final MediaType APPLICATION_ATOMSVC_XML_TYPE = + new MediaType("application", "atomsvc+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_AUTH_POLICY_XML} media + * type defined by RFC 4745. + */ + public static final String APPLICATION_AUTH_POLICY_XML = + "application/auth-policy+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_AUTH_POLICY_XML} media + * type defined by RFC 4745. + */ + public static final MediaType APPLICATION_AUTH_POLICY_XML_TYPE = + new MediaType("application", "auth-policy+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_BATCH_SMTP} media + * type defined by RFC 2442. + */ + public static final String APPLICATION_BATCH_SMTP = + "application/batch-SMTP"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_BATCH_SMTP} media + * type defined by RFC 2442. + */ + public static final MediaType APPLICATION_BATCH_SMTP_TYPE = + new MediaType("application", "batch-SMTP"); + + /** + * A {@code String} constant representing {@value #APPLICATION_BEEP_XML} media + * type defined by RFC 3080. + */ + public static final String APPLICATION_BEEP_XML = + "application/beep+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_BEEP_XML} media + * type defined by RFC 3080. + */ + public static final MediaType APPLICATION_BEEP_XML_TYPE = + new MediaType("application", "beep+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CALENDAR_JSON} media + * type defined by RFC 7265. + */ + public static final String APPLICATION_CALENDAR_JSON = + "application/calendar+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CALENDAR_JSON} media + * type defined by RFC 7265. + */ + public static final MediaType APPLICATION_CALENDAR_JSON_TYPE = + new MediaType("application", "calendar+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CALENDAR_XML} media + * type defined by RFC 6321. + */ + public static final String APPLICATION_CALENDAR_XML = + "application/calendar+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CALENDAR_XML} media + * type defined by RFC 6321. + */ + public static final MediaType APPLICATION_CALENDAR_XML_TYPE = + new MediaType("application", "calendar+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CALL_COMPLETION} media + * type defined by RFC 6910. + */ + public static final String APPLICATION_CALL_COMPLETION = + "application/call-completion"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CALL_COMPLETION} media + * type defined by RFC 6910. + */ + public static final MediaType APPLICATION_CALL_COMPLETION_TYPE = + new MediaType("application", "call-completion"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CALS_1840} media + * type defined by RFC 1895. + */ + public static final String APPLICATION_CALS_1840 = + "application/CALS-1840"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CALS_1840} media + * type defined by RFC 1895. + */ + public static final MediaType APPLICATION_CALS_1840_TYPE = + new MediaType("application", "CALS-1840"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CAPTIVE_JSON} media + * type defined by RFC 8908. + */ + public static final String APPLICATION_CAPTIVE_JSON = + "application/captive+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CAPTIVE_JSON} media + * type defined by RFC 8908. + */ + public static final MediaType APPLICATION_CAPTIVE_JSON_TYPE = + new MediaType("application", "captive+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CBOR} media + * type defined by RFC 8949. + */ + public static final String APPLICATION_CBOR = + "application/cbor"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CBOR} media + * type defined by RFC 8949. + */ + public static final MediaType APPLICATION_CBOR_TYPE = + new MediaType("application", "cbor"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CBOR_SEQ} media + * type defined by RFC 8742. + */ + public static final String APPLICATION_CBOR_SEQ = + "application/cbor-seq"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CBOR_SEQ} media + * type defined by RFC 8742. + */ + public static final MediaType APPLICATION_CBOR_SEQ_TYPE = + new MediaType("application", "cbor-seq"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CCMP_XML} media + * type defined by RFC 6503. + */ + public static final String APPLICATION_CCMP_XML = + "application/ccmp+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CCMP_XML} media + * type defined by RFC 6503. + */ + public static final MediaType APPLICATION_CCMP_XML_TYPE = + new MediaType("application", "ccmp+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CCXML_XML} media + * type defined by RFC 4267. + */ + public static final String APPLICATION_CCXML_XML = + "application/ccxml+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CCXML_XML} media + * type defined by RFC 4267. + */ + public static final MediaType APPLICATION_CCXML_XML_TYPE = + new MediaType("application", "ccxml+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CDMI_CAPABILITY} media + * type defined by RFC 6208. + */ + public static final String APPLICATION_CDMI_CAPABILITY = + "application/cdmi-capability"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CDMI_CAPABILITY} media + * type defined by RFC 6208. + */ + public static final MediaType APPLICATION_CDMI_CAPABILITY_TYPE = + new MediaType("application", "cdmi-capability"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CDMI_CONTAINER} media + * type defined by RFC 6208. + */ + public static final String APPLICATION_CDMI_CONTAINER = + "application/cdmi-container"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CDMI_CONTAINER} media + * type defined by RFC 6208. + */ + public static final MediaType APPLICATION_CDMI_CONTAINER_TYPE = + new MediaType("application", "cdmi-container"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CDMI_DOMAIN} media + * type defined by RFC 6208. + */ + public static final String APPLICATION_CDMI_DOMAIN = + "application/cdmi-domain"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CDMI_DOMAIN} media + * type defined by RFC 6208. + */ + public static final MediaType APPLICATION_CDMI_DOMAIN_TYPE = + new MediaType("application", "cdmi-domain"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CDMI_OBJECT} media + * type defined by RFC 6208. + */ + public static final String APPLICATION_CDMI_OBJECT = + "application/cdmi-object"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CDMI_OBJECT} media + * type defined by RFC 6208. + */ + public static final MediaType APPLICATION_CDMI_OBJECT_TYPE = + new MediaType("application", "cdmi-object"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CDMI_QUEUE} media + * type defined by RFC 6208. + */ + public static final String APPLICATION_CDMI_QUEUE = + "application/cdmi-queue"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CDMI_QUEUE} media + * type defined by RFC 6208. + */ + public static final MediaType APPLICATION_CDMI_QUEUE_TYPE = + new MediaType("application", "cdmi-queue"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CDNI} media + * type defined by RFC 7736. + */ + public static final String APPLICATION_CDNI = + "application/cdni"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CDNI} media + * type defined by RFC 7736. + */ + public static final MediaType APPLICATION_CDNI_TYPE = + new MediaType("application", "cdni"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CELLML_XML} media + * type defined by RFC 4708. + */ + public static final String APPLICATION_CELLML_XML = + "application/cellml+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CELLML_XML} media + * type defined by RFC 4708. + */ + public static final MediaType APPLICATION_CELLML_XML_TYPE = + new MediaType("application", "cellml+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CFW} media + * type defined by RFC 6230. + */ + public static final String APPLICATION_CFW = + "application/cfw"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CFW} media + * type defined by RFC 6230. + */ + public static final MediaType APPLICATION_CFW_TYPE = + new MediaType("application", "cfw"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CID_EDHOC_CBOR_SEQ} media + * type defined by RFC 9528. + */ + public static final String APPLICATION_CID_EDHOC_CBOR_SEQ = + "application/cid-edhoc+cbor-seq"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CID_EDHOC_CBOR_SEQ} media + * type defined by RFC 9528. + */ + public static final MediaType APPLICATION_CID_EDHOC_CBOR_SEQ_TYPE = + new MediaType("application", "cid-edhoc+cbor-seq"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CLUE_INFO_XML} media + * type defined by RFC 8846. + */ + public static final String APPLICATION_CLUE_INFO_XML = + "application/clue_info+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CLUE_INFO_XML} media + * type defined by RFC 8846. + */ + public static final MediaType APPLICATION_CLUE_INFO_XML_TYPE = + new MediaType("application", "clue_info+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CLUE_XML} media + * type defined by RFC 8847. + */ + public static final String APPLICATION_CLUE_XML = + "application/clue+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CLUE_XML} media + * type defined by RFC 8847. + */ + public static final MediaType APPLICATION_CLUE_XML_TYPE = + new MediaType("application", "clue+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CMS} media + * type defined by RFC 7193. + */ + public static final String APPLICATION_CMS = + "application/cms"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CMS} media + * type defined by RFC 7193. + */ + public static final MediaType APPLICATION_CMS_TYPE = + new MediaType("application", "cms"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CNRP_XML} media + * type defined by RFC 3367. + */ + public static final String APPLICATION_CNRP_XML = + "application/cnrp+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CNRP_XML} media + * type defined by RFC 3367. + */ + public static final MediaType APPLICATION_CNRP_XML_TYPE = + new MediaType("application", "cnrp+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_COAP_EAP} media + * type defined by RFC 9820. + */ + public static final String APPLICATION_COAP_EAP = + "application/coap-eap"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_COAP_EAP} media + * type defined by RFC 9820. + */ + public static final MediaType APPLICATION_COAP_EAP_TYPE = + new MediaType("application", "coap-eap"); + + /** + * A {@code String} constant representing {@value #APPLICATION_COAP_GROUP_JSON} media + * type defined by RFC 7390. + */ + public static final String APPLICATION_COAP_GROUP_JSON = + "application/coap-group+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_COAP_GROUP_JSON} media + * type defined by RFC 7390. + */ + public static final MediaType APPLICATION_COAP_GROUP_JSON_TYPE = + new MediaType("application", "coap-group+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_COAP_PAYLOAD} media + * type defined by RFC 8075. + */ + public static final String APPLICATION_COAP_PAYLOAD = + "application/coap-payload"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_COAP_PAYLOAD} media + * type defined by RFC 8075. + */ + public static final MediaType APPLICATION_COAP_PAYLOAD_TYPE = + new MediaType("application", "coap-payload"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CONCISE_PROBLEM_DETAILS_CBOR} media + * type defined by RFC 9290, Section 6.3. + */ + public static final String APPLICATION_CONCISE_PROBLEM_DETAILS_CBOR = + "application/concise-problem-details+cbor"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CONCISE_PROBLEM_DETAILS_CBOR} media + * type defined by RFC 9290, Section 6.3. + */ + public static final MediaType APPLICATION_CONCISE_PROBLEM_DETAILS_CBOR_TYPE = + new MediaType("application", "concise-problem-details+cbor"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CONFERENCE_INFO_XML} media + * type defined by RFC 4575. + */ + public static final String APPLICATION_CONFERENCE_INFO_XML = + "application/conference-info+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CONFERENCE_INFO_XML} media + * type defined by RFC 4575. + */ + public static final MediaType APPLICATION_CONFERENCE_INFO_XML_TYPE = + new MediaType("application", "conference-info+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CPL_XML} media + * type defined by RFC 3880. + */ + public static final String APPLICATION_CPL_XML = + "application/cpl+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CPL_XML} media + * type defined by RFC 3880. + */ + public static final MediaType APPLICATION_CPL_XML_TYPE = + new MediaType("application", "cpl+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_COSE} media + * type defined by RFC 9052. + */ + public static final String APPLICATION_COSE = + "application/cose"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_COSE} media + * type defined by RFC 9052. + */ + public static final MediaType APPLICATION_COSE_TYPE = + new MediaType("application", "cose"); + + /** + * A {@code String} constant representing {@value #APPLICATION_COSE_KEY} media + * type defined by RFC 9052. + */ + public static final String APPLICATION_COSE_KEY = + "application/cose-key"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_COSE_KEY} media + * type defined by RFC 9052. + */ + public static final MediaType APPLICATION_COSE_KEY_TYPE = + new MediaType("application", "cose-key"); + + /** + * A {@code String} constant representing {@value #APPLICATION_COSE_KEY_SET} media + * type defined by RFC 9052. + */ + public static final String APPLICATION_COSE_KEY_SET = + "application/cose-key-set"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_COSE_KEY_SET} media + * type defined by RFC 9052. + */ + public static final MediaType APPLICATION_COSE_KEY_SET_TYPE = + new MediaType("application", "cose-key-set"); + + /** + * A {@code String} constant representing {@value #APPLICATION_COSE_X509} media + * type defined by RFC 9360. + */ + public static final String APPLICATION_COSE_X509 = + "application/cose-x509"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_COSE_X509} media + * type defined by RFC 9360. + */ + public static final MediaType APPLICATION_COSE_X509_TYPE = + new MediaType("application", "cose-x509"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CSRATTRS} media + * type defined by RFC 7030. + */ + public static final String APPLICATION_CSRATTRS = + "application/csrattrs"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CSRATTRS} media + * type defined by RFC 7030. + */ + public static final MediaType APPLICATION_CSRATTRS_TYPE = + new MediaType("application", "csrattrs"); + + /** + * A {@code String} constant representing {@value #APPLICATION_CWT} media + * type defined by RFC 8392. + */ + public static final String APPLICATION_CWT = + "application/cwt"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_CWT} media + * type defined by RFC 8392. + */ + public static final MediaType APPLICATION_CWT_TYPE = + new MediaType("application", "cwt"); + + /** + * A {@code String} constant representing {@value #APPLICATION_DAVMOUNT_XML} media + * type defined by RFC 4709. + */ + public static final String APPLICATION_DAVMOUNT_XML = + "application/davmount+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_DAVMOUNT_XML} media + * type defined by RFC 4709. + */ + public static final MediaType APPLICATION_DAVMOUNT_XML_TYPE = + new MediaType("application", "davmount+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_DIALOG_INFO_XML} media + * type defined by RFC 4235. + */ + public static final String APPLICATION_DIALOG_INFO_XML = + "application/dialog-info+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_DIALOG_INFO_XML} media + * type defined by RFC 4235. + */ + public static final MediaType APPLICATION_DIALOG_INFO_XML_TYPE = + new MediaType("application", "dialog-info+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_DICOM} media + * type defined by RFC 3240. + */ + public static final String APPLICATION_DICOM = + "application/dicom"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_DICOM} media + * type defined by RFC 3240. + */ + public static final MediaType APPLICATION_DICOM_TYPE = + new MediaType("application", "dicom"); + + /** + * A {@code String} constant representing {@value #APPLICATION_DNS} media + * type defined by RFC 4027. + */ + public static final String APPLICATION_DNS = + "application/dns"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_DNS} media + * type defined by RFC 4027. + */ + public static final MediaType APPLICATION_DNS_TYPE = + new MediaType("application", "dns"); + + /** + * A {@code String} constant representing {@value #APPLICATION_DNS_JSON} media + * type defined by RFC 8427. + */ + public static final String APPLICATION_DNS_JSON = + "application/dns+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_DNS_JSON} media + * type defined by RFC 8427. + */ + public static final MediaType APPLICATION_DNS_JSON_TYPE = + new MediaType("application", "dns+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_DNS_MESSAGE} media + * type defined by RFC 8484. + */ + public static final String APPLICATION_DNS_MESSAGE = + "application/dns-message"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_DNS_MESSAGE} media + * type defined by RFC 8484. + */ + public static final MediaType APPLICATION_DNS_MESSAGE_TYPE = + new MediaType("application", "dns-message"); + + /** + * A {@code String} constant representing {@value #APPLICATION_DOTS_CBOR} media + * type defined by RFC 9132. + */ + public static final String APPLICATION_DOTS_CBOR = + "application/dots+cbor"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_DOTS_CBOR} media + * type defined by RFC 9132. + */ + public static final MediaType APPLICATION_DOTS_CBOR_TYPE = + new MediaType("application", "dots+cbor"); + + /** + * A {@code String} constant representing {@value #APPLICATION_DPOP_JWT} media + * type defined by RFC 9449. + */ + public static final String APPLICATION_DPOP_JWT = + "application/dpop+jwt"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_DPOP_JWT} media + * type defined by RFC 9449. + */ + public static final MediaType APPLICATION_DPOP_JWT_TYPE = + new MediaType("application", "dpop+jwt"); + + /** + * A {@code String} constant representing {@value #APPLICATION_DSKPP_XML} media + * type defined by RFC 6063. + */ + public static final String APPLICATION_DSKPP_XML = + "application/dskpp+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_DSKPP_XML} media + * type defined by RFC 6063. + */ + public static final MediaType APPLICATION_DSKPP_XML_TYPE = + new MediaType("application", "dskpp+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_DSSC_DER} media + * type defined by RFC 5698. + */ + public static final String APPLICATION_DSSC_DER = + "application/dssc+der"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_DSSC_DER} media + * type defined by RFC 5698. + */ + public static final MediaType APPLICATION_DSSC_DER_TYPE = + new MediaType("application", "dssc+der"); + + /** + * A {@code String} constant representing {@value #APPLICATION_DSSC_XML} media + * type defined by RFC 5698. + */ + public static final String APPLICATION_DSSC_XML = + "application/dssc+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_DSSC_XML} media + * type defined by RFC 5698. + */ + public static final MediaType APPLICATION_DSSC_XML_TYPE = + new MediaType("application", "dssc+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_DVCS} media + * type defined by RFC 3029. + */ + public static final String APPLICATION_DVCS = + "application/dvcs"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_DVCS} media + * type defined by RFC 3029. + */ + public static final MediaType APPLICATION_DVCS_TYPE = + new MediaType("application", "dvcs"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EAT_CWT} media + * type defined by RFC 9782. + */ + public static final String APPLICATION_EAT_CWT = + "application/eat+cwt"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EAT_CWT} media + * type defined by RFC 9782. + */ + public static final MediaType APPLICATION_EAT_CWT_TYPE = + new MediaType("application", "eat+cwt"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EAT_JWT} media + * type defined by RFC 9782. + */ + public static final String APPLICATION_EAT_JWT = + "application/eat+jwt"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EAT_JWT} media + * type defined by RFC 9782. + */ + public static final MediaType APPLICATION_EAT_JWT_TYPE = + new MediaType("application", "eat+jwt"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EAT_BUN_CBOR} media + * type defined by RFC 9782. + */ + public static final String APPLICATION_EAT_BUN_CBOR = + "application/eat-bun+cbor"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EAT_BUN_CBOR} media + * type defined by RFC 9782. + */ + public static final MediaType APPLICATION_EAT_BUN_CBOR_TYPE = + new MediaType("application", "eat-bun+cbor"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EAT_BUN_JSON} media + * type defined by RFC 9782. + */ + public static final String APPLICATION_EAT_BUN_JSON = + "application/eat-bun+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EAT_BUN_JSON} media + * type defined by RFC 9782. + */ + public static final MediaType APPLICATION_EAT_BUN_JSON_TYPE = + new MediaType("application", "eat-bun+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EAT_UCS_CBOR} media + * type defined by RFC 9782. + */ + public static final String APPLICATION_EAT_UCS_CBOR = + "application/eat-ucs+cbor"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EAT_UCS_CBOR} media + * type defined by RFC 9782. + */ + public static final MediaType APPLICATION_EAT_UCS_CBOR_TYPE = + new MediaType("application", "eat-ucs+cbor"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EAT_UCS_JSON} media + * type defined by RFC 9782. + */ + public static final String APPLICATION_EAT_UCS_JSON = + "application/eat-ucs+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EAT_UCS_JSON} media + * type defined by RFC 9782. + */ + public static final MediaType APPLICATION_EAT_UCS_JSON_TYPE = + new MediaType("application", "eat-ucs+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ECMASCRIPT} media + * type defined by RFC 4329, and RFC 9239. + */ + public static final String APPLICATION_ECMASCRIPT = + "application/ecmascript"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ECMASCRIPT} media + * type defined by RFC 4329, and RFC 9239. + */ + public static final MediaType APPLICATION_ECMASCRIPT_TYPE = + new MediaType("application", "ecmascript"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EDHOC_CBOR_SEQ} media + * type defined by RFC 9528. + */ + public static final String APPLICATION_EDHOC_CBOR_SEQ = + "application/edhoc+cbor-seq"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EDHOC_CBOR_SEQ} media + * type defined by RFC 9528. + */ + public static final MediaType APPLICATION_EDHOC_CBOR_SEQ_TYPE = + new MediaType("application", "edhoc+cbor-seq"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EDI_CONSENT} media + * type defined by RFC 1767. + */ + public static final String APPLICATION_EDI_CONSENT = + "application/EDI-consent"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EDI_CONSENT} media + * type defined by RFC 1767. + */ + public static final MediaType APPLICATION_EDI_CONSENT_TYPE = + new MediaType("application", "EDI-consent"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EDIFACT} media + * type defined by RFC 1767. + */ + public static final String APPLICATION_EDIFACT = + "application/EDIFACT"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EDIFACT} media + * type defined by RFC 1767. + */ + public static final MediaType APPLICATION_EDIFACT_TYPE = + new MediaType("application", "EDIFACT"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EDI_X12} media + * type defined by RFC 1767. + */ + public static final String APPLICATION_EDI_X12 = + "application/EDI-X12"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EDI_X12} media + * type defined by RFC 1767. + */ + public static final MediaType APPLICATION_EDI_X12_TYPE = + new MediaType("application", "EDI-X12"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_CAP_XML} media + * type defined by RFC 8876. + */ + public static final String APPLICATION_EMERGENCYCALLDATA_CAP_XML = + "application/EmergencyCallData.cap+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_CAP_XML} media + * type defined by RFC 8876. + */ + public static final MediaType APPLICATION_EMERGENCYCALLDATA_CAP_XML_TYPE = + new MediaType("application", "EmergencyCallData.cap+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_COMMENT_XML} media + * type defined by RFC 7852. + */ + public static final String APPLICATION_EMERGENCYCALLDATA_COMMENT_XML = + "application/EmergencyCallData.Comment+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_COMMENT_XML} media + * type defined by RFC 7852. + */ + public static final MediaType APPLICATION_EMERGENCYCALLDATA_COMMENT_XML_TYPE = + new MediaType("application", "EmergencyCallData.Comment+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_CONTROL_XML} media + * type defined by RFC 8147. + */ + public static final String APPLICATION_EMERGENCYCALLDATA_CONTROL_XML = + "application/EmergencyCallData.Control+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_CONTROL_XML} media + * type defined by RFC 8147. + */ + public static final MediaType APPLICATION_EMERGENCYCALLDATA_CONTROL_XML_TYPE = + new MediaType("application", "EmergencyCallData.Control+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_DEVICEINFO_XML} media + * type defined by RFC 7852. + */ + public static final String APPLICATION_EMERGENCYCALLDATA_DEVICEINFO_XML = + "application/EmergencyCallData.DeviceInfo+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_DEVICEINFO_XML} media + * type defined by RFC 7852. + */ + public static final MediaType APPLICATION_EMERGENCYCALLDATA_DEVICEINFO_XML_TYPE = + new MediaType("application", "EmergencyCallData.DeviceInfo+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_ECALL_MSD} media + * type defined by RFC 8147. + */ + public static final String APPLICATION_EMERGENCYCALLDATA_ECALL_MSD = + "application/EmergencyCallData.eCall.MSD"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_ECALL_MSD} media + * type defined by RFC 8147. + */ + public static final MediaType APPLICATION_EMERGENCYCALLDATA_ECALL_MSD_TYPE = + new MediaType("application", "EmergencyCallData.eCall.MSD"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_PROVIDERINFO_XML} media + * type defined by RFC 7852. + */ + public static final String APPLICATION_EMERGENCYCALLDATA_PROVIDERINFO_XML = + "application/EmergencyCallData.ProviderInfo+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_PROVIDERINFO_XML} media + * type defined by RFC 7852. + */ + public static final MediaType APPLICATION_EMERGENCYCALLDATA_PROVIDERINFO_XML_TYPE = + new MediaType("application", "EmergencyCallData.ProviderInfo+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_SERVICEINFO_XML} media + * type defined by RFC 7852. + */ + public static final String APPLICATION_EMERGENCYCALLDATA_SERVICEINFO_XML = + "application/EmergencyCallData.ServiceInfo+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_SERVICEINFO_XML} media + * type defined by RFC 7852. + */ + public static final MediaType APPLICATION_EMERGENCYCALLDATA_SERVICEINFO_XML_TYPE = + new MediaType("application", "EmergencyCallData.ServiceInfo+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_SUBSCRIBERINFO_XML} media + * type defined by RFC 7852. + */ + public static final String APPLICATION_EMERGENCYCALLDATA_SUBSCRIBERINFO_XML = + "application/EmergencyCallData.SubscriberInfo+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_SUBSCRIBERINFO_XML} media + * type defined by RFC 7852. + */ + public static final MediaType APPLICATION_EMERGENCYCALLDATA_SUBSCRIBERINFO_XML_TYPE = + new MediaType("application", "EmergencyCallData.SubscriberInfo+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_VEDS_XML} media + * type defined by RFC 8148, and RFC Errata 6500. + */ + public static final String APPLICATION_EMERGENCYCALLDATA_VEDS_XML = + "application/EmergencyCallData.VEDS+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EMERGENCYCALLDATA_VEDS_XML} media + * type defined by RFC 8148, and RFC Errata 6500. + */ + public static final MediaType APPLICATION_EMERGENCYCALLDATA_VEDS_XML_TYPE = + new MediaType("application", "EmergencyCallData.VEDS+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EMMA_XML} media + * type defined by {@code http://www.w3.org/TR/2007/CR-emma-20071211/#media-type-registration}. + */ + public static final String APPLICATION_EMMA_XML = + "application/emma+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EMMA_XML} media + * type defined by {@code http://www.w3.org/TR/2007/CR-emma-20071211/#media-type-registration}. + */ + public static final MediaType APPLICATION_EMMA_XML_TYPE = + new MediaType("application", "emma+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ENCAPRTP} media + * type defined by RFC 6849. + */ + public static final String APPLICATION_ENCAPRTP = + "application/encaprtp"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ENCAPRTP} media + * type defined by RFC 6849. + */ + public static final MediaType APPLICATION_ENCAPRTP_TYPE = + new MediaType("application", "encaprtp"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EPP_XML} media + * type defined by RFC 5730. + */ + public static final String APPLICATION_EPP_XML = + "application/epp+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EPP_XML} media + * type defined by RFC 5730. + */ + public static final MediaType APPLICATION_EPP_XML_TYPE = + new MediaType("application", "epp+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EXAMPLE} media + * type defined by RFC 4735. + */ + public static final String APPLICATION_EXAMPLE = + "application/example"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EXAMPLE} media + * type defined by RFC 4735. + */ + public static final MediaType APPLICATION_EXAMPLE_TYPE = + new MediaType("application", "example"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EXI} media + * type defined by {@code http://www.w3.org/TR/2009/CR-exi-20091208/#mediaTypeRegistration}. + */ + public static final String APPLICATION_EXI = + "application/exi"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EXI} media + * type defined by {@code http://www.w3.org/TR/2009/CR-exi-20091208/#mediaTypeRegistration}. + */ + public static final MediaType APPLICATION_EXI_TYPE = + new MediaType("application", "exi"); + + /** + * A {@code String} constant representing {@value #APPLICATION_EXPECT_CT_REPORT_JSON} media + * type defined by RFC 9163. + */ + public static final String APPLICATION_EXPECT_CT_REPORT_JSON = + "application/expect-ct-report+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_EXPECT_CT_REPORT_JSON} media + * type defined by RFC 9163. + */ + public static final MediaType APPLICATION_EXPECT_CT_REPORT_JSON_TYPE = + new MediaType("application", "expect-ct-report+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_FDT_XML} media + * type defined by RFC 6726. + */ + public static final String APPLICATION_FDT_XML = + "application/fdt+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_FDT_XML} media + * type defined by RFC 6726. + */ + public static final MediaType APPLICATION_FDT_XML_TYPE = + new MediaType("application", "fdt+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_FITS} media + * type defined by RFC 4047. + */ + public static final String APPLICATION_FITS = + "application/fits"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_FITS} media + * type defined by RFC 4047. + */ + public static final MediaType APPLICATION_FITS_TYPE = + new MediaType("application", "fits"); + + /** + * A {@code String} constant representing {@value #APPLICATION_FLEXFEC} media + * type defined by RFC 8627. + */ + public static final String APPLICATION_FLEXFEC = + "application/flexfec"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_FLEXFEC} media + * type defined by RFC 8627. + */ + public static final MediaType APPLICATION_FLEXFEC_TYPE = + new MediaType("application", "flexfec"); + + /** + * A {@code String} constant representing {@value #APPLICATION_FONT_SFNT} media + * type defined by RFC 8081. + */ + public static final String APPLICATION_FONT_SFNT = + "application/font-sfnt"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_FONT_SFNT} media + * type defined by RFC 8081. + */ + public static final MediaType APPLICATION_FONT_SFNT_TYPE = + new MediaType("application", "font-sfnt"); + + /** + * A {@code String} constant representing {@value #APPLICATION_FONT_TDPFR} media + * type defined by RFC 3073. + */ + public static final String APPLICATION_FONT_TDPFR = + "application/font-tdpfr"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_FONT_TDPFR} media + * type defined by RFC 3073. + */ + public static final MediaType APPLICATION_FONT_TDPFR_TYPE = + new MediaType("application", "font-tdpfr"); + + /** + * A {@code String} constant representing {@value #APPLICATION_FONT_WOFF} media + * type defined by RFC 8081. + */ + public static final String APPLICATION_FONT_WOFF = + "application/font-woff"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_FONT_WOFF} media + * type defined by RFC 8081. + */ + public static final MediaType APPLICATION_FONT_WOFF_TYPE = + new MediaType("application", "font-woff"); + + /** + * A {@code String} constant representing {@value #APPLICATION_FRAMEWORK_ATTRIBUTES_XML} media + * type defined by RFC 6230. + */ + public static final String APPLICATION_FRAMEWORK_ATTRIBUTES_XML = + "application/framework-attributes+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_FRAMEWORK_ATTRIBUTES_XML} media + * type defined by RFC 6230. + */ + public static final MediaType APPLICATION_FRAMEWORK_ATTRIBUTES_XML_TYPE = + new MediaType("application", "framework-attributes+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_GEO_JSON} media + * type defined by RFC 7946. + */ + public static final String APPLICATION_GEO_JSON = + "application/geo+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_GEO_JSON} media + * type defined by RFC 7946. + */ + public static final MediaType APPLICATION_GEO_JSON_TYPE = + new MediaType("application", "geo+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_GEO_JSON_SEQ} media + * type defined by RFC 8142. + */ + public static final String APPLICATION_GEO_JSON_SEQ = + "application/geo+json-seq"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_GEO_JSON_SEQ} media + * type defined by RFC 8142. + */ + public static final MediaType APPLICATION_GEO_JSON_SEQ_TYPE = + new MediaType("application", "geo+json-seq"); + + /** + * A {@code String} constant representing {@value #APPLICATION_GEOFEED_CSV} media + * type defined by RFC-ietf-regext-rdap-geofeed-14. + */ + public static final String APPLICATION_GEOFEED_CSV = + "application/geofeed+csv"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_GEOFEED_CSV} media + * type defined by RFC-ietf-regext-rdap-geofeed-14. + */ + public static final MediaType APPLICATION_GEOFEED_CSV_TYPE = + new MediaType("application", "geofeed+csv"); + + /** + * A {@code String} constant representing {@value #APPLICATION_GNAP_BINDING_JWS} media + * type defined by RFC 9635. + */ + public static final String APPLICATION_GNAP_BINDING_JWS = + "application/gnap-binding-jws"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_GNAP_BINDING_JWS} media + * type defined by RFC 9635. + */ + public static final MediaType APPLICATION_GNAP_BINDING_JWS_TYPE = + new MediaType("application", "gnap-binding-jws"); + + /** + * A {@code String} constant representing {@value #APPLICATION_GNAP_BINDING_JWSD} media + * type defined by RFC 9635. + */ + public static final String APPLICATION_GNAP_BINDING_JWSD = + "application/gnap-binding-jwsd"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_GNAP_BINDING_JWSD} media + * type defined by RFC 9635. + */ + public static final MediaType APPLICATION_GNAP_BINDING_JWSD_TYPE = + new MediaType("application", "gnap-binding-jwsd"); + + /** + * A {@code String} constant representing {@value #APPLICATION_GNAP_BINDING_ROTATION_JWS} media + * type defined by RFC 9635. + */ + public static final String APPLICATION_GNAP_BINDING_ROTATION_JWS = + "application/gnap-binding-rotation-jws"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_GNAP_BINDING_ROTATION_JWS} media + * type defined by RFC 9635. + */ + public static final MediaType APPLICATION_GNAP_BINDING_ROTATION_JWS_TYPE = + new MediaType("application", "gnap-binding-rotation-jws"); + + /** + * A {@code String} constant representing {@value #APPLICATION_GNAP_BINDING_ROTATION_JWSD} media + * type defined by RFC 9635. + */ + public static final String APPLICATION_GNAP_BINDING_ROTATION_JWSD = + "application/gnap-binding-rotation-jwsd"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_GNAP_BINDING_ROTATION_JWSD} media + * type defined by RFC 9635. + */ + public static final MediaType APPLICATION_GNAP_BINDING_ROTATION_JWSD_TYPE = + new MediaType("application", "gnap-binding-rotation-jwsd"); + + /** + * A {@code String} constant representing {@value #APPLICATION_GZIP} media + * type defined by RFC 6713. + */ + public static final String APPLICATION_GZIP = + "application/gzip"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_GZIP} media + * type defined by RFC 6713. + */ + public static final MediaType APPLICATION_GZIP_TYPE = + new MediaType("application", "gzip"); + + /** + * A {@code String} constant representing {@value #APPLICATION_H224} media + * type defined by RFC 4573. + */ + public static final String APPLICATION_H224 = + "application/H224"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_H224} media + * type defined by RFC 4573. + */ + public static final MediaType APPLICATION_H224_TYPE = + new MediaType("application", "H224"); + + /** + * A {@code String} constant representing {@value #APPLICATION_HELD_XML} media + * type defined by RFC 5985. + */ + public static final String APPLICATION_HELD_XML = + "application/held+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_HELD_XML} media + * type defined by RFC 5985. + */ + public static final MediaType APPLICATION_HELD_XML_TYPE = + new MediaType("application", "held+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_HTTP} media + * type defined by RFC 9112. + */ + public static final String APPLICATION_HTTP = + "application/http"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_HTTP} media + * type defined by RFC 9112. + */ + public static final MediaType APPLICATION_HTTP_TYPE = + new MediaType("application", "http"); + + /** + * A {@code String} constant representing {@value #APPLICATION_IBE_KEY_REQUEST_XML} media + * type defined by RFC 5408. + */ + public static final String APPLICATION_IBE_KEY_REQUEST_XML = + "application/ibe-key-request+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_IBE_KEY_REQUEST_XML} media + * type defined by RFC 5408. + */ + public static final MediaType APPLICATION_IBE_KEY_REQUEST_XML_TYPE = + new MediaType("application", "ibe-key-request+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_IBE_PKG_REPLY_XML} media + * type defined by RFC 5408. + */ + public static final String APPLICATION_IBE_PKG_REPLY_XML = + "application/ibe-pkg-reply+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_IBE_PKG_REPLY_XML} media + * type defined by RFC 5408. + */ + public static final MediaType APPLICATION_IBE_PKG_REPLY_XML_TYPE = + new MediaType("application", "ibe-pkg-reply+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_IBE_PP_DATA} media + * type defined by RFC 5408. + */ + public static final String APPLICATION_IBE_PP_DATA = + "application/ibe-pp-data"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_IBE_PP_DATA} media + * type defined by RFC 5408. + */ + public static final MediaType APPLICATION_IBE_PP_DATA_TYPE = + new MediaType("application", "ibe-pp-data"); + + /** + * A {@code String} constant representing {@value #APPLICATION_IM_ISCOMPOSING_XML} media + * type defined by RFC 3994. + */ + public static final String APPLICATION_IM_ISCOMPOSING_XML = + "application/im-iscomposing+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_IM_ISCOMPOSING_XML} media + * type defined by RFC 3994. + */ + public static final MediaType APPLICATION_IM_ISCOMPOSING_XML_TYPE = + new MediaType("application", "im-iscomposing+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_INDEX} media + * type defined by RFC 2652. + */ + public static final String APPLICATION_INDEX = + "application/index"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_INDEX} media + * type defined by RFC 2652. + */ + public static final MediaType APPLICATION_INDEX_TYPE = + new MediaType("application", "index"); + + /** + * A {@code String} constant representing {@value #APPLICATION_INDEX_CMD} media + * type defined by RFC 2652. + */ + public static final String APPLICATION_INDEX_CMD = + "application/index.cmd"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_INDEX_CMD} media + * type defined by RFC 2652. + */ + public static final MediaType APPLICATION_INDEX_CMD_TYPE = + new MediaType("application", "index.cmd"); + + /** + * A {@code String} constant representing {@value #APPLICATION_INDEX_OBJ} media + * type defined by RFC 2652. + */ + public static final String APPLICATION_INDEX_OBJ = + "application/index.obj"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_INDEX_OBJ} media + * type defined by RFC 2652. + */ + public static final MediaType APPLICATION_INDEX_OBJ_TYPE = + new MediaType("application", "index.obj"); + + /** + * A {@code String} constant representing {@value #APPLICATION_INDEX_RESPONSE} media + * type defined by RFC 2652. + */ + public static final String APPLICATION_INDEX_RESPONSE = + "application/index.response"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_INDEX_RESPONSE} media + * type defined by RFC 2652. + */ + public static final MediaType APPLICATION_INDEX_RESPONSE_TYPE = + new MediaType("application", "index.response"); + + /** + * A {@code String} constant representing {@value #APPLICATION_INDEX_VND} media + * type defined by RFC 2652. + */ + public static final String APPLICATION_INDEX_VND = + "application/index.vnd"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_INDEX_VND} media + * type defined by RFC 2652. + */ + public static final MediaType APPLICATION_INDEX_VND_TYPE = + new MediaType("application", "index.vnd"); + + /** + * A {@code String} constant representing {@value #APPLICATION_IOTP} media + * type defined by RFC 2935. + */ + public static final String APPLICATION_IOTP = + "application/IOTP"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_IOTP} media + * type defined by RFC 2935. + */ + public static final MediaType APPLICATION_IOTP_TYPE = + new MediaType("application", "IOTP"); + + /** + * A {@code String} constant representing {@value #APPLICATION_IPFIX} media + * type defined by RFC 5655. + */ + public static final String APPLICATION_IPFIX = + "application/ipfix"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_IPFIX} media + * type defined by RFC 5655. + */ + public static final MediaType APPLICATION_IPFIX_TYPE = + new MediaType("application", "ipfix"); + + /** + * A {@code String} constant representing {@value #APPLICATION_IPP} media + * type defined by RFC 8010. + */ + public static final String APPLICATION_IPP = + "application/ipp"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_IPP} media + * type defined by RFC 8010. + */ + public static final MediaType APPLICATION_IPP_TYPE = + new MediaType("application", "ipp"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ISUP} media + * type defined by RFC 3204. + */ + public static final String APPLICATION_ISUP = + "application/ISUP"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ISUP} media + * type defined by RFC 3204. + */ + public static final MediaType APPLICATION_ISUP_TYPE = + new MediaType("application", "ISUP"); + + /** + * A {@code String} constant representing {@value #APPLICATION_JAVASCRIPT} media + * type defined by RFC 4329, and RFC 9239. + */ + public static final String APPLICATION_JAVASCRIPT = + "application/javascript"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_JAVASCRIPT} media + * type defined by RFC 4329, and RFC 9239. + */ + public static final MediaType APPLICATION_JAVASCRIPT_TYPE = + new MediaType("application", "javascript"); + + /** + * A {@code String} constant representing {@value #APPLICATION_JOSE} media + * type defined by RFC 7515. + */ + public static final String APPLICATION_JOSE = + "application/jose"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_JOSE} media + * type defined by RFC 7515. + */ + public static final MediaType APPLICATION_JOSE_TYPE = + new MediaType("application", "jose"); + + /** + * A {@code String} constant representing {@value #APPLICATION_JOSE_JSON} media + * type defined by RFC 7515. + */ + public static final String APPLICATION_JOSE_JSON = + "application/jose+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_JOSE_JSON} media + * type defined by RFC 7515. + */ + public static final MediaType APPLICATION_JOSE_JSON_TYPE = + new MediaType("application", "jose+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_JRD_JSON} media + * type defined by RFC 7033. + */ + public static final String APPLICATION_JRD_JSON = + "application/jrd+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_JRD_JSON} media + * type defined by RFC 7033. + */ + public static final MediaType APPLICATION_JRD_JSON_TYPE = + new MediaType("application", "jrd+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_JSCALENDAR_JSON} media + * type defined by RFC 8984. + */ + public static final String APPLICATION_JSCALENDAR_JSON = + "application/jscalendar+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_JSCALENDAR_JSON} media + * type defined by RFC 8984. + */ + public static final MediaType APPLICATION_JSCALENDAR_JSON_TYPE = + new MediaType("application", "jscalendar+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_JSCONTACT_JSON} media + * type defined by RFC 9553. + */ + public static final String APPLICATION_JSCONTACT_JSON = + "application/jscontact+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_JSCONTACT_JSON} media + * type defined by RFC 9553. + */ + public static final MediaType APPLICATION_JSCONTACT_JSON_TYPE = + new MediaType("application", "jscontact+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_JSON} media + * type defined by RFC 8259. + */ + public static final String APPLICATION_JSON = + "application/json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_JSON} media + * type defined by RFC 8259. + */ + public static final MediaType APPLICATION_JSON_TYPE = + new MediaType("application", "json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_JSON_PATCH_JSON} media + * type defined by RFC 6902. + */ + public static final String APPLICATION_JSON_PATCH_JSON = + "application/json-patch+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_JSON_PATCH_JSON} media + * type defined by RFC 6902. + */ + public static final MediaType APPLICATION_JSON_PATCH_JSON_TYPE = + new MediaType("application", "json-patch+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_JSON_SEQ} media + * type defined by RFC 7464. + */ + public static final String APPLICATION_JSON_SEQ = + "application/json-seq"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_JSON_SEQ} media + * type defined by RFC 7464. + */ + public static final MediaType APPLICATION_JSON_SEQ_TYPE = + new MediaType("application", "json-seq"); + + /** + * A {@code String} constant representing {@value #APPLICATION_JSONPATH} media + * type defined by RFC 9535. + */ + public static final String APPLICATION_JSONPATH = + "application/jsonpath"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_JSONPATH} media + * type defined by RFC 9535. + */ + public static final MediaType APPLICATION_JSONPATH_TYPE = + new MediaType("application", "jsonpath"); + + /** + * A {@code String} constant representing {@value #APPLICATION_JWK_JSON} media + * type defined by RFC 7517. + */ + public static final String APPLICATION_JWK_JSON = + "application/jwk+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_JWK_JSON} media + * type defined by RFC 7517. + */ + public static final MediaType APPLICATION_JWK_JSON_TYPE = + new MediaType("application", "jwk+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_JWK_SET_JSON} media + * type defined by RFC 7517. + */ + public static final String APPLICATION_JWK_SET_JSON = + "application/jwk-set+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_JWK_SET_JSON} media + * type defined by RFC 7517. + */ + public static final MediaType APPLICATION_JWK_SET_JSON_TYPE = + new MediaType("application", "jwk-set+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_JWT} media + * type defined by RFC 7519. + */ + public static final String APPLICATION_JWT = + "application/jwt"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_JWT} media + * type defined by RFC 7519. + */ + public static final MediaType APPLICATION_JWT_TYPE = + new MediaType("application", "jwt"); + + /** + * A {@code String} constant representing {@value #APPLICATION_KB_JWT} media + * type defined by RFC-ietf-oauth-selective-disclosure-jwt-22. + */ + public static final String APPLICATION_KB_JWT = + "application/kb+jwt"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_KB_JWT} media + * type defined by RFC-ietf-oauth-selective-disclosure-jwt-22. + */ + public static final MediaType APPLICATION_KB_JWT_TYPE = + new MediaType("application", "kb+jwt"); + + /** + * A {@code String} constant representing {@value #APPLICATION_KPML_REQUEST_XML} media + * type defined by RFC 4730. + */ + public static final String APPLICATION_KPML_REQUEST_XML = + "application/kpml-request+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_KPML_REQUEST_XML} media + * type defined by RFC 4730. + */ + public static final MediaType APPLICATION_KPML_REQUEST_XML_TYPE = + new MediaType("application", "kpml-request+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_KPML_RESPONSE_XML} media + * type defined by RFC 4730. + */ + public static final String APPLICATION_KPML_RESPONSE_XML = + "application/kpml-response+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_KPML_RESPONSE_XML} media + * type defined by RFC 4730. + */ + public static final MediaType APPLICATION_KPML_RESPONSE_XML_TYPE = + new MediaType("application", "kpml-response+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_LGR_XML} media + * type defined by RFC 7940. + */ + public static final String APPLICATION_LGR_XML = + "application/lgr+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_LGR_XML} media + * type defined by RFC 7940. + */ + public static final MediaType APPLICATION_LGR_XML_TYPE = + new MediaType("application", "lgr+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_LINK_FORMAT} media + * type defined by RFC 6690. + */ + public static final String APPLICATION_LINK_FORMAT = + "application/link-format"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_LINK_FORMAT} media + * type defined by RFC 6690. + */ + public static final MediaType APPLICATION_LINK_FORMAT_TYPE = + new MediaType("application", "link-format"); + + /** + * A {@code String} constant representing {@value #APPLICATION_LINKSET} media + * type defined by RFC 9264. + */ + public static final String APPLICATION_LINKSET = + "application/linkset"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_LINKSET} media + * type defined by RFC 9264. + */ + public static final MediaType APPLICATION_LINKSET_TYPE = + new MediaType("application", "linkset"); + + /** + * A {@code String} constant representing {@value #APPLICATION_LINKSET_JSON} media + * type defined by RFC 9264. + */ + public static final String APPLICATION_LINKSET_JSON = + "application/linkset+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_LINKSET_JSON} media + * type defined by RFC 9264. + */ + public static final MediaType APPLICATION_LINKSET_JSON_TYPE = + new MediaType("application", "linkset+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_LOAD_CONTROL_XML} media + * type defined by RFC 7200. + */ + public static final String APPLICATION_LOAD_CONTROL_XML = + "application/load-control+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_LOAD_CONTROL_XML} media + * type defined by RFC 7200. + */ + public static final MediaType APPLICATION_LOAD_CONTROL_XML_TYPE = + new MediaType("application", "load-control+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_LOST_XML} media + * type defined by RFC 5222. + */ + public static final String APPLICATION_LOST_XML = + "application/lost+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_LOST_XML} media + * type defined by RFC 5222. + */ + public static final MediaType APPLICATION_LOST_XML_TYPE = + new MediaType("application", "lost+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_LOSTSYNC_XML} media + * type defined by RFC 6739. + */ + public static final String APPLICATION_LOSTSYNC_XML = + "application/lostsync+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_LOSTSYNC_XML} media + * type defined by RFC 6739. + */ + public static final MediaType APPLICATION_LOSTSYNC_XML_TYPE = + new MediaType("application", "lostsync+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MADS_XML} media + * type defined by RFC 6207. + */ + public static final String APPLICATION_MADS_XML = + "application/mads+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MADS_XML} media + * type defined by RFC 6207. + */ + public static final MediaType APPLICATION_MADS_XML_TYPE = + new MediaType("application", "mads+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MARC} media + * type defined by RFC 2220. + */ + public static final String APPLICATION_MARC = + "application/marc"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MARC} media + * type defined by RFC 2220. + */ + public static final MediaType APPLICATION_MARC_TYPE = + new MediaType("application", "marc"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MARCXML_XML} media + * type defined by RFC 6207. + */ + public static final String APPLICATION_MARCXML_XML = + "application/marcxml+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MARCXML_XML} media + * type defined by RFC 6207. + */ + public static final MediaType APPLICATION_MARCXML_XML_TYPE = + new MediaType("application", "marcxml+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MATHML_XML} media + * type defined by {@code http://www.w3.org/TR/MathML3/appendixb.html}. + */ + public static final String APPLICATION_MATHML_XML = + "application/mathml+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MATHML_XML} media + * type defined by {@code http://www.w3.org/TR/MathML3/appendixb.html}. + */ + public static final MediaType APPLICATION_MATHML_XML_TYPE = + new MediaType("application", "mathml+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MATHML_CONTENT_XML} media + * type defined by {@code http://www.w3.org/TR/MathML3/appendixb.html}. + */ + public static final String APPLICATION_MATHML_CONTENT_XML = + "application/mathml-content+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MATHML_CONTENT_XML} media + * type defined by {@code http://www.w3.org/TR/MathML3/appendixb.html}. + */ + public static final MediaType APPLICATION_MATHML_CONTENT_XML_TYPE = + new MediaType("application", "mathml-content+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MATHML_PRESENTATION_XML} media + * type defined by {@code http://www.w3.org/TR/MathML3/appendixb.html}. + */ + public static final String APPLICATION_MATHML_PRESENTATION_XML = + "application/mathml-presentation+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MATHML_PRESENTATION_XML} media + * type defined by {@code http://www.w3.org/TR/MathML3/appendixb.html}. + */ + public static final MediaType APPLICATION_MATHML_PRESENTATION_XML_TYPE = + new MediaType("application", "mathml-presentation+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MBOX} media + * type defined by RFC 4155. + */ + public static final String APPLICATION_MBOX = + "application/mbox"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MBOX} media + * type defined by RFC 4155. + */ + public static final MediaType APPLICATION_MBOX_TYPE = + new MediaType("application", "mbox"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MEDIA_CONTROL_XML} media + * type defined by RFC 5168. + */ + public static final String APPLICATION_MEDIA_CONTROL_XML = + "application/media_control+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MEDIA_CONTROL_XML} media + * type defined by RFC 5168. + */ + public static final MediaType APPLICATION_MEDIA_CONTROL_XML_TYPE = + new MediaType("application", "media_control+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MEDIA_POLICY_DATASET_XML} media + * type defined by RFC 6796. + */ + public static final String APPLICATION_MEDIA_POLICY_DATASET_XML = + "application/media-policy-dataset+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MEDIA_POLICY_DATASET_XML} media + * type defined by RFC 6796. + */ + public static final MediaType APPLICATION_MEDIA_POLICY_DATASET_XML_TYPE = + new MediaType("application", "media-policy-dataset+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MEDIASERVERCONTROL_XML} media + * type defined by RFC 5022. + */ + public static final String APPLICATION_MEDIASERVERCONTROL_XML = + "application/mediaservercontrol+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MEDIASERVERCONTROL_XML} media + * type defined by RFC 5022. + */ + public static final MediaType APPLICATION_MEDIASERVERCONTROL_XML_TYPE = + new MediaType("application", "mediaservercontrol+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MERGE_PATCH_JSON} media + * type defined by RFC 7396. + */ + public static final String APPLICATION_MERGE_PATCH_JSON = + "application/merge-patch+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MERGE_PATCH_JSON} media + * type defined by RFC 7396. + */ + public static final MediaType APPLICATION_MERGE_PATCH_JSON_TYPE = + new MediaType("application", "merge-patch+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_METALINK4_XML} media + * type defined by RFC 5854. + */ + public static final String APPLICATION_METALINK4_XML = + "application/metalink4+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_METALINK4_XML} media + * type defined by RFC 5854. + */ + public static final MediaType APPLICATION_METALINK4_XML_TYPE = + new MediaType("application", "metalink4+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_METS_XML} media + * type defined by RFC 6207. + */ + public static final String APPLICATION_METS_XML = + "application/mets+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_METS_XML} media + * type defined by RFC 6207. + */ + public static final MediaType APPLICATION_METS_XML_TYPE = + new MediaType("application", "mets+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MIKEY} media + * type defined by RFC 3830. + */ + public static final String APPLICATION_MIKEY = + "application/mikey"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MIKEY} media + * type defined by RFC 3830. + */ + public static final MediaType APPLICATION_MIKEY_TYPE = + new MediaType("application", "mikey"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MISSING_BLOCKS_CBOR_SEQ} media + * type defined by RFC 9177. + */ + public static final String APPLICATION_MISSING_BLOCKS_CBOR_SEQ = + "application/missing-blocks+cbor-seq"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MISSING_BLOCKS_CBOR_SEQ} media + * type defined by RFC 9177. + */ + public static final MediaType APPLICATION_MISSING_BLOCKS_CBOR_SEQ_TYPE = + new MediaType("application", "missing-blocks+cbor-seq"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MODS_XML} media + * type defined by RFC 6207. + */ + public static final String APPLICATION_MODS_XML = + "application/mods+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MODS_XML} media + * type defined by RFC 6207. + */ + public static final MediaType APPLICATION_MODS_XML_TYPE = + new MediaType("application", "mods+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MOSS_KEYS} media + * type defined by RFC 1848. + */ + public static final String APPLICATION_MOSS_KEYS = + "application/moss-keys"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MOSS_KEYS} media + * type defined by RFC 1848. + */ + public static final MediaType APPLICATION_MOSS_KEYS_TYPE = + new MediaType("application", "moss-keys"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MOSS_SIGNATURE} media + * type defined by RFC 1848. + */ + public static final String APPLICATION_MOSS_SIGNATURE = + "application/moss-signature"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MOSS_SIGNATURE} media + * type defined by RFC 1848. + */ + public static final MediaType APPLICATION_MOSS_SIGNATURE_TYPE = + new MediaType("application", "moss-signature"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MOSSKEY_DATA} media + * type defined by RFC 1848. + */ + public static final String APPLICATION_MOSSKEY_DATA = + "application/mosskey-data"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MOSSKEY_DATA} media + * type defined by RFC 1848. + */ + public static final MediaType APPLICATION_MOSSKEY_DATA_TYPE = + new MediaType("application", "mosskey-data"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MOSSKEY_REQUEST} media + * type defined by RFC 1848. + */ + public static final String APPLICATION_MOSSKEY_REQUEST = + "application/mosskey-request"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MOSSKEY_REQUEST} media + * type defined by RFC 1848. + */ + public static final MediaType APPLICATION_MOSSKEY_REQUEST_TYPE = + new MediaType("application", "mosskey-request"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MP21} media + * type defined by RFC 6381. + */ + public static final String APPLICATION_MP21 = + "application/mp21"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MP21} media + * type defined by RFC 6381. + */ + public static final MediaType APPLICATION_MP21_TYPE = + new MediaType("application", "mp21"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MP4} media + * type defined by RFC 4337, and RFC 6381. + */ + public static final String APPLICATION_MP4 = + "application/mp4"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MP4} media + * type defined by RFC 4337, and RFC 6381. + */ + public static final MediaType APPLICATION_MP4_TYPE = + new MediaType("application", "mp4"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MPEG4_GENERIC} media + * type defined by RFC 3640. + */ + public static final String APPLICATION_MPEG4_GENERIC = + "application/mpeg4-generic"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MPEG4_GENERIC} media + * type defined by RFC 3640. + */ + public static final MediaType APPLICATION_MPEG4_GENERIC_TYPE = + new MediaType("application", "mpeg4-generic"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MPEG4_IOD} media + * type defined by RFC 4337. + */ + public static final String APPLICATION_MPEG4_IOD = + "application/mpeg4-iod"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MPEG4_IOD} media + * type defined by RFC 4337. + */ + public static final MediaType APPLICATION_MPEG4_IOD_TYPE = + new MediaType("application", "mpeg4-iod"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MPEG4_IOD_XMT} media + * type defined by RFC 4337. + */ + public static final String APPLICATION_MPEG4_IOD_XMT = + "application/mpeg4-iod-xmt"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MPEG4_IOD_XMT} media + * type defined by RFC 4337. + */ + public static final MediaType APPLICATION_MPEG4_IOD_XMT_TYPE = + new MediaType("application", "mpeg4-iod-xmt"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MRB_CONSUMER_XML} media + * type defined by RFC 6917. + */ + public static final String APPLICATION_MRB_CONSUMER_XML = + "application/mrb-consumer+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MRB_CONSUMER_XML} media + * type defined by RFC 6917. + */ + public static final MediaType APPLICATION_MRB_CONSUMER_XML_TYPE = + new MediaType("application", "mrb-consumer+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MRB_PUBLISH_XML} media + * type defined by RFC 6917. + */ + public static final String APPLICATION_MRB_PUBLISH_XML = + "application/mrb-publish+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MRB_PUBLISH_XML} media + * type defined by RFC 6917. + */ + public static final MediaType APPLICATION_MRB_PUBLISH_XML_TYPE = + new MediaType("application", "mrb-publish+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MSC_IVR_XML} media + * type defined by RFC 6231. + */ + public static final String APPLICATION_MSC_IVR_XML = + "application/msc-ivr+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MSC_IVR_XML} media + * type defined by RFC 6231. + */ + public static final MediaType APPLICATION_MSC_IVR_XML_TYPE = + new MediaType("application", "msc-ivr+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MSC_MIXER_XML} media + * type defined by RFC 6505. + */ + public static final String APPLICATION_MSC_MIXER_XML = + "application/msc-mixer+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MSC_MIXER_XML} media + * type defined by RFC 6505. + */ + public static final MediaType APPLICATION_MSC_MIXER_XML_TYPE = + new MediaType("application", "msc-mixer+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MUD_JSON} media + * type defined by RFC 8520. + */ + public static final String APPLICATION_MUD_JSON = + "application/mud+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MUD_JSON} media + * type defined by RFC 8520. + */ + public static final MediaType APPLICATION_MUD_JSON_TYPE = + new MediaType("application", "mud+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MULTIPART_CORE} media + * type defined by RFC 8710. + */ + public static final String APPLICATION_MULTIPART_CORE = + "application/multipart-core"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MULTIPART_CORE} media + * type defined by RFC 8710. + */ + public static final MediaType APPLICATION_MULTIPART_CORE_TYPE = + new MediaType("application", "multipart-core"); + + /** + * A {@code String} constant representing {@value #APPLICATION_MXF} media + * type defined by RFC 4539. + */ + public static final String APPLICATION_MXF = + "application/mxf"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_MXF} media + * type defined by RFC 4539. + */ + public static final MediaType APPLICATION_MXF_TYPE = + new MediaType("application", "mxf"); + + /** + * A {@code String} constant representing {@value #APPLICATION_NASDATA} media + * type defined by RFC 4707. + */ + public static final String APPLICATION_NASDATA = + "application/nasdata"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_NASDATA} media + * type defined by RFC 4707. + */ + public static final MediaType APPLICATION_NASDATA_TYPE = + new MediaType("application", "nasdata"); + + /** + * A {@code String} constant representing {@value #APPLICATION_NEWS_CHECKGROUPS} media + * type defined by RFC 5537. + */ + public static final String APPLICATION_NEWS_CHECKGROUPS = + "application/news-checkgroups"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_NEWS_CHECKGROUPS} media + * type defined by RFC 5537. + */ + public static final MediaType APPLICATION_NEWS_CHECKGROUPS_TYPE = + new MediaType("application", "news-checkgroups"); + + /** + * A {@code String} constant representing {@value #APPLICATION_NEWS_GROUPINFO} media + * type defined by RFC 5537. + */ + public static final String APPLICATION_NEWS_GROUPINFO = + "application/news-groupinfo"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_NEWS_GROUPINFO} media + * type defined by RFC 5537. + */ + public static final MediaType APPLICATION_NEWS_GROUPINFO_TYPE = + new MediaType("application", "news-groupinfo"); + + /** + * A {@code String} constant representing {@value #APPLICATION_NEWS_TRANSMISSION} media + * type defined by RFC 5537. + */ + public static final String APPLICATION_NEWS_TRANSMISSION = + "application/news-transmission"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_NEWS_TRANSMISSION} media + * type defined by RFC 5537. + */ + public static final MediaType APPLICATION_NEWS_TRANSMISSION_TYPE = + new MediaType("application", "news-transmission"); + + /** + * A {@code String} constant representing {@value #APPLICATION_NLSML_XML} media + * type defined by RFC 6787. + */ + public static final String APPLICATION_NLSML_XML = + "application/nlsml+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_NLSML_XML} media + * type defined by RFC 6787. + */ + public static final MediaType APPLICATION_NLSML_XML_TYPE = + new MediaType("application", "nlsml+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_OAUTH_AUTHZ_REQ_JWT} media + * type defined by RFC 9101. + */ + public static final String APPLICATION_OAUTH_AUTHZ_REQ_JWT = + "application/oauth-authz-req+jwt"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_OAUTH_AUTHZ_REQ_JWT} media + * type defined by RFC 9101. + */ + public static final MediaType APPLICATION_OAUTH_AUTHZ_REQ_JWT_TYPE = + new MediaType("application", "oauth-authz-req+jwt"); + + /** + * A {@code String} constant representing {@value #APPLICATION_OBLIVIOUS_DNS_MESSAGE} media + * type defined by RFC 9230. + */ + public static final String APPLICATION_OBLIVIOUS_DNS_MESSAGE = + "application/oblivious-dns-message"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_OBLIVIOUS_DNS_MESSAGE} media + * type defined by RFC 9230. + */ + public static final MediaType APPLICATION_OBLIVIOUS_DNS_MESSAGE_TYPE = + new MediaType("application", "oblivious-dns-message"); + + /** + * A {@code String} constant representing {@value #APPLICATION_OCSP_REQUEST} media + * type defined by RFC 6960. + */ + public static final String APPLICATION_OCSP_REQUEST = + "application/ocsp-request"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_OCSP_REQUEST} media + * type defined by RFC 6960. + */ + public static final MediaType APPLICATION_OCSP_REQUEST_TYPE = + new MediaType("application", "ocsp-request"); + + /** + * A {@code String} constant representing {@value #APPLICATION_OCSP_RESPONSE} media + * type defined by RFC 6960. + */ + public static final String APPLICATION_OCSP_RESPONSE = + "application/ocsp-response"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_OCSP_RESPONSE} media + * type defined by RFC 6960. + */ + public static final MediaType APPLICATION_OCSP_RESPONSE_TYPE = + new MediaType("application", "ocsp-response"); + + /** + * A {@code String} constant representing {@value #APPLICATION_OCTET_STREAM} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final String APPLICATION_OCTET_STREAM = + "application/octet-stream"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_OCTET_STREAM} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final MediaType APPLICATION_OCTET_STREAM_TYPE = + new MediaType("application", "octet-stream"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ODA} media + * type defined by RFC 1494. + */ + public static final String APPLICATION_ODA = + "application/ODA"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ODA} media + * type defined by RFC 1494. + */ + public static final MediaType APPLICATION_ODA_TYPE = + new MediaType("application", "ODA"); + + /** + * A {@code String} constant representing {@value #APPLICATION_OGG} media + * type defined by RFC 5334, and RFC 7845. + */ + public static final String APPLICATION_OGG = + "application/ogg"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_OGG} media + * type defined by RFC 5334, and RFC 7845. + */ + public static final MediaType APPLICATION_OGG_TYPE = + new MediaType("application", "ogg"); + + /** + * A {@code String} constant representing {@value #APPLICATION_OHTTP_KEYS} media + * type defined by RFC 9458. + */ + public static final String APPLICATION_OHTTP_KEYS = + "application/ohttp-keys"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_OHTTP_KEYS} media + * type defined by RFC 9458. + */ + public static final MediaType APPLICATION_OHTTP_KEYS_TYPE = + new MediaType("application", "ohttp-keys"); + + /** + * A {@code String} constant representing {@value #APPLICATION_OSCORE} media + * type defined by RFC 8613. + */ + public static final String APPLICATION_OSCORE = + "application/oscore"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_OSCORE} media + * type defined by RFC 8613. + */ + public static final MediaType APPLICATION_OSCORE_TYPE = + new MediaType("application", "oscore"); + + /** + * A {@code String} constant representing {@value #APPLICATION_P2P_OVERLAY_XML} media + * type defined by RFC 6940. + */ + public static final String APPLICATION_P2P_OVERLAY_XML = + "application/p2p-overlay+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_P2P_OVERLAY_XML} media + * type defined by RFC 6940. + */ + public static final MediaType APPLICATION_P2P_OVERLAY_XML_TYPE = + new MediaType("application", "p2p-overlay+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PARITYFEC} media + * type defined by RFC 3009. + */ + public static final String APPLICATION_PARITYFEC = + "application/parityfec"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PARITYFEC} media + * type defined by RFC 3009. + */ + public static final MediaType APPLICATION_PARITYFEC_TYPE = + new MediaType("application", "parityfec"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PASSPORT} media + * type defined by RFC 8225. + */ + public static final String APPLICATION_PASSPORT = + "application/passport"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PASSPORT} media + * type defined by RFC 8225. + */ + public static final MediaType APPLICATION_PASSPORT_TYPE = + new MediaType("application", "passport"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PATCH_OPS_ERROR_XML} media + * type defined by RFC 5261. + */ + public static final String APPLICATION_PATCH_OPS_ERROR_XML = + "application/patch-ops-error+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PATCH_OPS_ERROR_XML} media + * type defined by RFC 5261. + */ + public static final MediaType APPLICATION_PATCH_OPS_ERROR_XML_TYPE = + new MediaType("application", "patch-ops-error+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PDF} media + * type defined by RFC 8118. + */ + public static final String APPLICATION_PDF = + "application/pdf"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PDF} media + * type defined by RFC 8118. + */ + public static final MediaType APPLICATION_PDF_TYPE = + new MediaType("application", "pdf"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PEM_CERTIFICATE_CHAIN} media + * type defined by RFC 8555. + */ + public static final String APPLICATION_PEM_CERTIFICATE_CHAIN = + "application/pem-certificate-chain"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PEM_CERTIFICATE_CHAIN} media + * type defined by RFC 8555. + */ + public static final MediaType APPLICATION_PEM_CERTIFICATE_CHAIN_TYPE = + new MediaType("application", "pem-certificate-chain"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PGP_ENCRYPTED} media + * type defined by RFC 3156. + */ + public static final String APPLICATION_PGP_ENCRYPTED = + "application/pgp-encrypted"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PGP_ENCRYPTED} media + * type defined by RFC 3156. + */ + public static final MediaType APPLICATION_PGP_ENCRYPTED_TYPE = + new MediaType("application", "pgp-encrypted"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PGP_KEYS} media + * type defined by RFC 3156. + */ + public static final String APPLICATION_PGP_KEYS = + "application/pgp-keys"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PGP_KEYS} media + * type defined by RFC 3156. + */ + public static final MediaType APPLICATION_PGP_KEYS_TYPE = + new MediaType("application", "pgp-keys"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PGP_SIGNATURE} media + * type defined by RFC 3156. + */ + public static final String APPLICATION_PGP_SIGNATURE = + "application/pgp-signature"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PGP_SIGNATURE} media + * type defined by RFC 3156. + */ + public static final MediaType APPLICATION_PGP_SIGNATURE_TYPE = + new MediaType("application", "pgp-signature"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PIDF_DIFF_XML} media + * type defined by RFC 5262. + */ + public static final String APPLICATION_PIDF_DIFF_XML = + "application/pidf-diff+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PIDF_DIFF_XML} media + * type defined by RFC 5262. + */ + public static final MediaType APPLICATION_PIDF_DIFF_XML_TYPE = + new MediaType("application", "pidf-diff+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PIDF_XML} media + * type defined by RFC 3863. + */ + public static final String APPLICATION_PIDF_XML = + "application/pidf+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PIDF_XML} media + * type defined by RFC 3863. + */ + public static final MediaType APPLICATION_PIDF_XML_TYPE = + new MediaType("application", "pidf+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PKCS10} media + * type defined by RFC 5967. + */ + public static final String APPLICATION_PKCS10 = + "application/pkcs10"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PKCS10} media + * type defined by RFC 5967. + */ + public static final MediaType APPLICATION_PKCS10_TYPE = + new MediaType("application", "pkcs10"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PKCS7_MIME} media + * type defined by RFC 8551, and RFC 7114. + */ + public static final String APPLICATION_PKCS7_MIME = + "application/pkcs7-mime"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PKCS7_MIME} media + * type defined by RFC 8551, and RFC 7114. + */ + public static final MediaType APPLICATION_PKCS7_MIME_TYPE = + new MediaType("application", "pkcs7-mime"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PKCS7_SIGNATURE} media + * type defined by RFC 8551. + */ + public static final String APPLICATION_PKCS7_SIGNATURE = + "application/pkcs7-signature"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PKCS7_SIGNATURE} media + * type defined by RFC 8551. + */ + public static final MediaType APPLICATION_PKCS7_SIGNATURE_TYPE = + new MediaType("application", "pkcs7-signature"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PKCS8} media + * type defined by RFC 5958. + */ + public static final String APPLICATION_PKCS8 = + "application/pkcs8"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PKCS8} media + * type defined by RFC 5958. + */ + public static final MediaType APPLICATION_PKCS8_TYPE = + new MediaType("application", "pkcs8"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PKCS8_ENCRYPTED} media + * type defined by RFC 8351. + */ + public static final String APPLICATION_PKCS8_ENCRYPTED = + "application/pkcs8-encrypted"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PKCS8_ENCRYPTED} media + * type defined by RFC 8351. + */ + public static final MediaType APPLICATION_PKCS8_ENCRYPTED_TYPE = + new MediaType("application", "pkcs8-encrypted"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PKIX_ATTR_CERT} media + * type defined by RFC 5877. + */ + public static final String APPLICATION_PKIX_ATTR_CERT = + "application/pkix-attr-cert"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PKIX_ATTR_CERT} media + * type defined by RFC 5877. + */ + public static final MediaType APPLICATION_PKIX_ATTR_CERT_TYPE = + new MediaType("application", "pkix-attr-cert"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PKIX_CERT} media + * type defined by RFC 2585. + */ + public static final String APPLICATION_PKIX_CERT = + "application/pkix-cert"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PKIX_CERT} media + * type defined by RFC 2585. + */ + public static final MediaType APPLICATION_PKIX_CERT_TYPE = + new MediaType("application", "pkix-cert"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PKIX_CRL} media + * type defined by RFC 2585. + */ + public static final String APPLICATION_PKIX_CRL = + "application/pkix-crl"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PKIX_CRL} media + * type defined by RFC 2585. + */ + public static final MediaType APPLICATION_PKIX_CRL_TYPE = + new MediaType("application", "pkix-crl"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PKIX_PKIPATH} media + * type defined by RFC 6066. + */ + public static final String APPLICATION_PKIX_PKIPATH = + "application/pkix-pkipath"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PKIX_PKIPATH} media + * type defined by RFC 6066. + */ + public static final MediaType APPLICATION_PKIX_PKIPATH_TYPE = + new MediaType("application", "pkix-pkipath"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PKIXCMP} media + * type defined by RFC 9811. + */ + public static final String APPLICATION_PKIXCMP = + "application/pkixcmp"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PKIXCMP} media + * type defined by RFC 9811. + */ + public static final MediaType APPLICATION_PKIXCMP_TYPE = + new MediaType("application", "pkixcmp"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PLS_XML} media + * type defined by RFC 4267. + */ + public static final String APPLICATION_PLS_XML = + "application/pls+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PLS_XML} media + * type defined by RFC 4267. + */ + public static final MediaType APPLICATION_PLS_XML_TYPE = + new MediaType("application", "pls+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_POC_SETTINGS_XML} media + * type defined by RFC 4354. + */ + public static final String APPLICATION_POC_SETTINGS_XML = + "application/poc-settings+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_POC_SETTINGS_XML} media + * type defined by RFC 4354. + */ + public static final MediaType APPLICATION_POC_SETTINGS_XML_TYPE = + new MediaType("application", "poc-settings+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_POSTSCRIPT} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final String APPLICATION_POSTSCRIPT = + "application/postscript"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_POSTSCRIPT} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final MediaType APPLICATION_POSTSCRIPT_TYPE = + new MediaType("application", "postscript"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PPSP_TRACKER_JSON} media + * type defined by RFC 7846. + */ + public static final String APPLICATION_PPSP_TRACKER_JSON = + "application/ppsp-tracker+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PPSP_TRACKER_JSON} media + * type defined by RFC 7846. + */ + public static final MediaType APPLICATION_PPSP_TRACKER_JSON_TYPE = + new MediaType("application", "ppsp-tracker+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PRIVATE_TOKEN_ISSUER_DIRECTORY} media + * type defined by RFC 9578. + */ + public static final String APPLICATION_PRIVATE_TOKEN_ISSUER_DIRECTORY = + "application/private-token-issuer-directory"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PRIVATE_TOKEN_ISSUER_DIRECTORY} media + * type defined by RFC 9578. + */ + public static final MediaType APPLICATION_PRIVATE_TOKEN_ISSUER_DIRECTORY_TYPE = + new MediaType("application", "private-token-issuer-directory"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PRIVATE_TOKEN_REQUEST} media + * type defined by RFC 9578. + */ + public static final String APPLICATION_PRIVATE_TOKEN_REQUEST = + "application/private-token-request"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PRIVATE_TOKEN_REQUEST} media + * type defined by RFC 9578. + */ + public static final MediaType APPLICATION_PRIVATE_TOKEN_REQUEST_TYPE = + new MediaType("application", "private-token-request"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PRIVATE_TOKEN_RESPONSE} media + * type defined by RFC 9578. + */ + public static final String APPLICATION_PRIVATE_TOKEN_RESPONSE = + "application/private-token-response"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PRIVATE_TOKEN_RESPONSE} media + * type defined by RFC 9578. + */ + public static final MediaType APPLICATION_PRIVATE_TOKEN_RESPONSE_TYPE = + new MediaType("application", "private-token-response"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PROBLEM_JSON} media + * type defined by RFC 9457. + */ + public static final String APPLICATION_PROBLEM_JSON = + "application/problem+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PROBLEM_JSON} media + * type defined by RFC 9457. + */ + public static final MediaType APPLICATION_PROBLEM_JSON_TYPE = + new MediaType("application", "problem+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PROBLEM_XML} media + * type defined by RFC 9457. + */ + public static final String APPLICATION_PROBLEM_XML = + "application/problem+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PROBLEM_XML} media + * type defined by RFC 9457. + */ + public static final MediaType APPLICATION_PROBLEM_XML_TYPE = + new MediaType("application", "problem+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PSKC_XML} media + * type defined by RFC 6030. + */ + public static final String APPLICATION_PSKC_XML = + "application/pskc+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PSKC_XML} media + * type defined by RFC 6030. + */ + public static final MediaType APPLICATION_PSKC_XML_TYPE = + new MediaType("application", "pskc+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_PVD_JSON} media + * type defined by RFC 8801. + */ + public static final String APPLICATION_PVD_JSON = + "application/pvd+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_PVD_JSON} media + * type defined by RFC 8801. + */ + public static final MediaType APPLICATION_PVD_JSON_TYPE = + new MediaType("application", "pvd+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RDF_XML} media + * type defined by RFC 3870. + */ + public static final String APPLICATION_RDF_XML = + "application/rdf+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RDF_XML} media + * type defined by RFC 3870. + */ + public static final MediaType APPLICATION_RDF_XML_TYPE = + new MediaType("application", "rdf+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_QSIG} media + * type defined by RFC 3204. + */ + public static final String APPLICATION_QSIG = + "application/QSIG"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_QSIG} media + * type defined by RFC 3204. + */ + public static final MediaType APPLICATION_QSIG_TYPE = + new MediaType("application", "QSIG"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RAPTORFEC} media + * type defined by RFC 6682. + */ + public static final String APPLICATION_RAPTORFEC = + "application/raptorfec"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RAPTORFEC} media + * type defined by RFC 6682. + */ + public static final MediaType APPLICATION_RAPTORFEC_TYPE = + new MediaType("application", "raptorfec"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RDAP_JSON} media + * type defined by RFC 9083. + */ + public static final String APPLICATION_RDAP_JSON = + "application/rdap+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RDAP_JSON} media + * type defined by RFC 9083. + */ + public static final MediaType APPLICATION_RDAP_JSON_TYPE = + new MediaType("application", "rdap+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_REGINFO_XML} media + * type defined by RFC 3680. + */ + public static final String APPLICATION_REGINFO_XML = + "application/reginfo+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_REGINFO_XML} media + * type defined by RFC 3680. + */ + public static final MediaType APPLICATION_REGINFO_XML_TYPE = + new MediaType("application", "reginfo+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RELAX_NG_COMPACT_SYNTAX} media + * type defined by {@code http://www.JTC_1sc34.org/repository/0661.pdf}. + */ + public static final String APPLICATION_RELAX_NG_COMPACT_SYNTAX = + "application/relax-ng-compact-syntax"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RELAX_NG_COMPACT_SYNTAX} media + * type defined by {@code http://www.JTC_1sc34.org/repository/0661.pdf}. + */ + public static final MediaType APPLICATION_RELAX_NG_COMPACT_SYNTAX_TYPE = + new MediaType("application", "relax-ng-compact-syntax"); + + /** + * A {@code String} constant representing {@value #APPLICATION_REMOTE_PRINTING} media + * type defined by RFC 1486. + */ + public static final String APPLICATION_REMOTE_PRINTING = + "application/remote-printing"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_REMOTE_PRINTING} media + * type defined by RFC 1486. + */ + public static final MediaType APPLICATION_REMOTE_PRINTING_TYPE = + new MediaType("application", "remote-printing"); + + /** + * A {@code String} constant representing {@value #APPLICATION_REPUTON_JSON} media + * type defined by RFC 7071. + */ + public static final String APPLICATION_REPUTON_JSON = + "application/reputon+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_REPUTON_JSON} media + * type defined by RFC 7071. + */ + public static final MediaType APPLICATION_REPUTON_JSON_TYPE = + new MediaType("application", "reputon+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RESOURCE_LISTS_DIFF_XML} media + * type defined by RFC 5362. + */ + public static final String APPLICATION_RESOURCE_LISTS_DIFF_XML = + "application/resource-lists-diff+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RESOURCE_LISTS_DIFF_XML} media + * type defined by RFC 5362. + */ + public static final MediaType APPLICATION_RESOURCE_LISTS_DIFF_XML_TYPE = + new MediaType("application", "resource-lists-diff+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RESOURCE_LISTS_XML} media + * type defined by RFC 4826. + */ + public static final String APPLICATION_RESOURCE_LISTS_XML = + "application/resource-lists+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RESOURCE_LISTS_XML} media + * type defined by RFC 4826. + */ + public static final MediaType APPLICATION_RESOURCE_LISTS_XML_TYPE = + new MediaType("application", "resource-lists+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RFC_XML} media + * type defined by RFC 7991. + */ + public static final String APPLICATION_RFC_XML = + "application/rfc+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RFC_XML} media + * type defined by RFC 7991. + */ + public static final MediaType APPLICATION_RFC_XML_TYPE = + new MediaType("application", "rfc+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RLMI_XML} media + * type defined by RFC 4662. + */ + public static final String APPLICATION_RLMI_XML = + "application/rlmi+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RLMI_XML} media + * type defined by RFC 4662. + */ + public static final MediaType APPLICATION_RLMI_XML_TYPE = + new MediaType("application", "rlmi+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RLS_SERVICES_XML} media + * type defined by RFC 4826. + */ + public static final String APPLICATION_RLS_SERVICES_XML = + "application/rls-services+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RLS_SERVICES_XML} media + * type defined by RFC 4826. + */ + public static final MediaType APPLICATION_RLS_SERVICES_XML_TYPE = + new MediaType("application", "rls-services+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RPKI_CHECKLIST} media + * type defined by RFC 9323. + */ + public static final String APPLICATION_RPKI_CHECKLIST = + "application/rpki-checklist"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RPKI_CHECKLIST} media + * type defined by RFC 9323. + */ + public static final MediaType APPLICATION_RPKI_CHECKLIST_TYPE = + new MediaType("application", "rpki-checklist"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RPKI_GHOSTBUSTERS} media + * type defined by RFC 6493. + */ + public static final String APPLICATION_RPKI_GHOSTBUSTERS = + "application/rpki-ghostbusters"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RPKI_GHOSTBUSTERS} media + * type defined by RFC 6493. + */ + public static final MediaType APPLICATION_RPKI_GHOSTBUSTERS_TYPE = + new MediaType("application", "rpki-ghostbusters"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RPKI_MANIFEST} media + * type defined by RFC 6481. + */ + public static final String APPLICATION_RPKI_MANIFEST = + "application/rpki-manifest"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RPKI_MANIFEST} media + * type defined by RFC 6481. + */ + public static final MediaType APPLICATION_RPKI_MANIFEST_TYPE = + new MediaType("application", "rpki-manifest"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RPKI_PUBLICATION} media + * type defined by RFC 8181. + */ + public static final String APPLICATION_RPKI_PUBLICATION = + "application/rpki-publication"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RPKI_PUBLICATION} media + * type defined by RFC 8181. + */ + public static final MediaType APPLICATION_RPKI_PUBLICATION_TYPE = + new MediaType("application", "rpki-publication"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RPKI_ROA} media + * type defined by RFC 9582. + */ + public static final String APPLICATION_RPKI_ROA = + "application/rpki-roa"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RPKI_ROA} media + * type defined by RFC 9582. + */ + public static final MediaType APPLICATION_RPKI_ROA_TYPE = + new MediaType("application", "rpki-roa"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RPKI_SIGNED_TAL} media + * type defined by RFC 9691. + */ + public static final String APPLICATION_RPKI_SIGNED_TAL = + "application/rpki-signed-tal"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RPKI_SIGNED_TAL} media + * type defined by RFC 9691. + */ + public static final MediaType APPLICATION_RPKI_SIGNED_TAL_TYPE = + new MediaType("application", "rpki-signed-tal"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RPKI_UPDOWN} media + * type defined by RFC 6492. + */ + public static final String APPLICATION_RPKI_UPDOWN = + "application/rpki-updown"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RPKI_UPDOWN} media + * type defined by RFC 6492. + */ + public static final MediaType APPLICATION_RPKI_UPDOWN_TYPE = + new MediaType("application", "rpki-updown"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RS_METADATA_XML} media + * type defined by RFC 7865, and RFC 9806. + */ + public static final String APPLICATION_RS_METADATA_XML = + "application/rs-metadata+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RS_METADATA_XML} media + * type defined by RFC 7865, and RFC 9806. + */ + public static final MediaType APPLICATION_RS_METADATA_XML_TYPE = + new MediaType("application", "rs-metadata+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RTPLOOPBACK} media + * type defined by RFC 6849. + */ + public static final String APPLICATION_RTPLOOPBACK = + "application/rtploopback"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RTPLOOPBACK} media + * type defined by RFC 6849. + */ + public static final MediaType APPLICATION_RTPLOOPBACK_TYPE = + new MediaType("application", "rtploopback"); + + /** + * A {@code String} constant representing {@value #APPLICATION_RTX} media + * type defined by RFC 4588. + */ + public static final String APPLICATION_RTX = + "application/rtx"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_RTX} media + * type defined by RFC 4588. + */ + public static final MediaType APPLICATION_RTX_TYPE = + new MediaType("application", "rtx"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SBML_XML} media + * type defined by RFC 3823. + */ + public static final String APPLICATION_SBML_XML = + "application/sbml+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SBML_XML} media + * type defined by RFC 3823. + */ + public static final MediaType APPLICATION_SBML_XML_TYPE = + new MediaType("application", "sbml+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SCIM_JSON} media + * type defined by RFC 7644. + */ + public static final String APPLICATION_SCIM_JSON = + "application/scim+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SCIM_JSON} media + * type defined by RFC 7644. + */ + public static final MediaType APPLICATION_SCIM_JSON_TYPE = + new MediaType("application", "scim+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SCVP_CV_REQUEST} media + * type defined by RFC 5055. + */ + public static final String APPLICATION_SCVP_CV_REQUEST = + "application/scvp-cv-request"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SCVP_CV_REQUEST} media + * type defined by RFC 5055. + */ + public static final MediaType APPLICATION_SCVP_CV_REQUEST_TYPE = + new MediaType("application", "scvp-cv-request"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SCVP_CV_RESPONSE} media + * type defined by RFC 5055. + */ + public static final String APPLICATION_SCVP_CV_RESPONSE = + "application/scvp-cv-response"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SCVP_CV_RESPONSE} media + * type defined by RFC 5055. + */ + public static final MediaType APPLICATION_SCVP_CV_RESPONSE_TYPE = + new MediaType("application", "scvp-cv-response"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SCVP_VP_REQUEST} media + * type defined by RFC 5055. + */ + public static final String APPLICATION_SCVP_VP_REQUEST = + "application/scvp-vp-request"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SCVP_VP_REQUEST} media + * type defined by RFC 5055. + */ + public static final MediaType APPLICATION_SCVP_VP_REQUEST_TYPE = + new MediaType("application", "scvp-vp-request"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SCVP_VP_RESPONSE} media + * type defined by RFC 5055. + */ + public static final String APPLICATION_SCVP_VP_RESPONSE = + "application/scvp-vp-response"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SCVP_VP_RESPONSE} media + * type defined by RFC 5055. + */ + public static final MediaType APPLICATION_SCVP_VP_RESPONSE_TYPE = + new MediaType("application", "scvp-vp-response"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SD_JWT} media + * type defined by RFC-ietf-oauth-selective-disclosure-jwt-22. + */ + public static final String APPLICATION_SD_JWT = + "application/sd-jwt"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SD_JWT} media + * type defined by RFC-ietf-oauth-selective-disclosure-jwt-22. + */ + public static final MediaType APPLICATION_SD_JWT_TYPE = + new MediaType("application", "sd-jwt"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SD_JWT_JSON} media + * type defined by RFC-ietf-oauth-selective-disclosure-jwt-22. + */ + public static final String APPLICATION_SD_JWT_JSON = + "application/sd-jwt+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SD_JWT_JSON} media + * type defined by RFC-ietf-oauth-selective-disclosure-jwt-22. + */ + public static final MediaType APPLICATION_SD_JWT_JSON_TYPE = + new MediaType("application", "sd-jwt+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SDF_JSON} media + * type defined by RFC-ietf-asdf-sdf-23. + */ + public static final String APPLICATION_SDF_JSON = + "application/sdf+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SDF_JSON} media + * type defined by RFC-ietf-asdf-sdf-23. + */ + public static final MediaType APPLICATION_SDF_JSON_TYPE = + new MediaType("application", "sdf+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SDP} media + * type defined by RFC 8866. + */ + public static final String APPLICATION_SDP = + "application/sdp"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SDP} media + * type defined by RFC 8866. + */ + public static final MediaType APPLICATION_SDP_TYPE = + new MediaType("application", "sdp"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SECEVENT_JWT} media + * type defined by RFC 8417. + */ + public static final String APPLICATION_SECEVENT_JWT = + "application/secevent+jwt"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SECEVENT_JWT} media + * type defined by RFC 8417. + */ + public static final MediaType APPLICATION_SECEVENT_JWT_TYPE = + new MediaType("application", "secevent+jwt"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SENML_ETCH_CBOR} media + * type defined by RFC 8790. + */ + public static final String APPLICATION_SENML_ETCH_CBOR = + "application/senml-etch+cbor"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SENML_ETCH_CBOR} media + * type defined by RFC 8790. + */ + public static final MediaType APPLICATION_SENML_ETCH_CBOR_TYPE = + new MediaType("application", "senml-etch+cbor"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SENML_ETCH_JSON} media + * type defined by RFC 8790. + */ + public static final String APPLICATION_SENML_ETCH_JSON = + "application/senml-etch+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SENML_ETCH_JSON} media + * type defined by RFC 8790. + */ + public static final MediaType APPLICATION_SENML_ETCH_JSON_TYPE = + new MediaType("application", "senml-etch+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SENML_EXI} media + * type defined by RFC 8428. + */ + public static final String APPLICATION_SENML_EXI = + "application/senml-exi"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SENML_EXI} media + * type defined by RFC 8428. + */ + public static final MediaType APPLICATION_SENML_EXI_TYPE = + new MediaType("application", "senml-exi"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SENML_CBOR} media + * type defined by RFC 8428. + */ + public static final String APPLICATION_SENML_CBOR = + "application/senml+cbor"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SENML_CBOR} media + * type defined by RFC 8428. + */ + public static final MediaType APPLICATION_SENML_CBOR_TYPE = + new MediaType("application", "senml+cbor"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SENML_JSON} media + * type defined by RFC 8428. + */ + public static final String APPLICATION_SENML_JSON = + "application/senml+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SENML_JSON} media + * type defined by RFC 8428. + */ + public static final MediaType APPLICATION_SENML_JSON_TYPE = + new MediaType("application", "senml+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SENML_XML} media + * type defined by RFC 8428. + */ + public static final String APPLICATION_SENML_XML = + "application/senml+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SENML_XML} media + * type defined by RFC 8428. + */ + public static final MediaType APPLICATION_SENML_XML_TYPE = + new MediaType("application", "senml+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SENSML_EXI} media + * type defined by RFC 8428. + */ + public static final String APPLICATION_SENSML_EXI = + "application/sensml-exi"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SENSML_EXI} media + * type defined by RFC 8428. + */ + public static final MediaType APPLICATION_SENSML_EXI_TYPE = + new MediaType("application", "sensml-exi"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SENSML_CBOR} media + * type defined by RFC 8428. + */ + public static final String APPLICATION_SENSML_CBOR = + "application/sensml+cbor"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SENSML_CBOR} media + * type defined by RFC 8428. + */ + public static final MediaType APPLICATION_SENSML_CBOR_TYPE = + new MediaType("application", "sensml+cbor"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SENSML_JSON} media + * type defined by RFC 8428. + */ + public static final String APPLICATION_SENSML_JSON = + "application/sensml+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SENSML_JSON} media + * type defined by RFC 8428. + */ + public static final MediaType APPLICATION_SENSML_JSON_TYPE = + new MediaType("application", "sensml+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SENSML_XML} media + * type defined by RFC 8428. + */ + public static final String APPLICATION_SENSML_XML = + "application/sensml+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SENSML_XML} media + * type defined by RFC 8428. + */ + public static final MediaType APPLICATION_SENSML_XML_TYPE = + new MediaType("application", "sensml+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SGML} media + * type defined by RFC 1874. + */ + public static final String APPLICATION_SGML = + "application/SGML"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SGML} media + * type defined by RFC 1874. + */ + public static final MediaType APPLICATION_SGML_TYPE = + new MediaType("application", "SGML"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SHF_XML} media + * type defined by RFC 4194. + */ + public static final String APPLICATION_SHF_XML = + "application/shf+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SHF_XML} media + * type defined by RFC 4194. + */ + public static final MediaType APPLICATION_SHF_XML_TYPE = + new MediaType("application", "shf+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SIEVE} media + * type defined by RFC 5228. + */ + public static final String APPLICATION_SIEVE = + "application/sieve"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SIEVE} media + * type defined by RFC 5228. + */ + public static final MediaType APPLICATION_SIEVE_TYPE = + new MediaType("application", "sieve"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SIMPLE_FILTER_XML} media + * type defined by RFC 4661. + */ + public static final String APPLICATION_SIMPLE_FILTER_XML = + "application/simple-filter+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SIMPLE_FILTER_XML} media + * type defined by RFC 4661. + */ + public static final MediaType APPLICATION_SIMPLE_FILTER_XML_TYPE = + new MediaType("application", "simple-filter+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SIMPLE_MESSAGE_SUMMARY} media + * type defined by RFC 3842. + */ + public static final String APPLICATION_SIMPLE_MESSAGE_SUMMARY = + "application/simple-message-summary"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SIMPLE_MESSAGE_SUMMARY} media + * type defined by RFC 3842. + */ + public static final MediaType APPLICATION_SIMPLE_MESSAGE_SUMMARY_TYPE = + new MediaType("application", "simple-message-summary"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SMIL} media + * type defined by RFC 4536. + */ + public static final String APPLICATION_SMIL = + "application/smil"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SMIL} media + * type defined by RFC 4536. + */ + public static final MediaType APPLICATION_SMIL_TYPE = + new MediaType("application", "smil"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SMIL_XML} media + * type defined by RFC 4536. + */ + public static final String APPLICATION_SMIL_XML = + "application/smil+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SMIL_XML} media + * type defined by RFC 4536. + */ + public static final MediaType APPLICATION_SMIL_XML_TYPE = + new MediaType("application", "smil+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SMPTE336M} media + * type defined by RFC 6597. + */ + public static final String APPLICATION_SMPTE336M = + "application/smpte336m"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SMPTE336M} media + * type defined by RFC 6597. + */ + public static final MediaType APPLICATION_SMPTE336M_TYPE = + new MediaType("application", "smpte336m"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SOAP_XML} media + * type defined by RFC 3902. + */ + public static final String APPLICATION_SOAP_XML = + "application/soap+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SOAP_XML} media + * type defined by RFC 3902. + */ + public static final MediaType APPLICATION_SOAP_XML_TYPE = + new MediaType("application", "soap+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SPARQL_QUERY} media + * type defined by {@code http://www.w3.org/TR/2007/CR-rdf-sparql-query-20070614/#mediaType}. + */ + public static final String APPLICATION_SPARQL_QUERY = + "application/sparql-query"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SPARQL_QUERY} media + * type defined by {@code http://www.w3.org/TR/2007/CR-rdf-sparql-query-20070614/#mediaType}. + */ + public static final MediaType APPLICATION_SPARQL_QUERY_TYPE = + new MediaType("application", "sparql-query"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SPARQL_RESULTS_XML} media + * type defined by {@code http://www.w3.org/TR/2007/CR-rdf-sparql-XMLres-20070925/#mime}. + */ + public static final String APPLICATION_SPARQL_RESULTS_XML = + "application/sparql-results+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SPARQL_RESULTS_XML} media + * type defined by {@code http://www.w3.org/TR/2007/CR-rdf-sparql-XMLres-20070925/#mime}. + */ + public static final MediaType APPLICATION_SPARQL_RESULTS_XML_TYPE = + new MediaType("application", "sparql-results+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SPIRITS_EVENT_XML} media + * type defined by RFC 3910. + */ + public static final String APPLICATION_SPIRITS_EVENT_XML = + "application/spirits-event+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SPIRITS_EVENT_XML} media + * type defined by RFC 3910. + */ + public static final MediaType APPLICATION_SPIRITS_EVENT_XML_TYPE = + new MediaType("application", "spirits-event+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SQL} media + * type defined by RFC 6922. + */ + public static final String APPLICATION_SQL = + "application/sql"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SQL} media + * type defined by RFC 6922. + */ + public static final MediaType APPLICATION_SQL_TYPE = + new MediaType("application", "sql"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SRGS} media + * type defined by RFC 4267. + */ + public static final String APPLICATION_SRGS = + "application/srgs"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SRGS} media + * type defined by RFC 4267. + */ + public static final MediaType APPLICATION_SRGS_TYPE = + new MediaType("application", "srgs"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SRGS_XML} media + * type defined by RFC 4267. + */ + public static final String APPLICATION_SRGS_XML = + "application/srgs+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SRGS_XML} media + * type defined by RFC 4267. + */ + public static final MediaType APPLICATION_SRGS_XML_TYPE = + new MediaType("application", "srgs+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SRU_XML} media + * type defined by RFC 6207. + */ + public static final String APPLICATION_SRU_XML = + "application/sru+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SRU_XML} media + * type defined by RFC 6207. + */ + public static final MediaType APPLICATION_SRU_XML_TYPE = + new MediaType("application", "sru+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SSLKEYLOGFILE} media + * type defined by RFC-ietf-tls-keylogfile-05. + */ + public static final String APPLICATION_SSLKEYLOGFILE = + "application/sslkeylogfile"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SSLKEYLOGFILE} media + * type defined by RFC-ietf-tls-keylogfile-05. + */ + public static final MediaType APPLICATION_SSLKEYLOGFILE_TYPE = + new MediaType("application", "sslkeylogfile"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SSML_XML} media + * type defined by RFC 4267. + */ + public static final String APPLICATION_SSML_XML = + "application/ssml+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SSML_XML} media + * type defined by RFC 4267. + */ + public static final MediaType APPLICATION_SSML_XML_TYPE = + new MediaType("application", "ssml+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SUIT_ENVELOPE_COSE} media + * type defined by RFC-ietf-suit-manifest-34. + */ + public static final String APPLICATION_SUIT_ENVELOPE_COSE = + "application/suit-envelope+cose"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SUIT_ENVELOPE_COSE} media + * type defined by RFC-ietf-suit-manifest-34. + */ + public static final MediaType APPLICATION_SUIT_ENVELOPE_COSE_TYPE = + new MediaType("application", "suit-envelope+cose"); + + /** + * A {@code String} constant representing {@value #APPLICATION_SWID_CBOR} media + * type defined by RFC 9393. + */ + public static final String APPLICATION_SWID_CBOR = + "application/swid+cbor"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_SWID_CBOR} media + * type defined by RFC 9393. + */ + public static final MediaType APPLICATION_SWID_CBOR_TYPE = + new MediaType("application", "swid+cbor"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TAMP_APEX_UPDATE} media + * type defined by RFC 5934. + */ + public static final String APPLICATION_TAMP_APEX_UPDATE = + "application/tamp-apex-update"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TAMP_APEX_UPDATE} media + * type defined by RFC 5934. + */ + public static final MediaType APPLICATION_TAMP_APEX_UPDATE_TYPE = + new MediaType("application", "tamp-apex-update"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TAMP_APEX_UPDATE_CONFIRM} media + * type defined by RFC 5934. + */ + public static final String APPLICATION_TAMP_APEX_UPDATE_CONFIRM = + "application/tamp-apex-update-confirm"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TAMP_APEX_UPDATE_CONFIRM} media + * type defined by RFC 5934. + */ + public static final MediaType APPLICATION_TAMP_APEX_UPDATE_CONFIRM_TYPE = + new MediaType("application", "tamp-apex-update-confirm"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TAMP_COMMUNITY_UPDATE} media + * type defined by RFC 5934. + */ + public static final String APPLICATION_TAMP_COMMUNITY_UPDATE = + "application/tamp-community-update"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TAMP_COMMUNITY_UPDATE} media + * type defined by RFC 5934. + */ + public static final MediaType APPLICATION_TAMP_COMMUNITY_UPDATE_TYPE = + new MediaType("application", "tamp-community-update"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TAMP_COMMUNITY_UPDATE_CONFIRM} media + * type defined by RFC 5934. + */ + public static final String APPLICATION_TAMP_COMMUNITY_UPDATE_CONFIRM = + "application/tamp-community-update-confirm"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TAMP_COMMUNITY_UPDATE_CONFIRM} media + * type defined by RFC 5934. + */ + public static final MediaType APPLICATION_TAMP_COMMUNITY_UPDATE_CONFIRM_TYPE = + new MediaType("application", "tamp-community-update-confirm"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TAMP_ERROR} media + * type defined by RFC 5934. + */ + public static final String APPLICATION_TAMP_ERROR = + "application/tamp-error"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TAMP_ERROR} media + * type defined by RFC 5934. + */ + public static final MediaType APPLICATION_TAMP_ERROR_TYPE = + new MediaType("application", "tamp-error"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TAMP_SEQUENCE_ADJUST} media + * type defined by RFC 5934. + */ + public static final String APPLICATION_TAMP_SEQUENCE_ADJUST = + "application/tamp-sequence-adjust"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TAMP_SEQUENCE_ADJUST} media + * type defined by RFC 5934. + */ + public static final MediaType APPLICATION_TAMP_SEQUENCE_ADJUST_TYPE = + new MediaType("application", "tamp-sequence-adjust"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TAMP_SEQUENCE_ADJUST_CONFIRM} media + * type defined by RFC 5934. + */ + public static final String APPLICATION_TAMP_SEQUENCE_ADJUST_CONFIRM = + "application/tamp-sequence-adjust-confirm"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TAMP_SEQUENCE_ADJUST_CONFIRM} media + * type defined by RFC 5934. + */ + public static final MediaType APPLICATION_TAMP_SEQUENCE_ADJUST_CONFIRM_TYPE = + new MediaType("application", "tamp-sequence-adjust-confirm"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TAMP_STATUS_QUERY} media + * type defined by RFC 5934. + */ + public static final String APPLICATION_TAMP_STATUS_QUERY = + "application/tamp-status-query"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TAMP_STATUS_QUERY} media + * type defined by RFC 5934. + */ + public static final MediaType APPLICATION_TAMP_STATUS_QUERY_TYPE = + new MediaType("application", "tamp-status-query"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TAMP_STATUS_RESPONSE} media + * type defined by RFC 5934. + */ + public static final String APPLICATION_TAMP_STATUS_RESPONSE = + "application/tamp-status-response"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TAMP_STATUS_RESPONSE} media + * type defined by RFC 5934. + */ + public static final MediaType APPLICATION_TAMP_STATUS_RESPONSE_TYPE = + new MediaType("application", "tamp-status-response"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TAMP_UPDATE} media + * type defined by RFC 5934. + */ + public static final String APPLICATION_TAMP_UPDATE = + "application/tamp-update"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TAMP_UPDATE} media + * type defined by RFC 5934. + */ + public static final MediaType APPLICATION_TAMP_UPDATE_TYPE = + new MediaType("application", "tamp-update"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TAMP_UPDATE_CONFIRM} media + * type defined by RFC 5934. + */ + public static final String APPLICATION_TAMP_UPDATE_CONFIRM = + "application/tamp-update-confirm"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TAMP_UPDATE_CONFIRM} media + * type defined by RFC 5934. + */ + public static final MediaType APPLICATION_TAMP_UPDATE_CONFIRM_TYPE = + new MediaType("application", "tamp-update-confirm"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TEI_XML} media + * type defined by RFC 6129. + */ + public static final String APPLICATION_TEI_XML = + "application/tei+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TEI_XML} media + * type defined by RFC 6129. + */ + public static final MediaType APPLICATION_TEI_XML_TYPE = + new MediaType("application", "tei+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_THRAUD_XML} media + * type defined by RFC 5941. + */ + public static final String APPLICATION_THRAUD_XML = + "application/thraud+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_THRAUD_XML} media + * type defined by RFC 5941. + */ + public static final MediaType APPLICATION_THRAUD_XML_TYPE = + new MediaType("application", "thraud+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TIMESTAMP_QUERY} media + * type defined by RFC 3161. + */ + public static final String APPLICATION_TIMESTAMP_QUERY = + "application/timestamp-query"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TIMESTAMP_QUERY} media + * type defined by RFC 3161. + */ + public static final MediaType APPLICATION_TIMESTAMP_QUERY_TYPE = + new MediaType("application", "timestamp-query"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TIMESTAMP_REPLY} media + * type defined by RFC 3161. + */ + public static final String APPLICATION_TIMESTAMP_REPLY = + "application/timestamp-reply"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TIMESTAMP_REPLY} media + * type defined by RFC 3161. + */ + public static final MediaType APPLICATION_TIMESTAMP_REPLY_TYPE = + new MediaType("application", "timestamp-reply"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TIMESTAMPED_DATA} media + * type defined by RFC 5955. + */ + public static final String APPLICATION_TIMESTAMPED_DATA = + "application/timestamped-data"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TIMESTAMPED_DATA} media + * type defined by RFC 5955. + */ + public static final MediaType APPLICATION_TIMESTAMPED_DATA_TYPE = + new MediaType("application", "timestamped-data"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TLSRPT_GZIP} media + * type defined by RFC 8460. + */ + public static final String APPLICATION_TLSRPT_GZIP = + "application/tlsrpt+gzip"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TLSRPT_GZIP} media + * type defined by RFC 8460. + */ + public static final MediaType APPLICATION_TLSRPT_GZIP_TYPE = + new MediaType("application", "tlsrpt+gzip"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TLSRPT_JSON} media + * type defined by RFC 8460. + */ + public static final String APPLICATION_TLSRPT_JSON = + "application/tlsrpt+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TLSRPT_JSON} media + * type defined by RFC 8460. + */ + public static final MediaType APPLICATION_TLSRPT_JSON_TYPE = + new MediaType("application", "tlsrpt+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TNAUTHLIST} media + * type defined by RFC 8226. + */ + public static final String APPLICATION_TNAUTHLIST = + "application/tnauthlist"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TNAUTHLIST} media + * type defined by RFC 8226. + */ + public static final MediaType APPLICATION_TNAUTHLIST_TYPE = + new MediaType("application", "tnauthlist"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TOKEN_INTROSPECTION_JWT} media + * type defined by RFC 9701. + */ + public static final String APPLICATION_TOKEN_INTROSPECTION_JWT = + "application/token-introspection+jwt"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TOKEN_INTROSPECTION_JWT} media + * type defined by RFC 9701. + */ + public static final MediaType APPLICATION_TOKEN_INTROSPECTION_JWT_TYPE = + new MediaType("application", "token-introspection+jwt"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TOML} media + * type defined by {@code https://github.com/toml-lang/toml/issues/870}. + */ + public static final String APPLICATION_TOML = + "application/toml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TOML} media + * type defined by {@code https://github.com/toml-lang/toml/issues/870}. + */ + public static final MediaType APPLICATION_TOML_TYPE = + new MediaType("application", "toml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TRICKLE_ICE_SDPFRAG} media + * type defined by RFC 8840. + */ + public static final String APPLICATION_TRICKLE_ICE_SDPFRAG = + "application/trickle-ice-sdpfrag"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TRICKLE_ICE_SDPFRAG} media + * type defined by RFC 8840. + */ + public static final MediaType APPLICATION_TRICKLE_ICE_SDPFRAG_TYPE = + new MediaType("application", "trickle-ice-sdpfrag"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TZIF} media + * type defined by RFC 9636. + */ + public static final String APPLICATION_TZIF = + "application/tzif"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TZIF} media + * type defined by RFC 9636. + */ + public static final MediaType APPLICATION_TZIF_TYPE = + new MediaType("application", "tzif"); + + /** + * A {@code String} constant representing {@value #APPLICATION_TZIF_LEAP} media + * type defined by RFC 9636. + */ + public static final String APPLICATION_TZIF_LEAP = + "application/tzif-leap"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_TZIF_LEAP} media + * type defined by RFC 9636. + */ + public static final MediaType APPLICATION_TZIF_LEAP_TYPE = + new MediaType("application", "tzif-leap"); + + /** + * A {@code String} constant representing {@value #APPLICATION_UCCS_CBOR} media + * type defined by RFC 9781. + */ + public static final String APPLICATION_UCCS_CBOR = + "application/uccs+cbor"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_UCCS_CBOR} media + * type defined by RFC 9781. + */ + public static final MediaType APPLICATION_UCCS_CBOR_TYPE = + new MediaType("application", "uccs+cbor"); + + /** + * A {@code String} constant representing {@value #APPLICATION_UJCS_JSON} media + * type defined by RFC 9781. + */ + public static final String APPLICATION_UJCS_JSON = + "application/ujcs+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_UJCS_JSON} media + * type defined by RFC 9781. + */ + public static final MediaType APPLICATION_UJCS_JSON_TYPE = + new MediaType("application", "ujcs+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ULPFEC} media + * type defined by RFC 5109. + */ + public static final String APPLICATION_ULPFEC = + "application/ulpfec"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ULPFEC} media + * type defined by RFC 5109. + */ + public static final MediaType APPLICATION_ULPFEC_TYPE = + new MediaType("application", "ulpfec"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VCARD_JSON} media + * type defined by RFC 7095. + */ + public static final String APPLICATION_VCARD_JSON = + "application/vcard+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VCARD_JSON} media + * type defined by RFC 7095. + */ + public static final MediaType APPLICATION_VCARD_JSON_TYPE = + new MediaType("application", "vcard+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VCARD_XML} media + * type defined by RFC 6351. + */ + public static final String APPLICATION_VCARD_XML = + "application/vcard+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VCARD_XML} media + * type defined by RFC 6351. + */ + public static final MediaType APPLICATION_VCARD_XML_TYPE = + new MediaType("application", "vcard+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VEMMI} media + * type defined by RFC 2122. + */ + public static final String APPLICATION_VEMMI = + "application/vemmi"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VEMMI} media + * type defined by RFC 2122. + */ + public static final MediaType APPLICATION_VEMMI_TYPE = + new MediaType("application", "vemmi"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_APPLE_MPEGURL} media + * type defined by RFC 8216. + */ + public static final String APPLICATION_VND_APPLE_MPEGURL = + "application/vnd.apple.mpegurl"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_APPLE_MPEGURL} media + * type defined by RFC 8216. + */ + public static final MediaType APPLICATION_VND_APPLE_MPEGURL_TYPE = + new MediaType("application", "vnd.apple.mpegurl"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_GEO_JSON} media + * type defined by . + */ + public static final String APPLICATION_VND_GEO_JSON = + "application/vnd.geo+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_GEO_JSON} media + * type defined by . + */ + public static final MediaType APPLICATION_VND_GEO_JSON_TYPE = + new MediaType("application", "vnd.geo+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_PWG_MULTIPLEXED} media + * type defined by RFC 3391. + */ + public static final String APPLICATION_VND_PWG_MULTIPLEXED = + "application/vnd.pwg-multiplexed"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_PWG_MULTIPLEXED} media + * type defined by RFC 3391. + */ + public static final MediaType APPLICATION_VND_PWG_MULTIPLEXED_TYPE = + new MediaType("application", "vnd.pwg-multiplexed"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_RADISYS_MOML_XML} media + * type defined by RFC 5707. + */ + public static final String APPLICATION_VND_RADISYS_MOML_XML = + "application/vnd.radisys.moml+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_RADISYS_MOML_XML} media + * type defined by RFC 5707. + */ + public static final MediaType APPLICATION_VND_RADISYS_MOML_XML_TYPE = + new MediaType("application", "vnd.radisys.moml+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_RADISYS_MSML_AUDIT_CONF_XML} media + * type defined by RFC 5707. + */ + public static final String APPLICATION_VND_RADISYS_MSML_AUDIT_CONF_XML = + "application/vnd.radisys.msml-audit-conf+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_RADISYS_MSML_AUDIT_CONF_XML} media + * type defined by RFC 5707. + */ + public static final MediaType APPLICATION_VND_RADISYS_MSML_AUDIT_CONF_XML_TYPE = + new MediaType("application", "vnd.radisys.msml-audit-conf+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_RADISYS_MSML_AUDIT_CONN_XML} media + * type defined by RFC 5707. + */ + public static final String APPLICATION_VND_RADISYS_MSML_AUDIT_CONN_XML = + "application/vnd.radisys.msml-audit-conn+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_RADISYS_MSML_AUDIT_CONN_XML} media + * type defined by RFC 5707. + */ + public static final MediaType APPLICATION_VND_RADISYS_MSML_AUDIT_CONN_XML_TYPE = + new MediaType("application", "vnd.radisys.msml-audit-conn+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_RADISYS_MSML_AUDIT_DIALOG_XML} media + * type defined by RFC 5707. + */ + public static final String APPLICATION_VND_RADISYS_MSML_AUDIT_DIALOG_XML = + "application/vnd.radisys.msml-audit-dialog+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_RADISYS_MSML_AUDIT_DIALOG_XML} media + * type defined by RFC 5707. + */ + public static final MediaType APPLICATION_VND_RADISYS_MSML_AUDIT_DIALOG_XML_TYPE = + new MediaType("application", "vnd.radisys.msml-audit-dialog+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_RADISYS_MSML_AUDIT_STREAM_XML} media + * type defined by RFC 5707. + */ + public static final String APPLICATION_VND_RADISYS_MSML_AUDIT_STREAM_XML = + "application/vnd.radisys.msml-audit-stream+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_RADISYS_MSML_AUDIT_STREAM_XML} media + * type defined by RFC 5707. + */ + public static final MediaType APPLICATION_VND_RADISYS_MSML_AUDIT_STREAM_XML_TYPE = + new MediaType("application", "vnd.radisys.msml-audit-stream+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_RADISYS_MSML_AUDIT_XML} media + * type defined by RFC 5707. + */ + public static final String APPLICATION_VND_RADISYS_MSML_AUDIT_XML = + "application/vnd.radisys.msml-audit+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_RADISYS_MSML_AUDIT_XML} media + * type defined by RFC 5707. + */ + public static final MediaType APPLICATION_VND_RADISYS_MSML_AUDIT_XML_TYPE = + new MediaType("application", "vnd.radisys.msml-audit+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_RADISYS_MSML_CONF_XML} media + * type defined by RFC 5707. + */ + public static final String APPLICATION_VND_RADISYS_MSML_CONF_XML = + "application/vnd.radisys.msml-conf+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_RADISYS_MSML_CONF_XML} media + * type defined by RFC 5707. + */ + public static final MediaType APPLICATION_VND_RADISYS_MSML_CONF_XML_TYPE = + new MediaType("application", "vnd.radisys.msml-conf+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_RADISYS_MSML_DIALOG_BASE_XML} media + * type defined by RFC 5707. + */ + public static final String APPLICATION_VND_RADISYS_MSML_DIALOG_BASE_XML = + "application/vnd.radisys.msml-dialog-base+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_RADISYS_MSML_DIALOG_BASE_XML} media + * type defined by RFC 5707. + */ + public static final MediaType APPLICATION_VND_RADISYS_MSML_DIALOG_BASE_XML_TYPE = + new MediaType("application", "vnd.radisys.msml-dialog-base+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_RADISYS_MSML_DIALOG_FAX_DETECT_XML} media + * type defined by RFC 5707. + */ + public static final String APPLICATION_VND_RADISYS_MSML_DIALOG_FAX_DETECT_XML = + "application/vnd.radisys.msml-dialog-fax-detect+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_RADISYS_MSML_DIALOG_FAX_DETECT_XML} media + * type defined by RFC 5707. + */ + public static final MediaType APPLICATION_VND_RADISYS_MSML_DIALOG_FAX_DETECT_XML_TYPE = + new MediaType("application", "vnd.radisys.msml-dialog-fax-detect+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_RADISYS_MSML_DIALOG_FAX_SENDRECV_XML} media + * type defined by RFC 5707. + */ + public static final String APPLICATION_VND_RADISYS_MSML_DIALOG_FAX_SENDRECV_XML = + "application/vnd.radisys.msml-dialog-fax-sendrecv+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_RADISYS_MSML_DIALOG_FAX_SENDRECV_XML} media + * type defined by RFC 5707. + */ + public static final MediaType APPLICATION_VND_RADISYS_MSML_DIALOG_FAX_SENDRECV_XML_TYPE = + new MediaType("application", "vnd.radisys.msml-dialog-fax-sendrecv+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_RADISYS_MSML_DIALOG_GROUP_XML} media + * type defined by RFC 5707. + */ + public static final String APPLICATION_VND_RADISYS_MSML_DIALOG_GROUP_XML = + "application/vnd.radisys.msml-dialog-group+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_RADISYS_MSML_DIALOG_GROUP_XML} media + * type defined by RFC 5707. + */ + public static final MediaType APPLICATION_VND_RADISYS_MSML_DIALOG_GROUP_XML_TYPE = + new MediaType("application", "vnd.radisys.msml-dialog-group+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_RADISYS_MSML_DIALOG_SPEECH_XML} media + * type defined by RFC 5707. + */ + public static final String APPLICATION_VND_RADISYS_MSML_DIALOG_SPEECH_XML = + "application/vnd.radisys.msml-dialog-speech+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_RADISYS_MSML_DIALOG_SPEECH_XML} media + * type defined by RFC 5707. + */ + public static final MediaType APPLICATION_VND_RADISYS_MSML_DIALOG_SPEECH_XML_TYPE = + new MediaType("application", "vnd.radisys.msml-dialog-speech+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_RADISYS_MSML_DIALOG_TRANSFORM_XML} media + * type defined by RFC 5707. + */ + public static final String APPLICATION_VND_RADISYS_MSML_DIALOG_TRANSFORM_XML = + "application/vnd.radisys.msml-dialog-transform+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_RADISYS_MSML_DIALOG_TRANSFORM_XML} media + * type defined by RFC 5707. + */ + public static final MediaType APPLICATION_VND_RADISYS_MSML_DIALOG_TRANSFORM_XML_TYPE = + new MediaType("application", "vnd.radisys.msml-dialog-transform+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_RADISYS_MSML_DIALOG_XML} media + * type defined by RFC 5707. + */ + public static final String APPLICATION_VND_RADISYS_MSML_DIALOG_XML = + "application/vnd.radisys.msml-dialog+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_RADISYS_MSML_DIALOG_XML} media + * type defined by RFC 5707. + */ + public static final MediaType APPLICATION_VND_RADISYS_MSML_DIALOG_XML_TYPE = + new MediaType("application", "vnd.radisys.msml-dialog+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VND_RADISYS_MSML_XML} media + * type defined by RFC 5707. + */ + public static final String APPLICATION_VND_RADISYS_MSML_XML = + "application/vnd.radisys.msml+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VND_RADISYS_MSML_XML} media + * type defined by RFC 5707. + */ + public static final MediaType APPLICATION_VND_RADISYS_MSML_XML_TYPE = + new MediaType("application", "vnd.radisys.msml+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VOICEXML_XML} media + * type defined by RFC 4267. + */ + public static final String APPLICATION_VOICEXML_XML = + "application/voicexml+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VOICEXML_XML} media + * type defined by RFC 4267. + */ + public static final MediaType APPLICATION_VOICEXML_XML_TYPE = + new MediaType("application", "voicexml+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VOUCHER_CMS_JSON} media + * type defined by RFC 8366. + */ + public static final String APPLICATION_VOUCHER_CMS_JSON = + "application/voucher-cms+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VOUCHER_CMS_JSON} media + * type defined by RFC 8366. + */ + public static final MediaType APPLICATION_VOUCHER_CMS_JSON_TYPE = + new MediaType("application", "voucher-cms+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VOUCHER_JWS_JSON} media + * type defined by RFC-ietf-anima-jws-voucher-16. + */ + public static final String APPLICATION_VOUCHER_JWS_JSON = + "application/voucher-jws+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VOUCHER_JWS_JSON} media + * type defined by RFC-ietf-anima-jws-voucher-16. + */ + public static final MediaType APPLICATION_VOUCHER_JWS_JSON_TYPE = + new MediaType("application", "voucher-jws+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_VQ_RTCPXR} media + * type defined by RFC 6035. + */ + public static final String APPLICATION_VQ_RTCPXR = + "application/vq-rtcpxr"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_VQ_RTCPXR} media + * type defined by RFC 6035. + */ + public static final MediaType APPLICATION_VQ_RTCPXR_TYPE = + new MediaType("application", "vq-rtcpxr"); + + /** + * A {@code String} constant representing {@value #APPLICATION_WATCHERINFO_XML} media + * type defined by RFC 3858. + */ + public static final String APPLICATION_WATCHERINFO_XML = + "application/watcherinfo+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_WATCHERINFO_XML} media + * type defined by RFC 3858. + */ + public static final MediaType APPLICATION_WATCHERINFO_XML_TYPE = + new MediaType("application", "watcherinfo+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_WEBPUSH_OPTIONS_JSON} media + * type defined by RFC 8292. + */ + public static final String APPLICATION_WEBPUSH_OPTIONS_JSON = + "application/webpush-options+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_WEBPUSH_OPTIONS_JSON} media + * type defined by RFC 8292. + */ + public static final MediaType APPLICATION_WEBPUSH_OPTIONS_JSON_TYPE = + new MediaType("application", "webpush-options+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_WHOISPP_QUERY} media + * type defined by RFC 2957. + */ + public static final String APPLICATION_WHOISPP_QUERY = + "application/whoispp-query"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_WHOISPP_QUERY} media + * type defined by RFC 2957. + */ + public static final MediaType APPLICATION_WHOISPP_QUERY_TYPE = + new MediaType("application", "whoispp-query"); + + /** + * A {@code String} constant representing {@value #APPLICATION_WHOISPP_RESPONSE} media + * type defined by RFC 2958. + */ + public static final String APPLICATION_WHOISPP_RESPONSE = + "application/whoispp-response"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_WHOISPP_RESPONSE} media + * type defined by RFC 2958. + */ + public static final MediaType APPLICATION_WHOISPP_RESPONSE_TYPE = + new MediaType("application", "whoispp-response"); + + /** + * A {@code String} constant representing {@value #APPLICATION_X_PKI_MESSAGE} media + * type defined by RFC 8894. + */ + public static final String APPLICATION_X_PKI_MESSAGE = + "application/x-pki-message"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_X_PKI_MESSAGE} media + * type defined by RFC 8894. + */ + public static final MediaType APPLICATION_X_PKI_MESSAGE_TYPE = + new MediaType("application", "x-pki-message"); + + /** + * A {@code String} constant representing {@value #APPLICATION_X_X509_CA_CERT} media + * type defined by RFC 8894. + */ + public static final String APPLICATION_X_X509_CA_CERT = + "application/x-x509-ca-cert"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_X_X509_CA_CERT} media + * type defined by RFC 8894. + */ + public static final MediaType APPLICATION_X_X509_CA_CERT_TYPE = + new MediaType("application", "x-x509-ca-cert"); + + /** + * A {@code String} constant representing {@value #APPLICATION_X_X509_CA_RA_CERT} media + * type defined by RFC 8894. + */ + public static final String APPLICATION_X_X509_CA_RA_CERT = + "application/x-x509-ca-ra-cert"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_X_X509_CA_RA_CERT} media + * type defined by RFC 8894. + */ + public static final MediaType APPLICATION_X_X509_CA_RA_CERT_TYPE = + new MediaType("application", "x-x509-ca-ra-cert"); + + /** + * A {@code String} constant representing {@value #APPLICATION_X_X509_NEXT_CA_CERT} media + * type defined by RFC 8894. + */ + public static final String APPLICATION_X_X509_NEXT_CA_CERT = + "application/x-x509-next-ca-cert"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_X_X509_NEXT_CA_CERT} media + * type defined by RFC 8894. + */ + public static final MediaType APPLICATION_X_X509_NEXT_CA_CERT_TYPE = + new MediaType("application", "x-x509-next-ca-cert"); + + /** + * A {@code String} constant representing {@value #APPLICATION_X400_BP} media + * type defined by RFC 1494. + */ + public static final String APPLICATION_X400_BP = + "application/x400-bp"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_X400_BP} media + * type defined by RFC 1494. + */ + public static final MediaType APPLICATION_X400_BP_TYPE = + new MediaType("application", "x400-bp"); + + /** + * A {@code String} constant representing {@value #APPLICATION_XACML_XML} media + * type defined by RFC 7061. + */ + public static final String APPLICATION_XACML_XML = + "application/xacml+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XACML_XML} media + * type defined by RFC 7061. + */ + public static final MediaType APPLICATION_XACML_XML_TYPE = + new MediaType("application", "xacml+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_XCAP_ATT_XML} media + * type defined by RFC 4825. + */ + public static final String APPLICATION_XCAP_ATT_XML = + "application/xcap-att+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XCAP_ATT_XML} media + * type defined by RFC 4825. + */ + public static final MediaType APPLICATION_XCAP_ATT_XML_TYPE = + new MediaType("application", "xcap-att+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_XCAP_CAPS_XML} media + * type defined by RFC 4825. + */ + public static final String APPLICATION_XCAP_CAPS_XML = + "application/xcap-caps+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XCAP_CAPS_XML} media + * type defined by RFC 4825. + */ + public static final MediaType APPLICATION_XCAP_CAPS_XML_TYPE = + new MediaType("application", "xcap-caps+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_XCAP_DIFF_XML} media + * type defined by RFC 5874. + */ + public static final String APPLICATION_XCAP_DIFF_XML = + "application/xcap-diff+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XCAP_DIFF_XML} media + * type defined by RFC 5874. + */ + public static final MediaType APPLICATION_XCAP_DIFF_XML_TYPE = + new MediaType("application", "xcap-diff+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_XCAP_EL_XML} media + * type defined by RFC 4825. + */ + public static final String APPLICATION_XCAP_EL_XML = + "application/xcap-el+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XCAP_EL_XML} media + * type defined by RFC 4825. + */ + public static final MediaType APPLICATION_XCAP_EL_XML_TYPE = + new MediaType("application", "xcap-el+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_XCAP_ERROR_XML} media + * type defined by RFC 4825. + */ + public static final String APPLICATION_XCAP_ERROR_XML = + "application/xcap-error+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XCAP_ERROR_XML} media + * type defined by RFC 4825. + */ + public static final MediaType APPLICATION_XCAP_ERROR_XML_TYPE = + new MediaType("application", "xcap-error+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_XCAP_NS_XML} media + * type defined by RFC 4825. + */ + public static final String APPLICATION_XCAP_NS_XML = + "application/xcap-ns+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XCAP_NS_XML} media + * type defined by RFC 4825. + */ + public static final MediaType APPLICATION_XCAP_NS_XML_TYPE = + new MediaType("application", "xcap-ns+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_XCON_CONFERENCE_INFO_DIFF_XML} media + * type defined by RFC 6502. + */ + public static final String APPLICATION_XCON_CONFERENCE_INFO_DIFF_XML = + "application/xcon-conference-info-diff+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XCON_CONFERENCE_INFO_DIFF_XML} media + * type defined by RFC 6502. + */ + public static final MediaType APPLICATION_XCON_CONFERENCE_INFO_DIFF_XML_TYPE = + new MediaType("application", "xcon-conference-info-diff+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_XCON_CONFERENCE_INFO_XML} media + * type defined by RFC 6502. + */ + public static final String APPLICATION_XCON_CONFERENCE_INFO_XML = + "application/xcon-conference-info+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XCON_CONFERENCE_INFO_XML} media + * type defined by RFC 6502. + */ + public static final MediaType APPLICATION_XCON_CONFERENCE_INFO_XML_TYPE = + new MediaType("application", "xcon-conference-info+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_XML} media + * type defined by RFC 7303. + */ + public static final String APPLICATION_XML = + "application/xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XML} media + * type defined by RFC 7303. + */ + public static final MediaType APPLICATION_XML_TYPE = + new MediaType("application", "xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_XML_DTD} media + * type defined by RFC 7303. + */ + public static final String APPLICATION_XML_DTD = + "application/xml-dtd"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XML_DTD} media + * type defined by RFC 7303. + */ + public static final MediaType APPLICATION_XML_DTD_TYPE = + new MediaType("application", "xml-dtd"); + + /** + * A {@code String} constant representing {@value #APPLICATION_XML_EXTERNAL_PARSED_ENTITY} media + * type defined by RFC 7303. + */ + public static final String APPLICATION_XML_EXTERNAL_PARSED_ENTITY = + "application/xml-external-parsed-entity"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XML_EXTERNAL_PARSED_ENTITY} media + * type defined by RFC 7303. + */ + public static final MediaType APPLICATION_XML_EXTERNAL_PARSED_ENTITY_TYPE = + new MediaType("application", "xml-external-parsed-entity"); + + /** + * A {@code String} constant representing {@value #APPLICATION_XML_PATCH_XML} media + * type defined by RFC 7351. + */ + public static final String APPLICATION_XML_PATCH_XML = + "application/xml-patch+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XML_PATCH_XML} media + * type defined by RFC 7351. + */ + public static final MediaType APPLICATION_XML_PATCH_XML_TYPE = + new MediaType("application", "xml-patch+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_XMPP_XML} media + * type defined by RFC 3923. + */ + public static final String APPLICATION_XMPP_XML = + "application/xmpp+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XMPP_XML} media + * type defined by RFC 3923. + */ + public static final MediaType APPLICATION_XMPP_XML_TYPE = + new MediaType("application", "xmpp+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_XSLT_XML} media + * type defined by {@code http://www.w3.org/TR/2007/REC-xslt20-20070123/#media-type-registration}. + */ + public static final String APPLICATION_XSLT_XML = + "application/xslt+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XSLT_XML} media + * type defined by {@code http://www.w3.org/TR/2007/REC-xslt20-20070123/#media-type-registration}. + */ + public static final MediaType APPLICATION_XSLT_XML_TYPE = + new MediaType("application", "xslt+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_XV_XML} media + * type defined by RFC 4374. + */ + public static final String APPLICATION_XV_XML = + "application/xv+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_XV_XML} media + * type defined by RFC 4374. + */ + public static final MediaType APPLICATION_XV_XML_TYPE = + new MediaType("application", "xv+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_YAML} media + * type defined by RFC 9512. + */ + public static final String APPLICATION_YAML = + "application/yaml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_YAML} media + * type defined by RFC 9512. + */ + public static final MediaType APPLICATION_YAML_TYPE = + new MediaType("application", "yaml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_YANG} media + * type defined by RFC 6020. + */ + public static final String APPLICATION_YANG = + "application/yang"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_YANG} media + * type defined by RFC 6020. + */ + public static final MediaType APPLICATION_YANG_TYPE = + new MediaType("application", "yang"); + + /** + * A {@code String} constant representing {@value #APPLICATION_YANG_DATA_CBOR} media + * type defined by RFC 9254. + */ + public static final String APPLICATION_YANG_DATA_CBOR = + "application/yang-data+cbor"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_YANG_DATA_CBOR} media + * type defined by RFC 9254. + */ + public static final MediaType APPLICATION_YANG_DATA_CBOR_TYPE = + new MediaType("application", "yang-data+cbor"); + + /** + * A {@code String} constant representing {@value #APPLICATION_YANG_DATA_JSON} media + * type defined by RFC 8040. + */ + public static final String APPLICATION_YANG_DATA_JSON = + "application/yang-data+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_YANG_DATA_JSON} media + * type defined by RFC 8040. + */ + public static final MediaType APPLICATION_YANG_DATA_JSON_TYPE = + new MediaType("application", "yang-data+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_YANG_DATA_XML} media + * type defined by RFC 8040. + */ + public static final String APPLICATION_YANG_DATA_XML = + "application/yang-data+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_YANG_DATA_XML} media + * type defined by RFC 8040. + */ + public static final MediaType APPLICATION_YANG_DATA_XML_TYPE = + new MediaType("application", "yang-data+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_YANG_PATCH_JSON} media + * type defined by RFC 8072. + */ + public static final String APPLICATION_YANG_PATCH_JSON = + "application/yang-patch+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_YANG_PATCH_JSON} media + * type defined by RFC 8072. + */ + public static final MediaType APPLICATION_YANG_PATCH_JSON_TYPE = + new MediaType("application", "yang-patch+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_YANG_PATCH_XML} media + * type defined by RFC 8072. + */ + public static final String APPLICATION_YANG_PATCH_XML = + "application/yang-patch+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_YANG_PATCH_XML} media + * type defined by RFC 8072. + */ + public static final MediaType APPLICATION_YANG_PATCH_XML_TYPE = + new MediaType("application", "yang-patch+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_YANG_SID_JSON} media + * type defined by RFC 9595. + */ + public static final String APPLICATION_YANG_SID_JSON = + "application/yang-sid+json"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_YANG_SID_JSON} media + * type defined by RFC 9595. + */ + public static final MediaType APPLICATION_YANG_SID_JSON_TYPE = + new MediaType("application", "yang-sid+json"); + + /** + * A {@code String} constant representing {@value #APPLICATION_YIN_XML} media + * type defined by RFC 6020. + */ + public static final String APPLICATION_YIN_XML = + "application/yin+xml"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_YIN_XML} media + * type defined by RFC 6020. + */ + public static final MediaType APPLICATION_YIN_XML_TYPE = + new MediaType("application", "yin+xml"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ZLIB} media + * type defined by RFC 6713. + */ + public static final String APPLICATION_ZLIB = + "application/zlib"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ZLIB} media + * type defined by RFC 6713. + */ + public static final MediaType APPLICATION_ZLIB_TYPE = + new MediaType("application", "zlib"); + + /** + * A {@code String} constant representing {@value #APPLICATION_ZSTD} media + * type defined by RFC 8878. + */ + public static final String APPLICATION_ZSTD = + "application/zstd"; + + /** + * A {@link MediaType} constant representing {@value #APPLICATION_ZSTD} media + * type defined by RFC 8878. + */ + public static final MediaType APPLICATION_ZSTD_TYPE = + new MediaType("application", "zstd"); + } + + /** + * Audio type media subtypes. + */ + public static class Audio { + /** + * A {@code String} constant representing {@value #AUDIO_1D_INTERLEAVED_PARITYFEC} media + * type defined by RFC 6015. + */ + public static final String AUDIO_1D_INTERLEAVED_PARITYFEC = + "audio/1d-interleaved-parityfec"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_1D_INTERLEAVED_PARITYFEC} media + * type defined by RFC 6015. + */ + public static final MediaType AUDIO_1D_INTERLEAVED_PARITYFEC_TYPE = + new MediaType("audio", "1d-interleaved-parityfec"); + + /** + * A {@code String} constant representing {@value #AUDIO_32KADPCM} media + * type defined by RFC 3802, and RFC 2421. + */ + public static final String AUDIO_32KADPCM = + "audio/32kadpcm"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_32KADPCM} media + * type defined by RFC 3802, and RFC 2421. + */ + public static final MediaType AUDIO_32KADPCM_TYPE = + new MediaType("audio", "32kadpcm"); + + /** + * A {@code String} constant representing {@value #AUDIO_3GPP} media + * type defined by RFC 3839, and RFC 6381. + */ + public static final String AUDIO_3GPP = + "audio/3gpp"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_3GPP} media + * type defined by RFC 3839, and RFC 6381. + */ + public static final MediaType AUDIO_3GPP_TYPE = + new MediaType("audio", "3gpp"); + + /** + * A {@code String} constant representing {@value #AUDIO_3GPP2} media + * type defined by RFC 4393, and RFC 6381. + */ + public static final String AUDIO_3GPP2 = + "audio/3gpp2"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_3GPP2} media + * type defined by RFC 4393, and RFC 6381. + */ + public static final MediaType AUDIO_3GPP2_TYPE = + new MediaType("audio", "3gpp2"); + + /** + * A {@code String} constant representing {@value #AUDIO_AC3} media + * type defined by RFC 4184. + */ + public static final String AUDIO_AC3 = + "audio/ac3"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_AC3} media + * type defined by RFC 4184. + */ + public static final MediaType AUDIO_AC3_TYPE = + new MediaType("audio", "ac3"); + + /** + * A {@code String} constant representing {@value #AUDIO_AMR} media + * type defined by RFC 4867. + */ + public static final String AUDIO_AMR = + "audio/AMR"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_AMR} media + * type defined by RFC 4867. + */ + public static final MediaType AUDIO_AMR_TYPE = + new MediaType("audio", "AMR"); + + /** + * A {@code String} constant representing {@value #AUDIO_AMR_WB} media + * type defined by RFC 4867. + */ + public static final String AUDIO_AMR_WB = + "audio/AMR-WB"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_AMR_WB} media + * type defined by RFC 4867. + */ + public static final MediaType AUDIO_AMR_WB_TYPE = + new MediaType("audio", "AMR-WB"); + + /** + * A {@code String} constant representing {@value #AUDIO_AMR_WB_} media + * type defined by RFC 4352. + */ + public static final String AUDIO_AMR_WB_ = + "audio/amr-wb+"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_AMR_WB_} media + * type defined by RFC 4352. + */ + public static final MediaType AUDIO_AMR_WB__TYPE = + new MediaType("audio", "amr-wb+"); + + /** + * A {@code String} constant representing {@value #AUDIO_APTX} media + * type defined by RFC 7310. + */ + public static final String AUDIO_APTX = + "audio/aptx"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_APTX} media + * type defined by RFC 7310. + */ + public static final MediaType AUDIO_APTX_TYPE = + new MediaType("audio", "aptx"); + + /** + * A {@code String} constant representing {@value #AUDIO_ASC} media + * type defined by RFC 6295. + */ + public static final String AUDIO_ASC = + "audio/asc"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_ASC} media + * type defined by RFC 6295. + */ + public static final MediaType AUDIO_ASC_TYPE = + new MediaType("audio", "asc"); + + /** + * A {@code String} constant representing {@value #AUDIO_ATRAC_ADVANCED_LOSSLESS} media + * type defined by RFC 5584. + */ + public static final String AUDIO_ATRAC_ADVANCED_LOSSLESS = + "audio/ATRAC-ADVANCED-LOSSLESS"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_ATRAC_ADVANCED_LOSSLESS} media + * type defined by RFC 5584. + */ + public static final MediaType AUDIO_ATRAC_ADVANCED_LOSSLESS_TYPE = + new MediaType("audio", "ATRAC-ADVANCED-LOSSLESS"); + + /** + * A {@code String} constant representing {@value #AUDIO_ATRAC_X} media + * type defined by RFC 5584. + */ + public static final String AUDIO_ATRAC_X = + "audio/ATRAC-X"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_ATRAC_X} media + * type defined by RFC 5584. + */ + public static final MediaType AUDIO_ATRAC_X_TYPE = + new MediaType("audio", "ATRAC-X"); + + /** + * A {@code String} constant representing {@value #AUDIO_ATRAC3} media + * type defined by RFC 5584. + */ + public static final String AUDIO_ATRAC3 = + "audio/ATRAC3"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_ATRAC3} media + * type defined by RFC 5584. + */ + public static final MediaType AUDIO_ATRAC3_TYPE = + new MediaType("audio", "ATRAC3"); + + /** + * A {@code String} constant representing {@value #AUDIO_BASIC} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final String AUDIO_BASIC = + "audio/basic"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_BASIC} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final MediaType AUDIO_BASIC_TYPE = + new MediaType("audio", "basic"); + + /** + * A {@code String} constant representing {@value #AUDIO_BV16} media + * type defined by RFC 4298. + */ + public static final String AUDIO_BV16 = + "audio/BV16"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_BV16} media + * type defined by RFC 4298. + */ + public static final MediaType AUDIO_BV16_TYPE = + new MediaType("audio", "BV16"); + + /** + * A {@code String} constant representing {@value #AUDIO_BV32} media + * type defined by RFC 4298. + */ + public static final String AUDIO_BV32 = + "audio/BV32"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_BV32} media + * type defined by RFC 4298. + */ + public static final MediaType AUDIO_BV32_TYPE = + new MediaType("audio", "BV32"); + + /** + * A {@code String} constant representing {@value #AUDIO_CLEARMODE} media + * type defined by RFC 4040. + */ + public static final String AUDIO_CLEARMODE = + "audio/clearmode"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_CLEARMODE} media + * type defined by RFC 4040. + */ + public static final MediaType AUDIO_CLEARMODE_TYPE = + new MediaType("audio", "clearmode"); + + /** + * A {@code String} constant representing {@value #AUDIO_CN} media + * type defined by RFC 3389. + */ + public static final String AUDIO_CN = + "audio/CN"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_CN} media + * type defined by RFC 3389. + */ + public static final MediaType AUDIO_CN_TYPE = + new MediaType("audio", "CN"); + + /** + * A {@code String} constant representing {@value #AUDIO_DAT12} media + * type defined by RFC 3190. + */ + public static final String AUDIO_DAT12 = + "audio/DAT12"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_DAT12} media + * type defined by RFC 3190. + */ + public static final MediaType AUDIO_DAT12_TYPE = + new MediaType("audio", "DAT12"); + + /** + * A {@code String} constant representing {@value #AUDIO_DLS} media + * type defined by RFC 4613. + */ + public static final String AUDIO_DLS = + "audio/dls"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_DLS} media + * type defined by RFC 4613. + */ + public static final MediaType AUDIO_DLS_TYPE = + new MediaType("audio", "dls"); + + /** + * A {@code String} constant representing {@value #AUDIO_DSR_ES201108} media + * type defined by RFC 3557. + */ + public static final String AUDIO_DSR_ES201108 = + "audio/dsr-es201108"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_DSR_ES201108} media + * type defined by RFC 3557. + */ + public static final MediaType AUDIO_DSR_ES201108_TYPE = + new MediaType("audio", "dsr-es201108"); + + /** + * A {@code String} constant representing {@value #AUDIO_DSR_ES202050} media + * type defined by RFC 4060. + */ + public static final String AUDIO_DSR_ES202050 = + "audio/dsr-es202050"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_DSR_ES202050} media + * type defined by RFC 4060. + */ + public static final MediaType AUDIO_DSR_ES202050_TYPE = + new MediaType("audio", "dsr-es202050"); + + /** + * A {@code String} constant representing {@value #AUDIO_DSR_ES202211} media + * type defined by RFC 4060. + */ + public static final String AUDIO_DSR_ES202211 = + "audio/dsr-es202211"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_DSR_ES202211} media + * type defined by RFC 4060. + */ + public static final MediaType AUDIO_DSR_ES202211_TYPE = + new MediaType("audio", "dsr-es202211"); + + /** + * A {@code String} constant representing {@value #AUDIO_DSR_ES202212} media + * type defined by RFC 4060. + */ + public static final String AUDIO_DSR_ES202212 = + "audio/dsr-es202212"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_DSR_ES202212} media + * type defined by RFC 4060. + */ + public static final MediaType AUDIO_DSR_ES202212_TYPE = + new MediaType("audio", "dsr-es202212"); + + /** + * A {@code String} constant representing {@value #AUDIO_DV} media + * type defined by RFC 6469. + */ + public static final String AUDIO_DV = + "audio/DV"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_DV} media + * type defined by RFC 6469. + */ + public static final MediaType AUDIO_DV_TYPE = + new MediaType("audio", "DV"); + + /** + * A {@code String} constant representing {@value #AUDIO_DVI4} media + * type defined by RFC 4856. + */ + public static final String AUDIO_DVI4 = + "audio/DVI4"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_DVI4} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_DVI4_TYPE = + new MediaType("audio", "DVI4"); + + /** + * A {@code String} constant representing {@value #AUDIO_EAC3} media + * type defined by RFC 4598. + */ + public static final String AUDIO_EAC3 = + "audio/eac3"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_EAC3} media + * type defined by RFC 4598. + */ + public static final MediaType AUDIO_EAC3_TYPE = + new MediaType("audio", "eac3"); + + /** + * A {@code String} constant representing {@value #AUDIO_ENCAPRTP} media + * type defined by RFC 6849. + */ + public static final String AUDIO_ENCAPRTP = + "audio/encaprtp"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_ENCAPRTP} media + * type defined by RFC 6849. + */ + public static final MediaType AUDIO_ENCAPRTP_TYPE = + new MediaType("audio", "encaprtp"); + + /** + * A {@code String} constant representing {@value #AUDIO_EVRC} media + * type defined by RFC 4788. + */ + public static final String AUDIO_EVRC = + "audio/EVRC"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_EVRC} media + * type defined by RFC 4788. + */ + public static final MediaType AUDIO_EVRC_TYPE = + new MediaType("audio", "EVRC"); + + /** + * A {@code String} constant representing {@value #AUDIO_EVRC_QCP} media + * type defined by RFC 3625. + */ + public static final String AUDIO_EVRC_QCP = + "audio/EVRC-QCP"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_EVRC_QCP} media + * type defined by RFC 3625. + */ + public static final MediaType AUDIO_EVRC_QCP_TYPE = + new MediaType("audio", "EVRC-QCP"); + + /** + * A {@code String} constant representing {@value #AUDIO_EVRC0} media + * type defined by RFC 4788. + */ + public static final String AUDIO_EVRC0 = + "audio/EVRC0"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_EVRC0} media + * type defined by RFC 4788. + */ + public static final MediaType AUDIO_EVRC0_TYPE = + new MediaType("audio", "EVRC0"); + + /** + * A {@code String} constant representing {@value #AUDIO_EVRC1} media + * type defined by RFC 4788. + */ + public static final String AUDIO_EVRC1 = + "audio/EVRC1"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_EVRC1} media + * type defined by RFC 4788. + */ + public static final MediaType AUDIO_EVRC1_TYPE = + new MediaType("audio", "EVRC1"); + + /** + * A {@code String} constant representing {@value #AUDIO_EVRCB} media + * type defined by RFC 5188. + */ + public static final String AUDIO_EVRCB = + "audio/EVRCB"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_EVRCB} media + * type defined by RFC 5188. + */ + public static final MediaType AUDIO_EVRCB_TYPE = + new MediaType("audio", "EVRCB"); + + /** + * A {@code String} constant representing {@value #AUDIO_EVRCB0} media + * type defined by RFC 5188. + */ + public static final String AUDIO_EVRCB0 = + "audio/EVRCB0"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_EVRCB0} media + * type defined by RFC 5188. + */ + public static final MediaType AUDIO_EVRCB0_TYPE = + new MediaType("audio", "EVRCB0"); + + /** + * A {@code String} constant representing {@value #AUDIO_EVRCB1} media + * type defined by RFC 4788. + */ + public static final String AUDIO_EVRCB1 = + "audio/EVRCB1"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_EVRCB1} media + * type defined by RFC 4788. + */ + public static final MediaType AUDIO_EVRCB1_TYPE = + new MediaType("audio", "EVRCB1"); + + /** + * A {@code String} constant representing {@value #AUDIO_EVRCNW} media + * type defined by RFC 6884. + */ + public static final String AUDIO_EVRCNW = + "audio/EVRCNW"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_EVRCNW} media + * type defined by RFC 6884. + */ + public static final MediaType AUDIO_EVRCNW_TYPE = + new MediaType("audio", "EVRCNW"); + + /** + * A {@code String} constant representing {@value #AUDIO_EVRCNW0} media + * type defined by RFC 6884. + */ + public static final String AUDIO_EVRCNW0 = + "audio/EVRCNW0"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_EVRCNW0} media + * type defined by RFC 6884. + */ + public static final MediaType AUDIO_EVRCNW0_TYPE = + new MediaType("audio", "EVRCNW0"); + + /** + * A {@code String} constant representing {@value #AUDIO_EVRCNW1} media + * type defined by RFC 6884. + */ + public static final String AUDIO_EVRCNW1 = + "audio/EVRCNW1"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_EVRCNW1} media + * type defined by RFC 6884. + */ + public static final MediaType AUDIO_EVRCNW1_TYPE = + new MediaType("audio", "EVRCNW1"); + + /** + * A {@code String} constant representing {@value #AUDIO_EVRCWB} media + * type defined by RFC 5188. + */ + public static final String AUDIO_EVRCWB = + "audio/EVRCWB"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_EVRCWB} media + * type defined by RFC 5188. + */ + public static final MediaType AUDIO_EVRCWB_TYPE = + new MediaType("audio", "EVRCWB"); + + /** + * A {@code String} constant representing {@value #AUDIO_EVRCWB0} media + * type defined by RFC 5188. + */ + public static final String AUDIO_EVRCWB0 = + "audio/EVRCWB0"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_EVRCWB0} media + * type defined by RFC 5188. + */ + public static final MediaType AUDIO_EVRCWB0_TYPE = + new MediaType("audio", "EVRCWB0"); + + /** + * A {@code String} constant representing {@value #AUDIO_EVRCWB1} media + * type defined by RFC 5188. + */ + public static final String AUDIO_EVRCWB1 = + "audio/EVRCWB1"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_EVRCWB1} media + * type defined by RFC 5188. + */ + public static final MediaType AUDIO_EVRCWB1_TYPE = + new MediaType("audio", "EVRCWB1"); + + /** + * A {@code String} constant representing {@value #AUDIO_EXAMPLE} media + * type defined by RFC 4735. + */ + public static final String AUDIO_EXAMPLE = + "audio/example"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_EXAMPLE} media + * type defined by RFC 4735. + */ + public static final MediaType AUDIO_EXAMPLE_TYPE = + new MediaType("audio", "example"); + + /** + * A {@code String} constant representing {@value #AUDIO_FLAC} media + * type defined by RFC 9639. + */ + public static final String AUDIO_FLAC = + "audio/flac"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_FLAC} media + * type defined by RFC 9639. + */ + public static final MediaType AUDIO_FLAC_TYPE = + new MediaType("audio", "flac"); + + /** + * A {@code String} constant representing {@value #AUDIO_FLEXFEC} media + * type defined by RFC 8627. + */ + public static final String AUDIO_FLEXFEC = + "audio/flexfec"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_FLEXFEC} media + * type defined by RFC 8627. + */ + public static final MediaType AUDIO_FLEXFEC_TYPE = + new MediaType("audio", "flexfec"); + + /** + * A {@code String} constant representing {@value #AUDIO_FWDRED} media + * type defined by RFC 6354. + */ + public static final String AUDIO_FWDRED = + "audio/fwdred"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_FWDRED} media + * type defined by RFC 6354. + */ + public static final MediaType AUDIO_FWDRED_TYPE = + new MediaType("audio", "fwdred"); + + /** + * A {@code String} constant representing {@value #AUDIO_G711_0} media + * type defined by RFC 7655. + */ + public static final String AUDIO_G711_0 = + "audio/G711-0"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_G711_0} media + * type defined by RFC 7655. + */ + public static final MediaType AUDIO_G711_0_TYPE = + new MediaType("audio", "G711-0"); + + /** + * A {@code String} constant representing {@value #AUDIO_G719} media + * type defined by RFC 5404, and RFC Errata 3245. + */ + public static final String AUDIO_G719 = + "audio/G719"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_G719} media + * type defined by RFC 5404, and RFC Errata 3245. + */ + public static final MediaType AUDIO_G719_TYPE = + new MediaType("audio", "G719"); + + /** + * A {@code String} constant representing {@value #AUDIO_G7221} media + * type defined by RFC 5577. + */ + public static final String AUDIO_G7221 = + "audio/G7221"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_G7221} media + * type defined by RFC 5577. + */ + public static final MediaType AUDIO_G7221_TYPE = + new MediaType("audio", "G7221"); + + /** + * A {@code String} constant representing {@value #AUDIO_G722} media + * type defined by RFC 4856. + */ + public static final String AUDIO_G722 = + "audio/G722"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_G722} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_G722_TYPE = + new MediaType("audio", "G722"); + + /** + * A {@code String} constant representing {@value #AUDIO_G723} media + * type defined by RFC 4856. + */ + public static final String AUDIO_G723 = + "audio/G723"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_G723} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_G723_TYPE = + new MediaType("audio", "G723"); + + /** + * A {@code String} constant representing {@value #AUDIO_G726_16} media + * type defined by RFC 4856. + */ + public static final String AUDIO_G726_16 = + "audio/G726-16"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_G726_16} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_G726_16_TYPE = + new MediaType("audio", "G726-16"); + + /** + * A {@code String} constant representing {@value #AUDIO_G726_24} media + * type defined by RFC 4856. + */ + public static final String AUDIO_G726_24 = + "audio/G726-24"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_G726_24} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_G726_24_TYPE = + new MediaType("audio", "G726-24"); + + /** + * A {@code String} constant representing {@value #AUDIO_G726_32} media + * type defined by RFC 4856. + */ + public static final String AUDIO_G726_32 = + "audio/G726-32"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_G726_32} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_G726_32_TYPE = + new MediaType("audio", "G726-32"); + + /** + * A {@code String} constant representing {@value #AUDIO_G726_40} media + * type defined by RFC 4856. + */ + public static final String AUDIO_G726_40 = + "audio/G726-40"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_G726_40} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_G726_40_TYPE = + new MediaType("audio", "G726-40"); + + /** + * A {@code String} constant representing {@value #AUDIO_G728} media + * type defined by RFC 4856. + */ + public static final String AUDIO_G728 = + "audio/G728"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_G728} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_G728_TYPE = + new MediaType("audio", "G728"); + + /** + * A {@code String} constant representing {@value #AUDIO_G729} media + * type defined by RFC 4856. + */ + public static final String AUDIO_G729 = + "audio/G729"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_G729} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_G729_TYPE = + new MediaType("audio", "G729"); + + /** + * A {@code String} constant representing {@value #AUDIO_G7291} media + * type defined by RFC 4749, and RFC 5459. + */ + public static final String AUDIO_G7291 = + "audio/G7291"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_G7291} media + * type defined by RFC 4749, and RFC 5459. + */ + public static final MediaType AUDIO_G7291_TYPE = + new MediaType("audio", "G7291"); + + /** + * A {@code String} constant representing {@value #AUDIO_G729D} media + * type defined by RFC 4856. + */ + public static final String AUDIO_G729D = + "audio/G729D"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_G729D} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_G729D_TYPE = + new MediaType("audio", "G729D"); + + /** + * A {@code String} constant representing {@value #AUDIO_G729E} media + * type defined by RFC 4856. + */ + public static final String AUDIO_G729E = + "audio/G729E"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_G729E} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_G729E_TYPE = + new MediaType("audio", "G729E"); + + /** + * A {@code String} constant representing {@value #AUDIO_GSM} media + * type defined by RFC 4856. + */ + public static final String AUDIO_GSM = + "audio/GSM"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_GSM} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_GSM_TYPE = + new MediaType("audio", "GSM"); + + /** + * A {@code String} constant representing {@value #AUDIO_GSM_EFR} media + * type defined by RFC 4856. + */ + public static final String AUDIO_GSM_EFR = + "audio/GSM-EFR"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_GSM_EFR} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_GSM_EFR_TYPE = + new MediaType("audio", "GSM-EFR"); + + /** + * A {@code String} constant representing {@value #AUDIO_GSM_HR_08} media + * type defined by RFC 5993. + */ + public static final String AUDIO_GSM_HR_08 = + "audio/GSM-HR-08"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_GSM_HR_08} media + * type defined by RFC 5993. + */ + public static final MediaType AUDIO_GSM_HR_08_TYPE = + new MediaType("audio", "GSM-HR-08"); + + /** + * A {@code String} constant representing {@value #AUDIO_ILBC} media + * type defined by RFC 3952. + */ + public static final String AUDIO_ILBC = + "audio/iLBC"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_ILBC} media + * type defined by RFC 3952. + */ + public static final MediaType AUDIO_ILBC_TYPE = + new MediaType("audio", "iLBC"); + + /** + * A {@code String} constant representing {@value #AUDIO_IP_MR_V2_5} media + * type defined by RFC 6262. + */ + public static final String AUDIO_IP_MR_V2_5 = + "audio/ip-mr_v2.5"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_IP_MR_V2_5} media + * type defined by RFC 6262. + */ + public static final MediaType AUDIO_IP_MR_V2_5_TYPE = + new MediaType("audio", "ip-mr_v2.5"); + + /** + * A {@code String} constant representing {@value #AUDIO_L8} media + * type defined by RFC 4856. + */ + public static final String AUDIO_L8 = + "audio/L8"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_L8} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_L8_TYPE = + new MediaType("audio", "L8"); + + /** + * A {@code String} constant representing {@value #AUDIO_L16} media + * type defined by RFC 4856. + */ + public static final String AUDIO_L16 = + "audio/L16"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_L16} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_L16_TYPE = + new MediaType("audio", "L16"); + + /** + * A {@code String} constant representing {@value #AUDIO_L20} media + * type defined by RFC 3190. + */ + public static final String AUDIO_L20 = + "audio/L20"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_L20} media + * type defined by RFC 3190. + */ + public static final MediaType AUDIO_L20_TYPE = + new MediaType("audio", "L20"); + + /** + * A {@code String} constant representing {@value #AUDIO_L24} media + * type defined by RFC 3190. + */ + public static final String AUDIO_L24 = + "audio/L24"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_L24} media + * type defined by RFC 3190. + */ + public static final MediaType AUDIO_L24_TYPE = + new MediaType("audio", "L24"); + + /** + * A {@code String} constant representing {@value #AUDIO_LPC} media + * type defined by RFC 4856. + */ + public static final String AUDIO_LPC = + "audio/LPC"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_LPC} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_LPC_TYPE = + new MediaType("audio", "LPC"); + + /** + * A {@code String} constant representing {@value #AUDIO_MATROSKA} media + * type defined by RFC 9559. + */ + public static final String AUDIO_MATROSKA = + "audio/matroska"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_MATROSKA} media + * type defined by RFC 9559. + */ + public static final MediaType AUDIO_MATROSKA_TYPE = + new MediaType("audio", "matroska"); + + /** + * A {@code String} constant representing {@value #AUDIO_MELP} media + * type defined by RFC 8130. + */ + public static final String AUDIO_MELP = + "audio/MELP"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_MELP} media + * type defined by RFC 8130. + */ + public static final MediaType AUDIO_MELP_TYPE = + new MediaType("audio", "MELP"); + + /** + * A {@code String} constant representing {@value #AUDIO_MELP600} media + * type defined by RFC 8130. + */ + public static final String AUDIO_MELP600 = + "audio/MELP600"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_MELP600} media + * type defined by RFC 8130. + */ + public static final MediaType AUDIO_MELP600_TYPE = + new MediaType("audio", "MELP600"); + + /** + * A {@code String} constant representing {@value #AUDIO_MELP1200} media + * type defined by RFC 8130. + */ + public static final String AUDIO_MELP1200 = + "audio/MELP1200"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_MELP1200} media + * type defined by RFC 8130. + */ + public static final MediaType AUDIO_MELP1200_TYPE = + new MediaType("audio", "MELP1200"); + + /** + * A {@code String} constant representing {@value #AUDIO_MELP2400} media + * type defined by RFC 8130. + */ + public static final String AUDIO_MELP2400 = + "audio/MELP2400"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_MELP2400} media + * type defined by RFC 8130. + */ + public static final MediaType AUDIO_MELP2400_TYPE = + new MediaType("audio", "MELP2400"); + + /** + * A {@code String} constant representing {@value #AUDIO_MOBILE_XMF} media + * type defined by RFC 4723. + */ + public static final String AUDIO_MOBILE_XMF = + "audio/mobile-xmf"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_MOBILE_XMF} media + * type defined by RFC 4723. + */ + public static final MediaType AUDIO_MOBILE_XMF_TYPE = + new MediaType("audio", "mobile-xmf"); + + /** + * A {@code String} constant representing {@value #AUDIO_MPA} media + * type defined by RFC 3555. + */ + public static final String AUDIO_MPA = + "audio/MPA"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_MPA} media + * type defined by RFC 3555. + */ + public static final MediaType AUDIO_MPA_TYPE = + new MediaType("audio", "MPA"); + + /** + * A {@code String} constant representing {@value #AUDIO_MP4} media + * type defined by RFC 4337, and RFC 6381. + */ + public static final String AUDIO_MP4 = + "audio/mp4"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_MP4} media + * type defined by RFC 4337, and RFC 6381. + */ + public static final MediaType AUDIO_MP4_TYPE = + new MediaType("audio", "mp4"); + + /** + * A {@code String} constant representing {@value #AUDIO_MP4A_LATM} media + * type defined by RFC 6416. + */ + public static final String AUDIO_MP4A_LATM = + "audio/MP4A-LATM"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_MP4A_LATM} media + * type defined by RFC 6416. + */ + public static final MediaType AUDIO_MP4A_LATM_TYPE = + new MediaType("audio", "MP4A-LATM"); + + /** + * A {@code String} constant representing {@value #AUDIO_MPA_ROBUST} media + * type defined by RFC 5219. + */ + public static final String AUDIO_MPA_ROBUST = + "audio/mpa-robust"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_MPA_ROBUST} media + * type defined by RFC 5219. + */ + public static final MediaType AUDIO_MPA_ROBUST_TYPE = + new MediaType("audio", "mpa-robust"); + + /** + * A {@code String} constant representing {@value #AUDIO_MPEG} media + * type defined by RFC 3003. + */ + public static final String AUDIO_MPEG = + "audio/mpeg"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_MPEG} media + * type defined by RFC 3003. + */ + public static final MediaType AUDIO_MPEG_TYPE = + new MediaType("audio", "mpeg"); + + /** + * A {@code String} constant representing {@value #AUDIO_MPEG4_GENERIC} media + * type defined by RFC 3640, and RFC 5691, and RFC 6295. + */ + public static final String AUDIO_MPEG4_GENERIC = + "audio/mpeg4-generic"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_MPEG4_GENERIC} media + * type defined by RFC 3640, and RFC 5691, and RFC 6295. + */ + public static final MediaType AUDIO_MPEG4_GENERIC_TYPE = + new MediaType("audio", "mpeg4-generic"); + + /** + * A {@code String} constant representing {@value #AUDIO_OGG} media + * type defined by RFC 5334, and RFC 7845. + */ + public static final String AUDIO_OGG = + "audio/ogg"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_OGG} media + * type defined by RFC 5334, and RFC 7845. + */ + public static final MediaType AUDIO_OGG_TYPE = + new MediaType("audio", "ogg"); + + /** + * A {@code String} constant representing {@value #AUDIO_OPUS} media + * type defined by RFC 7587. + */ + public static final String AUDIO_OPUS = + "audio/opus"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_OPUS} media + * type defined by RFC 7587. + */ + public static final MediaType AUDIO_OPUS_TYPE = + new MediaType("audio", "opus"); + + /** + * A {@code String} constant representing {@value #AUDIO_PARITYFEC} media + * type defined by RFC 3009. + */ + public static final String AUDIO_PARITYFEC = + "audio/parityfec"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_PARITYFEC} media + * type defined by RFC 3009. + */ + public static final MediaType AUDIO_PARITYFEC_TYPE = + new MediaType("audio", "parityfec"); + + /** + * A {@code String} constant representing {@value #AUDIO_PCMA} media + * type defined by RFC 4856. + */ + public static final String AUDIO_PCMA = + "audio/PCMA"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_PCMA} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_PCMA_TYPE = + new MediaType("audio", "PCMA"); + + /** + * A {@code String} constant representing {@value #AUDIO_PCMA_WB} media + * type defined by RFC 5391. + */ + public static final String AUDIO_PCMA_WB = + "audio/PCMA-WB"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_PCMA_WB} media + * type defined by RFC 5391. + */ + public static final MediaType AUDIO_PCMA_WB_TYPE = + new MediaType("audio", "PCMA-WB"); + + /** + * A {@code String} constant representing {@value #AUDIO_PCMU} media + * type defined by RFC 4856. + */ + public static final String AUDIO_PCMU = + "audio/PCMU"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_PCMU} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_PCMU_TYPE = + new MediaType("audio", "PCMU"); + + /** + * A {@code String} constant representing {@value #AUDIO_PCMU_WB} media + * type defined by RFC 5391. + */ + public static final String AUDIO_PCMU_WB = + "audio/PCMU-WB"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_PCMU_WB} media + * type defined by RFC 5391. + */ + public static final MediaType AUDIO_PCMU_WB_TYPE = + new MediaType("audio", "PCMU-WB"); + + /** + * A {@code String} constant representing {@value #AUDIO_QCELP} media + * type defined by RFC 3555, and RFC 3625. + */ + public static final String AUDIO_QCELP = + "audio/QCELP"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_QCELP} media + * type defined by RFC 3555, and RFC 3625. + */ + public static final MediaType AUDIO_QCELP_TYPE = + new MediaType("audio", "QCELP"); + + /** + * A {@code String} constant representing {@value #AUDIO_RAPTORFEC} media + * type defined by RFC 6682. + */ + public static final String AUDIO_RAPTORFEC = + "audio/raptorfec"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_RAPTORFEC} media + * type defined by RFC 6682. + */ + public static final MediaType AUDIO_RAPTORFEC_TYPE = + new MediaType("audio", "raptorfec"); + + /** + * A {@code String} constant representing {@value #AUDIO_RED} media + * type defined by RFC 3555. + */ + public static final String AUDIO_RED = + "audio/RED"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_RED} media + * type defined by RFC 3555. + */ + public static final MediaType AUDIO_RED_TYPE = + new MediaType("audio", "RED"); + + /** + * A {@code String} constant representing {@value #AUDIO_RTPLOOPBACK} media + * type defined by RFC 6849. + */ + public static final String AUDIO_RTPLOOPBACK = + "audio/rtploopback"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_RTPLOOPBACK} media + * type defined by RFC 6849. + */ + public static final MediaType AUDIO_RTPLOOPBACK_TYPE = + new MediaType("audio", "rtploopback"); + + /** + * A {@code String} constant representing {@value #AUDIO_RTP_MIDI} media + * type defined by RFC 6295. + */ + public static final String AUDIO_RTP_MIDI = + "audio/rtp-midi"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_RTP_MIDI} media + * type defined by RFC 6295. + */ + public static final MediaType AUDIO_RTP_MIDI_TYPE = + new MediaType("audio", "rtp-midi"); + + /** + * A {@code String} constant representing {@value #AUDIO_RTX} media + * type defined by RFC 4588. + */ + public static final String AUDIO_RTX = + "audio/rtx"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_RTX} media + * type defined by RFC 4588. + */ + public static final MediaType AUDIO_RTX_TYPE = + new MediaType("audio", "rtx"); + + /** + * A {@code String} constant representing {@value #AUDIO_SCIP} media + * type defined by RFC 9607. + */ + public static final String AUDIO_SCIP = + "audio/scip"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_SCIP} media + * type defined by RFC 9607. + */ + public static final MediaType AUDIO_SCIP_TYPE = + new MediaType("audio", "scip"); + + /** + * A {@code String} constant representing {@value #AUDIO_SMV} media + * type defined by RFC 3558. + */ + public static final String AUDIO_SMV = + "audio/SMV"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_SMV} media + * type defined by RFC 3558. + */ + public static final MediaType AUDIO_SMV_TYPE = + new MediaType("audio", "SMV"); + + /** + * A {@code String} constant representing {@value #AUDIO_SMV0} media + * type defined by RFC 3558. + */ + public static final String AUDIO_SMV0 = + "audio/SMV0"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_SMV0} media + * type defined by RFC 3558. + */ + public static final MediaType AUDIO_SMV0_TYPE = + new MediaType("audio", "SMV0"); + + /** + * A {@code String} constant representing {@value #AUDIO_SMV_QCP} media + * type defined by RFC 3625. + */ + public static final String AUDIO_SMV_QCP = + "audio/SMV-QCP"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_SMV_QCP} media + * type defined by RFC 3625. + */ + public static final MediaType AUDIO_SMV_QCP_TYPE = + new MediaType("audio", "SMV-QCP"); + + /** + * A {@code String} constant representing {@value #AUDIO_SPEEX} media + * type defined by RFC 5574. + */ + public static final String AUDIO_SPEEX = + "audio/speex"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_SPEEX} media + * type defined by RFC 5574. + */ + public static final MediaType AUDIO_SPEEX_TYPE = + new MediaType("audio", "speex"); + + /** + * A {@code String} constant representing {@value #AUDIO_T140C} media + * type defined by RFC 4351. + */ + public static final String AUDIO_T140C = + "audio/t140c"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_T140C} media + * type defined by RFC 4351. + */ + public static final MediaType AUDIO_T140C_TYPE = + new MediaType("audio", "t140c"); + + /** + * A {@code String} constant representing {@value #AUDIO_T38} media + * type defined by RFC 4612. + */ + public static final String AUDIO_T38 = + "audio/t38"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_T38} media + * type defined by RFC 4612. + */ + public static final MediaType AUDIO_T38_TYPE = + new MediaType("audio", "t38"); + + /** + * A {@code String} constant representing {@value #AUDIO_TELEPHONE_EVENT} media + * type defined by RFC 4733. + */ + public static final String AUDIO_TELEPHONE_EVENT = + "audio/telephone-event"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_TELEPHONE_EVENT} media + * type defined by RFC 4733. + */ + public static final MediaType AUDIO_TELEPHONE_EVENT_TYPE = + new MediaType("audio", "telephone-event"); + + /** + * A {@code String} constant representing {@value #AUDIO_TONE} media + * type defined by RFC 4733. + */ + public static final String AUDIO_TONE = + "audio/tone"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_TONE} media + * type defined by RFC 4733. + */ + public static final MediaType AUDIO_TONE_TYPE = + new MediaType("audio", "tone"); + + /** + * A {@code String} constant representing {@value #AUDIO_TSVCIS} media + * type defined by RFC 8817. + */ + public static final String AUDIO_TSVCIS = + "audio/TSVCIS"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_TSVCIS} media + * type defined by RFC 8817. + */ + public static final MediaType AUDIO_TSVCIS_TYPE = + new MediaType("audio", "TSVCIS"); + + /** + * A {@code String} constant representing {@value #AUDIO_UEMCLIP} media + * type defined by RFC 5686. + */ + public static final String AUDIO_UEMCLIP = + "audio/UEMCLIP"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_UEMCLIP} media + * type defined by RFC 5686. + */ + public static final MediaType AUDIO_UEMCLIP_TYPE = + new MediaType("audio", "UEMCLIP"); + + /** + * A {@code String} constant representing {@value #AUDIO_ULPFEC} media + * type defined by RFC 5109. + */ + public static final String AUDIO_ULPFEC = + "audio/ulpfec"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_ULPFEC} media + * type defined by RFC 5109. + */ + public static final MediaType AUDIO_ULPFEC_TYPE = + new MediaType("audio", "ulpfec"); + + /** + * A {@code String} constant representing {@value #AUDIO_VDVI} media + * type defined by RFC 4856. + */ + public static final String AUDIO_VDVI = + "audio/VDVI"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_VDVI} media + * type defined by RFC 4856. + */ + public static final MediaType AUDIO_VDVI_TYPE = + new MediaType("audio", "VDVI"); + + /** + * A {@code String} constant representing {@value #AUDIO_VMR_WB} media + * type defined by RFC 4348, and RFC 4424. + */ + public static final String AUDIO_VMR_WB = + "audio/VMR-WB"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_VMR_WB} media + * type defined by RFC 4348, and RFC 4424. + */ + public static final MediaType AUDIO_VMR_WB_TYPE = + new MediaType("audio", "VMR-WB"); + + /** + * A {@code String} constant representing {@value #AUDIO_VND_QCELP} media + * type defined by RFC 3625. + */ + public static final String AUDIO_VND_QCELP = + "audio/vnd.qcelp"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_VND_QCELP} media + * type defined by RFC 3625. + */ + public static final MediaType AUDIO_VND_QCELP_TYPE = + new MediaType("audio", "vnd.qcelp"); + + /** + * A {@code String} constant representing {@value #AUDIO_VORBIS} media + * type defined by RFC 5215. + */ + public static final String AUDIO_VORBIS = + "audio/vorbis"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_VORBIS} media + * type defined by RFC 5215. + */ + public static final MediaType AUDIO_VORBIS_TYPE = + new MediaType("audio", "vorbis"); + + /** + * A {@code String} constant representing {@value #AUDIO_VORBIS_CONFIG} media + * type defined by RFC 5215. + */ + public static final String AUDIO_VORBIS_CONFIG = + "audio/vorbis-config"; + + /** + * A {@link MediaType} constant representing {@value #AUDIO_VORBIS_CONFIG} media + * type defined by RFC 5215. + */ + public static final MediaType AUDIO_VORBIS_CONFIG_TYPE = + new MediaType("audio", "vorbis-config"); + } + + /** + * Font type media subtypes. + */ + public static class Font { + /** + * A {@code String} constant representing {@value #FONT_COLLECTION} media + * type defined by RFC 8081. + */ + public static final String FONT_COLLECTION = + "font/collection"; + + /** + * A {@link MediaType} constant representing {@value #FONT_COLLECTION} media + * type defined by RFC 8081. + */ + public static final MediaType FONT_COLLECTION_TYPE = + new MediaType("font", "collection"); + + /** + * A {@code String} constant representing {@value #FONT_OTF} media + * type defined by RFC 8081. + */ + public static final String FONT_OTF = + "font/otf"; + + /** + * A {@link MediaType} constant representing {@value #FONT_OTF} media + * type defined by RFC 8081. + */ + public static final MediaType FONT_OTF_TYPE = + new MediaType("font", "otf"); + + /** + * A {@code String} constant representing {@value #FONT_SFNT} media + * type defined by RFC 8081. + */ + public static final String FONT_SFNT = + "font/sfnt"; + + /** + * A {@link MediaType} constant representing {@value #FONT_SFNT} media + * type defined by RFC 8081. + */ + public static final MediaType FONT_SFNT_TYPE = + new MediaType("font", "sfnt"); + + /** + * A {@code String} constant representing {@value #FONT_TTF} media + * type defined by RFC 8081. + */ + public static final String FONT_TTF = + "font/ttf"; + + /** + * A {@link MediaType} constant representing {@value #FONT_TTF} media + * type defined by RFC 8081. + */ + public static final MediaType FONT_TTF_TYPE = + new MediaType("font", "ttf"); + + /** + * A {@code String} constant representing {@value #FONT_WOFF} media + * type defined by RFC 8081. + */ + public static final String FONT_WOFF = + "font/woff"; + + /** + * A {@link MediaType} constant representing {@value #FONT_WOFF} media + * type defined by RFC 8081. + */ + public static final MediaType FONT_WOFF_TYPE = + new MediaType("font", "woff"); + + /** + * A {@code String} constant representing {@value #FONT_WOFF2} media + * type defined by RFC 8081. + */ + public static final String FONT_WOFF2 = + "font/woff2"; + + /** + * A {@link MediaType} constant representing {@value #FONT_WOFF2} media + * type defined by RFC 8081. + */ + public static final MediaType FONT_WOFF2_TYPE = + new MediaType("font", "woff2"); + } + + /** + * Haptics type media subtypes. + */ + public static class Haptics { + /** + * A {@code String} constant representing {@value #HAPTICS_IVS} media + * type defined by RFC 9695. + */ + public static final String HAPTICS_IVS = + "haptics/ivs"; + + /** + * A {@link MediaType} constant representing {@value #HAPTICS_IVS} media + * type defined by RFC 9695. + */ + public static final MediaType HAPTICS_IVS_TYPE = + new MediaType("haptics", "ivs"); + + /** + * A {@code String} constant representing {@value #HAPTICS_HJIF} media + * type defined by RFC 9695. + */ + public static final String HAPTICS_HJIF = + "haptics/hjif"; + + /** + * A {@link MediaType} constant representing {@value #HAPTICS_HJIF} media + * type defined by RFC 9695. + */ + public static final MediaType HAPTICS_HJIF_TYPE = + new MediaType("haptics", "hjif"); + + /** + * A {@code String} constant representing {@value #HAPTICS_HMPG} media + * type defined by RFC 9695. + */ + public static final String HAPTICS_HMPG = + "haptics/hmpg"; + + /** + * A {@link MediaType} constant representing {@value #HAPTICS_HMPG} media + * type defined by RFC 9695. + */ + public static final MediaType HAPTICS_HMPG_TYPE = + new MediaType("haptics", "hmpg"); + } + + /** + * Image type media subtypes. + */ + public static class Image { + /** + * A {@code String} constant representing {@value #IMAGE_BMP} media + * type defined by RFC 7903. + */ + public static final String IMAGE_BMP = + "image/bmp"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_BMP} media + * type defined by RFC 7903. + */ + public static final MediaType IMAGE_BMP_TYPE = + new MediaType("image", "bmp"); + + /** + * A {@code String} constant representing {@value #IMAGE_EMF} media + * type defined by RFC 7903. + */ + public static final String IMAGE_EMF = + "image/emf"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_EMF} media + * type defined by RFC 7903. + */ + public static final MediaType IMAGE_EMF_TYPE = + new MediaType("image", "emf"); + + /** + * A {@code String} constant representing {@value #IMAGE_EXAMPLE} media + * type defined by RFC 4735. + */ + public static final String IMAGE_EXAMPLE = + "image/example"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_EXAMPLE} media + * type defined by RFC 4735. + */ + public static final MediaType IMAGE_EXAMPLE_TYPE = + new MediaType("image", "example"); + + /** + * A {@code String} constant representing {@value #IMAGE_FITS} media + * type defined by RFC 4047. + */ + public static final String IMAGE_FITS = + "image/fits"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_FITS} media + * type defined by RFC 4047. + */ + public static final MediaType IMAGE_FITS_TYPE = + new MediaType("image", "fits"); + + /** + * A {@code String} constant representing {@value #IMAGE_G3FAX} media + * type defined by RFC 1494. + */ + public static final String IMAGE_G3FAX = + "image/g3fax"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_G3FAX} media + * type defined by RFC 1494. + */ + public static final MediaType IMAGE_G3FAX_TYPE = + new MediaType("image", "g3fax"); + + /** + * A {@code String} constant representing {@value #IMAGE_GIF} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final String IMAGE_GIF = + "image/gif"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_GIF} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final MediaType IMAGE_GIF_TYPE = + new MediaType("image", "gif"); + + /** + * A {@code String} constant representing {@value #IMAGE_IEF} media + * type defined by RFC 1314. + */ + public static final String IMAGE_IEF = + "image/ief"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_IEF} media + * type defined by RFC 1314. + */ + public static final MediaType IMAGE_IEF_TYPE = + new MediaType("image", "ief"); + + /** + * A {@code String} constant representing {@value #IMAGE_JP2} media + * type defined by RFC 3745. + */ + public static final String IMAGE_JP2 = + "image/jp2"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_JP2} media + * type defined by RFC 3745. + */ + public static final MediaType IMAGE_JP2_TYPE = + new MediaType("image", "jp2"); + + /** + * A {@code String} constant representing {@value #IMAGE_JPEG} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final String IMAGE_JPEG = + "image/jpeg"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_JPEG} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final MediaType IMAGE_JPEG_TYPE = + new MediaType("image", "jpeg"); + + /** + * A {@code String} constant representing {@value #IMAGE_JPM} media + * type defined by RFC 3745. + */ + public static final String IMAGE_JPM = + "image/jpm"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_JPM} media + * type defined by RFC 3745. + */ + public static final MediaType IMAGE_JPM_TYPE = + new MediaType("image", "jpm"); + + /** + * A {@code String} constant representing {@value #IMAGE_JPX} media + * type defined by RFC 3745. + */ + public static final String IMAGE_JPX = + "image/jpx"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_JPX} media + * type defined by RFC 3745. + */ + public static final MediaType IMAGE_JPX_TYPE = + new MediaType("image", "jpx"); + + /** + * A {@code String} constant representing {@value #IMAGE_SVG_XML} media + * type defined by {@code http://www.w3.org/TR/SVG/mimereg.html}. + */ + public static final String IMAGE_SVG_XML = + "image/svg+xml"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_SVG_XML} media + * type defined by {@code http://www.w3.org/TR/SVG/mimereg.html}. + */ + public static final MediaType IMAGE_SVG_XML_TYPE = + new MediaType("image", "svg+xml"); + + /** + * A {@code String} constant representing {@value #IMAGE_T38} media + * type defined by RFC 3362. + */ + public static final String IMAGE_T38 = + "image/t38"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_T38} media + * type defined by RFC 3362. + */ + public static final MediaType IMAGE_T38_TYPE = + new MediaType("image", "t38"); + + /** + * A {@code String} constant representing {@value #IMAGE_TIFF} media + * type defined by RFC 3302. + */ + public static final String IMAGE_TIFF = + "image/tiff"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_TIFF} media + * type defined by RFC 3302. + */ + public static final MediaType IMAGE_TIFF_TYPE = + new MediaType("image", "tiff"); + + /** + * A {@code String} constant representing {@value #IMAGE_TIFF_FX} media + * type defined by RFC 3950. + */ + public static final String IMAGE_TIFF_FX = + "image/tiff-fx"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_TIFF_FX} media + * type defined by RFC 3950. + */ + public static final MediaType IMAGE_TIFF_FX_TYPE = + new MediaType("image", "tiff-fx"); + + /** + * A {@code String} constant representing {@value #IMAGE_WEBP} media + * type defined by RFC 9649. + */ + public static final String IMAGE_WEBP = + "image/webp"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_WEBP} media + * type defined by RFC 9649. + */ + public static final MediaType IMAGE_WEBP_TYPE = + new MediaType("image", "webp"); + + /** + * A {@code String} constant representing {@value #IMAGE_WMF} media + * type defined by RFC 7903. + */ + public static final String IMAGE_WMF = + "image/wmf"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_WMF} media + * type defined by RFC 7903. + */ + public static final MediaType IMAGE_WMF_TYPE = + new MediaType("image", "wmf"); + + /** + * A {@code String} constant representing {@value #IMAGE_X_EMF} media + * type defined by RFC 7903. + */ + public static final String IMAGE_X_EMF = + "image/x-emf"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_X_EMF} media + * type defined by RFC 7903. + */ + public static final MediaType IMAGE_X_EMF_TYPE = + new MediaType("image", "x-emf"); + + /** + * A {@code String} constant representing {@value #IMAGE_X_WMF} media + * type defined by RFC 7903. + */ + public static final String IMAGE_X_WMF = + "image/x-wmf"; + + /** + * A {@link MediaType} constant representing {@value #IMAGE_X_WMF} media + * type defined by RFC 7903. + */ + public static final MediaType IMAGE_X_WMF_TYPE = + new MediaType("image", "x-wmf"); + } + + /** + * Message type media subtypes. + */ + public static class Message { + /** + * A {@code String} constant representing {@value #MESSAGE_BHTTP} media + * type defined by RFC 9292. + */ + public static final String MESSAGE_BHTTP = + "message/bhttp"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_BHTTP} media + * type defined by RFC 9292. + */ + public static final MediaType MESSAGE_BHTTP_TYPE = + new MediaType("message", "bhttp"); + + /** + * A {@code String} constant representing {@value #MESSAGE_CPIM} media + * type defined by RFC 3862. + */ + public static final String MESSAGE_CPIM = + "message/CPIM"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_CPIM} media + * type defined by RFC 3862. + */ + public static final MediaType MESSAGE_CPIM_TYPE = + new MediaType("message", "CPIM"); + + /** + * A {@code String} constant representing {@value #MESSAGE_DELIVERY_STATUS} media + * type defined by RFC 1894. + */ + public static final String MESSAGE_DELIVERY_STATUS = + "message/delivery-status"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_DELIVERY_STATUS} media + * type defined by RFC 1894. + */ + public static final MediaType MESSAGE_DELIVERY_STATUS_TYPE = + new MediaType("message", "delivery-status"); + + /** + * A {@code String} constant representing {@value #MESSAGE_DISPOSITION_NOTIFICATION} media + * type defined by RFC 8098. + */ + public static final String MESSAGE_DISPOSITION_NOTIFICATION = + "message/disposition-notification"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_DISPOSITION_NOTIFICATION} media + * type defined by RFC 8098. + */ + public static final MediaType MESSAGE_DISPOSITION_NOTIFICATION_TYPE = + new MediaType("message", "disposition-notification"); + + /** + * A {@code String} constant representing {@value #MESSAGE_EXAMPLE} media + * type defined by RFC 4735. + */ + public static final String MESSAGE_EXAMPLE = + "message/example"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_EXAMPLE} media + * type defined by RFC 4735. + */ + public static final MediaType MESSAGE_EXAMPLE_TYPE = + new MediaType("message", "example"); + + /** + * A {@code String} constant representing {@value #MESSAGE_EXTERNAL_BODY} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final String MESSAGE_EXTERNAL_BODY = + "message/external-body"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_EXTERNAL_BODY} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final MediaType MESSAGE_EXTERNAL_BODY_TYPE = + new MediaType("message", "external-body"); + + /** + * A {@code String} constant representing {@value #MESSAGE_FEEDBACK_REPORT} media + * type defined by RFC 5965. + */ + public static final String MESSAGE_FEEDBACK_REPORT = + "message/feedback-report"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_FEEDBACK_REPORT} media + * type defined by RFC 5965. + */ + public static final MediaType MESSAGE_FEEDBACK_REPORT_TYPE = + new MediaType("message", "feedback-report"); + + /** + * A {@code String} constant representing {@value #MESSAGE_GLOBAL} media + * type defined by RFC 6532. + */ + public static final String MESSAGE_GLOBAL = + "message/global"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_GLOBAL} media + * type defined by RFC 6532. + */ + public static final MediaType MESSAGE_GLOBAL_TYPE = + new MediaType("message", "global"); + + /** + * A {@code String} constant representing {@value #MESSAGE_GLOBAL_DELIVERY_STATUS} media + * type defined by RFC 6533. + */ + public static final String MESSAGE_GLOBAL_DELIVERY_STATUS = + "message/global-delivery-status"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_GLOBAL_DELIVERY_STATUS} media + * type defined by RFC 6533. + */ + public static final MediaType MESSAGE_GLOBAL_DELIVERY_STATUS_TYPE = + new MediaType("message", "global-delivery-status"); + + /** + * A {@code String} constant representing {@value #MESSAGE_GLOBAL_DISPOSITION_NOTIFICATION} media + * type defined by RFC 6533. + */ + public static final String MESSAGE_GLOBAL_DISPOSITION_NOTIFICATION = + "message/global-disposition-notification"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_GLOBAL_DISPOSITION_NOTIFICATION} media + * type defined by RFC 6533. + */ + public static final MediaType MESSAGE_GLOBAL_DISPOSITION_NOTIFICATION_TYPE = + new MediaType("message", "global-disposition-notification"); + + /** + * A {@code String} constant representing {@value #MESSAGE_GLOBAL_HEADERS} media + * type defined by RFC 6533. + */ + public static final String MESSAGE_GLOBAL_HEADERS = + "message/global-headers"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_GLOBAL_HEADERS} media + * type defined by RFC 6533. + */ + public static final MediaType MESSAGE_GLOBAL_HEADERS_TYPE = + new MediaType("message", "global-headers"); + + /** + * A {@code String} constant representing {@value #MESSAGE_HTTP} media + * type defined by RFC 9112. + */ + public static final String MESSAGE_HTTP = + "message/http"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_HTTP} media + * type defined by RFC 9112. + */ + public static final MediaType MESSAGE_HTTP_TYPE = + new MediaType("message", "http"); + + /** + * A {@code String} constant representing {@value #MESSAGE_IMDN_XML} media + * type defined by RFC 5438. + */ + public static final String MESSAGE_IMDN_XML = + "message/imdn+xml"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_IMDN_XML} media + * type defined by RFC 5438. + */ + public static final MediaType MESSAGE_IMDN_XML_TYPE = + new MediaType("message", "imdn+xml"); + + /** + * A {@code String} constant representing {@value #MESSAGE_MLS} media + * type defined by RFC 9420. + */ + public static final String MESSAGE_MLS = + "message/mls"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_MLS} media + * type defined by RFC 9420. + */ + public static final MediaType MESSAGE_MLS_TYPE = + new MediaType("message", "mls"); + + /** + * A {@code String} constant representing {@value #MESSAGE_NEWS} media + * type defined by RFC 5537. + */ + public static final String MESSAGE_NEWS = + "message/news"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_NEWS} media + * type defined by RFC 5537. + */ + public static final MediaType MESSAGE_NEWS_TYPE = + new MediaType("message", "news"); + + /** + * A {@code String} constant representing {@value #MESSAGE_OHTTP_REQ} media + * type defined by RFC 9458. + */ + public static final String MESSAGE_OHTTP_REQ = + "message/ohttp-req"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_OHTTP_REQ} media + * type defined by RFC 9458. + */ + public static final MediaType MESSAGE_OHTTP_REQ_TYPE = + new MediaType("message", "ohttp-req"); + + /** + * A {@code String} constant representing {@value #MESSAGE_OHTTP_RES} media + * type defined by RFC 9458. + */ + public static final String MESSAGE_OHTTP_RES = + "message/ohttp-res"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_OHTTP_RES} media + * type defined by RFC 9458. + */ + public static final MediaType MESSAGE_OHTTP_RES_TYPE = + new MediaType("message", "ohttp-res"); + + /** + * A {@code String} constant representing {@value #MESSAGE_PARTIAL} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final String MESSAGE_PARTIAL = + "message/partial"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_PARTIAL} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final MediaType MESSAGE_PARTIAL_TYPE = + new MediaType("message", "partial"); + + /** + * A {@code String} constant representing {@value #MESSAGE_RFC822} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final String MESSAGE_RFC822 = + "message/rfc822"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_RFC822} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final MediaType MESSAGE_RFC822_TYPE = + new MediaType("message", "rfc822"); + + /** + * A {@code String} constant representing {@value #MESSAGE_S_HTTP} media + * type defined by RFC 2660{@code Status change of HTTP experiments to Historic}. + */ + public static final String MESSAGE_S_HTTP = + "message/s-http"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_S_HTTP} media + * type defined by RFC 2660{@code Status change of HTTP experiments to Historic}. + */ + public static final MediaType MESSAGE_S_HTTP_TYPE = + new MediaType("message", "s-http"); + + /** + * A {@code String} constant representing {@value #MESSAGE_SIP} media + * type defined by RFC 3261. + */ + public static final String MESSAGE_SIP = + "message/sip"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_SIP} media + * type defined by RFC 3261. + */ + public static final MediaType MESSAGE_SIP_TYPE = + new MediaType("message", "sip"); + + /** + * A {@code String} constant representing {@value #MESSAGE_SIPFRAG} media + * type defined by RFC 3420. + */ + public static final String MESSAGE_SIPFRAG = + "message/sipfrag"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_SIPFRAG} media + * type defined by RFC 3420. + */ + public static final MediaType MESSAGE_SIPFRAG_TYPE = + new MediaType("message", "sipfrag"); + + /** + * A {@code String} constant representing {@value #MESSAGE_TRACKING_STATUS} media + * type defined by RFC 3886. + */ + public static final String MESSAGE_TRACKING_STATUS = + "message/tracking-status"; + + /** + * A {@link MediaType} constant representing {@value #MESSAGE_TRACKING_STATUS} media + * type defined by RFC 3886. + */ + public static final MediaType MESSAGE_TRACKING_STATUS_TYPE = + new MediaType("message", "tracking-status"); + } + + /** + * Model type media subtypes. + */ + public static class Model { + /** + * A {@code String} constant representing {@value #MODEL_3MF} media + * type defined by {@code http://www.3mf.io/specification}. + */ + public static final String MODEL_3MF = + "model/3mf"; + + /** + * A {@link MediaType} constant representing {@value #MODEL_3MF} media + * type defined by {@code http://www.3mf.io/specification}. + */ + public static final MediaType MODEL_3MF_TYPE = + new MediaType("model", "3mf"); + + /** + * A {@code String} constant representing {@value #MODEL_EXAMPLE} media + * type defined by RFC 4735. + */ + public static final String MODEL_EXAMPLE = + "model/example"; + + /** + * A {@link MediaType} constant representing {@value #MODEL_EXAMPLE} media + * type defined by RFC 4735. + */ + public static final MediaType MODEL_EXAMPLE_TYPE = + new MediaType("model", "example"); + + /** + * A {@code String} constant representing {@value #MODEL_MESH} media + * type defined by RFC 2077. + */ + public static final String MODEL_MESH = + "model/mesh"; + + /** + * A {@link MediaType} constant representing {@value #MODEL_MESH} media + * type defined by RFC 2077. + */ + public static final MediaType MODEL_MESH_TYPE = + new MediaType("model", "mesh"); + + /** + * A {@code String} constant representing {@value #MODEL_VRML} media + * type defined by RFC 2077. + */ + public static final String MODEL_VRML = + "model/vrml"; + + /** + * A {@link MediaType} constant representing {@value #MODEL_VRML} media + * type defined by RFC 2077. + */ + public static final MediaType MODEL_VRML_TYPE = + new MediaType("model", "vrml"); + } + + /** + * Multipart type media subtypes. + */ + public static class Multipart { + /** + * A {@code String} constant representing {@value #MULTIPART_ALTERNATIVE} media + * type defined by RFC 2046, and RFC 2045. + */ + public static final String MULTIPART_ALTERNATIVE = + "multipart/alternative"; + + /** + * A {@link MediaType} constant representing {@value #MULTIPART_ALTERNATIVE} media + * type defined by RFC 2046, and RFC 2045. + */ + public static final MediaType MULTIPART_ALTERNATIVE_TYPE = + new MediaType("multipart", "alternative"); + + /** + * A {@code String} constant representing {@value #MULTIPART_BYTERANGES} media + * type defined by RFC 9110. + */ + public static final String MULTIPART_BYTERANGES = + "multipart/byteranges"; + + /** + * A {@link MediaType} constant representing {@value #MULTIPART_BYTERANGES} media + * type defined by RFC 9110. + */ + public static final MediaType MULTIPART_BYTERANGES_TYPE = + new MediaType("multipart", "byteranges"); + + /** + * A {@code String} constant representing {@value #MULTIPART_DIGEST} media + * type defined by RFC 2046, and RFC 2045. + */ + public static final String MULTIPART_DIGEST = + "multipart/digest"; + + /** + * A {@link MediaType} constant representing {@value #MULTIPART_DIGEST} media + * type defined by RFC 2046, and RFC 2045. + */ + public static final MediaType MULTIPART_DIGEST_TYPE = + new MediaType("multipart", "digest"); + + /** + * A {@code String} constant representing {@value #MULTIPART_ENCRYPTED} media + * type defined by RFC 1847. + */ + public static final String MULTIPART_ENCRYPTED = + "multipart/encrypted"; + + /** + * A {@link MediaType} constant representing {@value #MULTIPART_ENCRYPTED} media + * type defined by RFC 1847. + */ + public static final MediaType MULTIPART_ENCRYPTED_TYPE = + new MediaType("multipart", "encrypted"); + + /** + * A {@code String} constant representing {@value #MULTIPART_EXAMPLE} media + * type defined by RFC 4735. + */ + public static final String MULTIPART_EXAMPLE = + "multipart/example"; + + /** + * A {@link MediaType} constant representing {@value #MULTIPART_EXAMPLE} media + * type defined by RFC 4735. + */ + public static final MediaType MULTIPART_EXAMPLE_TYPE = + new MediaType("multipart", "example"); + + /** + * A {@code String} constant representing {@value #MULTIPART_FORM_DATA} media + * type defined by RFC 7578. + */ + public static final String MULTIPART_FORM_DATA = + "multipart/form-data"; + + /** + * A {@link MediaType} constant representing {@value #MULTIPART_FORM_DATA} media + * type defined by RFC 7578. + */ + public static final MediaType MULTIPART_FORM_DATA_TYPE = + new MediaType("multipart", "form-data"); + + /** + * A {@code String} constant representing {@value #MULTIPART_MIXED} media + * type defined by RFC 2046, and RFC 2045. + */ + public static final String MULTIPART_MIXED = + "multipart/mixed"; + + /** + * A {@link MediaType} constant representing {@value #MULTIPART_MIXED} media + * type defined by RFC 2046, and RFC 2045. + */ + public static final MediaType MULTIPART_MIXED_TYPE = + new MediaType("multipart", "mixed"); + + /** + * A {@code String} constant representing {@value #MULTIPART_MULTILINGUAL} media + * type defined by RFC 8255. + */ + public static final String MULTIPART_MULTILINGUAL = + "multipart/multilingual"; + + /** + * A {@link MediaType} constant representing {@value #MULTIPART_MULTILINGUAL} media + * type defined by RFC 8255. + */ + public static final MediaType MULTIPART_MULTILINGUAL_TYPE = + new MediaType("multipart", "multilingual"); + + /** + * A {@code String} constant representing {@value #MULTIPART_PARALLEL} media + * type defined by RFC 2046, and RFC 2045. + */ + public static final String MULTIPART_PARALLEL = + "multipart/parallel"; + + /** + * A {@link MediaType} constant representing {@value #MULTIPART_PARALLEL} media + * type defined by RFC 2046, and RFC 2045. + */ + public static final MediaType MULTIPART_PARALLEL_TYPE = + new MediaType("multipart", "parallel"); + + /** + * A {@code String} constant representing {@value #MULTIPART_RELATED} media + * type defined by RFC 2387. + */ + public static final String MULTIPART_RELATED = + "multipart/related"; + + /** + * A {@link MediaType} constant representing {@value #MULTIPART_RELATED} media + * type defined by RFC 2387. + */ + public static final MediaType MULTIPART_RELATED_TYPE = + new MediaType("multipart", "related"); + + /** + * A {@code String} constant representing {@value #MULTIPART_REPORT} media + * type defined by RFC 6522. + */ + public static final String MULTIPART_REPORT = + "multipart/report"; + + /** + * A {@link MediaType} constant representing {@value #MULTIPART_REPORT} media + * type defined by RFC 6522. + */ + public static final MediaType MULTIPART_REPORT_TYPE = + new MediaType("multipart", "report"); + + /** + * A {@code String} constant representing {@value #MULTIPART_SIGNED} media + * type defined by RFC 1847. + */ + public static final String MULTIPART_SIGNED = + "multipart/signed"; + + /** + * A {@link MediaType} constant representing {@value #MULTIPART_SIGNED} media + * type defined by RFC 1847. + */ + public static final MediaType MULTIPART_SIGNED_TYPE = + new MediaType("multipart", "signed"); + + /** + * A {@code String} constant representing {@value #MULTIPART_VOICE_MESSAGE} media + * type defined by RFC 3801. + */ + public static final String MULTIPART_VOICE_MESSAGE = + "multipart/voice-message"; + + /** + * A {@link MediaType} constant representing {@value #MULTIPART_VOICE_MESSAGE} media + * type defined by RFC 3801. + */ + public static final MediaType MULTIPART_VOICE_MESSAGE_TYPE = + new MediaType("multipart", "voice-message"); + } + + /** + * Text type media subtypes. + */ + public static class Text { + /** + * A {@code String} constant representing {@value #TEXT_1D_INTERLEAVED_PARITYFEC} media + * type defined by RFC 6015. + */ + public static final String TEXT_1D_INTERLEAVED_PARITYFEC = + "text/1d-interleaved-parityfec"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_1D_INTERLEAVED_PARITYFEC} media + * type defined by RFC 6015. + */ + public static final MediaType TEXT_1D_INTERLEAVED_PARITYFEC_TYPE = + new MediaType("text", "1d-interleaved-parityfec"); + + /** + * A {@code String} constant representing {@value #TEXT_CALENDAR} media + * type defined by RFC 5545. + */ + public static final String TEXT_CALENDAR = + "text/calendar"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_CALENDAR} media + * type defined by RFC 5545. + */ + public static final MediaType TEXT_CALENDAR_TYPE = + new MediaType("text", "calendar"); + + /** + * A {@code String} constant representing {@value #TEXT_CSS} media + * type defined by RFC 2318. + */ + public static final String TEXT_CSS = + "text/css"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_CSS} media + * type defined by RFC 2318. + */ + public static final MediaType TEXT_CSS_TYPE = + new MediaType("text", "css"); + + /** + * A {@code String} constant representing {@value #TEXT_CSV} media + * type defined by RFC 4180, and RFC 7111. + */ + public static final String TEXT_CSV = + "text/csv"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_CSV} media + * type defined by RFC 4180, and RFC 7111. + */ + public static final MediaType TEXT_CSV_TYPE = + new MediaType("text", "csv"); + + /** + * A {@code String} constant representing {@value #TEXT_DIRECTORY} media + * type defined by RFC 2425, and RFC 6350. + */ + public static final String TEXT_DIRECTORY = + "text/directory"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_DIRECTORY} media + * type defined by RFC 2425, and RFC 6350. + */ + public static final MediaType TEXT_DIRECTORY_TYPE = + new MediaType("text", "directory"); + + /** + * A {@code String} constant representing {@value #TEXT_DNS} media + * type defined by RFC 4027. + */ + public static final String TEXT_DNS = + "text/dns"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_DNS} media + * type defined by RFC 4027. + */ + public static final MediaType TEXT_DNS_TYPE = + new MediaType("text", "dns"); + + /** + * A {@code String} constant representing {@value #TEXT_ECMASCRIPT} media + * type defined by RFC 9239. + */ + public static final String TEXT_ECMASCRIPT = + "text/ecmascript"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_ECMASCRIPT} media + * type defined by RFC 9239. + */ + public static final MediaType TEXT_ECMASCRIPT_TYPE = + new MediaType("text", "ecmascript"); + + /** + * A {@code String} constant representing {@value #TEXT_ENCAPRTP} media + * type defined by RFC 6849. + */ + public static final String TEXT_ENCAPRTP = + "text/encaprtp"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_ENCAPRTP} media + * type defined by RFC 6849. + */ + public static final MediaType TEXT_ENCAPRTP_TYPE = + new MediaType("text", "encaprtp"); + + /** + * A {@code String} constant representing {@value #TEXT_ENRICHED} media + * type defined by RFC 1896. + */ + public static final String TEXT_ENRICHED = + "text/enriched"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_ENRICHED} media + * type defined by RFC 1896. + */ + public static final MediaType TEXT_ENRICHED_TYPE = + new MediaType("text", "enriched"); + + /** + * A {@code String} constant representing {@value #TEXT_EXAMPLE} media + * type defined by RFC 4735. + */ + public static final String TEXT_EXAMPLE = + "text/example"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_EXAMPLE} media + * type defined by RFC 4735. + */ + public static final MediaType TEXT_EXAMPLE_TYPE = + new MediaType("text", "example"); + + /** + * A {@code String} constant representing {@value #TEXT_FLEXFEC} media + * type defined by RFC 8627. + */ + public static final String TEXT_FLEXFEC = + "text/flexfec"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_FLEXFEC} media + * type defined by RFC 8627. + */ + public static final MediaType TEXT_FLEXFEC_TYPE = + new MediaType("text", "flexfec"); + + /** + * A {@code String} constant representing {@value #TEXT_FWDRED} media + * type defined by RFC 6354. + */ + public static final String TEXT_FWDRED = + "text/fwdred"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_FWDRED} media + * type defined by RFC 6354. + */ + public static final MediaType TEXT_FWDRED_TYPE = + new MediaType("text", "fwdred"); + + /** + * A {@code String} constant representing {@value #TEXT_GRAMMAR_REF_LIST} media + * type defined by RFC 6787. + */ + public static final String TEXT_GRAMMAR_REF_LIST = + "text/grammar-ref-list"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_GRAMMAR_REF_LIST} media + * type defined by RFC 6787. + */ + public static final MediaType TEXT_GRAMMAR_REF_LIST_TYPE = + new MediaType("text", "grammar-ref-list"); + + /** + * A {@code String} constant representing {@value #TEXT_JAVASCRIPT} media + * type defined by RFC 9239. + */ + public static final String TEXT_JAVASCRIPT = + "text/javascript"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_JAVASCRIPT} media + * type defined by RFC 9239. + */ + public static final MediaType TEXT_JAVASCRIPT_TYPE = + new MediaType("text", "javascript"); + + /** + * A {@code String} constant representing {@value #TEXT_MARKDOWN} media + * type defined by RFC 7763. + */ + public static final String TEXT_MARKDOWN = + "text/markdown"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_MARKDOWN} media + * type defined by RFC 7763. + */ + public static final MediaType TEXT_MARKDOWN_TYPE = + new MediaType("text", "markdown"); + + /** + * A {@code String} constant representing {@value #TEXT_PARAMETERS} media + * type defined by RFC 7826. + */ + public static final String TEXT_PARAMETERS = + "text/parameters"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_PARAMETERS} media + * type defined by RFC 7826. + */ + public static final MediaType TEXT_PARAMETERS_TYPE = + new MediaType("text", "parameters"); + + /** + * A {@code String} constant representing {@value #TEXT_PARITYFEC} media + * type defined by RFC 3009. + */ + public static final String TEXT_PARITYFEC = + "text/parityfec"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_PARITYFEC} media + * type defined by RFC 3009. + */ + public static final MediaType TEXT_PARITYFEC_TYPE = + new MediaType("text", "parityfec"); + + /** + * A {@code String} constant representing {@value #TEXT_PLAIN} media + * type defined by RFC 2046, and RFC 3676, and RFC 5147. + */ + public static final String TEXT_PLAIN = + "text/plain"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_PLAIN} media + * type defined by RFC 2046, and RFC 3676, and RFC 5147. + */ + public static final MediaType TEXT_PLAIN_TYPE = + new MediaType("text", "plain"); + + /** + * A {@code String} constant representing {@value #TEXT_RAPTORFEC} media + * type defined by RFC 6682. + */ + public static final String TEXT_RAPTORFEC = + "text/raptorfec"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_RAPTORFEC} media + * type defined by RFC 6682. + */ + public static final MediaType TEXT_RAPTORFEC_TYPE = + new MediaType("text", "raptorfec"); + + /** + * A {@code String} constant representing {@value #TEXT_RED} media + * type defined by RFC 4102. + */ + public static final String TEXT_RED = + "text/RED"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_RED} media + * type defined by RFC 4102. + */ + public static final MediaType TEXT_RED_TYPE = + new MediaType("text", "RED"); + + /** + * A {@code String} constant representing {@value #TEXT_RFC822_HEADERS} media + * type defined by RFC 6522. + */ + public static final String TEXT_RFC822_HEADERS = + "text/rfc822-headers"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_RFC822_HEADERS} media + * type defined by RFC 6522. + */ + public static final MediaType TEXT_RFC822_HEADERS_TYPE = + new MediaType("text", "rfc822-headers"); + + /** + * A {@code String} constant representing {@value #TEXT_RICHTEXT} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final String TEXT_RICHTEXT = + "text/richtext"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_RICHTEXT} media + * type defined by RFC 2045,, and RFC 2046. + */ + public static final MediaType TEXT_RICHTEXT_TYPE = + new MediaType("text", "richtext"); + + /** + * A {@code String} constant representing {@value #TEXT_RTPLOOPBACK} media + * type defined by RFC 6849. + */ + public static final String TEXT_RTPLOOPBACK = + "text/rtploopback"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_RTPLOOPBACK} media + * type defined by RFC 6849. + */ + public static final MediaType TEXT_RTPLOOPBACK_TYPE = + new MediaType("text", "rtploopback"); + + /** + * A {@code String} constant representing {@value #TEXT_RTX} media + * type defined by RFC 4588. + */ + public static final String TEXT_RTX = + "text/rtx"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_RTX} media + * type defined by RFC 4588. + */ + public static final MediaType TEXT_RTX_TYPE = + new MediaType("text", "rtx"); + + /** + * A {@code String} constant representing {@value #TEXT_SGML} media + * type defined by RFC 1874. + */ + public static final String TEXT_SGML = + "text/SGML"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_SGML} media + * type defined by RFC 1874. + */ + public static final MediaType TEXT_SGML_TYPE = + new MediaType("text", "SGML"); + + /** + * A {@code String} constant representing {@value #TEXT_T140} media + * type defined by RFC 4103. + */ + public static final String TEXT_T140 = + "text/t140"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_T140} media + * type defined by RFC 4103. + */ + public static final MediaType TEXT_T140_TYPE = + new MediaType("text", "t140"); + + /** + * A {@code String} constant representing {@value #TEXT_TROFF} media + * type defined by RFC 4263. + */ + public static final String TEXT_TROFF = + "text/troff"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_TROFF} media + * type defined by RFC 4263. + */ + public static final MediaType TEXT_TROFF_TYPE = + new MediaType("text", "troff"); + + /** + * A {@code String} constant representing {@value #TEXT_ULPFEC} media + * type defined by RFC 5109. + */ + public static final String TEXT_ULPFEC = + "text/ulpfec"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_ULPFEC} media + * type defined by RFC 5109. + */ + public static final MediaType TEXT_ULPFEC_TYPE = + new MediaType("text", "ulpfec"); + + /** + * A {@code String} constant representing {@value #TEXT_URI_LIST} media + * type defined by RFC 2483. + */ + public static final String TEXT_URI_LIST = + "text/uri-list"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_URI_LIST} media + * type defined by RFC 2483. + */ + public static final MediaType TEXT_URI_LIST_TYPE = + new MediaType("text", "uri-list"); + + /** + * A {@code String} constant representing {@value #TEXT_VCARD} media + * type defined by RFC 6350. + */ + public static final String TEXT_VCARD = + "text/vcard"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_VCARD} media + * type defined by RFC 6350. + */ + public static final MediaType TEXT_VCARD_TYPE = + new MediaType("text", "vcard"); + + /** + * A {@code String} constant representing {@value #TEXT_VND_RADISYS_MSML_BASIC_LAYOUT} media + * type defined by RFC 5707. + */ + public static final String TEXT_VND_RADISYS_MSML_BASIC_LAYOUT = + "text/vnd.radisys.msml-basic-layout"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_VND_RADISYS_MSML_BASIC_LAYOUT} media + * type defined by RFC 5707. + */ + public static final MediaType TEXT_VND_RADISYS_MSML_BASIC_LAYOUT_TYPE = + new MediaType("text", "vnd.radisys.msml-basic-layout"); + + /** + * A {@code String} constant representing {@value #TEXT_XML} media + * type defined by RFC 7303. + */ + public static final String TEXT_XML = + "text/xml"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_XML} media + * type defined by RFC 7303. + */ + public static final MediaType TEXT_XML_TYPE = + new MediaType("text", "xml"); + + /** + * A {@code String} constant representing {@value #TEXT_XML_EXTERNAL_PARSED_ENTITY} media + * type defined by RFC 7303. + */ + public static final String TEXT_XML_EXTERNAL_PARSED_ENTITY = + "text/xml-external-parsed-entity"; + + /** + * A {@link MediaType} constant representing {@value #TEXT_XML_EXTERNAL_PARSED_ENTITY} media + * type defined by RFC 7303. + */ + public static final MediaType TEXT_XML_EXTERNAL_PARSED_ENTITY_TYPE = + new MediaType("text", "xml-external-parsed-entity"); + } + + /** + * Video type media subtypes. + */ + public static class Video { + /** + * A {@code String} constant representing {@value #VIDEO_1D_INTERLEAVED_PARITYFEC} media + * type defined by RFC 6015. + */ + public static final String VIDEO_1D_INTERLEAVED_PARITYFEC = + "video/1d-interleaved-parityfec"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_1D_INTERLEAVED_PARITYFEC} media + * type defined by RFC 6015. + */ + public static final MediaType VIDEO_1D_INTERLEAVED_PARITYFEC_TYPE = + new MediaType("video", "1d-interleaved-parityfec"); + + /** + * A {@code String} constant representing {@value #VIDEO_3GPP} media + * type defined by RFC 3839, and RFC 6381. + */ + public static final String VIDEO_3GPP = + "video/3gpp"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_3GPP} media + * type defined by RFC 3839, and RFC 6381. + */ + public static final MediaType VIDEO_3GPP_TYPE = + new MediaType("video", "3gpp"); + + /** + * A {@code String} constant representing {@value #VIDEO_3GPP2} media + * type defined by RFC 4393, and RFC 6381. + */ + public static final String VIDEO_3GPP2 = + "video/3gpp2"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_3GPP2} media + * type defined by RFC 4393, and RFC 6381. + */ + public static final MediaType VIDEO_3GPP2_TYPE = + new MediaType("video", "3gpp2"); + + /** + * A {@code String} constant representing {@value #VIDEO_3GPP_TT} media + * type defined by RFC 4396. + */ + public static final String VIDEO_3GPP_TT = + "video/3gpp-tt"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_3GPP_TT} media + * type defined by RFC 4396. + */ + public static final MediaType VIDEO_3GPP_TT_TYPE = + new MediaType("video", "3gpp-tt"); + + /** + * A {@code String} constant representing {@value #VIDEO_BMPEG} media + * type defined by RFC 3555. + */ + public static final String VIDEO_BMPEG = + "video/BMPEG"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_BMPEG} media + * type defined by RFC 3555. + */ + public static final MediaType VIDEO_BMPEG_TYPE = + new MediaType("video", "BMPEG"); + + /** + * A {@code String} constant representing {@value #VIDEO_BT656} media + * type defined by RFC 3555. + */ + public static final String VIDEO_BT656 = + "video/BT656"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_BT656} media + * type defined by RFC 3555. + */ + public static final MediaType VIDEO_BT656_TYPE = + new MediaType("video", "BT656"); + + /** + * A {@code String} constant representing {@value #VIDEO_CELB} media + * type defined by RFC 3555. + */ + public static final String VIDEO_CELB = + "video/CelB"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_CELB} media + * type defined by RFC 3555. + */ + public static final MediaType VIDEO_CELB_TYPE = + new MediaType("video", "CelB"); + + /** + * A {@code String} constant representing {@value #VIDEO_DV} media + * type defined by RFC 6469. + */ + public static final String VIDEO_DV = + "video/DV"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_DV} media + * type defined by RFC 6469. + */ + public static final MediaType VIDEO_DV_TYPE = + new MediaType("video", "DV"); + + /** + * A {@code String} constant representing {@value #VIDEO_ENCAPRTP} media + * type defined by RFC 6849. + */ + public static final String VIDEO_ENCAPRTP = + "video/encaprtp"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_ENCAPRTP} media + * type defined by RFC 6849. + */ + public static final MediaType VIDEO_ENCAPRTP_TYPE = + new MediaType("video", "encaprtp"); + + /** + * A {@code String} constant representing {@value #VIDEO_EVC} media + * type defined by RFC 9584. + */ + public static final String VIDEO_EVC = + "video/evc"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_EVC} media + * type defined by RFC 9584. + */ + public static final MediaType VIDEO_EVC_TYPE = + new MediaType("video", "evc"); + + /** + * A {@code String} constant representing {@value #VIDEO_EXAMPLE} media + * type defined by RFC 4735. + */ + public static final String VIDEO_EXAMPLE = + "video/example"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_EXAMPLE} media + * type defined by RFC 4735. + */ + public static final MediaType VIDEO_EXAMPLE_TYPE = + new MediaType("video", "example"); + + /** + * A {@code String} constant representing {@value #VIDEO_FFV1} media + * type defined by RFC 9043. + */ + public static final String VIDEO_FFV1 = + "video/FFV1"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_FFV1} media + * type defined by RFC 9043. + */ + public static final MediaType VIDEO_FFV1_TYPE = + new MediaType("video", "FFV1"); + + /** + * A {@code String} constant representing {@value #VIDEO_FLEXFEC} media + * type defined by RFC 8627. + */ + public static final String VIDEO_FLEXFEC = + "video/flexfec"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_FLEXFEC} media + * type defined by RFC 8627. + */ + public static final MediaType VIDEO_FLEXFEC_TYPE = + new MediaType("video", "flexfec"); + + /** + * A {@code String} constant representing {@value #VIDEO_H261} media + * type defined by RFC 4587. + */ + public static final String VIDEO_H261 = + "video/H261"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_H261} media + * type defined by RFC 4587. + */ + public static final MediaType VIDEO_H261_TYPE = + new MediaType("video", "H261"); + + /** + * A {@code String} constant representing {@value #VIDEO_H263} media + * type defined by RFC 3555. + */ + public static final String VIDEO_H263 = + "video/H263"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_H263} media + * type defined by RFC 3555. + */ + public static final MediaType VIDEO_H263_TYPE = + new MediaType("video", "H263"); + + /** + * A {@code String} constant representing {@value #VIDEO_H263_1998} media + * type defined by RFC 4629. + */ + public static final String VIDEO_H263_1998 = + "video/H263-1998"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_H263_1998} media + * type defined by RFC 4629. + */ + public static final MediaType VIDEO_H263_1998_TYPE = + new MediaType("video", "H263-1998"); + + /** + * A {@code String} constant representing {@value #VIDEO_H263_2000} media + * type defined by RFC 4629. + */ + public static final String VIDEO_H263_2000 = + "video/H263-2000"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_H263_2000} media + * type defined by RFC 4629. + */ + public static final MediaType VIDEO_H263_2000_TYPE = + new MediaType("video", "H263-2000"); + + /** + * A {@code String} constant representing {@value #VIDEO_H264} media + * type defined by RFC 6184. + */ + public static final String VIDEO_H264 = + "video/H264"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_H264} media + * type defined by RFC 6184. + */ + public static final MediaType VIDEO_H264_TYPE = + new MediaType("video", "H264"); + + /** + * A {@code String} constant representing {@value #VIDEO_H264_RCDO} media + * type defined by RFC 6185. + */ + public static final String VIDEO_H264_RCDO = + "video/H264-RCDO"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_H264_RCDO} media + * type defined by RFC 6185. + */ + public static final MediaType VIDEO_H264_RCDO_TYPE = + new MediaType("video", "H264-RCDO"); + + /** + * A {@code String} constant representing {@value #VIDEO_H264_SVC} media + * type defined by RFC 6190. + */ + public static final String VIDEO_H264_SVC = + "video/H264-SVC"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_H264_SVC} media + * type defined by RFC 6190. + */ + public static final MediaType VIDEO_H264_SVC_TYPE = + new MediaType("video", "H264-SVC"); + + /** + * A {@code String} constant representing {@value #VIDEO_H265} media + * type defined by RFC 7798. + */ + public static final String VIDEO_H265 = + "video/H265"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_H265} media + * type defined by RFC 7798. + */ + public static final MediaType VIDEO_H265_TYPE = + new MediaType("video", "H265"); + + /** + * A {@code String} constant representing {@value #VIDEO_H266} media + * type defined by RFC 9328. + */ + public static final String VIDEO_H266 = + "video/H266"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_H266} media + * type defined by RFC 9328. + */ + public static final MediaType VIDEO_H266_TYPE = + new MediaType("video", "H266"); + + /** + * A {@code String} constant representing {@value #VIDEO_JPEG} media + * type defined by RFC 3555. + */ + public static final String VIDEO_JPEG = + "video/JPEG"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_JPEG} media + * type defined by RFC 3555. + */ + public static final MediaType VIDEO_JPEG_TYPE = + new MediaType("video", "JPEG"); + + /** + * A {@code String} constant representing {@value #VIDEO_JPEG2000} media + * type defined by RFC 5371, and RFC 5372. + */ + public static final String VIDEO_JPEG2000 = + "video/jpeg2000"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_JPEG2000} media + * type defined by RFC 5371, and RFC 5372. + */ + public static final MediaType VIDEO_JPEG2000_TYPE = + new MediaType("video", "jpeg2000"); + + /** + * A {@code String} constant representing {@value #VIDEO_JPEG2000_SCL} media + * type defined by RFC 9828. + */ + public static final String VIDEO_JPEG2000_SCL = + "video/jpeg2000-scl"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_JPEG2000_SCL} media + * type defined by RFC 9828. + */ + public static final MediaType VIDEO_JPEG2000_SCL_TYPE = + new MediaType("video", "jpeg2000-scl"); + + /** + * A {@code String} constant representing {@value #VIDEO_JXSV} media + * type defined by RFC 9134. + */ + public static final String VIDEO_JXSV = + "video/jxsv"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_JXSV} media + * type defined by RFC 9134. + */ + public static final MediaType VIDEO_JXSV_TYPE = + new MediaType("video", "jxsv"); + + /** + * A {@code String} constant representing {@value #VIDEO_MATROSKA} media + * type defined by RFC 9559. + */ + public static final String VIDEO_MATROSKA = + "video/matroska"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_MATROSKA} media + * type defined by RFC 9559. + */ + public static final MediaType VIDEO_MATROSKA_TYPE = + new MediaType("video", "matroska"); + + /** + * A {@code String} constant representing {@value #VIDEO_MATROSKA_3D} media + * type defined by RFC 9559. + */ + public static final String VIDEO_MATROSKA_3D = + "video/matroska-3d"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_MATROSKA_3D} media + * type defined by RFC 9559. + */ + public static final MediaType VIDEO_MATROSKA_3D_TYPE = + new MediaType("video", "matroska-3d"); + + /** + * A {@code String} constant representing {@value #VIDEO_MJ2} media + * type defined by RFC 3745. + */ + public static final String VIDEO_MJ2 = + "video/mj2"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_MJ2} media + * type defined by RFC 3745. + */ + public static final MediaType VIDEO_MJ2_TYPE = + new MediaType("video", "mj2"); + + /** + * A {@code String} constant representing {@value #VIDEO_MP1S} media + * type defined by RFC 3555. + */ + public static final String VIDEO_MP1S = + "video/MP1S"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_MP1S} media + * type defined by RFC 3555. + */ + public static final MediaType VIDEO_MP1S_TYPE = + new MediaType("video", "MP1S"); + + /** + * A {@code String} constant representing {@value #VIDEO_MP2P} media + * type defined by RFC 3555. + */ + public static final String VIDEO_MP2P = + "video/MP2P"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_MP2P} media + * type defined by RFC 3555. + */ + public static final MediaType VIDEO_MP2P_TYPE = + new MediaType("video", "MP2P"); + + /** + * A {@code String} constant representing {@value #VIDEO_MP2T} media + * type defined by RFC 3555. + */ + public static final String VIDEO_MP2T = + "video/MP2T"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_MP2T} media + * type defined by RFC 3555. + */ + public static final MediaType VIDEO_MP2T_TYPE = + new MediaType("video", "MP2T"); + + /** + * A {@code String} constant representing {@value #VIDEO_MP4} media + * type defined by RFC 4337, and RFC 6381. + */ + public static final String VIDEO_MP4 = + "video/mp4"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_MP4} media + * type defined by RFC 4337, and RFC 6381. + */ + public static final MediaType VIDEO_MP4_TYPE = + new MediaType("video", "mp4"); + + /** + * A {@code String} constant representing {@value #VIDEO_MP4V_ES} media + * type defined by RFC 6416. + */ + public static final String VIDEO_MP4V_ES = + "video/MP4V-ES"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_MP4V_ES} media + * type defined by RFC 6416. + */ + public static final MediaType VIDEO_MP4V_ES_TYPE = + new MediaType("video", "MP4V-ES"); + + /** + * A {@code String} constant representing {@value #VIDEO_MPV} media + * type defined by RFC 3555. + */ + public static final String VIDEO_MPV = + "video/MPV"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_MPV} media + * type defined by RFC 3555. + */ + public static final MediaType VIDEO_MPV_TYPE = + new MediaType("video", "MPV"); + + /** + * A {@code String} constant representing {@value #VIDEO_MPEG} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final String VIDEO_MPEG = + "video/mpeg"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_MPEG} media + * type defined by RFC 2045, and RFC 2046. + */ + public static final MediaType VIDEO_MPEG_TYPE = + new MediaType("video", "mpeg"); + + /** + * A {@code String} constant representing {@value #VIDEO_MPEG4_GENERIC} media + * type defined by RFC 3640. + */ + public static final String VIDEO_MPEG4_GENERIC = + "video/mpeg4-generic"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_MPEG4_GENERIC} media + * type defined by RFC 3640. + */ + public static final MediaType VIDEO_MPEG4_GENERIC_TYPE = + new MediaType("video", "mpeg4-generic"); + + /** + * A {@code String} constant representing {@value #VIDEO_NV} media + * type defined by RFC 4856. + */ + public static final String VIDEO_NV = + "video/nv"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_NV} media + * type defined by RFC 4856. + */ + public static final MediaType VIDEO_NV_TYPE = + new MediaType("video", "nv"); + + /** + * A {@code String} constant representing {@value #VIDEO_OGG} media + * type defined by RFC 5334, and RFC 7845. + */ + public static final String VIDEO_OGG = + "video/ogg"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_OGG} media + * type defined by RFC 5334, and RFC 7845. + */ + public static final MediaType VIDEO_OGG_TYPE = + new MediaType("video", "ogg"); + + /** + * A {@code String} constant representing {@value #VIDEO_PARITYFEC} media + * type defined by RFC 3009. + */ + public static final String VIDEO_PARITYFEC = + "video/parityfec"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_PARITYFEC} media + * type defined by RFC 3009. + */ + public static final MediaType VIDEO_PARITYFEC_TYPE = + new MediaType("video", "parityfec"); + + /** + * A {@code String} constant representing {@value #VIDEO_POINTER} media + * type defined by RFC 2862. + */ + public static final String VIDEO_POINTER = + "video/pointer"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_POINTER} media + * type defined by RFC 2862. + */ + public static final MediaType VIDEO_POINTER_TYPE = + new MediaType("video", "pointer"); + + /** + * A {@code String} constant representing {@value #VIDEO_QUICKTIME} media + * type defined by RFC 6381. + */ + public static final String VIDEO_QUICKTIME = + "video/quicktime"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_QUICKTIME} media + * type defined by RFC 6381. + */ + public static final MediaType VIDEO_QUICKTIME_TYPE = + new MediaType("video", "quicktime"); + + /** + * A {@code String} constant representing {@value #VIDEO_RAPTORFEC} media + * type defined by RFC 6682. + */ + public static final String VIDEO_RAPTORFEC = + "video/raptorfec"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_RAPTORFEC} media + * type defined by RFC 6682. + */ + public static final MediaType VIDEO_RAPTORFEC_TYPE = + new MediaType("video", "raptorfec"); + + /** + * A {@code String} constant representing {@value #VIDEO_RAW} media + * type defined by RFC 4175. + */ + public static final String VIDEO_RAW = + "video/raw"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_RAW} media + * type defined by RFC 4175. + */ + public static final MediaType VIDEO_RAW_TYPE = + new MediaType("video", "raw"); + + /** + * A {@code String} constant representing {@value #VIDEO_RTPLOOPBACK} media + * type defined by RFC 6849. + */ + public static final String VIDEO_RTPLOOPBACK = + "video/rtploopback"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_RTPLOOPBACK} media + * type defined by RFC 6849. + */ + public static final MediaType VIDEO_RTPLOOPBACK_TYPE = + new MediaType("video", "rtploopback"); + + /** + * A {@code String} constant representing {@value #VIDEO_RTX} media + * type defined by RFC 4588. + */ + public static final String VIDEO_RTX = + "video/rtx"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_RTX} media + * type defined by RFC 4588. + */ + public static final MediaType VIDEO_RTX_TYPE = + new MediaType("video", "rtx"); + + /** + * A {@code String} constant representing {@value #VIDEO_SCIP} media + * type defined by RFC 9607. + */ + public static final String VIDEO_SCIP = + "video/scip"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_SCIP} media + * type defined by RFC 9607. + */ + public static final MediaType VIDEO_SCIP_TYPE = + new MediaType("video", "scip"); + + /** + * A {@code String} constant representing {@value #VIDEO_SMPTE291} media + * type defined by RFC 8331. + */ + public static final String VIDEO_SMPTE291 = + "video/smpte291"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_SMPTE291} media + * type defined by RFC 8331. + */ + public static final MediaType VIDEO_SMPTE291_TYPE = + new MediaType("video", "smpte291"); + + /** + * A {@code String} constant representing {@value #VIDEO_SMPTE292M} media + * type defined by RFC 3497. + */ + public static final String VIDEO_SMPTE292M = + "video/SMPTE292M"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_SMPTE292M} media + * type defined by RFC 3497. + */ + public static final MediaType VIDEO_SMPTE292M_TYPE = + new MediaType("video", "SMPTE292M"); + + /** + * A {@code String} constant representing {@value #VIDEO_ULPFEC} media + * type defined by RFC 5109. + */ + public static final String VIDEO_ULPFEC = + "video/ulpfec"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_ULPFEC} media + * type defined by RFC 5109. + */ + public static final MediaType VIDEO_ULPFEC_TYPE = + new MediaType("video", "ulpfec"); + + /** + * A {@code String} constant representing {@value #VIDEO_VC1} media + * type defined by RFC 4425. + */ + public static final String VIDEO_VC1 = + "video/vc1"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_VC1} media + * type defined by RFC 4425. + */ + public static final MediaType VIDEO_VC1_TYPE = + new MediaType("video", "vc1"); + + /** + * A {@code String} constant representing {@value #VIDEO_VC2} media + * type defined by RFC 8450. + */ + public static final String VIDEO_VC2 = + "video/vc2"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_VC2} media + * type defined by RFC 8450. + */ + public static final MediaType VIDEO_VC2_TYPE = + new MediaType("video", "vc2"); + + /** + * A {@code String} constant representing {@value #VIDEO_VP8} media + * type defined by RFC 7741. + */ + public static final String VIDEO_VP8 = + "video/VP8"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_VP8} media + * type defined by RFC 7741. + */ + public static final MediaType VIDEO_VP8_TYPE = + new MediaType("video", "VP8"); + + /** + * A {@code String} constant representing {@value #VIDEO_VP9} media + * type defined by RFC 9628. + */ + public static final String VIDEO_VP9 = + "video/VP9"; + + /** + * A {@link MediaType} constant representing {@value #VIDEO_VP9} media + * type defined by RFC 9628. + */ + public static final MediaType VIDEO_VP9_TYPE = + new MediaType("video", "VP9"); + } +}
diff --git a/ext/constants/src/main/java/org/glassfish/jersey/constants/http/ResponseStatus.java b/ext/constants/src/main/java/org/glassfish/jersey/constants/http/ResponseStatus.java new file mode 100644 index 0000000..6d53994 --- /dev/null +++ b/ext/constants/src/main/java/org/glassfish/jersey/constants/http/ResponseStatus.java
@@ -0,0 +1,55 @@ +/* + * Copyright (c) 2025 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.constants.http; + +/** + * This is a list of Hypertext Transfer Protocol (HTTP) response status codes. + * The Internet Assigned Numbers Authority (IANA) maintains the official registry of HTTP status codes. + * See <a href="https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml">Hypertext Transfer Protocol (HTTP) Status Code Registry</a>. + */ +public final class ResponseStatus { + + /** + * 1xx informational status codes - request received, continuing process + */ + public static class Info1xx extends org.glassfish.jersey.http.ResponseStatus.Info1xx { + } + + /** + * 2xx success status codes - the action was successfully received, understood, and accepted. + */ + public static class Success2xx extends org.glassfish.jersey.http.ResponseStatus.Success2xx { + } + + /** + * 3xx redirection status codes - further action must be taken in order to complete the request. + */ + public static class Redirect3xx extends org.glassfish.jersey.http.ResponseStatus.Redirect3xx { + } + + /** + * 4xx client error status codes - the request contains bad syntax or cannot be fulfilled. + */ + public static class ClientError4xx extends org.glassfish.jersey.http.ResponseStatus.Redirect3xx { + } + + /** + * 5xx server error status codes - the server failed to fulfill an apparently valid request. + */ + public static class ServerError5xx extends org.glassfish.jersey.http.ResponseStatus.ServerError5xx { + } +}
diff --git a/ext/constants/src/main/java/org/glassfish/jersey/constants/http/package-info.java b/ext/constants/src/main/java/org/glassfish/jersey/constants/http/package-info.java new file mode 100644 index 0000000..2e4b917 --- /dev/null +++ b/ext/constants/src/main/java/org/glassfish/jersey/constants/http/package-info.java
@@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025 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 + */ + +/** + * HTTP communication related constants. + */ +package org.glassfish.jersey.constants.http; \ No newline at end of file
diff --git a/ext/pom.xml b/ext/pom.xml index 924a338..3f4358c 100644 --- a/ext/pom.xml +++ b/ext/pom.xml
@@ -42,6 +42,7 @@ <modules> <module>bean-validation</module> <module>cdi</module> + <module>constants</module> <module>entity-filtering</module> <module>metainf-services</module> <module>micrometer</module>
diff --git a/ext/rx/rx-client-guava/src/main/resources/META-INF/services/org.glassfish.jersey.client.rx.spi.RxInvokerProvider b/ext/rx/rx-client-guava/src/main/resources/META-INF/services/org.glassfish.jersey.client.rx.spi.RxInvokerProvider deleted file mode 100644 index 4246699..0000000 --- a/ext/rx/rx-client-guava/src/main/resources/META-INF/services/org.glassfish.jersey.client.rx.spi.RxInvokerProvider +++ /dev/null
@@ -1 +0,0 @@ -org.glassfish.jersey.client.rx.guava.RxListenableFutureInvokerProvider \ No newline at end of file
diff --git a/ext/rx/rx-client-rxjava/src/main/resources/META-INF/services/org.glassfish.jersey.client.rx.spi.RxInvokerProvider b/ext/rx/rx-client-rxjava/src/main/resources/META-INF/services/org.glassfish.jersey.client.rx.spi.RxInvokerProvider deleted file mode 100644 index 2e85ada..0000000 --- a/ext/rx/rx-client-rxjava/src/main/resources/META-INF/services/org.glassfish.jersey.client.rx.spi.RxInvokerProvider +++ /dev/null
@@ -1 +0,0 @@ -org.glassfish.jersey.client.rx.rxjava.RxObservableInvokerProvider \ No newline at end of file
diff --git a/incubator/cdi-inject-weld/src/main/java/org/glassfish/jersey/inject/weld/internal/bean/BeanHelper.java b/incubator/cdi-inject-weld/src/main/java/org/glassfish/jersey/inject/weld/internal/bean/BeanHelper.java index a1c5032..2b40c0c 100644 --- a/incubator/cdi-inject-weld/src/main/java/org/glassfish/jersey/inject/weld/internal/bean/BeanHelper.java +++ b/incubator/cdi-inject-weld/src/main/java/org/glassfish/jersey/inject/weld/internal/bean/BeanHelper.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025 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 @@ -149,8 +149,8 @@ public static <T> BindingBeanPair registerSupplier(RuntimeType runtimeType, SupplierClassBinding<T> binding, AfterBeanDiscovery abd, Collection<InjectionResolver> resolvers, BeanManager beanManager) { - Class<Supplier<T>> supplierClass = (Class<Supplier<T>>) binding.getSupplierClass(); - AnnotatedType<Supplier<T>> annotatedType = beanManager.createAnnotatedType(supplierClass); + final Class<Supplier<T>> supplierClass = (Class<Supplier<T>>) binding.getSupplierClass(); + final AnnotatedType<Supplier<T>> annotatedType = beanManager.createAnnotatedType(supplierClass); final InjectionTargetFactory<Supplier<T>> injectionTargetFactory = beanManager.getInjectionTargetFactory(annotatedType); final InjectionTarget<Supplier<T>> injectionTarget = injectionTargetFactory.createInjectionTarget(null);
diff --git a/incubator/cdi-inject-weld/src/main/java/org/glassfish/jersey/inject/weld/internal/scope/RequestScopeBean.java b/incubator/cdi-inject-weld/src/main/java/org/glassfish/jersey/inject/weld/internal/scope/RequestScopeBean.java index 7dd99c8..9525848 100644 --- a/incubator/cdi-inject-weld/src/main/java/org/glassfish/jersey/inject/weld/internal/scope/RequestScopeBean.java +++ b/incubator/cdi-inject-weld/src/main/java/org/glassfish/jersey/inject/weld/internal/scope/RequestScopeBean.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025 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
diff --git a/inject/cdi2-se/src/main/java/org/glassfish/jersey/inject/cdi/se/RequestScopeBean.java b/inject/cdi2-se/src/main/java/org/glassfish/jersey/inject/cdi/se/RequestScopeBean.java index 86e97ab..d3148b1 100644 --- a/inject/cdi2-se/src/main/java/org/glassfish/jersey/inject/cdi/se/RequestScopeBean.java +++ b/inject/cdi2-se/src/main/java/org/glassfish/jersey/inject/cdi/se/RequestScopeBean.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025 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
diff --git a/inject/cdi2-se/src/main/java/org/glassfish/jersey/inject/cdi/se/bean/BeanHelper.java b/inject/cdi2-se/src/main/java/org/glassfish/jersey/inject/cdi/se/bean/BeanHelper.java index 053dbe8..6e692e6 100644 --- a/inject/cdi2-se/src/main/java/org/glassfish/jersey/inject/cdi/se/bean/BeanHelper.java +++ b/inject/cdi2-se/src/main/java/org/glassfish/jersey/inject/cdi/se/bean/BeanHelper.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025 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
diff --git a/inject/hk2/src/main/java/org/glassfish/jersey/inject/hk2/Hk2RequestScope.java b/inject/hk2/src/main/java/org/glassfish/jersey/inject/hk2/Hk2RequestScope.java index e9437c4..2d66c16 100644 --- a/inject/hk2/src/main/java/org/glassfish/jersey/inject/hk2/Hk2RequestScope.java +++ b/inject/hk2/src/main/java/org/glassfish/jersey/inject/hk2/Hk2RequestScope.java
@@ -139,7 +139,7 @@ */ @Override public void release() { - if (referenceCounter.decrementAndGet() < 1) { + if (referenceCounter.decrementAndGet() == 0) { try { ArrayList<ForeignDescriptor> reverse = new ArrayList<>(store.keySet()); Collections.reverse(reverse);
diff --git a/inject/hk2/src/main/java/org/glassfish/jersey/inject/hk2/JerseyClassAnalyzer.java b/inject/hk2/src/main/java/org/glassfish/jersey/inject/hk2/JerseyClassAnalyzer.java index bceaeda..d9963b5 100644 --- a/inject/hk2/src/main/java/org/glassfish/jersey/inject/hk2/JerseyClassAnalyzer.java +++ b/inject/hk2/src/main/java/org/glassfish/jersey/inject/hk2/JerseyClassAnalyzer.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025 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 @@ -25,7 +25,6 @@ import java.security.PrivilegedAction; import java.util.List; import java.util.Set; -import java.util.function.Supplier; import jakarta.inject.Inject; import jakarta.inject.Named; @@ -35,9 +34,6 @@ import org.glassfish.jersey.internal.LocalizationMessages; import org.glassfish.jersey.internal.inject.InjectionResolver; import org.glassfish.jersey.internal.util.collection.ImmutableCollectors; -import org.glassfish.jersey.internal.util.collection.LazyValue; -import org.glassfish.jersey.internal.util.collection.Value; -import org.glassfish.jersey.internal.util.collection.Values; import org.glassfish.hk2.api.ClassAnalyzer; import org.glassfish.hk2.api.MultiException; @@ -79,33 +75,31 @@ @Override protected void configure() { - ClassAnalyzer defaultAnalyzer = - serviceLocator.getService(ClassAnalyzer.class, ClassAnalyzer.DEFAULT_IMPLEMENTATION_NAME); - - Supplier<List<InjectionResolver>> resolvers = () -> serviceLocator.getAllServices(InjectionResolver.class); - - bind(new JerseyClassAnalyzer(defaultAnalyzer, resolvers)) + bind(JerseyClassAnalyzer.class) .analyzeWith(ClassAnalyzer.DEFAULT_IMPLEMENTATION_NAME) .named(JerseyClassAnalyzer.NAME) .to(ClassAnalyzer.class); } } + private final Set<Class> resolverAnnotations; private final ClassAnalyzer defaultAnalyzer; - private final LazyValue<Set<Class>> resolverAnnotations; + /** * Injection constructor. * - * @param defaultAnalyzer default HK2 class analyzer. - * @param supplierResolvers configured injection resolvers. + * @param serviceLocator current injection manager. */ - private JerseyClassAnalyzer(ClassAnalyzer defaultAnalyzer, Supplier<List<InjectionResolver>> supplierResolvers) { - this.defaultAnalyzer = defaultAnalyzer; - Value<Set<Class>> resolvers = () -> supplierResolvers.get().stream() + @Inject + public JerseyClassAnalyzer(ServiceLocator serviceLocator) { + defaultAnalyzer = serviceLocator.getService(ClassAnalyzer.class, ClassAnalyzer.DEFAULT_IMPLEMENTATION_NAME); + // Load the resolver annotations once to avoid potential deadlock later + // See https://github.com/eclipse-ee4j/jersey/issues/5996 + List<InjectionResolver> resolvers = serviceLocator.getAllServices(InjectionResolver.class); + this.resolverAnnotations = resolvers.stream() .filter(InjectionResolver::isConstructorParameterIndicator) .map(InjectionResolver::getAnnotation) .collect(ImmutableCollectors.toImmutableSet()); - this.resolverAnnotations = Values.lazy(resolvers); } @SuppressWarnings("unchecked") @@ -186,7 +180,7 @@ final int paramSize = constructor.getParameterTypes().length; - if (paramSize != 0 && resolverAnnotations.get().isEmpty()) { + if (paramSize != 0 && resolverAnnotations.isEmpty()) { return false; } @@ -200,7 +194,7 @@ for (final Annotation[] paramAnnotations : constructor.getParameterAnnotations()) { boolean found = false; for (final Annotation paramAnnotation : paramAnnotations) { - if (resolverAnnotations.get().contains(paramAnnotation.annotationType())) { + if (resolverAnnotations.contains(paramAnnotation.annotationType())) { found = true; break; }
diff --git a/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/base/ProviderBase.java b/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/base/ProviderBase.java index 350be25..d86fa8b 100644 --- a/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/base/ProviderBase.java +++ b/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/base/ProviderBase.java
@@ -6,7 +6,10 @@ import java.io.Reader; import java.io.Writer; import java.lang.annotation.Annotation; +import java.lang.reflect.Constructor; import java.lang.reflect.Type; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -18,9 +21,12 @@ import jakarta.ws.rs.core.NoContentException; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.StreamingOutput; +import jakarta.ws.rs.ext.ContextResolver; import jakarta.ws.rs.ext.MessageBodyReader; import jakarta.ws.rs.ext.MessageBodyWriter; +import jakarta.ws.rs.ext.Providers; +import com.fasterxml.jackson.core.PrettyPrinter; import org.glassfish.jersey.jackson.internal.jackson.jaxrs.cfg.AnnotationBundleKey; import org.glassfish.jersey.jackson.internal.jackson.jaxrs.cfg.Annotations; import org.glassfish.jersey.jackson.internal.jackson.jaxrs.cfg.EndpointConfigBase; @@ -216,12 +222,13 @@ protected ProviderBase() { this(null); } + /** * @since 2.17 */ protected ProviderBase(MAPPER_CONFIG mconfig, - LookupCache<AnnotationBundleKey, EP_CONFIG> readerCache, - LookupCache<AnnotationBundleKey, EP_CONFIG> writerCache) + LookupCache<AnnotationBundleKey, EP_CONFIG> readerCache, + LookupCache<AnnotationBundleKey, EP_CONFIG> writerCache) { _mapperConfig = mconfig; _jaxRSFeatures = JAXRS_FEATURE_DEFAULTS; @@ -612,7 +619,12 @@ try { // Want indentation? if (writer.isEnabled(SerializationFeature.INDENT_OUTPUT)) { - g.useDefaultPrettyPrinter(); + PrettyPrinter defaultPrettyPrinter = writer.getConfig().getDefaultPrettyPrinter(); + if (defaultPrettyPrinter != null) { + g.setPrettyPrinter(defaultPrettyPrinter); + } else { + g.useDefaultPrettyPrinter(); + } } JavaType rootType = null; @@ -999,6 +1011,24 @@ /********************************************************** */ + // @since 2.19 + protected <OM extends ObjectMapper> OM _locateMapperViaProvider(Class<?> type, MediaType mediaType, + Class<OM> mapperType, Providers providers) { + if (providers != null) { + ContextResolver<OM> resolver = providers.getContextResolver(mapperType, mediaType); + // Above should work as is, but due to this bug + // [https://jersey.dev.java.net/issues/show_bug.cgi?id=288] + // in Jersey, it doesn't. But this works until resolution of the issue: + if (resolver == null) { + resolver = providers.getContextResolver(mapperType, null); + } + if (resolver != null) { + return resolver.getContext(type); + } + } + return null; + } + protected static boolean _containedIn(Class<?> mainType, HashSet<ClassKey> set) { if (set != null) {
diff --git a/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/json/JacksonJsonProvider.java b/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/json/JacksonJsonProvider.java index 13f9275..93a5192 100644 --- a/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/json/JacksonJsonProvider.java +++ b/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/json/JacksonJsonProvider.java
@@ -19,6 +19,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectReader; import com.fasterxml.jackson.databind.ObjectWriter; +import com.fasterxml.jackson.databind.json.JsonMapper; /** * Basic implementation of JAX-RS abstractions ({@link MessageBodyReader}, @@ -207,21 +208,12 @@ @Override protected ObjectMapper _locateMapperViaProvider(Class<?> type, MediaType mediaType) { - if (_providers != null) { - ContextResolver<ObjectMapper> resolver = _providers.getContextResolver(ObjectMapper.class, mediaType); - /* Above should work as is, but due to this bug - * [https://jersey.dev.java.net/issues/show_bug.cgi?id=288] - * in Jersey, it doesn't. But this works until resolution of - * the issue: - */ - if (resolver == null) { - resolver = _providers.getContextResolver(ObjectMapper.class, null); - } - if (resolver != null) { - return resolver.getContext(type); - } + // 26-Nov-2024, tatu: [jakarta-rs#36] Look for JsonMapper primarily + ObjectMapper m =_locateMapperViaProvider(type, mediaType, JsonMapper.class, _providers); + if (m == null) { + m = _locateMapperViaProvider(type, mediaType, ObjectMapper.class, _providers); } - return null; + return m; } @Override
diff --git a/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/json/JsonMapperConfigurator.java b/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/json/JsonMapperConfigurator.java index fd5d9aa..3325c5e 100644 --- a/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/json/JsonMapperConfigurator.java +++ b/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/json/JsonMapperConfigurator.java
@@ -10,6 +10,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationIntrospector; +import com.fasterxml.jackson.databind.json.JsonMapper; /** * Helper class used to encapsulate details of configuring an @@ -49,7 +50,7 @@ _lock.lock(); try { if (_defaultMapper == null) { - _defaultMapper = new ObjectMapper(); + _defaultMapper = new JsonMapper(); _setAnnotations(_defaultMapper, _defaultAnnotationsToUse); } } finally { @@ -77,7 +78,7 @@ _lock.lock(); try { if (_mapper == null) { - _mapper = new ObjectMapper(); + _mapper = new JsonMapper(); _setAnnotations(_mapper, _defaultAnnotationsToUse); } } finally { @@ -120,9 +121,8 @@ case JACKSON: return new JacksonAnnotationIntrospector(); case JAXB: - /* For this, need to use indirection just so that error occurs - * when we get here, and not when this class is being loaded - */ + // For this, need to use indirection just so that error occurs + // when we get here, and not when this class is being loaded try { if (_jaxbIntrospectorClass == null) { _jaxbIntrospectorClass = JakartaXmlBindAnnotationIntrospector.class;
diff --git a/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/json/PackageVersion.java b/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/json/PackageVersion.java index 44c9073..a7c123c 100644 --- a/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/json/PackageVersion.java +++ b/media/json-jackson/src/main/java/org/glassfish/jersey/jackson/internal/jackson/jaxrs/json/PackageVersion.java
@@ -11,7 +11,7 @@ */ public final class PackageVersion implements Versioned { public final static Version VERSION = VersionUtil.parseVersion( - "2.18.0", "com.fasterxml.jackson.jaxrs", "jackson-jaxrs-json-provider"); + "2.19.1", "com.fasterxml.jackson.jaxrs", "jackson-jaxrs-json-provider"); @Override public Version version() {
diff --git a/media/json-jackson/src/main/resources/META-INF/NOTICE.markdown b/media/json-jackson/src/main/resources/META-INF/NOTICE.markdown index d893c65..d9b20ee 100644 --- a/media/json-jackson/src/main/resources/META-INF/NOTICE.markdown +++ b/media/json-jackson/src/main/resources/META-INF/NOTICE.markdown
@@ -31,7 +31,7 @@ ## Third-party Content -Jackson JAX-RS Providers version 2.18.0 +Jackson JAX-RS Providers version 2.19.1 * License: Apache License, 2.0 * Project: https://github.com/FasterXML/jackson-jaxrs-providers * Copyright: (c) 2009-2023 FasterXML, LLC. All rights reserved unless otherwise indicated.
diff --git a/pom.xml b/pom.xml index 1f6bb54..ea2aa42 100644 --- a/pom.xml +++ b/pom.xml
@@ -2112,9 +2112,9 @@ <mvn.ant.version>1.10.15</mvn.ant.version> <assembly.mvn.plugin.version>3.7.1</assembly.mvn.plugin.version> <clean.mvn.plugin.version>3.5.0</clean.mvn.plugin.version> - <enforcer.mvn.plugin.version>3.5.0</enforcer.mvn.plugin.version> - <exec.mvn.plugin.version>3.5.0</exec.mvn.plugin.version> - <buildhelper.mvn.plugin.version>3.6.0</buildhelper.mvn.plugin.version> + <enforcer.mvn.plugin.version>3.6.1</enforcer.mvn.plugin.version> + <exec.mvn.plugin.version>3.5.1</exec.mvn.plugin.version> + <buildhelper.mvn.plugin.version>3.6.1</buildhelper.mvn.plugin.version> <buildnumber.mvn.plugin.version>3.2.1</buildnumber.mvn.plugin.version> <checkstyle.mvn.plugin.version>3.6.0</checkstyle.mvn.plugin.version> <checkstyle.version>10.21.4</checkstyle.version> @@ -2126,10 +2126,10 @@ but the jersey-common module which has to have the separate version for OSGi reasons. --> <compiler.common.mvn.plugin.version>3.14.0</compiler.common.mvn.plugin.version> - <cyclonedx.mvn.plugin.version>2.8.1</cyclonedx.mvn.plugin.version> + <cyclonedx.mvn.plugin.version>2.9.1</cyclonedx.mvn.plugin.version> <dependency.mvn.plugin.version>3.8.1</dependency.mvn.plugin.version> <deploy.mvn.plugin.version>3.1.4</deploy.mvn.plugin.version> - <ear.mvn.plugin.version>3.3.0</ear.mvn.plugin.version> + <ear.mvn.plugin.version>3.4.0</ear.mvn.plugin.version> <failsafe.mvn.plugin.version>3.5.3</failsafe.mvn.plugin.version> <felix.mvn.plugin.version>5.1.9</felix.mvn.plugin.version> <!-- newer versions are not supported by JDK 11- --> <findbugs.mvn.plugin.version>3.0.5</findbugs.mvn.plugin.version> @@ -2157,7 +2157,7 @@ <arquillian.weld.version>4.0.0.Final</arquillian.weld.version> <!-- 3.0.2.Final fails microprofile TCK tests --> <!-- asm is now source integrated - keeping this property to see the version --> <!-- see core-server/src/main/java/jersey/repackaged/asm/.. --> - <asm.version>9.8</asm.version> + <asm.version>9.9</asm.version> <!--required for spring (ext) modules integration --> <aspectj.weaver.version>1.9.24</aspectj.weaver.version> <!-- <bnd.plugin.version>2.3.6</bnd.plugin.version>--> @@ -2171,7 +2171,7 @@ <felix.framework.version>7.0.5</felix.framework.version> <findbugs.glassfish.version>1.7</findbugs.glassfish.version> <freemarker.version>2.3.34</freemarker.version> - <gae.version>2.0.36</gae.version> + <gae.version>2.0.38</gae.version> <groovy.version>5.0.0-alpha-12</groovy.version> <gson.version>2.13.1</gson.version> @@ -2199,10 +2199,10 @@ <guava.version>33.4.8-jre</guava.version> <hamcrest.version>3.0</hamcrest.version> - <xmlunit.version>2.10.0</xmlunit.version> + <xmlunit.version>2.10.3</xmlunit.version> <httpclient.version>4.5.14</httpclient.version> - <httpclient5.version>5.3.1</httpclient5.version> - <jackson.version>2.18.0</jackson.version> + <httpclient5.version>5.5</httpclient5.version> + <jackson.version>2.19.1</jackson.version> <javassist.version>3.30.2-GA</javassist.version> <jettison.version>1.3.7</jettison.version> <!-- TODO: 1.3.8 doesn't work; AbstractJsonTest complexBeanWithAttributes --> <jboss.vfs.version>3.3.2.Final</jboss.vfs.version> @@ -2210,13 +2210,13 @@ <jmh.version>1.37</jmh.version> <jmockit.version>1.49</jmockit.version> <junit4.version>4.13.2</junit4.version> - <junit5.version>5.12.2</junit5.version> - <junit-platform-suite.version>1.12.2</junit-platform-suite.version> + <junit5.version>5.13.4</junit5.version> + <junit-platform-suite.version>1.13.4</junit-platform-suite.version> <junit-platform-suite.legacy.version>1.10.0</junit-platform-suite.legacy.version> <kryo.version>4.0.3</kryo.version> <mockito.version>4.11.0</mockito.version> <!-- CQ 17673 --> <mustache.version>0.9.14</mustache.version> - <netty.version>4.1.125.Final</netty.version> + <netty.version>4.1.126.Final</netty.version> <opentracing.version>0.33.0</opentracing.version> <osgi.version>6.0.0</osgi.version> <osgi.framework.version>1.10.0</osgi.framework.version> @@ -2228,7 +2228,6 @@ <rxjava.version>1.3.8</rxjava.version> <rxjava2.version>2.2.21</rxjava2.version> - <servlet4.version>4.0.3</servlet4.version> <servlet6.version>6.0.0</servlet6.version> <simple.version>6.0.1</simple.version> @@ -2283,7 +2282,7 @@ <jaxrs.api.impl.version>3.1.0</jaxrs.api.impl.version> <jetty.osgi.version>org.eclipse.jetty.*;version="[11,15)"</jetty.osgi.version> <jetty.version>12.0.27</jetty.version> - <jetty9.version>9.4.57.v20241219</jetty9.version> + <jetty9.version>9.4.58.v20250814</jetty9.version> <jetty11.version>11.0.26</jetty11.version> <jetty.plugin.version>12.0.22</jetty.plugin.version> <jsonb.api.version>3.0.1</jsonb.api.version>
diff --git a/test-framework/util/pom.xml b/test-framework/util/pom.xml index 4d2dddc..db7304d 100644 --- a/test-framework/util/pom.xml +++ b/test-framework/util/pom.xml
@@ -59,6 +59,12 @@ <artifactId>junit-platform-engine</artifactId> <scope>test</scope> </dependency> + <dependency> <!--added due to an issue in JUnit 5 dependencies for junit-vintage-engine --> + <groupId>org.junit.platform</groupId> + <artifactId>junit-platform-launcher</artifactId> + <version>${junit-platform-suite.version}</version> + <scope>test</scope> + </dependency> </dependencies> <build> @@ -71,6 +77,12 @@ <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> <version>${junit5.version}</version> + <exclusions> + <exclusion> + <groupId>org.junit.platform</groupId> + <artifactId>junit-platform-launcher</artifactId> + </exclusion> + </exclusions> </dependency> </dependencies> </plugin>
diff --git a/tests/e2e-client/pom.xml b/tests/e2e-client/pom.xml index 3dce2ff..8084d3c 100644 --- a/tests/e2e-client/pom.xml +++ b/tests/e2e-client/pom.xml
@@ -344,6 +344,18 @@ </build> </profile> <profile> + <id>jdk26+</id> + <activation> + <jdk>[26,)</jdk> + </activation> + <properties> + <surefire.security.argline> + -Djdk.tls.server.protocols=TLSv1.2 + -Djava.security.properties=${project.build.directory}/test-classes/disabled_tls.properties + </surefire.security.argline> + </properties> + </profile> + <profile> <id>xdk</id> <properties> <!-- do not use security manager for xdk -->
diff --git a/tests/e2e-client/src/test/resources/disabled_tls.properties b/tests/e2e-client/src/test/resources/disabled_tls.properties new file mode 100644 index 0000000..41cb0b9 --- /dev/null +++ b/tests/e2e-client/src/test/resources/disabled_tls.properties
@@ -0,0 +1,19 @@ +# +# Copyright (c) 2012, 2025 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 +# + +jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, DTLSv1.0, RC4, DES, \ + MD5withRSA, DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \ + ECDH \ No newline at end of file
diff --git a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/process/internal/RequestScopeTest.java b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/process/internal/RequestScopeTest.java index d0488fa..6a875a8 100644 --- a/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/process/internal/RequestScopeTest.java +++ b/tests/e2e-core-common/src/test/java/org/glassfish/jersey/tests/e2e/common/process/internal/RequestScopeTest.java
@@ -17,6 +17,7 @@ package org.glassfish.jersey.tests.e2e.common.process.internal; import java.lang.reflect.Type; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; @@ -171,12 +172,67 @@ Assertions.assertEquals(987654321, instanceRelease.get()); } + @Test + public void testMultipleReleases() throws InterruptedException { + final RequestScope requestScope = new Hk2RequestScope(); + final AtomicBoolean passed = new AtomicBoolean(true); + final int CNT = 200; + Thread[] thread = new Thread[CNT]; + Hk2RequestScope.Instance instance = requestScope.runInScope(() -> { + final Hk2RequestScope.Instance internalInstance = (Hk2RequestScope.Instance) requestScope.current(); + for (int index = 1; index != CNT; index++) { + TestProvider testProvider = new TestProvider(String.valueOf(index)) { + @Override + public int hashCode() { + return super.hashCode() + Integer.parseInt(id); + } + }; + final ForeignDescriptor fd = ForeignDescriptor.wrap(testProvider, new Consumer<Object>() { + @Override + public void accept(Object o) { + // noop + } + }); + internalInstance.put(fd, String.valueOf(index)); + + for (int i = 0; i != CNT; i++) { + thread[i] = new Thread(new Runnable() { + @Override + public void run() { + final long waitTime = (int) (Math.random() * 5 + 1) * 10L; + try { + Thread.sleep(waitTime); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + try { + internalInstance.release(); + } catch (Throwable throwable) { + passed.set(false); + } + } + }); + } + for (int i = 0; i != CNT; i++) { + thread[i].start(); + } + } + return internalInstance; + }); + + for (int i = 0; i != CNT; i++) { + thread[i].join(); + } + + Assertions.assertTrue(passed.get()); + } + /** * Test request scope inhabitant. */ public static class TestProvider extends AbstractActiveDescriptor<String> { - private final String id; + public final String id; public TestProvider(final String id) { super();
diff --git a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/ContextResolverMediaTypeTest.java b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/ContextResolverMediaTypeTest.java index f7cfe15..66a2c7c 100644 --- a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/ContextResolverMediaTypeTest.java +++ b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/ContextResolverMediaTypeTest.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025 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 @@ -134,7 +134,7 @@ } @Nested - public static class ProduceTest extends JerseyTest { + class ProduceTest extends JerseyTest { @Override protected Application configure() { @@ -161,7 +161,7 @@ } @Nested - public static class ProducesTest extends JerseyTest { + class ProducesTest extends JerseyTest { @Override protected Application configure() { @@ -188,7 +188,7 @@ } @Nested - public static class ProducesSeparateTest extends JerseyTest { + class ProducesSeparateTest extends JerseyTest { @Override protected Application configure() { @@ -216,7 +216,7 @@ } @Nested - public static class ProducesXXXTest extends JerseyTest { + class ProducesXXXTest extends JerseyTest { @Override protected Application configure() {
diff --git a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EmptyRequestWithJaxbTest.java b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EmptyRequestWithJaxbTest.java index 74e4613..4577bcc 100644 --- a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EmptyRequestWithJaxbTest.java +++ b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/EmptyRequestWithJaxbTest.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025 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 @@ -96,7 +96,7 @@ } @Nested - public static class EmptyRequestTest extends JerseyTest { + class EmptyRequestTest extends JerseyTest { @Override protected Application configure() { @@ -162,7 +162,7 @@ } @Nested - public static class MappedJettisonCRTest extends JerseyTest { + class MappedJettisonCRTest extends JerseyTest { @Override protected Application configure() { @@ -174,7 +174,7 @@ config.register(JettisonFeature.class); } - public static class MappedJettisonCR extends CR { + class MappedJettisonCR extends CR { protected JAXBContext configure(Class[] classes) throws JAXBException { return new JettisonJaxbContext(JettisonConfig.mappedJettison().build(), classes); @@ -188,7 +188,7 @@ } @Nested - public static class BadgerFishCRTest extends JerseyTest { + class BadgerFishCRTest extends JerseyTest { @Override protected Application configure() { @@ -200,7 +200,7 @@ config.register(JettisonFeature.class); } - public static class BadgerFishCR extends CR { + class BadgerFishCR extends CR { protected JAXBContext configure(Class[] classes) throws JAXBException { return new JettisonJaxbContext(JettisonConfig.badgerFish().build(), classes);
diff --git a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/JAXBContextResolverTest.java b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/JAXBContextResolverTest.java index e56763f..a6b1a42 100644 --- a/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/JAXBContextResolverTest.java +++ b/tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/entity/JAXBContextResolverTest.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025 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 @@ -191,7 +191,7 @@ } @Nested - public static class UnmarshallerTest extends AbstractTypeTester { + class UnmarshallerTest extends AbstractTypeTester { private JAXBContextResolver cr; private MarshallerResolver mr; @@ -244,7 +244,7 @@ } @Nested - public static class JAXBContextAppTest extends AbstractTypeTester { + class JAXBContextAppTest extends AbstractTypeTester { private JAXBContextResolver cr; private JAXBContextResolverApp crApp; @@ -266,7 +266,7 @@ } @Nested - public static class UnmarshallerAppTest extends AbstractTypeTester { + class UnmarshallerAppTest extends AbstractTypeTester { private JAXBContextResolver cr; private MarshallerResolver mr; @@ -330,7 +330,7 @@ } @Nested - public static class JAXBContextTextTest extends AbstractTypeTester { + class JAXBContextTextTest extends AbstractTypeTester { private JAXBContextResolver cr; private JAXBContextResolverText crText; @@ -351,7 +351,7 @@ } @Nested - public static class UnmarshallerTextTest extends AbstractTypeTester { + class UnmarshallerTextTest extends AbstractTypeTester { private JAXBContextResolver cr; private MarshallerResolver mr; @@ -400,7 +400,7 @@ } @Nested - public static class UnmarshallerFooTest extends AbstractTypeTester { + class UnmarshallerFooTest extends AbstractTypeTester { private JAXBContextResolver cr; private MarshallerResolver mr; @@ -465,7 +465,7 @@ } @Nested - public static class JAXBContextAllTest extends AbstractTypeTester { + class JAXBContextAllTest extends AbstractTypeTester { private JAXBContextResolver cr; private JAXBContextResolverApp crApp; @@ -501,7 +501,7 @@ } @Nested - public static class UnmarshallerAllTest extends AbstractTypeTester { + class UnmarshallerAllTest extends AbstractTypeTester { private JAXBContextResolver cr; private JAXBContextResolverApp crApp; @@ -616,7 +616,7 @@ } @Nested - public static class JAXBContextAllWithOtherJaxbBeanTest extends AbstractTypeTester { + class JAXBContextAllWithOtherJaxbBeanTest extends AbstractTypeTester { private JAXBContextResolver cr; private JAXBContextResolverApp crApp;
diff --git a/tests/e2e-inject/cdi2-se/src/main/resources/META-INF/beans.xml b/tests/e2e-inject/cdi2-se/src/main/resources/META-INF/beans.xml index c2146b4..6591a9a 100644 --- a/tests/e2e-inject/cdi2-se/src/main/resources/META-INF/beans.xml +++ b/tests/e2e-inject/cdi2-se/src/main/resources/META-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2017, 2025 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
diff --git a/tests/e2e-testng/src/test/java/org/glassfish/jersey/tests/e2e/ContainerPerClassTest.java b/tests/e2e-testng/src/test/java/org/glassfish/jersey/tests/e2e/ContainerPerClassTest.java index 66ae84d..eba8422 100644 --- a/tests/e2e-testng/src/test/java/org/glassfish/jersey/tests/e2e/ContainerPerClassTest.java +++ b/tests/e2e-testng/src/test/java/org/glassfish/jersey/tests/e2e/ContainerPerClassTest.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025 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 @@ -27,8 +27,8 @@ import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTestNg; +import org.testng.Assert; import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; /** * Tests that container is created only once per class and each test method sends request to the same container. @@ -73,7 +73,7 @@ private void test(final Integer expected) { final Response response = target().request().get(); - assertEquals(response.getStatus(), 200); - assertEquals(response.readEntity(Integer.class), expected); + Assert.assertEquals(response.getStatus(), 200); + Assert.assertEquals(response.readEntity(Integer.class), expected); } }
diff --git a/tests/e2e-tls/pom.xml b/tests/e2e-tls/pom.xml index 51a907a..51be479 100644 --- a/tests/e2e-tls/pom.xml +++ b/tests/e2e-tls/pom.xml
@@ -97,7 +97,7 @@ <dependency> <groupId>io.specto</groupId> <artifactId>hoverfly-java-junit5</artifactId> - <version>0.18.1</version> + <version>0.20.2</version> <scope>test</scope> </dependency>
diff --git a/tests/e2e/src/test/java/org/glassfish/jersey/tests/api/Jersey5939Test.java b/tests/e2e/src/test/java/org/glassfish/jersey/tests/api/Jersey5939Test.java new file mode 100644 index 0000000..78f1ef4 --- /dev/null +++ b/tests/e2e/src/test/java/org/glassfish/jersey/tests/api/Jersey5939Test.java
@@ -0,0 +1,81 @@ +/* + * Copyright (c) 2025 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.tests.api; + +import org.glassfish.jersey.server.ContainerResponse; +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.test.JerseyTest; +import org.junit.jupiter.api.Test; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.container.ContainerResponseContext; +import jakarta.ws.rs.container.ContainerResponseFilter; +import jakarta.ws.rs.core.Application; +import jakarta.ws.rs.core.Response; +import java.io.IOException; +import java.lang.annotation.Annotation; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Check the reused response does not leak by additional Annotations (ContainerResponse#setEntityAnnottaions. + */ +public class Jersey5939Test extends JerseyTest { + + private final List<ContainerResponse> capturedResponses = new ArrayList<>(); + + @Override + protected Application configure() { + return new ResourceConfig(Restlet.class).register(new ContainerResponseFilter() { + @Override + public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) + throws IOException { + if (responseContext instanceof ContainerResponse) { + capturedResponses.add((ContainerResponse) responseContext); + } + } + }); + } + + @Test + public void testIssue5939() { + for (int i = 0; i < 10; i++) { + Response response = target("foo/bar").request().get(); + assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); + ContainerResponse containerResponse = capturedResponses.get(i); + Annotation[] annotations = containerResponse.getEntityAnnotations(); + // [@javax.ws.rs.GET(), @javax.ws.rs.Path("/bar")] + assertEquals(2, annotations.length, "Found " + annotations.length + " annotations, in iteration " + i); + } + } + + @Path("/foo") + public static class Restlet { + + private static final Response RESPONSE_204 = Response.noContent().build(); + + @GET + @Path("/bar") + public Response fooBar() { + return RESPONSE_204; + } + } +} \ No newline at end of file
diff --git a/tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/common/AutoDiscoverableTest.java b/tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/common/AutoDiscoverableTest.java index 3dea887..476c255 100644 --- a/tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/common/AutoDiscoverableTest.java +++ b/tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/common/AutoDiscoverableTest.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025 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 @@ -17,6 +17,9 @@ package org.glassfish.jersey.tests.e2e.common; import java.io.IOException; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.stream.Collectors; import jakarta.ws.rs.ConstrainedTo; import jakarta.ws.rs.POST; @@ -31,13 +34,20 @@ import jakarta.ws.rs.ext.WriterInterceptorContext; import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.internal.AutoDiscoverableConfigurator; +import org.glassfish.jersey.internal.BootstrapBag; +import org.glassfish.jersey.internal.ServiceFinder; +import org.glassfish.jersey.internal.inject.InjectionManager; +import org.glassfish.jersey.internal.inject.Injections; import org.glassfish.jersey.internal.spi.AutoDiscoverable; import org.glassfish.jersey.internal.util.PropertiesHelper; +import org.glassfish.jersey.model.internal.CommonConfig; +import org.glassfish.jersey.model.internal.ComponentBag; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; /** * Note: Auto-discoverables from this test "affects" all other tests in suit. @@ -133,6 +143,84 @@ public void testAutoDiscoverableConstrainedTo() throws Exception { final Response response = target().request().post(Entity.text("value")); - assertEquals("value-common-client-common-server", response.readEntity(String.class)); + Assertions.assertEquals("value-common-client-common-server", response.readEntity(String.class)); + } + + @Test + public void testServiceFinderIterator() { + Class<AutoDiscoverable>[] array = + ServiceFinder.service(AutoDiscoverable.class).runtimeType(RuntimeType.SERVER).find().toClassArray(); + int size = array.length; + + Assertions.assertTrue(size > 3); + + ServiceFinder<AutoDiscoverable> finder = + ServiceFinder.service(AutoDiscoverable.class).runtimeType(RuntimeType.SERVER).find(); + AutoDiscoverable next = null; + // check next() + final Iterator<AutoDiscoverable> it = finder.iterator(); + for (int i = 0; i != size; i++) { + AutoDiscoverable n = it.next(); + Assertions.assertNotSame(next, n); + next = n; + } + Assertions.assertThrows(NoSuchElementException.class, it::next); + + // check hasNext(); + final Iterator<AutoDiscoverable> it2 = finder.iterator(); + next = null; + for (int i = 0; i != size; i++) { + for (int j = 0; j != size + 1; j++) { + Assertions.assertTrue(it2.hasNext()); + } + AutoDiscoverable n = it2.next(); + Assertions.assertNotSame(next, n); + next = n; + } + Assertions.assertFalse(it2.hasNext()); + Assertions.assertThrows(NoSuchElementException.class, it2::next); + } + + @Test + public void testAutoDiscoverableConstrainedConfigurator() { + Class<?>[] array = ServiceFinder.find(AutoDiscoverable.class).toClassArray(); + Assertions.assertTrue(contains(ClientAutoDiscoverable.class, array)); + Assertions.assertTrue(contains(CommonAutoDiscoverable.class, array)); + Assertions.assertTrue(contains(ServerAutoDiscoverable.class, array)); + + array = ServiceFinder.service(AutoDiscoverable.class).find().toClassArray(); + Assertions.assertTrue(contains(ClientAutoDiscoverable.class, array)); + Assertions.assertTrue(contains(CommonAutoDiscoverable.class, array)); + Assertions.assertTrue(contains(ServerAutoDiscoverable.class, array)); + + array = ServiceFinder.service(AutoDiscoverable.class).runtimeType(RuntimeType.SERVER).find().toClassArray(); + Assertions.assertFalse(contains(ClientAutoDiscoverable.class, array)); + Assertions.assertTrue(contains(CommonAutoDiscoverable.class, array)); + Assertions.assertTrue(contains(ServerAutoDiscoverable.class, array)); + + array = ServiceFinder.service(AutoDiscoverable.class).runtimeType(RuntimeType.CLIENT).find().toClassArray(); + Assertions.assertTrue(contains(ClientAutoDiscoverable.class, array)); + Assertions.assertTrue(contains(CommonAutoDiscoverable.class, array)); + Assertions.assertFalse(contains(ServerAutoDiscoverable.class, array)); + + AutoDiscoverableConfigurator configurator = new AutoDiscoverableConfigurator(RuntimeType.SERVER); + InjectionManager injectionManager = Injections.createInjectionManager(); + BootstrapBag bb = new BootstrapBag(); + bb.setConfiguration(new CommonConfig(RuntimeType.SERVER, ComponentBag.INCLUDE_ALL)); + configurator.init(injectionManager, bb); + array = bb.getAutoDiscoverables().stream().map(ad -> ad.getClass()).collect(Collectors.toList()) + .toArray(new Class[0]); + Assertions.assertFalse(contains(ClientAutoDiscoverable.class, array)); + Assertions.assertTrue(contains(CommonAutoDiscoverable.class, array)); + Assertions.assertTrue(contains(ServerAutoDiscoverable.class, array)); + } + + private static boolean contains(Class<?> clazz, Class<?>... list) { + for (Class<?> listClass : list) { + if (listClass.equals(clazz)) { + return true; + } + } + return false; } }
diff --git a/tests/integration/cdi-integration/cdi-beanvalidation-webapp/src/main/java/org/glassfish/jersey/tests/cdi/bv/Hk2ValidationInterceptor.java b/tests/integration/cdi-integration/cdi-beanvalidation-webapp/src/main/java/org/glassfish/jersey/tests/cdi/bv/Hk2ValidationInterceptor.java index a531b9a..13d4c82 100644 --- a/tests/integration/cdi-integration/cdi-beanvalidation-webapp/src/main/java/org/glassfish/jersey/tests/cdi/bv/Hk2ValidationInterceptor.java +++ b/tests/integration/cdi-integration/cdi-beanvalidation-webapp/src/main/java/org/glassfish/jersey/tests/cdi/bv/Hk2ValidationInterceptor.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025 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 @@ -115,7 +115,7 @@ } /** - * Determines if a resource has a property of type {@code javax.mvc.validation.ValidationResult}. + * Determines if a resource has a property of type {@code jakarta.mvc.validation.ValidationResult}. * * @param resource resource instance. * @return outcome of test. @@ -125,7 +125,7 @@ } /** - * Returns a getter for {@code javax.mvc.validation.ValidationResult} or {@code null} + * Returns a getter for {@code jakarta.mvc.validation.ValidationResult} or {@code null} * if one cannot be found. * * @param resource resource instance. @@ -145,7 +145,7 @@ } /** - * Determines if a method is a getter for {@code javax.mvc.validation.ValidationResult}. + * Determines if a method is a getter for {@code jakarta.mvc.validation.ValidationResult}. * * @param m method to test. * @return outcome of test. @@ -157,7 +157,7 @@ } /** - * Returns a setter for {@code javax.mvc.validation.ValidationResult} or {@code null} + * Returns a setter for {@code jakarta.mvc.validation.ValidationResult} or {@code null} * if one cannot be found. * * @param resource resource instance. @@ -177,7 +177,7 @@ } /** - * Determines if a method is a setter for {@code javax.mvc.validation.ValidationResult}. + * Determines if a method is a setter for {@code jakarta.mvc.validation.ValidationResult}. * As a CDI initializer method, it must be annotated with {@link jakarta.inject.Inject}. * * @param m method to test.
diff --git a/tests/integration/cdi-integration/cdi-beanvalidation-webapp/src/main/java/org/glassfish/jersey/tests/cdi/bv/ValidationResultUtil.java b/tests/integration/cdi-integration/cdi-beanvalidation-webapp/src/main/java/org/glassfish/jersey/tests/cdi/bv/ValidationResultUtil.java index 498f91d..ce22760 100644 --- a/tests/integration/cdi-integration/cdi-beanvalidation-webapp/src/main/java/org/glassfish/jersey/tests/cdi/bv/ValidationResultUtil.java +++ b/tests/integration/cdi-integration/cdi-beanvalidation-webapp/src/main/java/org/glassfish/jersey/tests/cdi/bv/ValidationResultUtil.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025 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 @@ -27,7 +27,7 @@ import jakarta.validation.ConstraintViolation; /** - * Helper class to implement support for {@code javax.mvc.validation.ValidationResult}. + * Helper class to implement support for {@code jakarta.mvc.validation.ValidationResult}. * * @author Santiago Pericas-Geertsen */ @@ -41,7 +41,7 @@ } /** - * Search for a {@code javax.mvc.validation.ValidationResult} field in the resource's + * Search for a {@code jakarta.mvc.validation.ValidationResult} field in the resource's * class hierarchy. Field must be annotated with {@link jakarta.inject.Inject}. * * @param resource resource instance. @@ -63,7 +63,7 @@ } /** - * Updates a {@code javax.mvc.validation.ValidationResult} field. In pseudo-code: + * Updates a {@code jakarta.mvc.validation.ValidationResult} field. In pseudo-code: * <p/> * resource.field.setViolations(constraints) * @@ -92,7 +92,7 @@ } /** - * Updates a {@code javax.mvc.validation.ValidationResult} property. In pseudo-code: + * Updates a {@code jakarta.mvc.validation.ValidationResult} property. In pseudo-code: * <p/> * obj = getter.invoke(resource); * obj.setViolations(constraints); @@ -125,7 +125,7 @@ } /** - * Determines if a resource has a property of type {@code javax.mvc.validation.ValidationResult}. + * Determines if a resource has a property of type {@code jakarta.mvc.validation.ValidationResult}. * * @param resource resource instance. * @return outcome of test. @@ -135,7 +135,7 @@ } /** - * Returns a getter for {@code javax.mvc.validation.ValidationResult} or {@code null} + * Returns a getter for {@code jakarta.mvc.validation.ValidationResult} or {@code null} * if one cannot be found. * * @param resource resource instance. @@ -155,7 +155,7 @@ } /** - * Determines if a method is a getter for {@code javax.mvc.validation.ValidationResult}. + * Determines if a method is a getter for {@code jakarta.mvc.validation.ValidationResult}. * * @param m method to test. * @return outcome of test. @@ -167,7 +167,7 @@ } /** - * Returns a setter for {@code javax.mvc.validation.ValidationResult} or {@code null} + * Returns a setter for {@code jakarta.mvc.validation.ValidationResult} or {@code null} * if one cannot be found. * * @param resource resource instance. @@ -191,7 +191,7 @@ } /** - * Determines if a method is a setter for {@code javax.mvc.validation.ValidationResult}. + * Determines if a method is a setter for {@code jakarta.mvc.validation.ValidationResult}. * As a CDI initializer method, it must be annotated with {@link jakarta.inject.Inject}. * * @param m method to test.
diff --git a/tests/integration/cdi-integration/cdi-beanvalidation-webapp/src/main/resources/META-INF/beans.xml b/tests/integration/cdi-integration/cdi-beanvalidation-webapp/src/main/resources/META-INF/beans.xml index 14ea61e..5d27f02 100644 --- a/tests/integration/cdi-integration/cdi-beanvalidation-webapp/src/main/resources/META-INF/beans.xml +++ b/tests/integration/cdi-integration/cdi-beanvalidation-webapp/src/main/resources/META-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2025 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 @@ -17,4 +17,9 @@ --> -<beans/> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans>
diff --git a/tests/integration/cdi-integration/cdi-beanvalidation-webapp/src/main/webapp/WEB-INF/beans.xml b/tests/integration/cdi-integration/cdi-beanvalidation-webapp/src/main/webapp/WEB-INF/beans.xml index 2b8160f..3587fee 100644 --- a/tests/integration/cdi-integration/cdi-beanvalidation-webapp/src/main/webapp/WEB-INF/beans.xml +++ b/tests/integration/cdi-integration/cdi-beanvalidation-webapp/src/main/webapp/WEB-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2015, 2021 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2015, 2025 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 @@ -17,5 +17,10 @@ --> -<beans/> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans>
diff --git a/tests/integration/cdi-integration/cdi-client-on-server/src/main/resources/META-INF/beans.xml b/tests/integration/cdi-integration/cdi-client-on-server/src/main/resources/META-INF/beans.xml index dc38505..f105124 100644 --- a/tests/integration/cdi-integration/cdi-client-on-server/src/main/resources/META-INF/beans.xml +++ b/tests/integration/cdi-integration/cdi-client-on-server/src/main/resources/META-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2021, 2025 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 @@ -17,11 +17,10 @@ --> - -<beans - xmlns="http://java.sun.com/xml/ns/javaee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee - http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> </beans>
diff --git a/tests/integration/cdi-integration/cdi-ejb-test-webapp/src/main/webapp/WEB-INF/beans.xml b/tests/integration/cdi-integration/cdi-ejb-test-webapp/src/main/webapp/WEB-INF/beans.xml index 14ea61e..5d27f02 100644 --- a/tests/integration/cdi-integration/cdi-ejb-test-webapp/src/main/webapp/WEB-INF/beans.xml +++ b/tests/integration/cdi-integration/cdi-ejb-test-webapp/src/main/webapp/WEB-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2025 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 @@ -17,4 +17,9 @@ --> -<beans/> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans>
diff --git a/tests/integration/cdi-integration/cdi-iface-with-non-jaxrs-impl-test-webapp/src/main/webapp/WEB-INF/beans.xml b/tests/integration/cdi-integration/cdi-iface-with-non-jaxrs-impl-test-webapp/src/main/webapp/WEB-INF/beans.xml index 14ea61e..5d27f02 100644 --- a/tests/integration/cdi-integration/cdi-iface-with-non-jaxrs-impl-test-webapp/src/main/webapp/WEB-INF/beans.xml +++ b/tests/integration/cdi-integration/cdi-iface-with-non-jaxrs-impl-test-webapp/src/main/webapp/WEB-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2025 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 @@ -17,4 +17,9 @@ --> -<beans/> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans>
diff --git a/tests/integration/cdi-integration/cdi-log-check/src/main/resources/META-INF/beans.xml b/tests/integration/cdi-integration/cdi-log-check/src/main/resources/META-INF/beans.xml index ea4422d..7ab8f3c 100644 --- a/tests/integration/cdi-integration/cdi-log-check/src/main/resources/META-INF/beans.xml +++ b/tests/integration/cdi-integration/cdi-log-check/src/main/resources/META-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2019, 2025 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 @@ -18,11 +18,11 @@ --> -<beans - xmlns="http://java.sun.com/xml/ns/javaee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee - http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> <interceptors> <class>org.glassfish.jersey.tests.cdi.resources.FooInterceptor</class> </interceptors>
diff --git a/tests/integration/cdi-integration/cdi-multimodule/lib/src/main/resources/META-INF/beans.xml b/tests/integration/cdi-integration/cdi-multimodule/lib/src/main/resources/META-INF/beans.xml index 449fa1c..ae2af10 100644 --- a/tests/integration/cdi-integration/cdi-multimodule/lib/src/main/resources/META-INF/beans.xml +++ b/tests/integration/cdi-integration/cdi-multimodule/lib/src/main/resources/META-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2015, 2021 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2015, 2025 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 @@ -17,4 +17,9 @@ --> -<beans/> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans>
diff --git a/tests/integration/cdi-integration/cdi-multipart-webapp/src/main/webapp/WEB-INF/beans.xml b/tests/integration/cdi-integration/cdi-multipart-webapp/src/main/webapp/WEB-INF/beans.xml index c8df7fe..6f19892 100644 --- a/tests/integration/cdi-integration/cdi-multipart-webapp/src/main/webapp/WEB-INF/beans.xml +++ b/tests/integration/cdi-integration/cdi-multipart-webapp/src/main/webapp/WEB-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2014, 2021 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2014, 2025 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 @@ -17,4 +17,9 @@ --> -<beans/> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans>
diff --git a/tests/integration/cdi-integration/cdi-test-webapp/src/main/resources/META-INF/beans.xml b/tests/integration/cdi-integration/cdi-test-webapp/src/main/resources/META-INF/beans.xml index 8d3e4b2..5d27f02 100644 --- a/tests/integration/cdi-integration/cdi-test-webapp/src/main/resources/META-INF/beans.xml +++ b/tests/integration/cdi-integration/cdi-test-webapp/src/main/resources/META-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2025 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
diff --git a/tests/integration/cdi-integration/cdi-test-webapp/src/main/webapp/WEB-INF/beans.xml b/tests/integration/cdi-integration/cdi-test-webapp/src/main/webapp/WEB-INF/beans.xml index 8d3e4b2..5d27f02 100644 --- a/tests/integration/cdi-integration/cdi-test-webapp/src/main/webapp/WEB-INF/beans.xml +++ b/tests/integration/cdi-integration/cdi-test-webapp/src/main/webapp/WEB-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2025 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
diff --git a/tests/integration/cdi-integration/cdi-with-jersey-injection-custom-cfg-webapp/src/main/webapp/WEB-INF/beans.xml b/tests/integration/cdi-integration/cdi-with-jersey-injection-custom-cfg-webapp/src/main/webapp/WEB-INF/beans.xml index 14ea61e..5d27f02 100644 --- a/tests/integration/cdi-integration/cdi-with-jersey-injection-custom-cfg-webapp/src/main/webapp/WEB-INF/beans.xml +++ b/tests/integration/cdi-integration/cdi-with-jersey-injection-custom-cfg-webapp/src/main/webapp/WEB-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2025 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 @@ -17,4 +17,9 @@ --> -<beans/> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans>
diff --git a/tests/integration/cdi-integration/cdi-with-jersey-injection-custom-hk2-banned-webapp/src/main/webapp/WEB-INF/beans.xml b/tests/integration/cdi-integration/cdi-with-jersey-injection-custom-hk2-banned-webapp/src/main/webapp/WEB-INF/beans.xml index 14ea61e..5d27f02 100644 --- a/tests/integration/cdi-integration/cdi-with-jersey-injection-custom-hk2-banned-webapp/src/main/webapp/WEB-INF/beans.xml +++ b/tests/integration/cdi-integration/cdi-with-jersey-injection-custom-hk2-banned-webapp/src/main/webapp/WEB-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2025 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 @@ -17,4 +17,9 @@ --> -<beans/> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans>
diff --git a/tests/integration/cdi-integration/cdi-with-jersey-injection-webapp/src/main/webapp/WEB-INF/beans.xml b/tests/integration/cdi-integration/cdi-with-jersey-injection-webapp/src/main/webapp/WEB-INF/beans.xml index 14ea61e..5d27f02 100644 --- a/tests/integration/cdi-integration/cdi-with-jersey-injection-webapp/src/main/webapp/WEB-INF/beans.xml +++ b/tests/integration/cdi-integration/cdi-with-jersey-injection-webapp/src/main/webapp/WEB-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2025 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 @@ -17,4 +17,9 @@ --> -<beans/> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans>
diff --git a/tests/integration/ejb-multimodule-reload/lib/src/main/resources/META-INF/beans.xml b/tests/integration/ejb-multimodule-reload/lib/src/main/resources/META-INF/beans.xml index 3b46d69..ae2af10 100644 --- a/tests/integration/ejb-multimodule-reload/lib/src/main/resources/META-INF/beans.xml +++ b/tests/integration/ejb-multimodule-reload/lib/src/main/resources/META-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2015, 2025 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 @@ -17,4 +17,9 @@ --> -<beans/> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans>
diff --git a/tests/integration/ejb-multimodule-reload/war1/src/main/resources/META-INF/beans.xml b/tests/integration/ejb-multimodule-reload/war1/src/main/resources/META-INF/beans.xml index 07df368..5d27f02 100644 --- a/tests/integration/ejb-multimodule-reload/war1/src/main/resources/META-INF/beans.xml +++ b/tests/integration/ejb-multimodule-reload/war1/src/main/resources/META-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2025 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 @@ -17,4 +17,9 @@ --> -<beans/> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans>
diff --git a/tests/integration/ejb-multimodule-reload/war2/src/main/resources/META-INF/beans.xml b/tests/integration/ejb-multimodule-reload/war2/src/main/resources/META-INF/beans.xml index 07df368..5d27f02 100644 --- a/tests/integration/ejb-multimodule-reload/war2/src/main/resources/META-INF/beans.xml +++ b/tests/integration/ejb-multimodule-reload/war2/src/main/resources/META-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2025 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 @@ -17,4 +17,9 @@ --> -<beans/> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans>
diff --git a/tests/integration/j-376/src/main/resources/META-INF/beans.xml b/tests/integration/j-376/src/main/resources/META-INF/beans.xml index 3b46d69..ae2af10 100644 --- a/tests/integration/j-376/src/main/resources/META-INF/beans.xml +++ b/tests/integration/j-376/src/main/resources/META-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2015, 2025 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 @@ -17,4 +17,9 @@ --> -<beans/> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans>
diff --git a/tests/integration/j-441/war1/src/main/webapp/WEB-INF/beans.xml b/tests/integration/j-441/war1/src/main/webapp/WEB-INF/beans.xml index 93cfed7..825ac0c 100644 --- a/tests/integration/j-441/war1/src/main/webapp/WEB-INF/beans.xml +++ b/tests/integration/j-441/war1/src/main/webapp/WEB-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2015, 2025 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 @@ -17,7 +17,9 @@ --> -<beans xmlns="http://java.sun.com/xml/ns/javaee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> -</beans> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans> \ No newline at end of file
diff --git a/tests/integration/j-441/war2/src/main/webapp/WEB-INF/beans.xml b/tests/integration/j-441/war2/src/main/webapp/WEB-INF/beans.xml index 93cfed7..825ac0c 100644 --- a/tests/integration/j-441/war2/src/main/webapp/WEB-INF/beans.xml +++ b/tests/integration/j-441/war2/src/main/webapp/WEB-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2015, 2025 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 @@ -17,7 +17,9 @@ --> -<beans xmlns="http://java.sun.com/xml/ns/javaee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> -</beans> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans> \ No newline at end of file
diff --git a/tests/integration/j-59/war/pom.xml b/tests/integration/j-59/war/pom.xml index 1b5187a..82326d8 100644 --- a/tests/integration/j-59/war/pom.xml +++ b/tests/integration/j-59/war/pom.xml
@@ -68,7 +68,7 @@ <dependency> <groupId>jakarta.jws</groupId> <artifactId>jakarta.jws-api</artifactId> - <version>1.1.1</version> + <version>3.0.0</version> </dependency> </dependencies>
diff --git a/tests/integration/j-59/war/src/main/java/org/glassfish/jersey/tests/integration/j59/cdi/web/CdiBackedResource.java b/tests/integration/j-59/war/src/main/java/org/glassfish/jersey/tests/integration/j59/cdi/web/CdiBackedResource.java index 6210ac4..1992aae 100644 --- a/tests/integration/j-59/war/src/main/java/org/glassfish/jersey/tests/integration/j59/cdi/web/CdiBackedResource.java +++ b/tests/integration/j-59/war/src/main/java/org/glassfish/jersey/tests/integration/j59/cdi/web/CdiBackedResource.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025 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 @@ -19,7 +19,7 @@ import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; -import javax.jws.WebResult; +import jakarta.jws.WebResult; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path;
diff --git a/tests/integration/j-59/war/src/main/webapp/WEB-INF/beans.xml b/tests/integration/j-59/war/src/main/webapp/WEB-INF/beans.xml index 6d5c2c1..8d6656d 100644 --- a/tests/integration/j-59/war/src/main/webapp/WEB-INF/beans.xml +++ b/tests/integration/j-59/war/src/main/webapp/WEB-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2014, 2025 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 @@ -17,7 +17,9 @@ --> -<beans xmlns="http://java.sun.com/xml/ns/javaee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> </beans>
diff --git a/tests/integration/jersey-2137/src/main/webapp/WEB-INF/beans.xml b/tests/integration/jersey-2137/src/main/webapp/WEB-INF/beans.xml index 07df368..5d27f02 100644 --- a/tests/integration/jersey-2137/src/main/webapp/WEB-INF/beans.xml +++ b/tests/integration/jersey-2137/src/main/webapp/WEB-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2025 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 @@ -17,4 +17,9 @@ --> -<beans/> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans>
diff --git a/tests/integration/jersey-2137/src/test/java/org/glassfish/jersey/tests/integration/jersey2137/WaeExceptionMappingTest.java b/tests/integration/jersey-2137/src/test/java/org/glassfish/jersey/tests/integration/jersey2137/WaeExceptionMappingTest.java index 5a1a631..a91df15 100644 --- a/tests/integration/jersey-2137/src/test/java/org/glassfish/jersey/tests/integration/jersey2137/WaeExceptionMappingTest.java +++ b/tests/integration/jersey-2137/src/test/java/org/glassfish/jersey/tests/integration/jersey2137/WaeExceptionMappingTest.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025 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 @@ -51,7 +51,7 @@ } /** - * Test all {@javax.transaction.Transactional} + * Test all {@jakarta.transaction.Transactional} * annotated CDI beans. The test scenario is as follows. * Set two accounts via the CDI bean that avoids rollback. * Should any rollback happen there, we would not be able
diff --git a/tests/integration/jersey-2154/src/main/webapp/WEB-INF/beans.xml b/tests/integration/jersey-2154/src/main/webapp/WEB-INF/beans.xml index 07df368..5d27f02 100644 --- a/tests/integration/jersey-2154/src/main/webapp/WEB-INF/beans.xml +++ b/tests/integration/jersey-2154/src/main/webapp/WEB-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2013, 2025 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 @@ -17,4 +17,9 @@ --> -<beans/> +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" + bean-discovery-mode="all"> +</beans>
diff --git a/tests/integration/jersey-4542/src/test/resources/META-INF/beans.xml b/tests/integration/jersey-4542/src/test/resources/META-INF/beans.xml index d6b4b48..fec2dcc 100644 --- a/tests/integration/jersey-4542/src/test/resources/META-INF/beans.xml +++ b/tests/integration/jersey-4542/src/test/resources/META-INF/beans.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2020, 2025 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
diff --git a/tests/performance/test-cases/monitoring/pom.xml b/tests/performance/test-cases/monitoring/pom.xml index d5b84bd..04d00ad 100644 --- a/tests/performance/test-cases/monitoring/pom.xml +++ b/tests/performance/test-cases/monitoring/pom.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2014, 2025 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 @@ -30,6 +30,7 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <jersey.version>2.47</jersey.version> </properties> <dependencies> @@ -43,31 +44,32 @@ <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter</artifactId> - <version>5.10.2</version> + <version>5.13.4</version> <scope>test</scope> </dependency> <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.6</version> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.18.0</version> </dependency> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> - <version>1.17.0</version> + <version>1.19.0</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-jdk14</artifactId> - <version>2.0.13</version> + <version>2.0.17</version> </dependency> <dependency> <groupId>org.glassfish.jersey.containers</groupId> <artifactId>jersey-container-grizzly2-http</artifactId> + <version>${jersey.version}</version> </dependency> </dependencies> @@ -88,7 +90,7 @@ <phase>package</phase> <!-- append to the packaging phase. --> <goals> - <goal>attached</goal> + <goal>single</goal> <!-- goals == mojos --> </goals> </execution> @@ -97,7 +99,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>3.13.0</version> + <version>3.14.0</version> <inherited>true</inherited> <configuration> <source>1.8</source>
diff --git a/tests/performance/test-cases/monitoring/src/main/assembly/zip-with-jars.xml b/tests/performance/test-cases/monitoring/src/main/assembly/zip-with-jars.xml new file mode 100644 index 0000000..1b42712 --- /dev/null +++ b/tests/performance/test-cases/monitoring/src/main/assembly/zip-with-jars.xml
@@ -0,0 +1,35 @@ +<!-- + + Copyright (c) 2025 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 + +--> + +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>zip-with-jars</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <dependencySets> + <dependencySet> + <outputDirectory>/</outputDirectory> + <useProjectArtifact>true</useProjectArtifact> + <unpack>false</unpack> + <scope>runtime</scope> + </dependencySet> + </dependencySets> +</assembly>
diff --git a/tests/release-test/pom.xml b/tests/release-test/pom.xml index 07ffef2..e075457 100644 --- a/tests/release-test/pom.xml +++ b/tests/release-test/pom.xml
@@ -55,6 +55,7 @@ <includes> <include>**/ArchetypesTest</include> <include>**/NoticeFilesTest</include> + <include>**/JavaxOccurrenceTest</include> </includes> </configuration> </plugin>
diff --git a/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/JavaxOccurrenceTest.java b/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/JavaxOccurrenceTest.java new file mode 100644 index 0000000..9a94141 --- /dev/null +++ b/tests/release-test/src/test/java/org/glassfish/jersey/test/artifacts/JavaxOccurrenceTest.java
@@ -0,0 +1,141 @@ +/* + * Copyright (c) 2025 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.test.artifacts; + +import org.glassfish.jersey.message.internal.ReaderWriter; +import org.junit.Assert; +import org.junit.Test; + +import java.io.IOException; +import java.nio.file.FileVisitResult; +import java.nio.file.FileVisitor; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.stream.Stream; + +public class JavaxOccurrenceTest { + + private static final String[] packages = {"javax.ws.rs"}; + + @Test + public void testSources() throws IOException { + TestResult result = new TestResult(); + Path root = Paths.get(".").toAbsolutePath().getParent().getParent().getParent(); + Assert.assertTrue(Files.exists(root) && Files.isDirectory(root)); + Files.walkFileTree(root, new FileVisitor<>() { + @Override + public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { + if (isSourceFolder(dir)) { + result.ok().append("parsing ").println(dir.toString()); + Files.walkFileTree(dir.resolve("main"), new SrcWalker(result)); + return FileVisitResult.CONTINUE; + } else if (isModule(dir)) { + return FileVisitResult.CONTINUE; + } else { + return FileVisitResult.SKIP_SUBTREE; + } + } + + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + return FileVisitResult.CONTINUE; + } + + @Override + public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { + return FileVisitResult.CONTINUE; + } + + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { + return FileVisitResult.CONTINUE; + } + }); + + if (result.exception().builder.length() == 0) { + result.ok().append("All java files are Jakartified correctly"); + } + if (!result.result()) { + Assert.fail(); + } + } + + private static class SrcWalker implements FileVisitor<Path> { + + private final TestResult testResult; + + private SrcWalker(TestResult testResult) { + this.testResult = testResult; + } + + @Override + public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { + String path = dir.toAbsolutePath().toString(); + boolean cont = (path.contains("main") || path.contains("test")) && !path.contains("resources"); + return cont ? FileVisitResult.CONTINUE : FileVisitResult.SKIP_SUBTREE; + } + + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + if (file.toString().endsWith(".java")) { + parseFile(file, testResult); + } + return FileVisitResult.CONTINUE; + } + + @Override + public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { + return FileVisitResult.CONTINUE; + } + + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { + return FileVisitResult.CONTINUE; + } + } + + private static boolean isModule(Path path) throws IOException { + try (Stream<Path> stream = Files.list(path)) { + return stream.anyMatch(path1 -> path1.getFileName().toString().equals("pom.xml")); + } + } + + private static boolean isSourceFolder(Path path) { + return path.getFileName().startsWith("src"); + } + + private static void parseFile(Path path, TestResult testResult) throws IOException { + String file = path.toString(); + if (file.contains("MetricsRequestEventListener") || file.contains("ObservationRequestEventListener")) { + // these contain both javax && jakarta + return; + } + for (String row : ReaderWriter.readFromAsString(Files.newBufferedReader(path)).split("\n")) { + parseRow(file, row, testResult); + } + } + + private static void parseRow(String path, String row, TestResult result) { + for (String pkg : packages) { + if (row.contains(pkg)) { + result.exception().append("Error in file ").append(path).append(" - contains ").println(pkg); + } + } + } +}
diff --git a/tools/jersey-release-notes-maven-plugin/pom.xml b/tools/jersey-release-notes-maven-plugin/pom.xml index dfd342b..acd6678 100644 --- a/tools/jersey-release-notes-maven-plugin/pom.xml +++ b/tools/jersey-release-notes-maven-plugin/pom.xml
@@ -136,6 +136,6 @@ <java.version>1.8</java.version> <maven.version>3.9.9</maven.version> <commons.io.version>2.19.0</commons.io.version> - <junit.version>5.12.2</junit.version> + <junit.version>5.13.3</junit.version> </properties> </project>