• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Image attribute and REST
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Image attribute and REST


  • Subject: Re: Image attribute and REST
  • From: Amedeo Mantica <email@hidden>
  • Date: Sat, 21 Jul 2012 01:12:13 +0200

U may encode the blob in a base64 and pass it in the rest response. But I think is better to pass a plain url and fetch the blob only when required by client.

Amedeo

Sent from my iPhone

On 20/lug/2012, at 22:52, Kieran Kelleher <email@hidden> wrote:

> Just curious how others are handling image (blob/binary) attributes in REST responses.
>
> For example, I have a REST EO named Media that has a blob attribute key 'content', typically containing an image. The Media entity also has the mime type, image dimensions, etc as attributes.
>
> What I did was omit the 'content' key from the response and added an additional direct action named contentAction to the MediaController class that simply returns the object itself as a response content with the appropriate mime type.
>
> For example, a url like this for the Media object
> https:// ..........    /Media/28747.xml
>
> returns sth like this:
> <CTMedia id="28747" objectType="Media">
>  <mimeType>image/jpeg</mimeType>
>  <pixelHeight type = "integer">825</pixelHeight>
>  <pixelWidth type = "integer">1275</pixelWidth>
> </CTMedia>
>
> And to get the actual blob...
> https:// ..........    /Media/28747/content
>
> Extensions such as .xml or.json on the url are ignored since response content-type header will reflect the mime type.
>
> Is there other approaches you guys are using, or even other "standard" approaches for handling binary attributes in REST responses? For example, should a derived attribute be added to the object response to indicate the URL..... sth like this??
>
> <CTMedia id="28747" objectType="Media">
>  <content type="url">/app/Media/28747/content</mimeType>
>  <mimeType>image/jpeg</mimeType>
>  <pixelHeight type = "integer">825</pixelHeight>
>  <pixelWidth type = "integer">1275</pixelWidth>
> </CTMedia>
>
> Thoughts?
>
> -Kieran
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Image attribute and REST (From: Kieran Kelleher <email@hidden>)

  • Prev by Date: Re: Image attribute and REST
  • Next by Date: Re: Image attribute and REST
  • Previous by thread: Re: Image attribute and REST
  • Next by thread: ERDEditHTML and tiny_mce
  • Index(es):
    • Date
    • Thread