You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Amend, Christian" <ch...@sap.com> on 2013/10/08 16:48:30 UTC
Enhanced Media Resource Handling WDYT?
Hi all,
I just commited my enhancement of media resource handling. This commit makes it possible to specify an external resource for a media resource for example a picture which is not in the OData Server but elsewhere. I wanted to know of you what you think about this enhancement.
Here is how it works:
At the EntityProviderWriteProperties we have now two additional fields for a mediaResourceSourceKey and mediaResourceTypeKey. If set we will look into the data map with this key and use the String we find there as a source link for this media resource during serialization.
For example this: <content type="image/jpeg" src="Employees('1')/$value"/> can now look like this <content type="image/jpeg" src="http://localhost:8080/Image.jpeg"/> if the src key is set and the data map is filled accordingly. The content type is filled the same way.
If you want to have a look on how it works I recommend the unit tests which can be found here:
org.apache.olingo.odata2.core.ep.producer.AtomEntryProducerTest -> serializeWithCustomSrcAttributeOnEmployee
-> serializeWithCustomSrcAndTypeAttributeOnEmployee
org.apache.olingo.odata2.core.ep.producer. JsonEntryEntityProducerTest -> serializeWithCustomSrcAttributeOnEmployee
-> serializeWithCustomSrcAndTypeAttributeOnEmployee
I think this is a good way to improve this and I will write a tutorial which shows the usage in detail.
WDYT? Any feedback is welcome :)
Best Regards,
Christian
Re: Enhanced Media Resource Handling WDYT?
Posted by "Bolz, Michael" <mi...@sap.com>.
Hi Christian,
For me your suggestion/enhancements looks good.
After an (short) look into the current implementation it is not just an
enhancement it is also a bug fix because the behavior of the JSON and XML
handling is currently different at the media type handling.
But IMHO we should create a JIRA Issue to discuss and handle this
enhancement (which I have done ->
https://issues.apache.org/jira/browse/OLINGO-30 ).
Kind regards,
Michael
On 08.10.13 16:48, "Amend, Christian" <ch...@sap.com> wrote:
>Hi all,
>
>I just commited my enhancement of media resource handling. This commit
>makes it possible to specify an external resource for a media resource
>for example a picture which is not in the OData Server but elsewhere. I
>wanted to know of you what you think about this enhancement.
>
>Here is how it works:
>At the EntityProviderWriteProperties we have now two additional fields
>for a mediaResourceSourceKey and mediaResourceTypeKey. If set we will
>look into the data map with this key and use the String we find there as
>a source link for this media resource during serialization.
>For example this: <content type="image/jpeg"
>src="Employees('1')/$value"/> can now look like this <content
>type="image/jpeg" src="http://localhost:8080/Image.jpeg"/> if the src key
>is set and the data map is filled accordingly. The content type is filled
>the same way.
>
>If you want to have a look on how it works I recommend the unit tests
>which can be found here:
>org.apache.olingo.odata2.core.ep.producer.AtomEntryProducerTest ->
>serializeWithCustomSrcAttributeOnEmployee
>
> ->
>serializeWithCustomSrcAndTypeAttributeOnEmployee
>org.apache.olingo.odata2.core.ep.producer. JsonEntryEntityProducerTest ->
>serializeWithCustomSrcAttributeOnEmployee
>
>
> -> serializeWithCustomSrcAndTypeAttributeOnEmployee
>
>I think this is a good way to improve this and I will write a tutorial
>which shows the usage in detail.
>
>WDYT? Any feedback is welcome :)
>
>Best Regards,
>Christian
>