ppalaga commented on a change in pull request #201: Fix #184 Leverage platform 
http service
URL: https://github.com/apache/camel-quarkus/pull/201#discussion_r330011459
 
 

 ##########
 File path: 
extensions/platform-http/component/src/main/java/org/apache/camel/component/platform/http/PlatformHttpEndpoint.java
 ##########
 @@ -0,0 +1,132 @@
+/*
+ * 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.component.platform.http;
+
+import java.util.Collections;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.camel.AsyncEndpoint;
+import org.apache.camel.Component;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.component.platform.http.spi.Method;
+import org.apache.camel.component.platform.http.spi.PlatformHttpEngine;
+import org.apache.camel.spi.HeaderFilterStrategy;
+import org.apache.camel.spi.HeaderFilterStrategyAware;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.support.DefaultEndpoint;
+
+@UriEndpoint(/* firstVersion = "3.?.0", */ scheme = "platform-http", title = 
"Platform HTTP", syntax = "platform-http:[methods:]path", label = "http")
+public class PlatformHttpEndpoint extends DefaultEndpoint implements 
AsyncEndpoint, HeaderFilterStrategyAware {
+
+    private final String path;
+    private final Set<Method> methods;
+
+    @UriParam(label = "consumer", description = "A comma separated list of 
HTTP methods to serve. This list will be merged with the methods specified in 
the URI path. E.g. platform-http:GET,POST:/path?httpMethodRestrict=PUT,DELETE 
will effectivelly result in GET,POST,PUT,DELETE. If no methods are specified, 
all methods will be served.")
+    private String httpMethodRestrict;
+
+    @UriParam(label = "advanced")
+    private PlatformHttpEngine platformHttpEngine;
+
+    @UriParam(label = "advanced")
+    private HeaderFilterStrategy headerFilterStrategy = new 
PlatformHttpHeaderFilterStrategy();
+
+    public PlatformHttpEndpoint(String uri, String remaining, Component 
component) {
+        super(uri, component);
+
+        final String[] remainingParts = remaining.split(":");
+        switch (remainingParts.length) {
+        case 1:
+            path = remaining;
+            methods = null;
+            break;
+        case 2:
+            methods = Method.parseList(remainingParts[0]);
+            path = remainingParts[1];
+            break;
+        default:
+            throw new IllegalArgumentException("Expected a path or two 
segments delimited by ':'; found " + remaining);
+        }
+    }
+
+    @Override
+    public Producer createProducer() throws Exception {
+        throw new UnsupportedOperationException("Producer is not supported");
+    }
+
+    @Override
+    public Consumer createConsumer(Processor processor) throws Exception {
+        if (platformHttpEngine == null) {
+            platformHttpEngine = getCamelContext().getRegistry()
+                    
.lookupByNameAndType(PlatformHttpConstants.PLATFORM_HTTP_ENGINE_NAME, 
PlatformHttpEngine.class);
+        }
+        return platformHttpEngine.createConsumer(this, processor);
+    }
+
+    public Set<Method> getEffectiveMethods() {
 
 Review comment:
   Removed in 7c292ebc4ee38f0bda8ed182c29d3cdc3957a0dd

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to