camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Me Coder <>
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.


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,
        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 + ";
        exchange.getOut().setHeader("PATH", path);
        exchange.getOut().setBody("Hello World");

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message