camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clarkcb <>
Subject Trying to use splitter to process list of URIs
Date Tue, 04 Sep 2012 19:29:38 GMT

I'm trying to create a route that reads an HTML directory index page,
process it to get the list of zip files that are listed in the index, and
split the list to grab each zip file separately. It's what to do after split
that has me stumped. Here's what I have so far (it's Scala but using the
Java RouteBuilder syntax):

import org.apache.camel.builder.{RouteBuilder => JRouteBuilder}
. . .
class HtmlToZipFileListProcessor(url: String) extends Processor {
  val FileLineRegex = """<li><a\shref=&quot;(.+?\.zip)&quot;>.+?\.zip

  def fileNamesFromLines(lines: List[String]): List[String] = {
    lines match {
      case head :: tail =>
        head match {
          case FileLineRegex(filename) =>
            (url + "/" + filename) :: fileNamesFromLines(tail)
          case _ => fileNamesFromLines(tail)
        case Nil => List[String]()

  def process(exchange: Exchange): Unit = {
    val lines =
    val filenames = fileNamesFromLines(lines)
    exchange.getIn.setBody(filenames.mkString(",")) // set to
comma,separated list of URIs

class HttpZipCopyBuilder(timerString:String, indexUrl:String,
targetDir:String) extends JRouteBuilder {
  def configure() {
      process(new HtmlToZipFileListProcessor(indexUrl)).
        to(body(classOf[String])). // trying to use the body as the URI
        to("file://" + targetDir) // copy the file to targetDir

The thing that I can't figure out is how to get the step after split to
treat the body as a URI.

Thanks in advance for any guidance.


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

View raw message