|
From: Ryan J. M. <ry...@da...> - 2008-06-24 02:53:52
|
On Jun 20, 2008, at 4:14 PM, Bill Burke wrote:
>
> I think you'll need a Multipart abstraction where the resource methods
> can inject what type they want marshalled into.
>
> public void post(Multipart parts) {
>
> MyJaxb jaxb = parts.getPart(0).read(MyJaxb.class);
> JPEG jpg = parts.getPart(1).read(JPEG.class);
>
> or
>
> MyJaxb jaxb = parts.get("myField").read(MyJaxb.class);
I was even thinking a bit more direct for read operations:
MyJaxb jaxb = parts.get(0,MyJaxb.class);
This variation seems to work out the best in my tests so far. I've
gotten the basic reader details functioning, but it'll require more
parts as we'll need our own Multipart and BodyPart classes. But it
should be much more flexible than having the developer have to parse
each part themselves.
>
> Alternatively, you could do:
>
> public void post(@Multipart({MyJaxB.class, JPEG.class}) List parts);
> But that only works if the format of the buffer is fixed and defined
> and
> it seems kinda quirky and quickly unreadable.
I tried a variation on this whereby you'd have:
void post(@MimePart(0) String partOne, @MimePart(1) MyJAX object) {...
This still has the same limitations as you pointed out, but it's a bit
more akin to @QueryParam, etc. The problem is that reading the data
for the 2nd part was always failing. As of now, a JavaMail multipart
provider has already.
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
|