Examples of CamelServlet


Examples of org.apache.camel.component.http.CamelServlet

        servlet.connect(consumer);
    }

    public void disconnect(HttpConsumer consumer) throws Exception {
        ServletEndpoint endpoint = (ServletEndpoint) consumer.getEndpoint();
        CamelServlet servlet = getCamelServlet(endpoint.getServletName());
        ObjectHelper.notNull(servlet, "CamelServlet");
        servlet.disconnect(consumer);
    }
View Full Code Here

Examples of org.apache.camel.component.http.CamelServlet

            applicationContext.stop();
        }
    }
   
    public static CamelServlet getCamelServlet(String servletName) {
        CamelServlet answer = null;
        if (servletName != null) {
            answer = CAMEL_SERVLET_MAP.get(servletName);
        } else {
            if (CAMEL_SERVLET_MAP.size() > 0) {
                // return the first one servlet
                Iterator<CamelServlet> iterator = CAMEL_SERVLET_MAP.values().iterator();
                answer = iterator.next();
                LOG.info("Since no servlet name is specified, using the first element of camelServlet map [" + answer.getServletName() + "]");
            }
        }       
        return answer;
    }
View Full Code Here

Examples of org.apache.camel.component.http.CamelServlet

    }
   
    @SuppressWarnings("rawtypes")
    public void register(CamelServlet provider, Map properties) {
        LOG.debug("Registering provider through OSGi service listener {}", properties);
        CamelServlet camelServlet = provider;
        camelServlet.setServletName((String) properties.get("servlet-name"));
        register(camelServlet);
    }
View Full Code Here

Examples of org.apache.camel.component.http.CamelServlet

                    server.setHandler(handlerCollection);
                }
            }
        }

        CamelServlet camelServlet;
        boolean jetty = endpoint.getUseContinuation() != null ? endpoint.getUseContinuation() : isUseContinuation();
        if (jetty) {
            // use Jetty continuations
            CamelContinuationServlet jettyServlet = new CamelContinuationServlet();
            // configure timeout and log it so end user know what we are using
            Long timeout = endpoint.getContinuationTimeout() != null ? endpoint.getContinuationTimeout() : getContinuationTimeout();
            if (timeout != null) {
                LOG.info("Using Jetty continuation timeout: " + timeout + " millis for: " + endpoint);
                jettyServlet.setContinuationTimeout(timeout);
            } else {
                LOG.info("Using default Jetty continuation timeout for: " + endpoint);
            }

            // use the jetty servlet
            camelServlet = jettyServlet;
        } else {
            // do not use jetty so use a plain servlet
            camelServlet = new CamelServlet();
            LOG.info("Jetty continuation is disabled for: " + endpoint);
        }

        ServletHolder holder = new ServletHolder();
        holder.setServlet(camelServlet);
View Full Code Here

Examples of org.apache.camel.component.http.CamelServlet

                    server.setHandler(handlerCollection);
                }
            }
        }

        CamelServlet camelServlet;
        boolean jetty = endpoint.getUseContinuation() != null ? endpoint.getUseContinuation() : isUseContinuation();
        if (jetty) {
            // use Jetty continuations
            CamelContinuationServlet jettyServlet = new CamelContinuationServlet();
            // configure timeout and log it so end user know what we are using
            Long timeout = endpoint.getContinuationTimeout() != null ? endpoint.getContinuationTimeout() : getContinuationTimeout();
            if (timeout != null) {
                LOG.info("Using Jetty continuation timeout: " + timeout + " millis for: " + endpoint);
                jettyServlet.setContinuationTimeout(timeout);
            } else {
                LOG.info("Using default Jetty continuation timeout for: " + endpoint);
            }

            // use the jetty servlet
            camelServlet = jettyServlet;
        } else {
            // do not use jetty so use a plain servlet
            camelServlet = new CamelServlet();
            LOG.info("Jetty continuation is disabled for: " + endpoint);
        }

        ServletHolder holder = new ServletHolder();
        holder.setServlet(camelServlet);
View Full Code Here

