Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:camel="http://camel.apache.org/schema/spring"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
- <camelContext xmlns="http://camel.apache.org/schema/spring">
- <restConfiguration component="restlet" port="8080"/>
- <rest path="/">
- <get uri="/test" >
- <to uri="direct:Test"/>
- </get>
- </rest>
- <route>
- <from uri="direct:Test"/>
- <transform><groovy><![CDATA[
- exchange.out.headers.'Content-Type' = 'text/html;charset=UTF-8'
- exchange.out.headers[org.apache.camel.Exchange.HTTP_RESPONSE_CODE] = 302
- def locationUri='http://yahoo.com'
- // This doesn't work
- // The console outputs:
- // Apr 01, 2015 1:56:01 PM org.restlet.engine.header.HeaderUtils addExtensionHeaders
- // WARNING: Addition of the standard header "location" is not allowed. Please use the equivalent property in the Restlet API.
- //
- // exchange.out.headers.location = locationUri
- // This works
- def response = exchange.getIn().getHeader('CamelRestletResponse')
- response.setLocationRef(locationUri)
- $/<html><body><a href="${locationUri}">redirect</a></body></html>/$
- ]]></groovy>
- </transform>
- </route>
- </camelContext>
- </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement