diff --git a/README.md b/README.md index 8cf70135..dcf230be 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ for easy development of WebSocket applications.Eclipse Tyrus is also a Jakarta WebSocket 2.0 compatible implementation. WebSocket protocol defined by IETF -provides bi-directional communication between the server and the remote host. The +provides bidirectional communication between the server and the remote host. The pros are mainly the ability to communicate both ways, low latency and small -communication overhead. Therefore Tyrus and WebSocket in general are suitable for web +communication overhead. Therefore, Tyrus and WebSocket in general are suitable for web applications that require sending a huge volume of relatively small messages like online games or market ticker broadcasting. @@ -20,6 +20,15 @@ online games or market ticker broadcasting. Building Tyrus can be done using `mvn clean install`, but sometimes (such as for building 2.x from a tag) `mvn clean install -Pstaging` would be required. +## Tyrus Git Branches + +| branch | Jakarta Version | Tyrus Version | +|--------|---------------------------------|---------------| +| master | Java EE 8 / Jakarta EE 8 branch | Tyrus 1.x | +| 2.0.x | Jakarta EE 9 branch | Tyrus 2.0.x | +| 2.1.x | Jakarta EE 10 branch | Tyrus 2.1.x | +| 2.x | Jakarta EE 11 branch | Tyrus 2.2.x | + ## Licensing - [Eclipse Public License 2.0](https://projects.eclipse.org/license/epl-2.0) diff --git a/client/src/main/java/module-info.java b/client/src/main/java/module-info.java index 1eb023ed..41929675 100644 --- a/client/src/main/java/module-info.java +++ b/client/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -26,4 +26,5 @@ exports org.glassfish.tyrus.client; exports org.glassfish.tyrus.client.auth; + exports org.glassfish.tyrus.client.exception; } \ No newline at end of file diff --git a/client/src/main/java/org/glassfish/tyrus/client/ClientManager.java b/client/src/main/java/org/glassfish/tyrus/client/ClientManager.java index b854523f..98958c47 100755 --- a/client/src/main/java/org/glassfish/tyrus/client/ClientManager.java +++ b/client/src/main/java/org/glassfish/tyrus/client/ClientManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -42,6 +42,7 @@ import jakarta.websocket.Session; import jakarta.websocket.WebSocketContainer; +import org.glassfish.tyrus.client.exception.Exceptions; import org.glassfish.tyrus.core.AnnotatedEndpoint; import org.glassfish.tyrus.core.BaseContainer; import org.glassfish.tyrus.core.ComponentProviderService; @@ -52,6 +53,7 @@ import org.glassfish.tyrus.core.TyrusFuture; import org.glassfish.tyrus.core.TyrusSession; import org.glassfish.tyrus.core.Utils; +import org.glassfish.tyrus.core.collection.SupplierWithEx; import org.glassfish.tyrus.core.monitoring.EndpointEventListener; import org.glassfish.tyrus.spi.ClientContainer; import org.glassfish.tyrus.spi.ClientEngine; @@ -288,81 +290,46 @@ public boolean evaluate() { } @Override - public Session connectToServer(Class annotatedEndpointClass, URI path) throws DeploymentException, IOException { + public Session connectToServer(final Class annotatedEndpointClass, final URI path) throws DeploymentException, IOException { if (annotatedEndpointClass.getAnnotation(ClientEndpoint.class) == null) { throw new DeploymentException( String.format( "Class argument in connectToServer(Class, URI) is to be annotated endpoint class. Class " + "%s does not have @ClientEndpoint", annotatedEndpointClass.getName())); } - try { - return connectToServer(annotatedEndpointClass, null, path.toString(), true).get(); - } catch (InterruptedException e) { - throw new DeploymentException(e.getMessage(), e); - } catch (ExecutionException e) { - final Throwable cause = e.getCause(); - if (cause instanceof DeploymentException) { - throw (DeploymentException) cause; - } else if (cause instanceof IOException) { - throw (IOException) cause; - } else { - throw new DeploymentException(cause.getMessage(), cause); - } - } + return tryCatchInterruptedExecutionEx(() -> connectToServer(annotatedEndpointClass, null, path.toString(), true)); } @Override - public Session connectToServer(Class endpointClass, ClientEndpointConfig cec, URI path) throws - DeploymentException, IOException { - try { - return connectToServer(endpointClass, cec, path.toString(), true).get(); - } catch (InterruptedException e) { - throw new DeploymentException(e.getMessage(), e); - } catch (ExecutionException e) { - final Throwable cause = e.getCause(); - if (cause instanceof DeploymentException) { - throw (DeploymentException) cause; - } else if (cause instanceof IOException) { - throw (IOException) cause; - } else { - throw new DeploymentException(cause.getMessage(), cause); - } - } + public Session connectToServer(final Class endpointClass, + final ClientEndpointConfig cec, + final URI path) throws DeploymentException, IOException { + return tryCatchInterruptedExecutionEx(() -> connectToServer(endpointClass, cec, path.toString(), true)); } @Override - public Session connectToServer(Endpoint endpointInstance, ClientEndpointConfig cec, URI path) throws + public Session connectToServer(final Endpoint endpointInstance, final ClientEndpointConfig cec, final URI path) throws DeploymentException, IOException { - try { - return connectToServer(endpointInstance, cec, path.toString(), true).get(); - } catch (InterruptedException e) { - throw new DeploymentException(e.getMessage(), e); - } catch (ExecutionException e) { - final Throwable cause = e.getCause(); - if (cause instanceof DeploymentException) { - throw (DeploymentException) cause; - } else if (cause instanceof IOException) { - throw (IOException) cause; - } else { - throw new DeploymentException(cause.getMessage(), cause); - } - } + return tryCatchInterruptedExecutionEx(() -> connectToServer(endpointInstance, cec, path.toString(), true)); } @Override - public Session connectToServer(Object obj, URI path) throws DeploymentException, IOException { + public Session connectToServer(final Object obj, final URI path) throws DeploymentException, IOException { + return tryCatchInterruptedExecutionEx(() -> connectToServer(obj, null, path.toString(), true)); + } + + private Session tryCatchInterruptedExecutionEx(SupplierWithEx, DeploymentException> supplier) + throws DeploymentException, IOException { try { - return connectToServer(obj, null, path.toString(), true).get(); + return supplier.get().get(); } catch (InterruptedException e) { throw new DeploymentException(e.getMessage(), e); } catch (ExecutionException e) { final Throwable cause = e.getCause(); - if (cause instanceof DeploymentException) { - throw (DeploymentException) cause; - } else if (cause instanceof IOException) { + if (cause instanceof IOException) { throw (IOException) cause; } else { - throw new DeploymentException(cause.getMessage(), cause); + throw Exceptions.deploymentException(cause.getMessage(), cause); } } } @@ -652,11 +619,7 @@ public void onClose(TyrusSession session, if (countedDown) { final Throwable exception = listener.getThrowable(); if (exception != null) { - if (exception instanceof DeploymentException) { - throw (DeploymentException) exception; - } else { - throw new DeploymentException("Handshake error.", exception); - } + throw Exceptions.deploymentException("Handshake error.", exception); } future.setResult(listener.getSession()); @@ -669,10 +632,8 @@ public void onClose(TyrusSession session, timeoutHandler.handleTimeout(); } } - } catch (DeploymentException e) { - throw e; } catch (Exception e) { - throw new DeploymentException("Handshake response not received.", e); + throw Exceptions.deploymentException("Handshake response not received.", e); } throw new DeploymentException("Handshake response not received."); diff --git a/client/src/main/java/org/glassfish/tyrus/client/TyrusClientEngine.java b/client/src/main/java/org/glassfish/tyrus/client/TyrusClientEngine.java index 9af08475..b3d34b01 100644 --- a/client/src/main/java/org/glassfish/tyrus/client/TyrusClientEngine.java +++ b/client/src/main/java/org/glassfish/tyrus/client/TyrusClientEngine.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -65,6 +65,7 @@ import org.glassfish.tyrus.spi.ClientEngine; import org.glassfish.tyrus.spi.Connection; import org.glassfish.tyrus.spi.ReadHandler; +import org.glassfish.tyrus.spi.TyrusClientEndpointConfigurator; import org.glassfish.tyrus.spi.UpgradeRequest; import org.glassfish.tyrus.spi.UpgradeResponse; import org.glassfish.tyrus.spi.Writer; @@ -169,6 +170,9 @@ public UpgradeRequest createUpgradeRequest(TimeoutHandler timeoutHandler) { clientHandShake.prepareRequest(); UpgradeRequest upgradeRequest = clientHandShake.getRequest(); + if (TyrusClientEndpointConfigurator.class.isInstance(config.getConfigurator())) { + ((TyrusClientEndpointConfigurator) config.getConfigurator()).beforeRequest(upgradeRequest); + } config.getConfigurator().beforeRequest(upgradeRequest.getHeaders()); clientEngineState = TyrusClientEngineState.UPGRADE_REQUEST_CREATED; @@ -251,6 +255,7 @@ public ClientUpgradeInfo processResponse(final UpgradeResponse upgradeResponse, throw new IllegalArgumentException(LocalizationMessages.ARGUMENT_NOT_NULL("upgradeResponse")); } + final ClientEngine.ClientUpgradeInfo upgradeInfo; switch (upgradeResponse.getStatus()) { case 101: return handleSwitchProtocol(upgradeResponse, writer, closeListener); @@ -262,7 +267,8 @@ public ClientUpgradeInfo processResponse(final UpgradeResponse upgradeResponse, case 308: return handleRedirect(upgradeResponse); case 401: - return handleAuth(upgradeResponse); + upgradeInfo = handleAuth(upgradeResponse); + break; case 503: // get Retry-After header @@ -293,19 +299,21 @@ public ClientUpgradeInfo processResponse(final UpgradeResponse upgradeResponse, listener.onError(new RetryAfterException( LocalizationMessages.HANDSHAKE_HTTP_RETRY_AFTER_MESSAGE(), delay)); - return UPGRADE_INFO_FAILED; + upgradeInfo = UPGRADE_INFO_FAILED; + break; default: - ((ClientEndpointConfig) endpointWrapper.getEndpointConfig()).getConfigurator().afterResponse(upgradeResponse); - clientEngineState = TyrusClientEngineState.FAILED; HandshakeException e = new HandshakeException( upgradeResponse.getStatus(), LocalizationMessages.INVALID_RESPONSE_CODE(101, upgradeResponse.getStatus())); listener.onError(e); redirectUriHistory.clear(); - return UPGRADE_INFO_FAILED; + upgradeInfo = UPGRADE_INFO_FAILED; + break; } + ((ClientEndpointConfig) endpointWrapper.getEndpointConfig()).getConfigurator().afterResponse(upgradeResponse); + return upgradeInfo; } redirectUriHistory.clear(); diff --git a/client/src/main/java/org/glassfish/tyrus/client/exception/DeploymentHandshakeException.java b/client/src/main/java/org/glassfish/tyrus/client/exception/DeploymentHandshakeException.java new file mode 100644 index 00000000..218a1e84 --- /dev/null +++ b/client/src/main/java/org/glassfish/tyrus/client/exception/DeploymentHandshakeException.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2023, 2024 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.glassfish.tyrus.client.exception; + +import org.glassfish.tyrus.core.HandshakeException; + +import jakarta.websocket.DeploymentException; + +/** + * The {@link DeploymentException} wrapping the {@link HandshakeException} and makes the HTTP status code accessible directly. + */ +public class DeploymentHandshakeException extends DeploymentException { + + public DeploymentHandshakeException(String message) { + super(message); + } + + public DeploymentHandshakeException(String message, HandshakeException cause) { + super(message, cause); + } + + /** + * Get the error code. + * + * @return the error code. + */ + public int getHttpStatusCode() { + return ((HandshakeException) getCause()).getHttpStatusCode(); + } +} diff --git a/client/src/main/java/org/glassfish/tyrus/client/exception/Exceptions.java b/client/src/main/java/org/glassfish/tyrus/client/exception/Exceptions.java new file mode 100644 index 00000000..4c034061 --- /dev/null +++ b/client/src/main/java/org/glassfish/tyrus/client/exception/Exceptions.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023, 2024 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.glassfish.tyrus.client.exception; + +import org.glassfish.tyrus.core.HandshakeException; + +import jakarta.websocket.DeploymentException; + +/** + * Converts the exceptions into more specific ones. + */ +public class Exceptions { + + /** + * Get the Deployment Exception, or return the exception if of the type. + * @param message The Exception message + * @param cause The Cause Exception + * @return a Deployment exception. + */ + public static DeploymentException deploymentException(String message, Throwable cause) { + if (DeploymentException.class.isInstance(cause)) { + return (DeploymentException) cause; + } else if (HandshakeException.class.isInstance(cause)) { + return new DeploymentHandshakeException(message, (HandshakeException) cause); + } else { + return new DeploymentException(message, cause); + } + } +} diff --git a/client/src/main/java/org/glassfish/tyrus/client/exception/package-info.java b/client/src/main/java/org/glassfish/tyrus/client/exception/package-info.java new file mode 100644 index 00000000..ef976ea1 --- /dev/null +++ b/client/src/main/java/org/glassfish/tyrus/client/exception/package-info.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2023, 2024 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/** + * Common Client Exceptions + */ +package org.glassfish.tyrus.client.exception; diff --git a/client/src/test/java/org/glassfish/tyrus/client/TyrusClientEngineTest.java b/client/src/test/java/org/glassfish/tyrus/client/TyrusClientEngineTest.java index 78d8a8c3..b787e389 100644 --- a/client/src/test/java/org/glassfish/tyrus/client/TyrusClientEngineTest.java +++ b/client/src/test/java/org/glassfish/tyrus/client/TyrusClientEngineTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -443,6 +443,11 @@ public void setReasonPhrase(String reason) { } + @Override + public String getReasonPhrase() { + return null; + } + @Override public Map> getHeaders() { headers.put(HandshakeResponse.SEC_WEBSOCKET_ACCEPT, Collections.singletonList(serverKey)); @@ -468,6 +473,11 @@ public void setReasonPhrase(String reason) { } + @Override + public String getReasonPhrase() { + return null; + } + @Override public Map> getHeaders() { return headers; diff --git a/containers/grizzly-client/src/main/java/org/glassfish/tyrus/container/grizzly/client/GrizzlyClientFilter.java b/containers/grizzly-client/src/main/java/org/glassfish/tyrus/container/grizzly/client/GrizzlyClientFilter.java index d1e892e7..5c6ae378 100644 --- a/containers/grizzly-client/src/main/java/org/glassfish/tyrus/container/grizzly/client/GrizzlyClientFilter.java +++ b/containers/grizzly-client/src/main/java/org/glassfish/tyrus/container/grizzly/client/GrizzlyClientFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -396,6 +396,7 @@ private static UpgradeResponse getUpgradeResponse(HttpResponsePacket httpRespons } tyrusUpgradeResponse.setStatus(httpResponsePacket.getStatus()); + tyrusUpgradeResponse.setReasonPhrase(httpResponsePacket.getReasonPhrase()); return tyrusUpgradeResponse; } diff --git a/containers/grizzly-client/src/main/java/org/glassfish/tyrus/container/grizzly/client/GrizzlyClientSocket.java b/containers/grizzly-client/src/main/java/org/glassfish/tyrus/container/grizzly/client/GrizzlyClientSocket.java index 881e9abb..67ac3c11 100644 --- a/containers/grizzly-client/src/main/java/org/glassfish/tyrus/container/grizzly/client/GrizzlyClientSocket.java +++ b/containers/grizzly-client/src/main/java/org/glassfish/tyrus/container/grizzly/client/GrizzlyClientSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -49,6 +49,7 @@ import org.glassfish.tyrus.client.ClientManager; import org.glassfish.tyrus.client.ClientProperties; import org.glassfish.tyrus.client.SslEngineConfigurator; +import org.glassfish.tyrus.client.exception.Exceptions; import org.glassfish.tyrus.core.TyrusFuture; import org.glassfish.tyrus.core.Utils; import org.glassfish.tyrus.spi.ClientEngine; @@ -207,7 +208,7 @@ public class GrizzlyClientSocket { (sharedTransport && sharedTransportTimeoutProperty != null) ? sharedTransportTimeoutProperty : 30; this.clientEngine = clientEngine; } catch (RuntimeException e) { - throw new DeploymentException(e.getMessage(), e); + throw Exceptions.deploymentException(e.getMessage(), e); } grizzlyConnector = new Callable() { @@ -229,12 +230,10 @@ public Void call() throws Exception { public void connect() throws DeploymentException, IOException { try { grizzlyConnector.call(); - } catch (DeploymentException e) { - throw e; } catch (IOException e) { throw e; } catch (Exception e) { - throw new DeploymentException(e.getMessage(), e); + throw Exceptions.deploymentException(e.getMessage(), e); } } @@ -386,7 +385,7 @@ public void handleTimeout() { throw new DeploymentException("SSL handshake has failed", e.getCause()); } catch (Exception e) { closeTransport(privateTransport); - throw new DeploymentException(String.format("Connection to '%s' failed.", requestURI), + throw Exceptions.deploymentException(String.format("Connection to '%s' failed.", requestURI), e.getCause()); } } @@ -416,7 +415,7 @@ public void handleTimeout() { } } - throw new DeploymentException("Connection failed.", exception); + throw Exceptions.deploymentException("Connection failed.", exception); } private static TCPNIOTransport createTransport(ThreadPoolConfig workerThreadPoolConfig, diff --git a/containers/grizzly-server/src/main/java/org/glassfish/tyrus/container/grizzly/server/GrizzlyServerFilter.java b/containers/grizzly-server/src/main/java/org/glassfish/tyrus/container/grizzly/server/GrizzlyServerFilter.java index c8d739d7..7a7cb2b6 100644 --- a/containers/grizzly-server/src/main/java/org/glassfish/tyrus/container/grizzly/server/GrizzlyServerFilter.java +++ b/containers/grizzly-server/src/main/java/org/glassfish/tyrus/container/grizzly/server/GrizzlyServerFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2023 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -286,6 +286,9 @@ private void write(FilterChainContext ctx, UpgradeResponse response) { ((HttpRequestPacket) ((HttpContent) ctx.getMessage()).getHttpHeader()).getResponse(); responsePacket.setProtocol(Protocol.HTTP_1_1); responsePacket.setStatus(response.getStatus()); + if (response.getReasonPhrase() != null) { + responsePacket.setReasonPhrase(response.getReasonPhrase()); + } // TODO // responsePacket.setReasonPhrase(response.getReasonPhrase()); diff --git a/containers/jdk-client/src/main/java/org/glassfish/tyrus/container/jdk/client/JdkClientContainer.java b/containers/jdk-client/src/main/java/org/glassfish/tyrus/container/jdk/client/JdkClientContainer.java index 813994ad..fe81aecf 100644 --- a/containers/jdk-client/src/main/java/org/glassfish/tyrus/container/jdk/client/JdkClientContainer.java +++ b/containers/jdk-client/src/main/java/org/glassfish/tyrus/container/jdk/client/JdkClientContainer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -43,6 +43,7 @@ import org.glassfish.tyrus.client.SslContextConfigurator; import org.glassfish.tyrus.client.SslEngineConfigurator; import org.glassfish.tyrus.client.ThreadPoolConfig; +import org.glassfish.tyrus.client.exception.Exceptions; import org.glassfish.tyrus.core.ReflectionHelper; import org.glassfish.tyrus.core.Utils; import org.glassfish.tyrus.spi.ClientContainer; @@ -184,7 +185,7 @@ public void handleTimeout() { } } - throw new DeploymentException("Connection failed.", exception); + throw Exceptions.deploymentException("Connection failed.", exception); } }; @@ -199,7 +200,7 @@ public void handleTimeout() { throw (IOException) e; } - throw new DeploymentException(e.getMessage(), e); + throw Exceptions.deploymentException(e.getMessage(), e); } } diff --git a/core/src/main/java/module-info.java b/core/src/main/java/module-info.java index ec8f5518..5e188a3b 100644 --- a/core/src/main/java/module-info.java +++ b/core/src/main/java/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -19,6 +19,7 @@ */ module org.glassfish.tyrus.core { requires java.logging; + requires static java.xml; requires static jakarta.xml.bind; requires transitive jakarta.websocket; @@ -31,6 +32,7 @@ exports org.glassfish.tyrus.core; exports org.glassfish.tyrus.core.cluster; exports org.glassfish.tyrus.core.coder; + exports org.glassfish.tyrus.core.collection; exports org.glassfish.tyrus.core.extension; exports org.glassfish.tyrus.core.frame; exports org.glassfish.tyrus.core.l10n; diff --git a/core/src/main/java/org/glassfish/tyrus/core/AnnotatedEndpoint.java b/core/src/main/java/org/glassfish/tyrus/core/AnnotatedEndpoint.java index 6101ccff..600d1df9 100755 --- a/core/src/main/java/org/glassfish/tyrus/core/AnnotatedEndpoint.java +++ b/core/src/main/java/org/glassfish/tyrus/core/AnnotatedEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/core/src/main/java/org/glassfish/tyrus/core/TyrusServerEndpointConfigurator.java b/core/src/main/java/org/glassfish/tyrus/core/TyrusServerEndpointConfigurator.java index 1b385f6b..b539e214 100644 --- a/core/src/main/java/org/glassfish/tyrus/core/TyrusServerEndpointConfigurator.java +++ b/core/src/main/java/org/glassfish/tyrus/core/TyrusServerEndpointConfigurator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/core/src/main/java/org/glassfish/tyrus/core/TyrusUpgradeResponse.java b/core/src/main/java/org/glassfish/tyrus/core/TyrusUpgradeResponse.java index 90dd8880..70d39ece 100644 --- a/core/src/main/java/org/glassfish/tyrus/core/TyrusUpgradeResponse.java +++ b/core/src/main/java/org/glassfish/tyrus/core/TyrusUpgradeResponse.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -52,10 +52,13 @@ public int getStatus() { /** * Get HTTP reason phrase. + *

