You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by GitBox <gi...@apache.org> on 2019/05/22 21:36:32 UTC

[GitHub] [camel-k-runtime] lburgazzoli commented on a change in pull request #71: Added a servletregistration customizer and improved examples.

lburgazzoli commented on a change in pull request #71: Added a servletregistration customizer and improved examples.
URL: https://github.com/apache/camel-k-runtime/pull/71#discussion_r286698146
 
 

 ##########
 File path: camel-k-runtime-servlet/src/main/java/org/apache/camel/k/servlet/ServletRegistrationContextCustomizer.java
 ##########
 @@ -0,0 +1,28 @@
+package org.apache.camel.k.servlet;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.servlet.CamelHttpTransportServlet;
+import org.apache.camel.k.ContextCustomizer;
+import org.apache.camel.k.Runtime;
+
+public class ServletRegistrationContextCustomizer implements ContextCustomizer {
+    public static final String DEFAULT_PATH = "/camel/*";
+
+    private String path;
+
+    public ServletRegistrationContextCustomizer(){
+        this(DEFAULT_PATH);
+    }
+
+    public ServletRegistrationContextCustomizer(String path){
+        this.path = path;
+    }
+
+    @Override
+    public void apply(CamelContext camelContext, Runtime.Registry registry) {
+        registry.bind(
+                "camel-servlet",
+                new ServletRegistration("CamelServlet", new CamelHttpTransportServlet(), path)
 
 Review comment:
   we need ot be able to customize the name of the servlet, eventually we can use the name of the key used to bind the ServletRegistration to the camel registry

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services