This is an automated email from the ASF dual-hosted git repository. ppalaga pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit a3df3f58284ccb2ec316f231ee890ad4317707da Author: James Netherton <jamesnether...@gmail.com> AuthorDate: Thu Aug 5 12:52:26 2021 +0100 Remove workaround for Vert.x Buffer conversion Fixes #2838 --- .../http/deployment/PlatformHttpProcessor.java | 9 --- .../runtime/CamelQuarkusVertxBufferConverter.java | 39 ------------- .../http/runtime/PlatformHttpRecorder.java | 5 -- .../runtime/VertxByteBufferConverterLoader.java | 64 ---------------------- 4 files changed, 117 deletions(-) diff --git a/extensions/platform-http/deployment/src/main/java/org/apache/camel/quarkus/component/platform/http/deployment/PlatformHttpProcessor.java b/extensions/platform-http/deployment/src/main/java/org/apache/camel/quarkus/component/platform/http/deployment/PlatformHttpProcessor.java index 6f4d0da..e504a38 100644 --- a/extensions/platform-http/deployment/src/main/java/org/apache/camel/quarkus/component/platform/http/deployment/PlatformHttpProcessor.java +++ b/extensions/platform-http/deployment/src/main/java/org/apache/camel/quarkus/component/platform/http/deployment/PlatformHttpProcessor.java @@ -32,7 +32,6 @@ import org.apache.camel.quarkus.component.platform.http.runtime.PlatformHttpReco import org.apache.camel.quarkus.core.deployment.spi.CamelRuntimeBeanBuildItem; import org.apache.camel.quarkus.core.deployment.spi.CamelServiceFilter; import org.apache.camel.quarkus.core.deployment.spi.CamelServiceFilterBuildItem; -import org.apache.camel.quarkus.core.deployment.spi.CamelTypeConverterLoaderBuildItem; class PlatformHttpProcessor { private static final String FEATURE = "camel-platform-http"; @@ -86,12 +85,4 @@ class PlatformHttpProcessor { PlatformHttpComponent.class.getName(), recorder.createComponent(engine.getInstance())); } - - // TODO: Remove this when the underlying issue is fixed in VertxPlatformHttpSupport.writeResponse - // https://github.com/apache/camel-quarkus/issues/2838 - @Record(ExecutionTime.STATIC_INIT) - @BuildStep - CamelTypeConverterLoaderBuildItem vertxByteBufferConverterLoader(PlatformHttpRecorder recorder) { - return new CamelTypeConverterLoaderBuildItem(recorder.createVertxByteBufferConverterLoader()); - } } diff --git a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/CamelQuarkusVertxBufferConverter.java b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/CamelQuarkusVertxBufferConverter.java deleted file mode 100644 index 6d4bc60..0000000 --- a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/CamelQuarkusVertxBufferConverter.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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 org.apache.camel.quarkus.component.platform.http.runtime; - -import java.nio.ByteBuffer; - -import io.vertx.core.buffer.Buffer; -import org.apache.camel.Converter; - -/** - * Supplementary converter methods to the existing {@link VertxByteBufferConverterLoader}. - * - * TODO: Remove this class - https://github.com/apache/camel-quarkus/issues/2838 - */ -@Converter(generateLoader = true) -public final class CamelQuarkusVertxBufferConverter { - - private CamelQuarkusVertxBufferConverter() { - } - - @Converter - public static ByteBuffer toByteBuffer(Buffer buffer) { - return buffer.getByteBuf().nioBuffer(); - } -} diff --git a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpRecorder.java b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpRecorder.java index b1f5580..29b7351 100644 --- a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpRecorder.java +++ b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/PlatformHttpRecorder.java @@ -26,7 +26,6 @@ import org.apache.camel.component.platform.http.PlatformHttpComponent; import org.apache.camel.component.platform.http.spi.PlatformHttpEngine; import org.apache.camel.component.platform.http.vertx.VertxPlatformHttpEngine; import org.apache.camel.component.platform.http.vertx.VertxPlatformHttpRouter; -import org.apache.camel.spi.TypeConverterLoader; @Recorder public class PlatformHttpRecorder { @@ -50,8 +49,4 @@ public class PlatformHttpRecorder { }; return new RuntimeValue<>(vertxPlatformHttpRouter); } - - public RuntimeValue<TypeConverterLoader> createVertxByteBufferConverterLoader() { - return new RuntimeValue<>(new VertxByteBufferConverterLoader()); - } } diff --git a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/VertxByteBufferConverterLoader.java b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/VertxByteBufferConverterLoader.java deleted file mode 100644 index 2a1dd25..0000000 --- a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/VertxByteBufferConverterLoader.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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 org.apache.camel.quarkus.component.platform.http.runtime; - -import org.apache.camel.CamelContext; -import org.apache.camel.CamelContextAware; -import org.apache.camel.DeferredContextBinding; -import org.apache.camel.TypeConverterLoaderException; -import org.apache.camel.spi.TypeConverterLoader; -import org.apache.camel.spi.TypeConverterRegistry; -import org.apache.camel.support.SimpleTypeConverter; - -/** - * TODO: Remove this class - https://github.com/apache/camel-quarkus/issues/2838 - */ -@SuppressWarnings("unchecked") -@DeferredContextBinding -public final class VertxByteBufferConverterLoader implements TypeConverterLoader, CamelContextAware { - - private CamelContext camelContext; - - public VertxByteBufferConverterLoader() { - } - - @Override - public void setCamelContext(CamelContext camelContext) { - this.camelContext = camelContext; - } - - @Override - public CamelContext getCamelContext() { - return camelContext; - } - - @Override - public void load(TypeConverterRegistry registry) throws TypeConverterLoaderException { - registerConverters(registry); - } - - private void registerConverters(TypeConverterRegistry registry) { - addTypeConverter(registry, java.nio.ByteBuffer.class, io.vertx.core.buffer.Buffer.class, false, - (type, exchange, value) -> CamelQuarkusVertxBufferConverter - .toByteBuffer((io.vertx.core.buffer.Buffer) value)); - } - - private static void addTypeConverter(TypeConverterRegistry registry, Class<?> toType, Class<?> fromType, boolean allowNull, - SimpleTypeConverter.ConversionMethod method) { - registry.addTypeConverter(toType, fromType, new SimpleTypeConverter(allowNull, method)); - } -}