Author: mibo
Date: Wed Mar  2 04:59:54 2016
New Revision: 1733216

URL: http://svn.apache.org/viewvc?rev=1733216&view=rev
Log:
Json Response sample

Modified:
    
olingo/site/trunk/content/doc/odata4/tutorials/streaming/tutorial_streaming.mdtext

Modified: 
olingo/site/trunk/content/doc/odata4/tutorials/streaming/tutorial_streaming.mdtext
URL: 
http://svn.apache.org/viewvc/olingo/site/trunk/content/doc/odata4/tutorials/streaming/tutorial_streaming.mdtext?rev=1733216&r1=1733215&r2=1733216&view=diff
==============================================================================
--- 
olingo/site/trunk/content/doc/odata4/tutorials/streaming/tutorial_streaming.mdtext
 (original)
+++ 
olingo/site/trunk/content/doc/odata4/tutorials/streaming/tutorial_streaming.mdtext
 Wed Mar  2 04:59:54 2016
@@ -258,7 +258,7 @@ Based on this the *OData-v4.0 Part1 Prot
 
 For *exception/error handling* in Olingo exists the 
`ODataContentWriteErrorCallback` interface which must be implemented and then 
can be set as an option at the `EntityCollectionSerializerOptions` with the 
`writeContentErrorCallback(...)` method.
 
-If during processing (*write*) of the `ODataContent` object (normally 
serialization into an according `OutputStream`, like the `ServletOutputStream` 
in a JEE servlet environment) an exception occurs the 
`ODataContentWriteErrorCallback` `handleError` method is called.
+If during processing (*write*) of the `ODataContent` object (normally 
serialization into an according `OutputStream`, like the 
`javax.servlet.ServletOutputStream` in a JEE servlet environment) an exception 
occurs the `ODataContentWriteErrorCallback` `handleError` method is called.
 This method get as parameter the `ODataContentWriteErrorContext` which 
contains at least the thrown and to be handled `Exception` and the 
`WritableByteChannel` in which the payload of the response was written before 
the error occurred.
 Based on the requirements of the OData specification that *the service MUST 
generate an error within the payload, which may leave the response malformed* 
the `WritableByteChannel` is still open and the service developer can write 
additional data to ensure that the response payload is malformed.
 
@@ -290,7 +290,31 @@ And could be set in the [read collection
 
 
 # Run sample service
-After building and deploying your service to your server, you can try a 
requests to the entity set via: 
[http://localhost:8080/DemoService-Action/DemoService.svc/Products](http://localhost:8080/DemoService-Action/DemoService.svc/Products)
+After building and deploying your service to your server, you can try a 
requests to the entity set via: 
[http://localhost:8080/DemoService/DemoService.svc/Products?$format=json](http://localhost:8080/DemoService/DemoService.svc/Products?$format=json)
+
+The response is exactly the same response as in the none streaming request. So 
unfortunaly here is no difference beside of the technical fact that the 
response is serialized at the very end of the request chain and directly 
written into the response output stream (`javax.servlet.ServletOutputStream`)
+
+    ::::json
+    {
+      "@odata.context": "$metadata#Products",
+      "value": [
+        {
+          "ID": 1,
+          "Name": "Notebook Basic 15",
+          "Description": "Notebook Basic, 1.7GHz - 15 XGA - 1024MB DDR2 SDRAM 
- 40GB"
+        },
+        {
+          "ID": 2,
+          "Name": "1UMTS PDA",
+          "Description": "Ultrafast 3G UMTS/HSDPA Pocket PC, supports GSM 
network"
+        },
+        {
+          "ID": 3,
+          "Name": "Ergo Screen",
+          "Description": "19 Optimum Resolution 1024 x 768 @ 85Hz, resolution 
1280 x 960"
+        }
+      ]
+    }
 
 # Links
 


Reply via email to