Examples of org.apache.camel.component.http.CamelServlet

                    server.setHandler(handlerCollection);
                }
            }
        }

        CamelServlet camelServlet;
        boolean jetty = endpoint.getUseContinuation() != null ? endpoint.getUseContinuation() : isUseContinuation();
        if (jetty) {
            // use Jetty continuations
            CamelContinuationServlet jettyServlet = new CamelContinuationServlet();
            // configure timeout and log it so end user know what we are using
            Long timeout = endpoint.getContinuationTimeout() != null ? endpoint.getContinuationTimeout() : getContinuationTimeout();
            if (timeout != null) {
                LOG.info("Using Jetty continuation timeout: " + timeout + " millis for: " + endpoint);
                jettyServlet.setContinuationTimeout(timeout);
            } else {
                LOG.info("Using default Jetty continuation timeout for: " + endpoint);
            }

            // use the jetty servlet
            camelServlet = jettyServlet;
        } else {
            // do not use jetty so use a plain servlet
            camelServlet = new CamelServlet();
            LOG.info("Jetty continuation is disabled for: " + endpoint);
        }

        ServletHolder holder = new ServletHolder();
        holder.setServlet(camelServlet);
View Full Code Here

Examples of org.apache.camel.component.http.CamelServlet

                    server.setHandler(handlerCollection);
                }
            }
        }

        CamelServlet camelServlet;
        boolean jetty = endpoint.getUseContinuation() != null ? endpoint.getUseContinuation() : isUseContinuation();
        if (jetty) {
            // use Jetty continuations
            CamelContinuationServlet jettyServlet = new CamelContinuationServlet();
            // configure timeout and log it so end user know what we are using
            Long timeout = endpoint.getContinuationTimeout() != null ? endpoint.getContinuationTimeout() : getContinuationTimeout();
            if (timeout != null) {
                LOG.info("Using Jetty continuation timeout: " + timeout + " millis for: " + endpoint);
                jettyServlet.setContinuationTimeout(timeout);
            } else {
                LOG.info("Using default Jetty continuation timeout for: " + endpoint);
            }

            // use the jetty servlet
            camelServlet = jettyServlet;
        } else {
            // do not use jetty so use a plain servlet
            camelServlet = new CamelServlet();
            LOG.info("Jetty continuation is disabled for: " + endpoint);
        }

        ServletHolder holder = new ServletHolder();
        holder.setServlet(camelServlet);
View Full Code Here

Examples of org.apache.camel.component.http.CamelServlet

        ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.NO_SECURITY | ServletContextHandler.NO_SESSIONS);
        context.setConnectorNames(new String[] {connector.getName()});

        addJettyHandlers(server, handlers);

        CamelServlet camelServlet;
        boolean jetty = endpoint.getUseContinuation() != null ? endpoint.getUseContinuation() : isUseContinuation();
        if (jetty) {
            // use Jetty continuations
            CamelContinuationServlet jettyServlet = new CamelContinuationServlet();
            // configure timeout and log it so end user know what we are using
            Long timeout = endpoint.getContinuationTimeout() != null ? endpoint.getContinuationTimeout() : getContinuationTimeout();
            if (timeout != null) {
                LOG.info("Using Jetty continuation timeout: " + timeout + " millis for: " + endpoint);
                jettyServlet.setContinuationTimeout(timeout);
            } else {
                LOG.info("Using default Jetty continuation timeout for: " + endpoint);
            }

            // use the jetty servlet
            camelServlet = jettyServlet;
        } else {
            // do not use jetty so use a plain servlet
            camelServlet = new CamelServlet();
            LOG.info("Jetty continuation is disabled for: " + endpoint);
        }

        ServletHolder holder = new ServletHolder();
        holder.setServlet(camelServlet);
        context.addServlet(holder, "/*");

        // use rest enabled resolver in case we use rest
        camelServlet.setServletResolveConsumerStrategy(new JettyRestServletResolveConsumerStrategy());

        return camelServlet;
    }
View Full Code Here

Examples of org.apache.camel.component.http.CamelServlet

        String name = config.getServletName();
        String contextPath = config.getServletContext().getContextPath();

        if (httpRegistry == null) {
            httpRegistry = DefaultHttpRegistry.getHttpRegistry(name);
            CamelServlet existing = httpRegistry.getCamelServlet(name);
            if (existing != null) {
                String msg = "Duplicate ServletName detected: " + name + ". Existing: " + existing + " This: " + this.toString()
                        + ". Its advised to use unique ServletName per Camel application.";
                // always log so people can see it easier
                if (isIgnoreDuplicateServletName()) {
View Full Code Here

Examples of org.apache.camel.component.http.CamelServlet

        }
    }
   
    @SuppressWarnings("rawtypes")
    public void register(CamelServlet provider, Map properties) {
        CamelServlet camelServlet = provider;
        camelServlet.setServletName((String) properties.get("servlet-name"));
        register(camelServlet);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.