Skip to content

Instantly share code, notes, and snippets.

@kitplummer
Created January 28, 2010 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitplummer/288959 to your computer and use it in GitHub Desktop.
Save kitplummer/288959 to your computer and use it in GitHub Desktop.
class JobRoute {
def configure = {
println "Setting JobRoute Camel Router..."
from("seda:job.contents").
process{ exchange ->
String body = exchange.getIn().getBody()
def job = new XmlParser().parseText(body)
def url = "http://localhost:4567/converter/service"
File input = new File(job.filepath.text())
def client = new HttpClient()
def post = new PostMethod(url)
post.setRequestHeader("Accept", "text/plain")
RequestEntity entity = new FileRequestEntity(input, job.type.text());
post.setRequestEntity(entity);
client.executeMethod(post)
//println "JOD RESPONSE: #${post.getResponseBodyAsString().toString()}"
def text = post.getResponseBodyAsString().toString()
}.
to("bean:rawTextService?methodName=handleText")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment