diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index c8bf9d5..7c1ae6f 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,6 +1,7 @@ ## 3.0-M3 * #84 (Jakarta migration) Deprecate JAX-RS 2 modules +* #85 Remove Jersey Jetty HTTP client ## 3.0.M2 diff --git a/bootique-jersey-jakarta-client-jetty/pom.xml b/bootique-jersey-jakarta-client-jetty/pom.xml deleted file mode 100644 index cf43470..0000000 --- a/bootique-jersey-jakarta-client-jetty/pom.xml +++ /dev/null @@ -1,165 +0,0 @@ - - - - - 4.0.0 - - - io.bootique.jersey - bootique-jersey-parent - 3.0-SNAPSHOT - - - bootique-jersey-jakarta-client-jetty - jar - - bootique-jersey-jakarta-client-jetty: integrates with Jetty HttpClient transport - - Sets Jetty HttpClient as the default transport for Jersey client - - - - - - org.glassfish.jersey.connectors - jersey-jetty-connector - ${jersey3.version} - - - org.eclipse.jetty - * - - - - - org.eclipse.jetty - jetty-client - ${jetty11.version} - - - org.eclipse.jetty - jetty-util - ${jetty11.version} - - - io.bootique.jersey - bootique-jersey-jakarta-client - ${bootique.version} - - - io.bootique.jersey - bootique-jersey-jakarta-client-instrumented - ${bootique.version} - - - io.bootique.jetty - bootique-jetty-jakarta-junit5 - ${bootique.version} - - - io.bootique.jetty - bootique-jetty-jakarta-instrumented - ${bootique.version} - - - io.bootique.jersey - bootique-jersey-jakarta - ${project.version} - - - - - - - - - io.bootique.jersey - bootique-jersey-jakarta-client - - - org.glassfish.jersey.connectors - jersey-jetty-connector - - - org.eclipse.jetty - jetty-client - - - org.eclipse.jetty - jetty-util - - - - - org.mockito - mockito-core - test - - - org.slf4j - slf4j-simple - test - - - io.bootique.jersey - bootique-jersey-jakarta-client-instrumented - test - - - io.bootique.jetty - bootique-jetty-jakarta-junit5 - test - - - io.bootique.jetty - bootique-jetty-jakarta-instrumented - test - - - io.bootique.jersey - bootique-jersey-jakarta - test - - - - - - - gpg - - - - org.apache.maven.plugins - maven-gpg-plugin - - - sign-artifacts - verify - - sign - - - - - - - - - diff --git a/bootique-jersey-jakarta-client-jetty/src/main/java/io/bootique/jersey/client/jetty/JerseyClientJettyModule.java b/bootique-jersey-jakarta-client-jetty/src/main/java/io/bootique/jersey/client/jetty/JerseyClientJettyModule.java deleted file mode 100644 index 6fb60b8..0000000 --- a/bootique-jersey-jakarta-client-jetty/src/main/java/io/bootique/jersey/client/jetty/JerseyClientJettyModule.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to ObjectStyle LLC under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ObjectStyle LLC licenses - * this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package io.bootique.jersey.client.jetty; - -import io.bootique.BQCoreModule; -import io.bootique.BQModule; -import io.bootique.ModuleCrate; -import io.bootique.di.Binder; -import io.bootique.jersey.client.JerseyClientModule; -import org.glassfish.jersey.jetty.connector.JettyConnectorProvider; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class JerseyClientJettyModule implements BQModule { - - private static final Logger LOGGER = LoggerFactory.getLogger(JerseyClientJettyModule.class); - - @Override - public ModuleCrate crate() { - return ModuleCrate.of(this) - .description("Integrates Jetty transport for Jersey HTTP client") - .build(); - } - - @Override - public void configure(Binder binder) { - JerseyClientModule.extend(binder).setConnectorProvider(JettyConnectorProvider.class); - - // Handling a bug / limitation in Jersey Jetty client. The line below in HttpClientFactoryFactory will cause - // the Jetty transport to blow up. So force-change Bootique compression flag default. - // - // config.register(new EncodingFeature(GZipEncoder.class)); - - LOGGER.info("Forcing 'bq.jerseyclient.compression' to 'false', as Jetty HttpClient does its own compression handling. " + - "Make sure your own configuration doesn't reset it back to true, as it will result in 'Not in GZIP format' exception"); - BQCoreModule.extend(binder).setProperty("bq.jerseyclient.compression", "false"); - } -} diff --git a/bootique-jersey-jakarta-client-jetty/src/main/resources/META-INF/services/io.bootique.BQModule b/bootique-jersey-jakarta-client-jetty/src/main/resources/META-INF/services/io.bootique.BQModule deleted file mode 100644 index 1fa453b..0000000 --- a/bootique-jersey-jakarta-client-jetty/src/main/resources/META-INF/services/io.bootique.BQModule +++ /dev/null @@ -1 +0,0 @@ -io.bootique.jersey.client.jetty.JerseyClientJettyModule \ No newline at end of file diff --git a/bootique-jersey-jakarta-client-jetty/src/test/java/io/bootique/jersey/client/jetty/JerseyClientJettyModuleIT.java b/bootique-jersey-jakarta-client-jetty/src/test/java/io/bootique/jersey/client/jetty/JerseyClientJettyModuleIT.java deleted file mode 100644 index 3d45219..0000000 --- a/bootique-jersey-jakarta-client-jetty/src/test/java/io/bootique/jersey/client/jetty/JerseyClientJettyModuleIT.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Licensed to ObjectStyle LLC under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ObjectStyle LLC licenses - * this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package io.bootique.jersey.client.jetty; - -import io.bootique.BQRuntime; -import io.bootique.Bootique; -import io.bootique.jersey.JerseyModule; -import io.bootique.jersey.client.HttpClientFactory; -import io.bootique.jetty.junit5.JettyTester; -import io.bootique.junit5.BQApp; -import io.bootique.junit5.BQTest; -import io.bootique.junit5.BQTestFactory; -import io.bootique.junit5.BQTestTool; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.client.Client; -import jakarta.ws.rs.client.WebTarget; -import jakarta.ws.rs.core.Context; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Request; -import jakarta.ws.rs.core.Response; -import org.glassfish.jersey.client.spi.ConnectorProvider; -import org.glassfish.jersey.jetty.connector.JettyConnectorProvider; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -import java.util.concurrent.ExecutionException; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -@BQTest -public class JerseyClientJettyModuleIT { - static final JettyTester jetty = JettyTester.create(); - - @BQApp - static final BQRuntime app = Bootique.app("--server") - .autoLoadModules() - .module(b -> JerseyModule.extend(b).addResource(Resource.class)) - .module(jetty.moduleReplacingConnectors()) - .createRuntime(); - - @BQTestTool - final BQTestFactory clientFactory = new BQTestFactory(); - - @Test - public void providerRegistered() { - BQRuntime clientApp = clientFactory.app() - .autoLoadModules() - .createRuntime(); - - assertTrue(clientApp.getInstance(ConnectorProvider.class) instanceof JettyConnectorProvider); - } - - @Test - public void get() { - BQRuntime clientApp = clientFactory.app() - .autoLoadModules() - .createRuntime(); - - Client client = clientApp.getInstance(HttpClientFactory.class).newClient(); - Response r1 = client.target(jetty.getUrl()).path("get").request().get(); - JettyTester.assertOk(r1).assertContent("got"); - } - - @Test - public void getRx() throws ExecutionException, InterruptedException { - BQRuntime clientApp = clientFactory.app() - .autoLoadModules() - .createRuntime(); - - Client client = clientApp.getInstance(HttpClientFactory.class).newClient(); - Response r1 = client.target(jetty.getUrl()).path("get").request().rx().get().toCompletableFuture().get(); - JettyTester.assertOk(r1).assertContent("got"); - } - - @Disabled("rx/thenApply causes a deadlock and timeout with Jetty") - @Test - public void getRxThenApply() throws ExecutionException, InterruptedException { - BQRuntime clientApp = clientFactory.app() - .autoLoadModules() - .createRuntime(); - - Client client = clientApp.getInstance(HttpClientFactory.class).newClient(); - WebTarget target = client.target(jetty.getUrl()).path("get"); - Response r1 = target.request().rx() - .get() - .thenApply(r -> target.queryParam("q", r.readEntity(String.class)).request().get()) - .toCompletableFuture() - .get(); - - JettyTester.assertOk(r1).assertContent("got?q=got"); - } - - @Test - public void get_Gzip() { - BQRuntime clientApp = clientFactory.app() - .autoLoadModules() - .createRuntime(); - - Client client = clientApp.getInstance(HttpClientFactory.class).newClient(); - - // gzip encoding on the server kicks in after a certain size. So request a bigger chunk of content - Response r1 = client.target(jetty.getUrl()).path("get-large").request().get(); - JettyTester.assertOk(r1) - - // unfortunately no clear way to verify that the request was actually gzipped, as Jetty GZIPContentDecoder - // strips off encoding-identifying headers. So just check that it decoded properly - .assertContent(c -> assertTrue(c.startsWith("got-large"))); - } - - - @Path("/") - @Produces(MediaType.TEXT_PLAIN) - public static class Resource { - - @GET - @Path("get") - public String get(@QueryParam("q") String q) { - String suffix = q != null ? "?q=" + q : ""; - return "got" + suffix; - } - - @GET - @Path("get-large") - public String getLarge(@Context Request request) { - return "got-large:" + "aaaaaaaaaaaaaaaaaaaaaaaaaa ".repeat(1000); - } - } -} diff --git a/bootique-jersey-jakarta-client-jetty/src/test/java/io/bootique/jersey/client/jetty/JerseyClientJettyModuleTest.java b/bootique-jersey-jakarta-client-jetty/src/test/java/io/bootique/jersey/client/jetty/JerseyClientJettyModuleTest.java deleted file mode 100644 index 75dee78..0000000 --- a/bootique-jersey-jakarta-client-jetty/src/test/java/io/bootique/jersey/client/jetty/JerseyClientJettyModuleTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to ObjectStyle LLC under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ObjectStyle LLC licenses - * this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package io.bootique.jersey.client.jetty; - -import io.bootique.junit5.BQModuleTester; -import org.junit.jupiter.api.Test; - -public class JerseyClientJettyModuleTest { - - @Test - public void check() { - BQModuleTester.of(JerseyClientJettyModule.class).testAutoLoadable().testConfig(); - } -} diff --git a/pom.xml b/pom.xml index 8b400fa..aab6008 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,6 @@ bootique-jersey-jakarta-client bootique-jersey-jakarta-client-instrumented bootique-jersey-jakarta-client-junit5-wiremock - bootique-jersey-jakarta-client-jetty