+ * Warning: The Reason Phrase is removed from HTTP/2 and from Servlet 6. + *

* * @return reason phrase. */ -// @Override + @Override public String getReasonPhrase() { return reasonPhrase; } diff --git a/core/src/main/java/org/glassfish/tyrus/core/collection/SupplierWithEx.java b/core/src/main/java/org/glassfish/tyrus/core/collection/SupplierWithEx.java new file mode 100644 index 00000000..1c45e384 --- /dev/null +++ b/core/src/main/java/org/glassfish/tyrus/core/collection/SupplierWithEx.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2023, 2024 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.glassfish.tyrus.core.collection; + +@FunctionalInterface +public interface SupplierWithEx { + T get() throws EX; +} diff --git a/etc/jenkins/Jenkinsfile_ci_build b/etc/jenkins/Jenkinsfile_ci_build index 2417696e..bc1fd896 100644 --- a/etc/jenkins/Jenkinsfile_ci_build +++ b/etc/jenkins/Jenkinsfile_ci_build @@ -18,38 +18,38 @@ pipeline { } steps { sh ''' - mvn -U -C -Dtyrus.test.container.client=org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer -Pbundles -Pstaging clean install -Dmaven.javadoc.skip=true + mvn -U -C -Dtyrus.test.container.client=org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer -Pbundles clean install -Dmaven.javadoc.skip=true ''' } } - stage('JDK 13 ') { +// stage('JDK 13 ') { +// agent { +// label 'centos-7' +// } +// tools { +// jdk 'openjdk-jdk13-latest' +// maven 'apache-maven-latest' +// } +// steps { +// sh ''' +// mvn -U -C -Dtyrus.test.container.client=org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer -Pbundles clean install -Dmaven.javadoc.skip=true +// ''' +// } +// } + stage('JDK 17 ') { agent { label 'centos-7' } tools { - jdk 'openjdk-jdk13-latest' + jdk 'openjdk-jdk17-latest' maven 'apache-maven-latest' } steps { sh ''' - mvn -U -C -Dtyrus.test.container.client=org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer -Pbundles -Pstaging clean install -Dmaven.javadoc.skip=true + mvn -U -C -Dtyrus.test.container.client=org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer -Pbundles clean install -Dmaven.javadoc.skip=true ''' } } - //stage('JDK 17 ') { - // agent { - // label 'centos-7' - // } - // tools { - // jdk 'openjdk-jdk17-latest' - // maven 'apache-maven-latest' - // } - // steps { - // sh ''' - // mvn -U -C -Dtyrus.test.container.client=org.glassfish.tyrus.container.grizzly.client.GrizzlyClientContainer -Pbundles -Pstaging clean install -Dmaven.javadoc.skip=true - // ''' - // } - //} } } } diff --git a/pom.xml b/pom.xml index 71bda093..61376a3b 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,6 @@