You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jared Whiklo <jw...@gmail.com> on 2015/10/24 04:34:59 UTC

message attachments

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I am having some trouble with message attachments in jetty9.

This same spring DSL route worked when deployed to a karaf 3.0.4
container.
It consumes a http request which may or may not have a file attachment.

I tried upgrading to Karaf 4.0.1 and switched from camel-jetty to
camel-jetty9.

Now this route does not see the attachments on the message.

If I log the message I can see the file in the headers (called
files[obj][]), but I can not seem to access it.

Is this a limitation of using the Spring DSL or am I just missing
something obvious?

- ----------------------
   <route>
      <from uri="jetty:http://0.0.0.0:8888/rest/basic-image/"/>
        <!--<to uri="log:?level=DEBUG&amp;showAll=true"/>-->
        <choice>
          <when><simple>${headers.CamelHttpMethod} == 'GET'</simple>
            <setProperty
propertyName="uuid"><simple>${headers.uuid}</simple></setProperty>
            <to uri="direct:getBasicImage"/>
          </when>
          <when><simple>${headers.CamelHttpMethod} == 'POST'</simple>
            <setProperty
propertyName="uuid"><simple>${headers.uuid}</simple></setProperty>
            <setProperty
propertyName="node"><simple>${headers.node}</simple></setProperty>
            <filter>
              <javaScript>request.hasAttachments()</javaScript>
              <setProperty
propertyName="attachment"><javaScript>request.getAttachments().values().toArray()[0]</javaScript></setProperty>
              <log message="attachment is ${property.attachment}"
loggingLevel="DEBUG"/>
            </filter>
            <setProperty
propertyName="mimetype"><simple>${headers.mimetype}</simple></setProperty>
            <to uri="direct:getCollectionUri"/>
            <to uri="direct:createBasicImage"/>
          </when>
          <when><simple>${headers.CamelHttpMethod} == 'PUT'</simple>
            <setProperty
propertyName="uuid"><simple>${headers.uuid}</simple></setProperty>
            <setProperty
propertyName="node"><simple>${headers.node}</simple></setProperty>
            <filter>
              <javaScript>request.hasAttachments()</javaScript>
              <setProperty
propertyName="attachment"><javaScript>request.getAttachments().values().toArray()[0]</javaScript></setProperty>
            </filter>
            <setProperty
propertyName="mimetype"><simple>${headers.mimetype}</simple></setProperty>
            <to uri="direct:updateBasicImage"/>
          </when>
          <when><simple>${headers.CamelHttpMethod} == 'DELETE'</simple>
            <setProperty
propertyName="uuid"><simple>${headers.uuid}</simple></setProperty>
            <to uri="direct:deleteBasicImage"/>
          </when>
        </choice>
    </route>
- ---------------------

cheers,
jared
- -- 
Jared Whiklo
jwhiklo@gmail.com
- --------------------------------------------------
Junk is something you've kept for years and throw away three weeks
before you need it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)

iEYEARECAAYFAlYq7lMACgkQqhIY384dF1Z7+ACfbMmOhqT3B//V7nF7nz6WPm+D
s44An0KE9f5gdIXBr4jy1Uizt+SVVtjK
=47Ln
-----END PGP SIGNATURE-----