You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by Ashan Bakmeedeniya <as...@gmail.com> on 2016/04/06 11:46:28 UTC

Stream Property value as a Binary data stream

Hi

If I am correct, according to the OData spec (http://www.odata.org/) we
should get a stream when we request for the property value of type
Edm.Stream, but right now (Olingo 4.3.0-SNAPSHOT) instead we get a
URI(which we set). So I want to know whether this is the correct behavior
in Olingo or something still needs to be implemented.
Your response will be greatly appreciated.


Thanks and Best Regards
Ashan

Re: Stream Property value as a Binary data stream

Posted by "Bolz, Michael" <mi...@sap.com>.
Hi Ashan,

Yes, you are right that the problem is that Edm.Stream properties are handled as primitive property (with according RepresentationType) for dispatching.
Actual I don’t know if there a new Representation Type (e.g. STREAM) is necessary or we can reuse the BINARY.
Furthermore it should be checked at which point the dispatching must be changed.
Perhaps we should open a JIRA issue for further clarification/discussion.

For a workaround you can use the “CustomContentTypeSupport” to allow dispatching,
however you will be dispatched to the “PrimitiveProcessor” methods.

> ODataHttpHandler handler = odata.createHandler(serviceMetadata);
> // Register processors.
> // Register helpers.
> handler.register(new CustomContentTypeSupport() {
>   @Override
>   public List<ContentType> modifySupportedContentTypes(List<ContentType> defaultContentTypes,
>       RepresentationType type) {
>     List<ContentType> supported = new ArrayList<ContentType>(defaultContentTypes);
>     supported.add(ContentType.APPLICATION_OCTET_STREAM);
>     return supported; 
>   }
> });

Best Regards, Michael


> On 19 Apr 2016, at 07:56, Ashan Bakmeedeniya <as...@gmail.com> wrote:
> 
> Hi Ramesh
> 
> Thanks for investigating it I will report an issue for this, BTW can we do something like bellow for the issue (I am bit new to Olingo, this is just an idea) 
> 
> If I test the above request with newest Olingo version (Olingo 4.3.0-SNAPSHOT), Representation Type “PRIMITIVE” was set in ODataDispatcher.java method handlePrimitiveDispatching (line 408). But before calling this method we actually know the data type and other properties of last segment (line 154), could we pass it to above method (right now only passed the collection is true or not) and do some check on there and set rather like RepresentationType.PRIMITIVE.STREAM/ RepresentationType.BINARY instead of RepresentationType.PRIMITIVE?
> 
> Any other thoughts/suggestions are highly welcome!!
> 
> Best Regards
> Ashan
> 
> 
> On Tue, Apr 19, 2016 at 9:40 AM, Ramesh Reddy <rareddy@redhat.com <ma...@redhat.com>> wrote:
> Yes, that is an issue, since there is no metadata available not sure if this easy fix, you should log an issue. BTW, I do not think this is an issue with server-core-ext framework if you want to give it a try.
> 
> Bellow is the stack-trace i got for postman PATCH request
>    
> "code": "Exception: class org.apache.olingo.server.core.ContentNegotiatorException: unsupported content type: application/octet-stream",
>       "message": "org.apache.olingo.server.core.ContentNegotiator.checkSupport(ContentNegotiator.java:174)
> org.apache.olingo.server.core.ODataDispatcher.getSupportedContentType(ODataDispatcher.java:558)
> org.apache.olingo.server.core.ODataDispatcher.handlePrimitiveDispatching(ODataDispatcher.java:422)
> org.apache.olingo.server.core.ODataDispatcher.handleResourceDispatching(ODataDispatcher.java:154)
> org.apache.olingo.server.core.ODataDispatcher.dispatch(ODataDispatcher.java:110)
> org.apache.olingo.server.core.ODataHandlerImpl.processInternal(ODataHandlerImpl.java:160)
> org.apache.olingo.server.core.ODataHandlerImpl.process(ODataHandlerImpl.java:85)
> org.apache.olingo.server.core.ODataHttpHandlerImpl.process(ODataHttpHandlerImpl.java:73)
> org.apache.olingo.server.core.ODataHttpHandlerImpl.process(ODataHttpHandlerImpl.java:87)\..."
> 
> Best Regards
> Ashan
> 
> 
> 
> On Tue, Apr 19, 2016 at 9:00 AM, Ramesh Reddy <rareddy@redhat.com <ma...@redhat.com>> wrote:
> Ashan,
> 
> Can you post the stacktrace? Looks to be bug to me.
> 
> Ramesh..
> 
> Hi
> 
> 
> First of all thank you for the responses for my previous question (Ramesh, Tom & Michael) it was really supportive, 
> I have another question when writing/updating Edm.Stream properties, according to OData V4 [1] section 11.4.8.1 it says that “A successful PUT request to the edit URL of a stream property changes the media stream associated with that property”.
> 
> So I have followed a similar use case in Olingo as follows
> 
> 
> 
> Request URL: EntitySet(keys)/<Edm.Stream Property>
> 
> HTTP Method: PUT or PATCH (I have used PATCH in this case)
> 
> Content Type: application/octet-stream
> 
> Request Body: Binary Date File
> 
> 
> 
> So when I send a request as above, Olingo throws an error: unsupported content type: application/octet-stream, when I dig in to the code I found that Representation Type “PRIMITIVE” does not support application/octet-stream (instead it supports in “MEDIA” and “BINARY” types) is this the correct way in Olingo? If the answer is yes how can I update an Edm.Stream property value with an “application/octet-stream” without making it as media entity stream?
> 
> Thanks in advance
> 
> See: [1] http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#Managing <http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#Managing> Stream Properties
> 
> 
> Best Regards
> Ashan
> 
> 
> On Mon, Apr 11, 2016 at 7:01 PM, Ramesh Reddy <rareddy@redhat.com <ma...@redhat.com>> wrote:
> Both implementations are driven through the OData specification documents, what we need here is more of clarification on interpretation of the specification.  We will try to seek out advise from OData TC.
> 
> Is there any communication between the Olingo Developers and the .NET OData team?
> 
> Op ma 11 apr. 2016 om 09:36 schreef Tom van Wietmarschen <aaargh@gmail.com <ma...@gmail.com>>:
> Ramesh,
> 
> I see what you mean, that section is quite ambiguous. I'm wondering if this is why the generated .NET client doesn't work with the @mediaReadLink annotation, it may simply not be supported at that level. 
> 
> /Tom 
> On 06 Apr 2016, at 16:41, Ramesh Reddy <rareddy@redhat.com <ma...@redhat.com>> wrote:
> 
> Tom,
> 
> You are correct, unfortunately Olingo still does not support metadata=full thus those annotations missing, we will try to see if we can fix this in 4.3. Unfortunately for "minimal" metadata the text seems little confusing to me from [1] 3.1.1
> 
> In addition, odata annotations MUST appear in the payload for cases where actual values are not the same as the computed values and MAY appear otherwise. When odata annotations appear in the payload, they are treated as exceptions to the computed values.
> Media entities and stream properties MAY in addition contain the following annotations:
> odata.mediaEtag <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*_1>: the ETag of the stream, as appropriate
> odata.mediaContentType <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*_1>: the content type of the stream
> 
> [1] http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940605 <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940605>
> 
> Ramesh..
> 
> On 06 Apr 2016, at 14:44, Ramesh Reddy <rareddy@redhat.com <ma...@redhat.com>> wrote:
> 
> Ashan,
> 
> When the *entity* with Edm.Stream property is requested you will see the URI of the Edm.Property in the payload. 
> 
> Looking at the specs [1] this seems like incorrect behaviour. 
> 
> Specifically: "The value of a stream property is represented as a set of odata.media* <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*> annotations." , which OLingo does not do, instead it outputs a property with the URL as value, instead of only annotations. Looking at the example in the code as well as the description this seems incorrect.
> 
> However, making changes to OLingo to output the media properties like they are in the example in section 9 makes a generated .net client fail on those annotated properties, which would make the implementation useless even if it was correct. Not sure what is going on here. 
> 
> /Tom
> 
> [1] - http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940639 <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940639> - section 9. 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 


Re: Stream Property value as a Binary data stream

Posted by Ashan Bakmeedeniya <as...@gmail.com>.
Hi Ramesh

Thanks for investigating it I will report an issue for this, BTW can we do
something like bellow for the issue (I am bit new to Olingo, this is just
an idea)

If I test the above request with newest Olingo version (Olingo
4.3.0-SNAPSHOT), Representation Type “PRIMITIVE” was set in
ODataDispatcher.java method handlePrimitiveDispatching (line 408). But
before calling this method we actually know the data type and other
properties of last segment (line 154), could we pass it to above method
(right now only passed the collection is true or not) and do some check on
there and set rather like RepresentationType.PRIMITIVE.STREAM/
RepresentationType.BINARY instead of RepresentationType.PRIMITIVE?

Any other thoughts/suggestions are highly welcome!!

Best Regards
Ashan


On Tue, Apr 19, 2016 at 9:40 AM, Ramesh Reddy <ra...@redhat.com> wrote:

> Yes, that is an issue, since there is no metadata available not sure if
> this easy fix, you should log an issue. BTW, I do not think this is an
> issue with server-core-ext framework if you want to give it a try.
>
> ------------------------------
>
> Bellow is the stack-trace i got for postman PATCH request
>
> "code": "Exception: class
> org.apache.olingo.server.core.ContentNegotiatorException: unsupported
> content type: application/octet-stream",
>
>       "message":
> "org.apache.olingo.server.core.ContentNegotiator.checkSupport(ContentNegotiator.java:174)
>
>
> org.apache.olingo.server.core.ODataDispatcher.getSupportedContentType(ODataDispatcher.java:558)
>
>
> org.apache.olingo.server.core.ODataDispatcher.handlePrimitiveDispatching(ODataDispatcher.java:422)
>
>
> org.apache.olingo.server.core.ODataDispatcher.handleResourceDispatching(ODataDispatcher.java:154)
>
>
> org.apache.olingo.server.core.ODataDispatcher.dispatch(ODataDispatcher.java:110)
>
>
> org.apache.olingo.server.core.ODataHandlerImpl.processInternal(ODataHandlerImpl.java:160)
>
>
> org.apache.olingo.server.core.ODataHandlerImpl.process(ODataHandlerImpl.java:85)
>
>
> org.apache.olingo.server.core.ODataHttpHandlerImpl.process(ODataHttpHandlerImpl.java:73)
>
>
> org.apache.olingo.server.core.ODataHttpHandlerImpl.process(ODataHttpHandlerImpl.java:87)\..."
>
> Best Regards
> Ashan
>
>
>
> On Tue, Apr 19, 2016 at 9:00 AM, Ramesh Reddy <ra...@redhat.com> wrote:
>
>> Ashan,
>>
>> Can you post the stacktrace? Looks to be bug to me.
>>
>> Ramesh..
>>
>> ------------------------------
>>
>> Hi
>>
>> First of all thank you for the responses for my previous question
>> (Ramesh, Tom & Michael) it was really supportive,
>> I have another question when writing/updating Edm.Stream properties,
>> according to OData V4 [1] section *11.4.8.1 *it says that* “*A successful
>>  PUT request to the edit URL of a stream property changes the media
>> stream associated with that property”.
>>
>> So I have followed a similar use case in Olingo as follows
>>
>>
>> *Request URL*: EntitySet(keys)/<Edm.Stream Property>
>>
>> *HTTP Method*: PUT or PATCH (I have used PATCH in this case)
>>
>> *Content Type*: application/octet-stream
>>
>> *Request Body*: Binary Date File
>>
>>
>> So when I send a request as above, Olingo throws an error: unsupported
>> content type: application/octet-stream, when I dig in to the code I found
>> that Representation Type “PRIMITIVE” does not support
>> application/octet-stream (instead it supports in “MEDIA” and “BINARY”
>> types) is this the correct way in Olingo? If the answer is yes how can I
>> update an Edm.Stream property value with an “application/octet-stream”
>> without making it as media entity stream?
>>
>> Thanks in advance
>>
>> See: [1]
>> http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#Managing
>> Stream Properties
>>
>>
>> Best Regards
>> Ashan
>>
>> On Mon, Apr 11, 2016 at 7:01 PM, Ramesh Reddy <ra...@redhat.com> wrote:
>>
>>> Both implementations are driven through the OData specification
>>> documents, what we need here is more of clarification on interpretation of
>>> the specification.  We will try to seek out advise from OData TC.
>>>
>>> ------------------------------
>>>
>>> Is there any communication between the Olingo Developers and the .NET
>>> OData team?
>>>
>>> Op ma 11 apr. 2016 om 09:36 schreef Tom van Wietmarschen <
>>> aaargh@gmail.com>:
>>>
>>>> Ramesh,
>>>>
>>>> I see what you mean, that section is quite ambiguous. I'm wondering if
>>>> this is why the generated .NET client doesn't work with the @mediaReadLink
>>>> annotation, it may simply not be supported at that level.
>>>>
>>>> /Tom
>>>>
>>>> On 06 Apr 2016, at 16:41, Ramesh Reddy <ra...@redhat.com> wrote:
>>>>
>>>> Tom,
>>>>
>>>> You are correct, unfortunately Olingo still does not support
>>>> metadata=full thus those annotations missing, we will try to see if we can
>>>> fix this in 4.3. Unfortunately for "minimal" metadata the text seems little
>>>> confusing to me from [1] 3.1.1
>>>>
>>>> In addition, odata annotations MUST appear in the payload for cases
>>>> where actual values are not the same as the computed values and MAY appear
>>>> otherwise. When odata annotations appear in the payload, they are
>>>> treated as exceptions to the computed values.
>>>> Media entities and stream properties MAY in addition contain the
>>>> following annotations:
>>>>
>>>>    - odata.mediaEtag
>>>>    <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*_1>:
>>>>    the ETag of the stream, as appropriate
>>>>    - odata.mediaContentType
>>>>    <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*_1>:
>>>>    the content type of the stream
>>>>
>>>>
>>>> [1]
>>>> http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940605
>>>>
>>>> Ramesh..
>>>> ------------------------------
>>>>
>>>>
>>>> On 06 Apr 2016, at 14:44, Ramesh Reddy <ra...@redhat.com> wrote:
>>>>
>>>> Ashan,
>>>>
>>>> When the *entity* with Edm.Stream property is requested you will see
>>>> the URI of the Edm.Property in the payload.
>>>>
>>>>
>>>> Looking at the specs [1] this seems like incorrect behaviour.
>>>>
>>>> Specifically: "The value of a stream property is represented as a set
>>>> of odata.media*
>>>> <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*>
>>>>  annotations." , which OLingo does not do, instead it outputs a
>>>> property with the URL as value, instead of only annotations. Looking at the
>>>> example in the code as well as the description this seems incorrect.
>>>>
>>>> However, making changes to OLingo to output the media properties like
>>>> they are in the example in section 9 makes a generated .net client fail on
>>>> those annotated properties, which would make the implementation useless
>>>> even if it was correct. Not sure what is going on here.
>>>>
>>>> /Tom
>>>>
>>>> [1] -
>>>> http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940639 -
>>>> section 9.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>
>

Re: Stream Property value as a Binary data stream

Posted by Ramesh Reddy <ra...@redhat.com>.
Yes, that is an issue, since there is no metadata available not sure if this easy fix, you should log an issue. BTW, I do not think this is an issue with server-core-ext framework if you want to give it a try. 

----- Original Message -----

> Bellow is the stack-trace i got for postman PATCH request

> "code": "Exception: class
> org.apache.olingo.server.core.ContentNegotiatorException: unsupported
> content type: application/octet-stream",

> "message":
> "org.apache.olingo.server.core.ContentNegotiator.checkSupport(ContentNegotiator.java:174)

> org.apache.olingo.server.core.ODataDispatcher.getSupportedContentType(ODataDispatcher.java:558)

> org.apache.olingo.server.core.ODataDispatcher.handlePrimitiveDispatching(ODataDispatcher.java:422)

> org.apache.olingo.server.core.ODataDispatcher.handleResourceDispatching(ODataDispatcher.java:154)

> org.apache.olingo.server.core.ODataDispatcher.dispatch(ODataDispatcher.java:110)

> org.apache.olingo.server.core.ODataHandlerImpl.processInternal(ODataHandlerImpl.java:160)

> org.apache.olingo.server.core.ODataHandlerImpl.process(ODataHandlerImpl.java:85)

> org.apache.olingo.server.core.ODataHttpHandlerImpl.process(ODataHttpHandlerImpl.java:73)

> org.apache.olingo.server.core.ODataHttpHandlerImpl.process(ODataHttpHandlerImpl.java:87)\..."

> Best Regards
> Ashan

> On Tue, Apr 19, 2016 at 9:00 AM, Ramesh Reddy < rareddy@redhat.com > wrote:

> > Ashan,
> 

> > Can you post the stacktrace? Looks to be bug to me.
> 

> > Ramesh..
> 

> > > Hi
> > 
> 

> > > First of all thank you for the responses for my previous question
> > > (Ramesh,
> > > Tom & Michael) it was really supportive,
> > 
> 
> > > I have another question when writing/updating Edm.Stream properties,
> > > according to OData V4 [1] section 11.4.8.1 it says that “ A successful
> > > PUT
> > > request to the edit URL of a stream property changes the media stream
> > > associated with that property”.
> > 
> 

> > > So I have followed a similar use case in Olingo as follows
> > 
> 

> > > Request URL : EntitySet(keys)/<Edm.Stream Property>
> > 
> 

> > > HTTP Method : PUT or PATCH (I have used PATCH in this case)
> > 
> 

> > > Content Type : application/octet-stream
> > 
> 

> > > Request Body : Binary Date File
> > 
> 

> > > So when I send a request as above, Olingo throws an error: unsupported
> > > content type: application/octet-stream, when I dig in to the code I found
> > > that Representation Type “ PRIMITIVE ” does not support
> > > application/octet-stream (instead it supports in “MEDIA” and “BINARY”
> > > types)
> > > is this the correct way in Olingo? If the answer is yes how can I update
> > > an
> > > Edm.Stream property value with an “application/octet-stream” without
> > > making
> > > it as media entity stream?
> > 
> 

> > > Thanks in advance
> > 
> 

> > > See: [1]
> > > http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#Managing
> > > Stream Properties
> > 
> 

> > > Best Regards
> > 
> 
> > > Ashan
> > 
> 

> > > On Mon, Apr 11, 2016 at 7:01 PM, Ramesh Reddy < rareddy@redhat.com >
> > > wrote:
> > 
> 

> > > > Both implementations are driven through the OData specification
> > > > documents,
> > > > what we need here is more of clarification on interpretation of the
> > > > specification. We will try to seek out advise from OData TC.
> > > 
> > 
> 

> > > > > Is there any communication between the Olingo Developers and the .NET
> > > > > OData
> > > > > team?
> > > > 
> > > 
> > 
> 

> > > > > Op ma 11 apr. 2016 om 09:36 schreef Tom van Wietmarschen <
> > > > > aaargh@gmail.com
> > > > > >:
> > > > 
> > > 
> > 
> 

> > > > > > Ramesh,
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > I see what you mean, that section is quite ambiguous. I'm wondering
> > > > > > if
> > > > > > this
> > > > > > is why the generated .NET client doesn't work with the
> > > > > > @mediaReadLink
> > > > > > annotation, it may simply not be supported at that level.
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > /Tom
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > On 06 Apr 2016, at 16:41, Ramesh Reddy < rareddy@redhat.com >
> > > > > > > wrote:
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > Tom,
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > You are correct, unfortunately Olingo still does not support
> > > > > > > metadata=full
> > > > > > > thus those annotations missing, we will try to see if we can fix
> > > > > > > this
> > > > > > > in
> > > > > > > 4.3. Unfortunately for "minimal" metadata the text seems little
> > > > > > > confusing
> > > > > > > to
> > > > > > > me from [1] 3.1.1
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > In addition, odata annotations MUST appear in the payload for
> > > > > > > cases
> > > > > > > where
> > > > > > > actual values are not the same as the computed values and MAY
> > > > > > > appear
> > > > > > > otherwise. When odata annotations appear in the payload, they are
> > > > > > > treated
> > > > > > > as
> > > > > > > exceptions to the computed values.
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > > Media entities and stream properties MAY in addition contain the
> > > > > > > following
> > > > > > > annotations:
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > * odata.mediaEtag : the ETag of the stream, as appropriate
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > > * odata.mediaContentType : the content type of the stream
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > [1]
> > > > > > > http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940605
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > Ramesh..
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > > > On 06 Apr 2016, at 14:44, Ramesh Reddy < rareddy@redhat.com >
> > > > > > > > > wrote:
> > > > > > > > 
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > > > Ashan,
> > > > > > > > 
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > > > When the *entity* with Edm.Stream property is requested you
> > > > > > > > > will
> > > > > > > > > see
> > > > > > > > > the
> > > > > > > > > URI
> > > > > > > > > of the Edm.Property in the payload.
> > > > > > > > 
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > > Looking at the specs [1] this seems like incorrect behaviour.
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > > Specifically: " The value of a stream property is represented
> > > > > > > > as
> > > > > > > > a
> > > > > > > > set
> > > > > > > > of
> > > > > > > > odata.media* annotations." , which OLingo does not do, instead
> > > > > > > > it
> > > > > > > > outputs
> > > > > > > > a
> > > > > > > > property with the URL as value, instead of only annotations.
> > > > > > > > Looking
> > > > > > > > at
> > > > > > > > the
> > > > > > > > example in the code as well as the description this seems
> > > > > > > > incorrect.
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > > However, making changes to OLingo to output the media
> > > > > > > > properties
> > > > > > > > like
> > > > > > > > they
> > > > > > > > are in the example in section 9 makes a generated .net client
> > > > > > > > fail
> > > > > > > > on
> > > > > > > > those
> > > > > > > > annotated properties, which would make the implementation
> > > > > > > > useless
> > > > > > > > even
> > > > > > > > if
> > > > > > > > it
> > > > > > > > was correct. Not sure what is going on here.
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > > /Tom
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > > [1] -
> > > > > > > > http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940639
> > > > > > > > - section 9.
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

Re: Stream Property value as a Binary data stream

Posted by Ashan Bakmeedeniya <as...@gmail.com>.
Bellow is the stack-trace i got for postman PATCH request

"code": "Exception: class
org.apache.olingo.server.core.ContentNegotiatorException: unsupported
content type: application/octet-stream",

      "message":
"org.apache.olingo.server.core.ContentNegotiator.checkSupport(ContentNegotiator.java:174)

org.apache.olingo.server.core.ODataDispatcher.getSupportedContentType(ODataDispatcher.java:558)

org.apache.olingo.server.core.ODataDispatcher.handlePrimitiveDispatching(ODataDispatcher.java:422)

org.apache.olingo.server.core.ODataDispatcher.handleResourceDispatching(ODataDispatcher.java:154)

org.apache.olingo.server.core.ODataDispatcher.dispatch(ODataDispatcher.java:110)

org.apache.olingo.server.core.ODataHandlerImpl.processInternal(ODataHandlerImpl.java:160)

org.apache.olingo.server.core.ODataHandlerImpl.process(ODataHandlerImpl.java:85)

org.apache.olingo.server.core.ODataHttpHandlerImpl.process(ODataHttpHandlerImpl.java:73)

org.apache.olingo.server.core.ODataHttpHandlerImpl.process(ODataHttpHandlerImpl.java:87)\..."

Best Regards
Ashan


On Tue, Apr 19, 2016 at 9:00 AM, Ramesh Reddy <ra...@redhat.com> wrote:

> Ashan,
>
> Can you post the stacktrace? Looks to be bug to me.
>
> Ramesh..
>
> ------------------------------
>
> Hi
>
> First of all thank you for the responses for my previous question (Ramesh,
> Tom & Michael) it was really supportive,
> I have another question when writing/updating Edm.Stream properties,
> according to OData V4 [1] section *11.4.8.1 *it says that* “*A successful
> PUT request to the edit URL of a stream property changes the media stream
> associated with that property”.
>
> So I have followed a similar use case in Olingo as follows
>
>
> *Request URL*: EntitySet(keys)/<Edm.Stream Property>
>
> *HTTP Method*: PUT or PATCH (I have used PATCH in this case)
>
> *Content Type*: application/octet-stream
>
> *Request Body*: Binary Date File
>
>
> So when I send a request as above, Olingo throws an error: unsupported
> content type: application/octet-stream, when I dig in to the code I found
> that Representation Type “PRIMITIVE” does not support
> application/octet-stream (instead it supports in “MEDIA” and “BINARY”
> types) is this the correct way in Olingo? If the answer is yes how can I
> update an Edm.Stream property value with an “application/octet-stream”
> without making it as media entity stream?
>
> Thanks in advance
>
> See: [1]
> http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#Managing
> Stream Properties
>
>
> Best Regards
> Ashan
>
> On Mon, Apr 11, 2016 at 7:01 PM, Ramesh Reddy <ra...@redhat.com> wrote:
>
>> Both implementations are driven through the OData specification
>> documents, what we need here is more of clarification on interpretation of
>> the specification.  We will try to seek out advise from OData TC.
>>
>> ------------------------------
>>
>> Is there any communication between the Olingo Developers and the .NET
>> OData team?
>>
>> Op ma 11 apr. 2016 om 09:36 schreef Tom van Wietmarschen <
>> aaargh@gmail.com>:
>>
>>> Ramesh,
>>>
>>> I see what you mean, that section is quite ambiguous. I'm wondering if
>>> this is why the generated .NET client doesn't work with the @mediaReadLink
>>> annotation, it may simply not be supported at that level.
>>>
>>> /Tom
>>>
>>> On 06 Apr 2016, at 16:41, Ramesh Reddy <ra...@redhat.com> wrote:
>>>
>>> Tom,
>>>
>>> You are correct, unfortunately Olingo still does not support
>>> metadata=full thus those annotations missing, we will try to see if we can
>>> fix this in 4.3. Unfortunately for "minimal" metadata the text seems little
>>> confusing to me from [1] 3.1.1
>>>
>>> In addition, odata annotations MUST appear in the payload for cases
>>> where actual values are not the same as the computed values and MAY appear
>>> otherwise. When odata annotations appear in the payload, they are
>>> treated as exceptions to the computed values.
>>> Media entities and stream properties MAY in addition contain the
>>> following annotations:
>>>
>>>    - odata.mediaEtag
>>>    <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*_1>:
>>>    the ETag of the stream, as appropriate
>>>    - odata.mediaContentType
>>>    <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*_1>:
>>>    the content type of the stream
>>>
>>>
>>> [1]
>>> http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940605
>>>
>>> Ramesh..
>>> ------------------------------
>>>
>>>
>>> On 06 Apr 2016, at 14:44, Ramesh Reddy <ra...@redhat.com> wrote:
>>>
>>> Ashan,
>>>
>>> When the *entity* with Edm.Stream property is requested you will see the
>>> URI of the Edm.Property in the payload.
>>>
>>>
>>> Looking at the specs [1] this seems like incorrect behaviour.
>>>
>>> Specifically: "The value of a stream property is represented as a set of
>>>  odata.media*
>>> <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*>
>>>  annotations." , which OLingo does not do, instead it outputs a
>>> property with the URL as value, instead of only annotations. Looking at the
>>> example in the code as well as the description this seems incorrect.
>>>
>>> However, making changes to OLingo to output the media properties like
>>> they are in the example in section 9 makes a generated .net client fail on
>>> those annotated properties, which would make the implementation useless
>>> even if it was correct. Not sure what is going on here.
>>>
>>> /Tom
>>>
>>> [1] -
>>> http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940639 -
>>> section 9.
>>>
>>>
>>>
>>>
>>>
>>
>
>

Re: Stream Property value as a Binary data stream

Posted by Ramesh Reddy <ra...@redhat.com>.
Ashan, 

Can you post the stacktrace? Looks to be bug to me. 

Ramesh.. 

----- Original Message -----

> Hi

> First of all thank you for the responses for my previous question (Ramesh,
> Tom & Michael) it was really supportive,
> I have another question when writing/updating Edm.Stream properties,
> according to OData V4 [1] section 11.4.8.1 it says that “ A successful PUT
> request to the edit URL of a stream property changes the media stream
> associated with that property”.

> So I have followed a similar use case in Olingo as follows

> Request URL : EntitySet(keys)/<Edm.Stream Property>

> HTTP Method : PUT or PATCH (I have used PATCH in this case)

> Content Type : application/octet-stream

> Request Body : Binary Date File

> So when I send a request as above, Olingo throws an error: unsupported
> content type: application/octet-stream, when I dig in to the code I found
> that Representation Type “ PRIMITIVE ” does not support
> application/octet-stream (instead it supports in “MEDIA” and “BINARY” types)
> is this the correct way in Olingo? If the answer is yes how can I update an
> Edm.Stream property value with an “application/octet-stream” without making
> it as media entity stream?

> Thanks in advance

> See: [1]
> http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#Managing
> Stream Properties

> Best Regards
> Ashan

> On Mon, Apr 11, 2016 at 7:01 PM, Ramesh Reddy < rareddy@redhat.com > wrote:

> > Both implementations are driven through the OData specification documents,
> > what we need here is more of clarification on interpretation of the
> > specification. We will try to seek out advise from OData TC.
> 

> > > Is there any communication between the Olingo Developers and the .NET
> > > OData
> > > team?
> > 
> 

> > > Op ma 11 apr. 2016 om 09:36 schreef Tom van Wietmarschen <
> > > aaargh@gmail.com
> > > >:
> > 
> 

> > > > Ramesh,
> > > 
> > 
> 

> > > > I see what you mean, that section is quite ambiguous. I'm wondering if
> > > > this
> > > > is why the generated .NET client doesn't work with the @mediaReadLink
> > > > annotation, it may simply not be supported at that level.
> > > 
> > 
> 

> > > > /Tom
> > > 
> > 
> 

> > > > > On 06 Apr 2016, at 16:41, Ramesh Reddy < rareddy@redhat.com > wrote:
> > > > 
> > > 
> > 
> 

> > > > > Tom,
> > > > 
> > > 
> > 
> 

> > > > > You are correct, unfortunately Olingo still does not support
> > > > > metadata=full
> > > > > thus those annotations missing, we will try to see if we can fix this
> > > > > in
> > > > > 4.3. Unfortunately for "minimal" metadata the text seems little
> > > > > confusing
> > > > > to
> > > > > me from [1] 3.1.1
> > > > 
> > > 
> > 
> 

> > > > > In addition, odata annotations MUST appear in the payload for cases
> > > > > where
> > > > > actual values are not the same as the computed values and MAY appear
> > > > > otherwise. When odata annotations appear in the payload, they are
> > > > > treated
> > > > > as
> > > > > exceptions to the computed values.
> > > > 
> > > 
> > 
> 
> > > > > Media entities and stream properties MAY in addition contain the
> > > > > following
> > > > > annotations:
> > > > 
> > > 
> > 
> 

> > > > > * odata.mediaEtag : the ETag of the stream, as appropriate
> > > > 
> > > 
> > 
> 
> > > > > * odata.mediaContentType : the content type of the stream
> > > > 
> > > 
> > 
> 

> > > > > [1]
> > > > > http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940605
> > > > 
> > > 
> > 
> 

> > > > > Ramesh..
> > > > 
> > > 
> > 
> 

> > > > > > > On 06 Apr 2016, at 14:44, Ramesh Reddy < rareddy@redhat.com >
> > > > > > > wrote:
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > Ashan,
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > When the *entity* with Edm.Stream property is requested you will
> > > > > > > see
> > > > > > > the
> > > > > > > URI
> > > > > > > of the Edm.Property in the payload.
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > Looking at the specs [1] this seems like incorrect behaviour.
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > Specifically: " The value of a stream property is represented as a
> > > > > > set
> > > > > > of
> > > > > > odata.media* annotations." , which OLingo does not do, instead it
> > > > > > outputs
> > > > > > a
> > > > > > property with the URL as value, instead of only annotations.
> > > > > > Looking
> > > > > > at
> > > > > > the
> > > > > > example in the code as well as the description this seems
> > > > > > incorrect.
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > However, making changes to OLingo to output the media properties
> > > > > > like
> > > > > > they
> > > > > > are in the example in section 9 makes a generated .net client fail
> > > > > > on
> > > > > > those
> > > > > > annotated properties, which would make the implementation useless
> > > > > > even
> > > > > > if
> > > > > > it
> > > > > > was correct. Not sure what is going on here.
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > /Tom
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > [1] -
> > > > > > http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940639
> > > > > > - section 9.
> > > > > 
> > > > 
> > > 
> > 
> 

Re: Stream Property value as a Binary data stream

Posted by Ashan Bakmeedeniya <as...@gmail.com>.
Hi

First of all thank you for the responses for my previous question (Ramesh,
Tom & Michael) it was really supportive,
I have another question when writing/updating Edm.Stream properties,
according to OData V4 [1] section *11.4.8.1 *it says that* “*A successful
PUT request to the edit URL of a stream property changes the media stream
associated with that property”.

So I have followed a similar use case in Olingo as follows


*Request URL*: EntitySet(keys)/<Edm.Stream Property>

*HTTP Method*: PUT or PATCH (I have used PATCH in this case)

*Content Type*: application/octet-stream

*Request Body*: Binary Date File


So when I send a request as above, Olingo throws an error: unsupported
content type: application/octet-stream, when I dig in to the code I found
that Representation Type “PRIMITIVE” does not support
application/octet-stream (instead it supports in “MEDIA” and “BINARY”
types) is this the correct way in Olingo? If the answer is yes how can I
update an Edm.Stream property value with an “application/octet-stream”
without making it as media entity stream?

Thanks in advance

See: [1]
http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#Managing
Stream Properties


Best Regards
Ashan

On Mon, Apr 11, 2016 at 7:01 PM, Ramesh Reddy <ra...@redhat.com> wrote:

> Both implementations are driven through the OData specification documents,
> what we need here is more of clarification on interpretation of the
> specification.  We will try to seek out advise from OData TC.
>
> ------------------------------
>
> Is there any communication between the Olingo Developers and the .NET
> OData team?
>
> Op ma 11 apr. 2016 om 09:36 schreef Tom van Wietmarschen <aaargh@gmail.com
> >:
>
>> Ramesh,
>>
>> I see what you mean, that section is quite ambiguous. I'm wondering if
>> this is why the generated .NET client doesn't work with the @mediaReadLink
>> annotation, it may simply not be supported at that level.
>>
>> /Tom
>>
>> On 06 Apr 2016, at 16:41, Ramesh Reddy <ra...@redhat.com> wrote:
>>
>> Tom,
>>
>> You are correct, unfortunately Olingo still does not support
>> metadata=full thus those annotations missing, we will try to see if we can
>> fix this in 4.3. Unfortunately for "minimal" metadata the text seems little
>> confusing to me from [1] 3.1.1
>>
>> In addition, odata annotations MUST appear in the payload for cases
>> where actual values are not the same as the computed values and MAY appear
>> otherwise. When odata annotations appear in the payload, they are
>> treated as exceptions to the computed values.
>> Media entities and stream properties MAY in addition contain the
>> following annotations:
>>
>>    - odata.mediaEtag
>>    <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*_1>:
>>    the ETag of the stream, as appropriate
>>    - odata.mediaContentType
>>    <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*_1>:
>>    the content type of the stream
>>
>>
>> [1]
>> http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940605
>>
>> Ramesh..
>> ------------------------------
>>
>>
>> On 06 Apr 2016, at 14:44, Ramesh Reddy <ra...@redhat.com> wrote:
>>
>> Ashan,
>>
>> When the *entity* with Edm.Stream property is requested you will see the
>> URI of the Edm.Property in the payload.
>>
>>
>> Looking at the specs [1] this seems like incorrect behaviour.
>>
>> Specifically: "The value of a stream property is represented as a set of
>> odata.media*
>> <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*>
>>  annotations." , which OLingo does not do, instead it outputs a property
>> with the URL as value, instead of only annotations. Looking at the example
>> in the code as well as the description this seems incorrect.
>>
>> However, making changes to OLingo to output the media properties like
>> they are in the example in section 9 makes a generated .net client fail on
>> those annotated properties, which would make the implementation useless
>> even if it was correct. Not sure what is going on here.
>>
>> /Tom
>>
>> [1] -
>> http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940639 -
>> section 9.
>>
>>
>>
>>
>>
>

Re: Stream Property value as a Binary data stream

Posted by Ramesh Reddy <ra...@redhat.com>.
Both implementations are driven through the OData specification documents, what we need here is more of clarification on interpretation of the specification. We will try to seek out advise from OData TC. 

----- Original Message -----

> Is there any communication between the Olingo Developers and the .NET OData
> team?

> Op ma 11 apr. 2016 om 09:36 schreef Tom van Wietmarschen < aaargh@gmail.com
> >:

> > Ramesh,
> 

> > I see what you mean, that section is quite ambiguous. I'm wondering if this
> > is why the generated .NET client doesn't work with the @mediaReadLink
> > annotation, it may simply not be supported at that level.
> 

> > /Tom
> 

> > > On 06 Apr 2016, at 16:41, Ramesh Reddy < rareddy@redhat.com > wrote:
> > 
> 

> > > Tom,
> > 
> 

> > > You are correct, unfortunately Olingo still does not support
> > > metadata=full
> > > thus those annotations missing, we will try to see if we can fix this in
> > > 4.3. Unfortunately for "minimal" metadata the text seems little confusing
> > > to
> > > me from [1] 3.1.1
> > 
> 

> > > In addition, odata annotations MUST appear in the payload for cases where
> > > actual values are not the same as the computed values and MAY appear
> > > otherwise. When odata annotations appear in the payload, they are treated
> > > as
> > > exceptions to the computed values.
> > 
> 
> > > Media entities and stream properties MAY in addition contain the
> > > following
> > > annotations:
> > 
> 

> > > * odata.mediaEtag : the ETag of the stream, as appropriate
> > 
> 
> > > * odata.mediaContentType : the content type of the stream
> > 
> 

> > > [1]
> > > http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940605
> > 
> 

> > > Ramesh..
> > 
> 

> > > > > On 06 Apr 2016, at 14:44, Ramesh Reddy < rareddy@redhat.com > wrote:
> > > > 
> > > 
> > 
> 

> > > > > Ashan,
> > > > 
> > > 
> > 
> 

> > > > > When the *entity* with Edm.Stream property is requested you will see
> > > > > the
> > > > > URI
> > > > > of the Edm.Property in the payload.
> > > > 
> > > 
> > 
> 

> > > > Looking at the specs [1] this seems like incorrect behaviour.
> > > 
> > 
> 

> > > > Specifically: " The value of a stream property is represented as a set
> > > > of
> > > > odata.media* annotations." , which OLingo does not do, instead it
> > > > outputs
> > > > a
> > > > property with the URL as value, instead of only annotations. Looking at
> > > > the
> > > > example in the code as well as the description this seems incorrect.
> > > 
> > 
> 

> > > > However, making changes to OLingo to output the media properties like
> > > > they
> > > > are in the example in section 9 makes a generated .net client fail on
> > > > those
> > > > annotated properties, which would make the implementation useless even
> > > > if
> > > > it
> > > > was correct. Not sure what is going on here.
> > > 
> > 
> 

> > > > /Tom
> > > 
> > 
> 

> > > > [1] -
> > > > http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940639
> > > > - section 9.
> > > 
> > 
> 

Re: Stream Property value as a Binary data stream

Posted by Hans Kruse <kr...@hanskruse.eu>.
Is there any communication between the Olingo Developers and the .NET OData
team?

Op ma 11 apr. 2016 om 09:36 schreef Tom van Wietmarschen <aa...@gmail.com>:

> Ramesh,
>
> I see what you mean, that section is quite ambiguous. I'm wondering if
> this is why the generated .NET client doesn't work with the @mediaReadLink
> annotation, it may simply not be supported at that level.
>
> /Tom
>
> On 06 Apr 2016, at 16:41, Ramesh Reddy <ra...@redhat.com> wrote:
>
> Tom,
>
> You are correct, unfortunately Olingo still does not support metadata=full
> thus those annotations missing, we will try to see if we can fix this in
> 4.3. Unfortunately for "minimal" metadata the text seems little confusing
> to me from [1] 3.1.1
>
> In addition, odata annotations MUST appear in the payload for cases where
> actual values are not the same as the computed values and MAY appear
> otherwise. When odata annotations appear in the payload, they are treated
> as exceptions to the computed values.
> Media entities and stream properties MAY in addition contain the following
> annotations:
>
>    - odata.mediaEtag
>    <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*_1>:
>    the ETag of the stream, as appropriate
>    - odata.mediaContentType
>    <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*_1>:
>    the content type of the stream
>
>
> [1]
> http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940605
>
> Ramesh..
> ------------------------------
>
>
> On 06 Apr 2016, at 14:44, Ramesh Reddy <ra...@redhat.com> wrote:
>
> Ashan,
>
> When the *entity* with Edm.Stream property is requested you will see the
> URI of the Edm.Property in the payload.
>
>
> Looking at the specs [1] this seems like incorrect behaviour.
>
> Specifically: "The value of a stream property is represented as a set of
> odata.media*
> <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*>
>  annotations." , which OLingo does not do, instead it outputs a property
> with the URL as value, instead of only annotations. Looking at the example
> in the code as well as the description this seems incorrect.
>
> However, making changes to OLingo to output the media properties like they
> are in the example in section 9 makes a generated .net client fail on those
> annotated properties, which would make the implementation useless even if
> it was correct. Not sure what is going on here.
>
> /Tom
>
> [1] -
> http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940639 -
> section 9.
>
>
>
>
>

Re: Stream Property value as a Binary data stream

Posted by Tom van Wietmarschen <aa...@gmail.com>.
Ramesh,

I see what you mean, that section is quite ambiguous. I'm wondering if this is why the generated .NET client doesn't work with the @mediaReadLink annotation, it may simply not be supported at that level. 

/Tom 
 
> On 06 Apr 2016, at 16:41, Ramesh Reddy <ra...@redhat.com> wrote:
> 
> Tom,
> 
> You are correct, unfortunately Olingo still does not support metadata=full thus those annotations missing, we will try to see if we can fix this in 4.3. Unfortunately for "minimal" metadata the text seems little confusing to me from [1] 3.1.1
> 
> In addition, odata annotations MUST appear in the payload for cases where actual values are not the same as the computed values and MAY appear otherwise. When odata annotations appear in the payload, they are treated as exceptions to the computed values.
> Media entities and stream properties MAY in addition contain the following annotations:
> odata.mediaEtag <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*_1>: the ETag of the stream, as appropriate
> odata.mediaContentType <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*_1>: the content type of the stream
> 
> [1] http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940605 <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940605>
> 
> Ramesh..
> 
> On 06 Apr 2016, at 14:44, Ramesh Reddy <rareddy@redhat.com <ma...@redhat.com>> wrote:
> 
> Ashan,
> 
> When the *entity* with Edm.Stream property is requested you will see the URI of the Edm.Property in the payload. 
> 
> Looking at the specs [1] this seems like incorrect behaviour. 
> 
> Specifically: "The value of a stream property is represented as a set of odata.media* <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*> annotations." , which OLingo does not do, instead it outputs a property with the URL as value, instead of only annotations. Looking at the example in the code as well as the description this seems incorrect.
> 
> However, making changes to OLingo to output the media properties like they are in the example in section 9 makes a generated .net client fail on those annotated properties, which would make the implementation useless even if it was correct. Not sure what is going on here. 
> 
> /Tom
> 
> [1] - http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940639 <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940639> - section 9. 
> 
> 
> 
> 


Re: Stream Property value as a Binary data stream

Posted by Ramesh Reddy <ra...@redhat.com>.
Tom, 

I can not comment about the .Net client, that you might have to raise with .Net library authors. What I am saying is it is not clear what the expected behavior should be in "metadata=minimal" mode, based on my link, thus may be implementation in Olingo. I am sure what you have done probably satisfies the metadata=full scenario. Let me know if I am interpreting this wrong, then we can open up JIRA. 

Thanks 

Ramesh.. 

----- Original Message -----

> > On 06 Apr 2016, at 16:41, Ramesh Reddy < rareddy@redhat.com > wrote:
> 

> > You are correct, unfortunately Olingo still does not support metadata=full
> > thus those annotations missing, we will try to see if we can fix this in
> > 4.3. Unfortunately for "minimal" metadata the text seems little confusing
> > to
> > me from [1] 3.1.1
> 

> I already implemented this locally but I can't get it to work with a
> generated .NET client (I'm assuming here the MS implementation is the
> defacto reference impl. since it's originally their standard). See:
> http://stackoverflow.com/questions/36356666/odata-net-4-16-generated-client-fails-on-annotations

> I can provide you with a patch against OLingo 4.1.0 if you want. I basically
> added a similar mechanism as used for media-entities to the Property class
> and it's serializer. (so there is setETag, setContentType, etc.). As far as
> I can see it is according to the OData spec, it just doesn't work in a
> 'real' client, not sure what is going on there yet.

> /Tom

Re: Stream Property value as a Binary data stream

Posted by Tom van Wietmarschen <aa...@gmail.com>.
> On 06 Apr 2016, at 16:41, Ramesh Reddy <ra...@redhat.com> wrote:
> 
> You are correct, unfortunately Olingo still does not support metadata=full thus those annotations missing, we will try to see if we can fix this in 4.3. Unfortunately for "minimal" metadata the text seems little confusing to me from [1] 3.1.1

I already implemented this locally but I can't get it to work with a generated .NET client (I'm assuming here the MS implementation is the defacto reference impl. since it's originally their standard). See: http://stackoverflow.com/questions/36356666/odata-net-4-16-generated-client-fails-on-annotations <http://stackoverflow.com/questions/36356666/odata-net-4-16-generated-client-fails-on-annotations> 

I can provide you with a patch against OLingo 4.1.0 if you want. I basically added a similar mechanism as used for media-entities to the Property class and it's serializer. (so there is setETag, setContentType, etc.). As far as I can see it is according to the OData spec, it just doesn't work in a 'real' client, not sure what is going on there yet. 

/Tom

Re: Stream Property value as a Binary data stream

Posted by Ramesh Reddy <ra...@redhat.com>.
Tom, 

You are correct, unfortunately Olingo still does not support metadata=full thus those annotations missing, we will try to see if we can fix this in 4.3. Unfortunately for "minimal" metadata the text seems little confusing to me from [1] 3.1.1 

In addition, odata annotations MUST appear in the payload for cases where actual values are not the same as the computed values and MAY appear otherwise. When odata annotations appear in the payload, they are treated as exceptions to the computed values. 

Media entities and stream properties MAY in addition contain the following annotations: 

    * odata.mediaEtag : the ETag of the stream, as appropriate 
    * odata.mediaContentType : the content type of the stream 

[1] http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940605 

Ramesh.. 
----- Original Message -----

> > On 06 Apr 2016, at 14:44, Ramesh Reddy < rareddy@redhat.com > wrote:
> 

> > Ashan,
> 

> > When the *entity* with Edm.Stream property is requested you will see the
> > URI
> > of the Edm.Property in the payload.
> 

> Looking at the specs [1] this seems like incorrect behaviour.

> Specifically: " The value of a stream property is represented as a set of
> odata.media* annotations." , which OLingo does not do, instead it outputs a
> property with the URL as value, instead of only annotations. Looking at the
> example in the code as well as the description this seems incorrect.

> However, making changes to OLingo to output the media properties like they
> are in the example in section 9 makes a generated .net client fail on those
> annotated properties, which would make the implementation useless even if it
> was correct. Not sure what is going on here.

> /Tom

> [1] -
> http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940639
> - section 9.

Re: Stream Property value as a Binary data stream

Posted by Tom van Wietmarschen <aa...@gmail.com>.
> On 06 Apr 2016, at 14:44, Ramesh Reddy <ra...@redhat.com> wrote:
> 
> Ashan,
> 
> When the *entity* with Edm.Stream property is requested you will see the URI of the Edm.Property in the payload. 

Looking at the specs [1] this seems like incorrect behaviour. 

Specifically: "The value of a stream property is represented as a set of odata.media* <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Annotation_odata.media*> annotations." , which OLingo does not do, instead it outputs a property with the URL as value, instead of only annotations. Looking at the example in the code as well as the description this seems incorrect.

However, making changes to OLingo to output the media properties like they are in the example in section 9 makes a generated .net client fail on those annotated properties, which would make the implementation useless even if it was correct. Not sure what is going on here. 

/Tom

[1] - http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940639 <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940639> - section 9. 




Re: Stream Property value as a Binary data stream

Posted by Ramesh Reddy <ra...@redhat.com>.
Ashan, 

When the *entity* with Edm.Stream property is requested you will see the URI of the Edm.Property in the payload. When the *Edm.Stream* is requested directly then the stream is returned. Also note Media entities are completely different, where they have implicit stream. 

Ramesh.. 

----- Original Message -----

> Hi Michael

> Thanks for the reply,
> But according to the odata-v4.0-os-part2-url-conventions [1] section 4.7 it
> says that Edm.Stream returns the raw value of the media stream.
> And other than that I have checked in reference services provided by OData V4
> [2] it seems it will return stream (XML) instead of URL, Correct me if I am
> still wrong on this matter.

> See: [1]
> http://docs.oasis-open.org/odata/odata/v4.0/os/part2-url-conventions/odata-v4.0-os-part2-url-conventions.html
> [2] http://services.odata.org/V4/OData/OData.svc/PersonDetails(0)/Photo

> Best Regards
> Ashan

> On Wed, Apr 6, 2016 at 3:46 PM, Bolz, Michael < michael.bolz@sap.com > wrote:

> > Hi Ashan,
> 

> > The Edm.Stream property as defined in OData contains only the URL for
> > editing
> > the stream values.
> 

> > > An entity may have one or more stream properties. Stream properties are
> > > properties of type Edm.Stream.
> > 
> 
> > > The values for stream properties do not appear in the entity payload.
> > > Instead, the values are read or written through URLs.
> > 
> 

> > see:
> > http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html#_Toc370126120
> 

> > Access of the stream is then via the URL.
> 

> > Kind Regards,
> 
> > Michael
> 

> > > On 06 Apr 2016, at 11:46, Ashan Bakmeedeniya < ashanb58@gmail.com >
> > > wrote:
> > 
> 

> > > Hi
> > 
> 

> > > If I am correct, according to the OData spec ( http://www.odata.org/ ) we
> > > should get a stream when we request for the property value of type
> > > Edm.Stream, but right now (Olingo 4.3.0-SNAPSHOT) instead we get a
> > > URI(which
> > > we set). So I want to know whether this is the correct behavior in Olingo
> > > or
> > > something still needs to be implemented.
> > 
> 
> > > Your response will be greatly appreciated.
> > 
> 

> > > Thanks and Best Regards
> > 
> 
> > > Ashan
> > 
> 

Re: Stream Property value as a Binary data stream

Posted by Tom van Wietmarschen <aa...@gmail.com>.
> On 06 Apr 2016, at 14:32, Ashan Bakmeedeniya <as...@gmail.com> wrote:
> 
> Hi Michael 
> 
> Thanks for the reply, 
> But according to the odata-v4.0-os-part2-url-conventions [1] section 4.7 it says that Edm.Stream returns the raw value of the media stream.
> And other than that I have checked in reference services provided by OData V4 [2] it seems it will return stream (XML) instead of URL, Correct me if I am still wrong on this matter.
> 
The value of a stream property when addressed directly returns the raw stream. As part of an entity it should be a set of annotations indicating the URL for reading (and optionally writing) the raw data[1].

Currently OLingo does not support this.

I made some changes to a local copy of OLingo 4.1.0 to add these annotations, which I'd like to submit to the olingo project if I could get them to work,  but they refuse to work with a real client [2]. Not sure if I'm interpreting the specs wrong or there is a problem with the generated .NET client. 

/Tom

[1] - http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940639 <http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940639> , section 9
[2] - http://stackoverflow.com/questions/36356666/odata-net-4-16-generated-client-fails-on-annotations <http://stackoverflow.com/questions/36356666/odata-net-4-16-generated-client-fails-on-annotations> - Post by a colleague who is writing testcases against our service.



Re: Stream Property value as a Binary data stream

Posted by Ashan Bakmeedeniya <as...@gmail.com>.
Hi Michael

Thanks for the reply,
But according to the odata-v4.0-os-part2-url-conventions [1] section 4.7 it
says that Edm.Stream returns the raw value of the media stream.
And other than that I have checked in reference services provided by OData
V4 [2] it seems it will return stream (XML) instead of URL, Correct me if I
am still wrong on this matter.

See: [1]
http://docs.oasis-open.org/odata/odata/v4.0/os/part2-url-conventions/odata-v4.0-os-part2-url-conventions.html
        [2]
http://services.odata.org/V4/OData/OData.svc/PersonDetails(0)/Photo

Best Regards
Ashan



On Wed, Apr 6, 2016 at 3:46 PM, Bolz, Michael <mi...@sap.com> wrote:

> Hi Ashan,
>
> The Edm.Stream property as defined in OData contains only the URL for
> editing the stream values.
>
> An entity may have one or more stream properties. Stream properties are
> properties of type Edm.Stream.
> The values for stream properties do not appear in the entity payload.
> Instead, the values are read or written through URLs.
>
> see:
> http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html#_Toc370126120
>
> Access of the stream is then via the URL.
>
> Kind Regards,
> Michael
>
>
>
> On 06 Apr 2016, at 11:46, Ashan Bakmeedeniya <as...@gmail.com> wrote:
>
> Hi
>
> If I am correct, according to the OData spec (http://www.odata.org/) we
> should get a stream when we request for the property value of type
> Edm.Stream, but right now (Olingo 4.3.0-SNAPSHOT) instead we get a
> URI(which we set). So I want to know whether this is the correct behavior
> in Olingo or something still needs to be implemented.
> Your response will be greatly appreciated.
>
>
> Thanks and Best Regards
> Ashan
>
>
>

Re: Stream Property value as a Binary data stream

Posted by "Bolz, Michael" <mi...@sap.com>.
Hi Ashan,

The Edm.Stream property as defined in OData contains only the URL for editing the stream values.

> An entity may have one or more stream properties. Stream properties are properties of type Edm.Stream.
> The values for stream properties do not appear in the entity payload. Instead, the values are read or written through URLs.
see: http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html#_Toc370126120 <http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html#_Toc370126120>

Access of the stream is then via the URL.

Kind Regards,
Michael



> On 06 Apr 2016, at 11:46, Ashan Bakmeedeniya <as...@gmail.com> wrote:
> 
> Hi 
> 
> If I am correct, according to the OData spec (http://www.odata.org/ <http://www.odata.org/>) we should get a stream when we request for the property value of type Edm.Stream, but right now (Olingo 4.3.0-SNAPSHOT) instead we get a URI(which we set). So I want to know whether this is the correct behavior in Olingo or something still needs to be implemented.
> Your response will be greatly appreciated.
> 
> 
> 
> Thanks and Best Regards
> Ashan
>