camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Me Coder <coder_...@yahoo.com>
Subject Servlet End-Point Route Processing in XML
Date Thu, 15 Oct 2009 07:41:29 GMT

I'd greatly appreciate help in converting the below route into its XML
equivalent.  I am stuck at the part on how to set the content type, charset
header and the body of the response itself.

Thanks...

from("servlet:///hello?matchOnUriPrefix=true").process(new Processor() {
    public void process(Exchange exchange) throws Exception {
        String contentType =
exchange.getIn().getHeader(Exchange.CONTENT_TYPE, String.class);
        String path = exchange.getIn().getHeader(Exchange.HTTP_PATH,
String.class);
        assertEquals("Get a wrong content type", CONTENT_TYPE, contentType);
        String charsetEncoding =
exchange.getIn().getHeader(Exchange.HTTP_CHARACTER_ENCODING, String.class);
        assertEquals("Get a wrong charset name", "UTF-8", charsetEncoding);
        exchange.getOut().setHeader(Exchange.CONTENT_TYPE, contentType + ";
charset=UTF-8");                        
        exchange.getOut().setHeader("PATH", path);
        exchange.getOut().setBody("Hello World");
    }
});

-- 
View this message in context: http://www.nabble.com/Servlet-End-Point-Route-Processing-in-XML-tp25904220p25904220.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message