You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2015/04/28 14:47:29 UTC

svn commit: r1676519 - /olingo/site/trunk/content/doc/odata4/tutorials/read/tutorial_read.mdtext

Author: mibo
Date: Tue Apr 28 12:47:29 2015
New Revision: 1676519

URL: http://svn.apache.org/r1676519
Log:
CMS commit to olingo by mibo

Modified:
    olingo/site/trunk/content/doc/odata4/tutorials/read/tutorial_read.mdtext

Modified: olingo/site/trunk/content/doc/odata4/tutorials/read/tutorial_read.mdtext
URL: http://svn.apache.org/viewvc/olingo/site/trunk/content/doc/odata4/tutorials/read/tutorial_read.mdtext?rev=1676519&r1=1676518&r2=1676519&view=diff
==============================================================================
--- olingo/site/trunk/content/doc/odata4/tutorials/read/tutorial_read.mdtext (original)
+++ olingo/site/trunk/content/doc/odata4/tutorials/read/tutorial_read.mdtext Tue Apr 28 12:47:29 2015
@@ -49,7 +49,8 @@ This is how our working directory in Ecl
 
 At the end of this tutorial, you’ll have written an OData service and you’ll be able to invoke the following URL in a browser:
 
-http://localhost:8080/DemoService/DemoService.svc/Products
+    :::html
+    http://localhost:8080/DemoService/DemoService.svc/Products
 
 And the browser will display the following little collection of data:
 
@@ -289,6 +290,7 @@ This document defines the contract, such
 
 The metadata document can be invoked via the following URI:
 
+    :::html
     <serviceroot>/$metadata
 
 
@@ -532,6 +534,8 @@ In our example:
     :::xml
     http://localhost:8080/DemoService/DemoService.svc/$metadata
 
+
+
     :::xml
     <?xml version='1.0' encoding='UTF-8'?>
     <edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
@@ -559,6 +563,7 @@ The Service Document can be invoked to v
     http://localhost:8080/DemoService/DemoService.svc/
 
 
+
     :::json
     {
       "@odata.context" : "http://localhost:8080/DemoService/DemoService.svc/$metadata",
@@ -668,30 +673,34 @@ The “request” parameter contai
 With the second parameter, the “response” object is passed to our method in order to carry the response data. So here we have to set the response body, along with status code and content-type header.
 
 The third parameter, the “uriInfo”, contains information about the relevant part of the URL. This means, the segments starting after the service name.  
-Example:
+
+Example:  
 If the user calls the following URL:  
-http://localhost:8080/DemoService/DemoService.svc/Products  
+`http://localhost:8080/DemoService/DemoService.svc/Products`  
 The _readEntityCollection_ method is invoked and the _uriInfo_ object contains one segment: “Products”  
+
 If the user calls the following URL:  
-http://localhost:8080/DemoService/DemoService.svc/Products?$filter=ID eq 1  
+`http://localhost:8080/DemoService/DemoService.svc/Products?$filter=ID eq 1`  
 Then the _readEntityCollection_ method is invoked and the _uriInfo_ contains the information about the entity set and furthermore the system query option $filter and its value.
 
 The last parameter, the “responseFormat”, contains information about the content type that is requested by the user.  
 This means that the user has the choice to receive the data either in XML or in JSON.  
+
 Example:  
 If the user calls the following URL:  
-http://localhost:8080/DemoService/DemoService.svc/Products?$format=application/json;odata.metadata=minimal  
+`http://localhost:8080/DemoService/DemoService.svc/Products?$format=application/json;odata.metadata=minimal`
+
 then the content type is:  
-application/json;odata.metadata=minimal  
+`application/json;odata.metadata=minimal`  
 which means that the payload is formatted in JSON (like it is shown in the introduction section of this tutorial)
 
-> Note:
-> The content type can as well be specified via the following request header  
-> Accept: application/json;odata.metadata=minimal  
-> In this case as well, our readEntityCollection() method will be called with the parameter responseFormat containing the content type > information.
+**Note:**
+The content type can as well be specified via the following request header  
+Accept: application/json;odata.metadata=minimal  
+In this case as well, our readEntityCollection() method will be called with the parameter responseFormat containing the content type > information.
 
-> Note:
-> If the user doesn’t specify any content type, then the default is JSON.
+**Note:**
+If the user doesn’t specify any content type, then the default is JSON.
 
 Why is this parameter needed?  
 Because the _readEntityCollection_ method is supposed to deliver the data in the format that is requested by the user. We’ll use this parameter when creating a serializer based on it.
@@ -715,11 +724,11 @@ The steps for implementating the method
   4. Configure the response  
   The response object has been passed to us in the method signature. We use it to set the serialized data (the _InputStream_ object).  
   Furthermore, we have to set the HTTP status code, which means that we have the opportunity to do proper error handling.  
-  And finally we have to set the content type.
+  And finally we have to set the content type.  
 
 
-    :::java
-    public void readEntityCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
+      :::java
+      public void readEntityCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
                          throws ODataApplicationException, SerializerException {
 
     	// 1st retrieve the requested EntitySet from the uriInfo (representation of the parsed URI)