You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by bu...@apache.org on 2013/11/07 10:38:28 UTC

svn commit: r885721 - in /websites/staging/olingo/trunk/content: ./ doc/tutorials/debug.html

Author: buildbot
Date: Thu Nov  7 09:38:28 2013
New Revision: 885721

Log:
Staging update by buildbot for olingo

Modified:
    websites/staging/olingo/trunk/content/   (props changed)
    websites/staging/olingo/trunk/content/doc/tutorials/debug.html

Propchange: websites/staging/olingo/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Nov  7 09:38:28 2013
@@ -1 +1 @@
-1539571
+1539572

Modified: websites/staging/olingo/trunk/content/doc/tutorials/debug.html
==============================================================================
--- websites/staging/olingo/trunk/content/doc/tutorials/debug.html (original)
+++ websites/staging/olingo/trunk/content/doc/tutorials/debug.html Thu Nov  7 09:38:28 2013
@@ -82,79 +82,89 @@
 <p>For productive uses cases this feature is by default off. The following explains how to enable the feature and gives options to an service implementation to switch if on and off e.g. role based or by configuration.</p>
 <h5 id="debugcallback">DebugCallback</h5>
 <p>The debug feature can be enabled by the following callback implementation:</p>
-<p><code>public class ScenarioDebugCallback implements ODataDebugCallback {
-  @Override
-  public boolean isDebugEnabled() {  
-    boolean isDebug = …; // true|configuration|user role check
-    return isDebug; 
-  }
-}</code>
-In your service factory (<code>ODataServiceFactory</code>) implement the following method to register the callback:</p>
-<p>```
-public <T extends ODataCallback> T getCallback(final Class&lt;? extends ODataCallback&gt; callbackInterface) { 
-  T callback</p>
-<p>if (callbackInterface.isAssignableFrom(ScenarioErrorCallback.class)) {
-    callback = (T) new ScenarioErrorCallback();
-  } else {
-    callback = (T) super.getCallback(callbackInterface);
-  }</p>
-<p>return callback;
-}
-```
-If this is in place then the url query option odata-debug=json will return detailed error information in json format for each request.</p>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">class</span> <span class="n">ScenarioDebugCallback</span> <span class="n">implements</span> <span class="n">ODataDebugCallback</span> <span class="p">{</span>
+  <span class="p">@</span><span class="n">Override</span>
+  <span class="n">public</span> <span class="n">boolean</span> <span class="n">isDebugEnabled</span><span class="p">()</span> <span class="p">{</span>  
+    <span class="n">boolean</span> <span class="n">isDebug</span> <span class="p">=</span> …<span class="p">;</span> <span class="o">//</span> <span class="n">true</span><span class="o">|</span><span class="n">configuration</span><span class="o">|</span><span class="n">user</span> <span class="n">role</span> <span class="n">check</span>
+    <span class="k">return</span> <span class="n">isDebug</span><span class="p">;</span> 
+  <span class="p">}</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>In your service factory (<code>ODataServiceFactory</code>) implement the following method to register the callback:</p>
+<div class="codehilite"><pre><span class="kr">public</span> <span class="o">&lt;</span><span class="nx">T</span> <span class="kr">extends</span> <span class="nx">ODataCallback</span><span class="o">&gt;</span> <span class="nx">T</span> <span class="nx">getCallback</span><span class="p">(</span><span class="kr">final</span> <span class="nx">Class</span><span class="cp">&lt;?</span> <span class="k">extends</span> <span class="nx">ODataCallback</span><span class="o">&gt;</span> <span class="nx">callbackInterface</span><span class="p">)</span> <span class="p">{</span> 
+  <span class="nx">T</span> <span class="nx">callback</span>
+
+  <span class="k">if</span> <span class="p">(</span><span class="nx">callbackInterface</span><span class="o">.</span><span class="nx">isAssignableFrom</span><span class="p">(</span><span class="nx">ScenarioErrorCallback</span><span class="o">.</span><span class="nx">class</span><span class="p">))</span> <span class="p">{</span>
+    <span class="nx">callback</span> <span class="o">=</span> <span class="p">(</span><span class="nx">T</span><span class="p">)</span> <span class="k">new</span> <span class="nx">ScenarioErrorCallback</span><span class="p">();</span>
+  <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+    <span class="nx">callback</span> <span class="o">=</span> <span class="p">(</span><span class="nx">T</span><span class="p">)</span> <span class="nx">super</span><span class="o">.</span><span class="nx">getCallback</span><span class="p">(</span><span class="nx">callbackInterface</span><span class="p">);</span>
+  <span class="p">}</span>
+
+  <span class="k">return</span> <span class="nx">callback</span><span class="p">;</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>If this is in place then the url query option odata-debug=json will return detailed error information in json format for each request.</p>
 <h5 id="example">Example</h5>
 <p>Request url: http://localhost:8080/com.sap.olingo.web/ReferenceScenario.svc/?odata-debug=json</p>
 <p>Response:</p>
-<p><code>{
-  "body": "&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;service xml:base=\"http://localhost:8080/com.sap.olingo.web/ReferenceScenario.svc/\" xmlns=\"http://www.w3.org/2007/app\" xmlns:atom=\"http://www.w3.org/2005/Atom\"&gt;&lt;workspace&gt;&lt;atom:title&gt;Default&lt;/atom:title&gt;&lt;collection href=\"Employees\"&gt;&lt;atom:title&gt;Employees&lt;/atom:title&gt;&lt;/collection&gt;&lt;collection href=\"Teams\"&gt;&lt;atom:title&gt;Teams&lt;/atom:title&gt;&lt;/collection&gt;&lt;collection href=\"Rooms\"&gt;&lt;atom:title&gt;Rooms&lt;/atom:title&gt;&lt;/collection&gt;&lt;collection href=\"Managers\"&gt;&lt;atom:title&gt;Managers&lt;/atom:title&gt;&lt;/collection&gt;&lt;collection href=\"Buildings\"&gt;&lt;atom:title&gt;Buildings&lt;/atom:title&gt;&lt;/collection&gt;&lt;collection href=\"Container2.Photos\"&gt;&lt;atom:title&gt;Photos&lt;/atom:title&gt;&lt;/collection&gt;&lt;/workspace&gt;&lt;/service&gt;",
-  "request": {
-    "method": "GET",
-    "uri": "https://localhost:8080/com.sap.olingo.web/ReferenceScenario.svc/?odata-debug=json",
-    "headers": {
-      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
-      "accept-encoding": "gzip, deflate",
-      "accept-language": "de-de,de;q=0.8,en-us;q=0.5,en;q=0.3",
-      "connection": "keep-alive",
-      "Content-Type": null,
-      "cookie": "JSESSIONID=C6A2403F354B61B1E645744FABCB7FB6C6BC5DA41BC841823647CF2DFF001556; BIGipServerlocalhost=3543090186.26911.0000",
-      "host": "localhost:8080",
-      "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0",
-      "x-forwarded-for": "173.12.210.11"
+<div class="codehilite"><pre>{
+  &quot;body&quot;: &quot;<span class="cp">&lt;?xml version=&#39;1.0&#39; encoding=&#39;utf-8&#39;?&gt;</span><span class="nt">&lt;service</span> <span class="na">xml:base=</span><span class="s">\&quot;http://localhost:8080/com.sap.olingo.web/ReferenceScenario.svc/\&quot;</span> <span class="na">xmlns=</span><span class="s">\&quot;http://www.w3.org/2007/app\&quot;</span> <span class="na">xmlns:atom=</span><span class="s">\&quot;http://www.w3.org/2005/Atom\&quot;</span><span class="nt">&gt;&lt;workspace&gt;&lt;atom:title&gt;</span>Default<span class="nt">&lt;/atom:title&gt;&lt;collection</span> <span class="na">href=</span><span class="s">\&quot;Employees\&quot;</span><span class="nt">&gt;&lt;atom:title&gt;</span>Employees<span class="nt">&lt;/atom:title&gt;&lt;/collection&gt;&lt;collection</span> <span class="na">href=</span><span class="s">\&quot;Teams\&quot;</span><span class="nt">&gt;&lt;atom:title&gt;</span>Teams<span class="nt">&lt;/atom:title&gt;&lt;/collection&gt;&lt;collecti
 on</span> <span class="na">href=</span><span class="s">\&quot;Rooms\&quot;</span><span class="nt">&gt;&lt;atom:title&gt;</span>Rooms<span class="nt">&lt;/atom:title&gt;&lt;/collection&gt;&lt;collection</span> <span class="na">href=</span><span class="s">\&quot;Managers\&quot;</span><span class="nt">&gt;&lt;atom:title&gt;</span>Managers<span class="nt">&lt;/atom:title&gt;&lt;/collection&gt;&lt;collection</span> <span class="na">href=</span><span class="s">\&quot;Buildings\&quot;</span><span class="nt">&gt;&lt;atom:title&gt;</span>Buildings<span class="nt">&lt;/atom:title&gt;&lt;/collection&gt;&lt;collection</span> <span class="na">href=</span><span class="s">\&quot;Container2.Photos\&quot;</span><span class="nt">&gt;&lt;atom:title&gt;</span>Photos<span class="nt">&lt;/atom:title&gt;&lt;/collection&gt;&lt;/workspace&gt;&lt;/service&gt;</span>&quot;,
+  &quot;request&quot;: {
+    &quot;method&quot;: &quot;GET&quot;,
+    &quot;uri&quot;: &quot;https://localhost:8080/com.sap.olingo.web/ReferenceScenario.svc/?odata-debug=json&quot;,
+    &quot;headers&quot;: {
+      &quot;Accept&quot;: &quot;text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&quot;,
+      &quot;accept-encoding&quot;: &quot;gzip, deflate&quot;,
+      &quot;accept-language&quot;: &quot;de-de,de;q=0.8,en-us;q=0.5,en;q=0.3&quot;,
+      &quot;connection&quot;: &quot;keep-alive&quot;,
+      &quot;Content-Type&quot;: null,
+      &quot;cookie&quot;: &quot;JSESSIONID=C6A2403F354B61B1E645744FABCB7FB6C6BC5DA41BC841823647CF2DFF001556; BIGipServerlocalhost=3543090186.26911.0000&quot;,
+      &quot;host&quot;: &quot;localhost:8080&quot;,
+      &quot;user-agent&quot;: &quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0&quot;,
+      &quot;x-forwarded-for&quot;: &quot;173.12.210.11&quot;
     }
   },
-  "response": {
-    "status": {
-      "code": 200,
-      "info": "OK"
+  &quot;response&quot;: {
+    &quot;status&quot;: {
+      &quot;code&quot;: 200,
+      &quot;info&quot;: &quot;OK&quot;
     },
-    "headers": {
-      "DataServiceVersion": "1.0",
-      "Content-Type": "application/xml;charset=utf-8"
+    &quot;headers&quot;: {
+      &quot;DataServiceVersion&quot;: &quot;1.0&quot;,
+      &quot;Content-Type&quot;: &quot;application/xml;charset=utf-8&quot;
     }
   },
-  "runtime": [{
-      "class": "ODataRequestHandler",
-      "method": "handle",
-      "duration": 1911,
-      "memory": 191,
-      "children": [
+  &quot;runtime&quot;: [{
+      &quot;class&quot;: &quot;ODataRequestHandler&quot;,
+      &quot;method&quot;: &quot;handle&quot;,
+      &quot;duration&quot;: 1911,
+      &quot;memory&quot;: 191,
+      &quot;children&quot;: [
         {
-          "class": "UriParserImpl",
-          "method": "parse",
-          "duration": 66,
-          "memory": 0,
-          "children": {}
+          &quot;class&quot;: &quot;UriParserImpl&quot;,
+          &quot;method&quot;: &quot;parse&quot;,
+          &quot;duration&quot;: 66,
+          &quot;memory&quot;: 0,
+          &quot;children&quot;: {}
         },
         {
-          "class": "Dispatcher",
-          "method": "dispatch",
-          "duration": 1029,
-          "memory": 95,
-          "children": {}
+          &quot;class&quot;: &quot;Dispatcher&quot;,
+          &quot;method&quot;: &quot;dispatch&quot;,
+          &quot;duration&quot;: 1029,
+          &quot;memory&quot;: 95,
+          &quot;children&quot;: {}
         }
       ]
     }]
-}</code></p>
+}
+</pre></div>
+
+
+<h3 id="log-and-trace-support">Log and Trace Support</h3>