camel-dropbox - 处理动态remotePath中的空格

时间:2016-09-19 08:52:16

标签: apache-camel

我用一个非常简单的用例来解决问题。

  1. 在dropbox文件夹中搜索文件
  2. 选择要加载的文件
  3. 从dropbox加载文件
  4. 这是我尝试的方式:

    from("timer:start?period=60m")
      //Load list of files
      .to("dropbox://search?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath={{remotePath}}")
      //Create list of files to load
      .bean(FileHandlerBean.class, "prepareOperations")
      .split(simple("${body}"))
        //Load file from dropbox
        .recipientList(simple("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=${body.dropBoxFilePath}"))
      [...]
    

    通常这应该可以,但是当remotePath包含带有 2015-05-16 18.43.56.jpg 等空格的文件名时, DropboxConfigurationValidator 会抛出异常。

    我尝试使用URLEncoder:

    URLEncoder.encode(dbxEntry.path, "UTF-8")
    

    但这并没有帮助。 我调试组件并且可以看到,当DropBoxComponent获取参数时," +"被翻译成空白。

    我有什么想法可以解决这个问题吗?

    使用Camel版本2.17.1

1 个答案:

答案 0 :(得分:0)

在下一个camel版本中,将会出现此问题的错误修正。 以下是Jira Ticket的链接:[CAMEL-10334]

然后可以在remotePath属性中使用空格。