Package org.apache.camel.component.http

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


        assertEquals("Bye World", out);
    }

    @Test
    public void testNulls() throws Exception {
        HttpMessage msg = null;
        assertNull(HttpConverter.toInputStream(msg, null));
        assertNull(HttpConverter.toServletInputStream(msg));
        assertNull(HttpConverter.toServletRequest(msg));
        assertNull(HttpConverter.toServletResponse(msg));
View Full Code Here


                exchange.setProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.TRUE);
            }
            if (consumer.getEndpoint().isDisableStreamCache()) {
                exchange.setProperty(Exchange.DISABLE_HTTP_STREAM_CACHE, Boolean.TRUE);
            }
            exchange.setIn(new HttpMessage(exchange, request, response));

            if (log.isTraceEnabled()) {
                log.trace("Suspending continuation of exchangeId: " + exchange.getExchangeId());
            }
            continuation.setAttribute(EXCHANGE_ATTRIBUTE_ID, exchange.getExchangeId());
View Full Code Here

                exchange.setProperty(Exchange.DISABLE_HTTP_STREAM_CACHE, Boolean.TRUE);
            }
           
            HttpHelper.setCharsetFromContentType(request.getContentType(), exchange);
           
            exchange.setIn(new HttpMessage(exchange, request, response));
            // set context path as header
            String contextPath = consumer.getEndpoint().getPath();
            exchange.getIn().setHeader("CamelServletContextPath", contextPath);
           
            String httpPath = (String)exchange.getIn().getHeader(Exchange.HTTP_PATH);
View Full Code Here

            String newUrl;
            if (endpoint.getUrlRewrite() instanceof HttpServletUrlRewrite) {
                // its servlet based, so we need the servlet request
                HttpServletRequest request = exchange.getIn().getBody(HttpServletRequest.class);
                if (request == null) {
                    HttpMessage msg = exchange.getIn(HttpMessage.class);
                    if (msg != null) {
                        request = msg.getRequest();
                    }
                }
                if (request == null) {
                    throw new IllegalArgumentException("UrlRewrite " + endpoint.getUrlRewrite() + " requires the message body to be a"
                            + "HttpServletRequest instance, but was: " + ObjectHelper.className(exchange.getIn().getBody()));
View Full Code Here

                exchange.setProperty(Exchange.DISABLE_HTTP_STREAM_CACHE, Boolean.TRUE);
            }
           
            HttpHelper.setCharsetFromContentType(request.getContentType(), exchange);
           
            exchange.setIn(new HttpMessage(exchange, request, response));
            // set context path as header
            String contextPath = consumer.getEndpoint().getPath();
            exchange.getIn().setHeader("CamelServletContextPath", contextPath);
           
            String httpPath = (String)exchange.getIn().getHeader(Exchange.HTTP_PATH);
View Full Code Here

        };
    }

    private class MyParamsProcessor implements Processor {
        public void process(Exchange exchange) throws Exception {
            HttpMessage message = (HttpMessage)exchange.getIn();
            Assert.assertNotNull(message.getRequest());
            Assert.assertEquals("uno", message.getRequest().getParameter("one"));
            Assert.assertEquals("dos", message.getRequest().getParameter("two"));

            exchange.getOut().setBody("Bye World");
            exchange.getOut().setHeader("one", "eins");
            exchange.getOut().setHeader("two", "zwei");
        }
View Full Code Here

                    exchange.setProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.TRUE);
                }
                if (consumer.getEndpoint().isDisableStreamCache()) {
                    exchange.setProperty(Exchange.DISABLE_HTTP_STREAM_CACHE, Boolean.TRUE);
                }
                exchange.setIn(new HttpMessage(exchange, request, response));

                if (log.isTraceEnabled()) {
                    log.trace("Suspending continuation of exchangeId: " + exchange.getExchangeId());
                }
                continuation.suspend();
View Full Code Here

            String newUrl;
            if (endpoint.getUrlRewrite() instanceof HttpServletUrlRewrite) {
                // its servlet based, so we need the servlet request
                HttpServletRequest request = exchange.getIn().getBody(HttpServletRequest.class);
                if (request == null) {
                    HttpMessage msg = exchange.getIn(HttpMessage.class);
                    if (msg != null) {
                        request = msg.getRequest();
                    }
                }
                if (request == null) {
                    throw new IllegalArgumentException("UrlRewrite " + endpoint.getUrlRewrite() + " requires the message body to be a"
                            + "HttpServletRequest instance, but was: " + ObjectHelper.className(exchange.getIn().getBody()));
View Full Code Here

                exchange.setProperty(Exchange.DISABLE_HTTP_STREAM_CACHE, Boolean.TRUE);
            }
           
            HttpHelper.setCharsetFromContentType(request.getContentType(), exchange);
           
            exchange.setIn(new HttpMessage(exchange, request, response));
            // set context path as header
            String contextPath = consumer.getEndpoint().getPath();
            exchange.getIn().setHeader("CamelServletContextPath", contextPath);
           
            String httpPath = (String)exchange.getIn().getHeader(Exchange.HTTP_PATH);
View Full Code Here

                from("jetty:http://localhost:9280/test").to("mock:a");

                Processor proc = new Processor() {
                    public void process(Exchange exchange) throws Exception {
                        try {
                            HttpMessage message = (HttpMessage)exchange.getIn();
                            HttpSession session = message.getRequest().getSession();
                            assertNotNull("we should get session here", session);
                        } catch (Exception e) {
                            exchange.getOut().setFault(true);
                            exchange.getOut().setBody(e);
                        }
View Full Code Here

TOP

Related Classes of org.apache.camel.component.http.HttpMessage

Copyright © 2018 www.massapicom. 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.