camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Tam <email.w...@gmail.com>
Subject Re: Restlet Component File Upload Handling
Date Wed, 04 Mar 2009 23:30:04 GMT
Hi Todd,

Your usecase seems to justify use of camel-restlet.  For example, user
code will need to deal with RESTful URI and authentication if it is
using camel-jetty.  I'll create a Jira to support multipart message.

Cheers,
William

On Tue, Mar 3, 2009 at 5:53 PM, tfredrich <tfredrich@yahoo.com> wrote:
>
> As usual, one thing calls for another...  I created a MultipartRestletBinder
> that simply overrides populateExchangeFromRestletRequest(), checks for
> multipart content, and leverages the FileUpload extension if applicable.
> However, once that operated appropriately (for my case of uploading images),
> I discovered that the download case assumes the body to be a string.
> Consequently, I overrode populateRestletResponseFromExchange() and serialize
> a byte array for the case of IMAGE MediaType.  See attached
> http://www.nabble.com/file/p22319865/MultipartRestletBinding.java
> MultipartRestletBinding.java
>
> Quite likely, you might ask (as I now am) why use Camel-Restlet to
> read/write images...  The basic use cases are:
>
> Upload:
> 1) Upload image for user using RESTful URI.
> 2) Authenticate user.
> 3) Hash name to make the filename unique.
> 4) Write the image to the unique filename (on virtual storage).
> 5) Update user data to reference newly uploaded image.
>
> Download:
> 1) Request image for user via RESTful URI (with hashed filename).
> 2) Authenticate user
> 3) Return image.
>
> Apache (httpd) is certainly faster for such static content.  I'm open to
> suggestions--especially as to how to better utilize Camel (with or without)
> the restlet component to localize authentication, present a RESTful service
> interface (with tidy URIs), etc.
>
> Thanks again,
> --Todd Fredrich
> --
> View this message in context: http://www.nabble.com/Restlet-Component-File-Upload-Handling-tp22250082p22319865.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>

Mime
View raw message