On Sat, Jan 23, 2010 at 5:39 PM, Hans Dieter Pearcey <
[email protected]> wrote:
> Excerpts from Bill Moseley's message of Sat Jan 23 19:45:28 -0500 2010:
>
> > With a jpeg I assume the content type would be form-data (that included
> an
> > upload in the form) where the file ends up in $req->uploads, not as a
> > request parameter.
>
> That assumption may hold true for *your* applications, but he didn't say
> anything about a form or even a web browser. It's perfectly reasonable,
> especially in the context of REST APIs, to talk about non-form-based
> request
> bodies. (I've written actions that accepted PUT requests with a
> content-type
> of application/vnd.ms-excel, for example.)
>
But, that's a different content type. I assumed form-data. So, in this
case in my "HTTP::Body deserialization layer" approach, I'd thus add:
$HTTP::Body::Types('application/vnd.ms-excel') = 'My::ExcelParser';
which would result in $req->uploads having an upload object for the
spreadsheet. My::ExcelParser would probably be a thin sub-class of
something like My::Upload. Then the same controller would work with both a
web request with an upload field or this REST request and expect to find the
upload object in $req->uploads.
--
Bill Moseley
[email protected]
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/