You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by bu...@apache.org on 2013/02/08 18:26:23 UTC

svn commit: r849923 - in /websites/staging/isis/trunk: cgi-bin/ content/ content/core/images/action-invocation-published-to-stderr.png content/core/images/changed-object-published-to-stderr.png content/core/publishing-service.html

Author: buildbot
Date: Fri Feb  8 17:26:22 2013
New Revision: 849923

Log:
Staging update by buildbot for isis

Added:
    websites/staging/isis/trunk/content/core/images/action-invocation-published-to-stderr.png   (with props)
    websites/staging/isis/trunk/content/core/images/changed-object-published-to-stderr.png   (with props)
Modified:
    websites/staging/isis/trunk/cgi-bin/   (props changed)
    websites/staging/isis/trunk/content/   (props changed)
    websites/staging/isis/trunk/content/core/publishing-service.html

Propchange: websites/staging/isis/trunk/cgi-bin/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri Feb  8 17:26:22 2013
@@ -1 +1 @@
-1444058
+1444159

Propchange: websites/staging/isis/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri Feb  8 17:26:22 2013
@@ -1 +1 @@
-1444058
+1444159

Added: websites/staging/isis/trunk/content/core/images/action-invocation-published-to-stderr.png
==============================================================================
Binary file - no diff available.

Propchange: websites/staging/isis/trunk/content/core/images/action-invocation-published-to-stderr.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: websites/staging/isis/trunk/content/core/images/changed-object-published-to-stderr.png
==============================================================================
Binary file - no diff available.

Propchange: websites/staging/isis/trunk/content/core/images/changed-object-published-to-stderr.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Modified: websites/staging/isis/trunk/content/core/publishing-service.html
==============================================================================
--- websites/staging/isis/trunk/content/core/publishing-service.html (original)
+++ websites/staging/isis/trunk/content/core/publishing-service.html Fri Feb  8 17:26:22 2013
@@ -311,29 +311,16 @@ lowest common denominator, but in some c
 
 <h3>Default Implementations</h3>
 
-<p>A default implementation of <code>EventSerializer</code> will be supplied to the <code>PublishingService</code> if none has been specified as a domain service.  This default implementation simply concatenates the metadata and payload together into a single string:</p>
+<p>A simple implementation of <code>PublishingService</code> (which must be configured as a domain service) is available; it simply writes to stderr.</p>
 
-<pre>
-  public interface EventSerializer {
-    ...
-    public static class Simple implements EventSerializer {
+<p>To configure a very simple form of publishing, add the following to <code>isis.properties</code>:</p>
 
-      @Programmatic
-      @Override
-      public Object serialize(EventMetadata metadata, EventPayload payload) {
-          return "PUBLISHED: \n    metadata: " + 
-                    metadata.getGuid() + ":" + 
-                    metadata.getUser() + ":" + 
-                    metadata.getTimestamp() + 
-                 ":    payload:s\n" + 
-                    payload.toString();
-      }
-    }
-    ...
-  }
+<pre>
+isis.services=<i>...other services...</i>,\
+        org.apache.isis.applib.services.publish.PublishingService$StdErr
 </pre>
 
-<p>A simple implementation of <code>PublishingService</code> (which must be configured as a domain service) is also available; this simply writes to stderr is also provided:</p>
+<p>The implementation is as follows:</p>
 
 <pre>
   public interface PublishingService {
@@ -343,8 +330,7 @@ lowest common denominator, but in some c
       @Hidden
       @Override
       public void publish(EventMetadata metadata, EventPayload payload) {
-        Object serializedEvent = eventSerializer.serialize(
-          metadata, payload);
+        Object serializedEvent = eventSerializer.serialize(metadata, payload);
         System.err.println(serializedEvent);
       }
 
@@ -357,13 +343,30 @@ lowest common denominator, but in some c
   }
 </pre>
 
-<p>Thus, to configure a very simple form of publishing, add the following to <code>isis.properties</code>:</p>
+<p>As can be seen, the above implementation in turn uses a default implementation of <code>EventSerializer</code>, which simply concatenates the metadata and payload together into a single string:</p>
 
 <pre>
-isis.services=<i>...other services...</i>,\
-        org.apache.isis.applib.services.publish.PublishingService$StdErr
+  public interface EventSerializer {
+    ...
+    public static class Simple implements EventSerializer {
+
+      @Programmatic
+      @Override
+      public Object serialize(EventMetadata metadata, EventPayload payload) {
+          return "PUBLISHED: \n    metadata: " + 
+                    metadata.getGuid() + ":" + 
+                    metadata.getUser() + ":" + 
+                    metadata.getTimestamp() + 
+                 ":    payload:s\n" + 
+                    payload.toString();
+      }
+    }
+    ...
+  }
 </pre>
 
+<p>The default <code>PublishingService</code> (or indeed any implementation) can be configured to run with a different <code>EventSerializer</code> by configuring the serializer implementation in the <code>isis.properties</code> file.  One alternative serializer is described next.</p>
+
 <h3>Restful Objects (JSON) Serializer</h3>
 
 <p>An alternative serializer is provided by the <code>isis-viewer-restfulobjects-rendering</code> module.  This converts the provided <code>EventPayload</code> into the form specified by the <a href="http://restfulobjects.org">Restful Objects spec</a>.</p>
@@ -375,7 +378,23 @@ isis.services=<i>...other services...</i
        org.apache.isis.viewer.restfulobjects.rendering.eventserializer.RestfulObjectsSpecEventSerializer
 </pre>
 
-<p>TODO: need to specify the base url via config.</p>
+<p>In addition, the <code>baseUrl</code> to use in hyperlinks must be specified, also in <code>isis.properties</code>; for example:</p>
+
+<pre>
+org.apache.isis.viewer.restfulobjects.rendering.eventserializer.RestfulObjectsSpecEventSerializer.baseUrl=https://myapp.mycompany.com:8080/restful/.
+</pre>
+
+<p>If no <code>baseUrl</code> is specified, then the default URL is <code>http://localhost:8080/restful/</code>.</p>
+
+<p>If - as described in the previous sections - you configure the default <code>PublishingService</code> with the <code>RestfulObjectsSpecEventSerializer</code>, then you should see JSON being written to your console.</p>
+
+<p>For example, this is the JSON generated on an action invocation:</p>
+
+<p><img src="images/action-invocation-published-to-stderr.png" alt="" /></p>
+
+<p>while this is the object change JSON:</p>
+
+<p><img src="images/changed-object-published-to-stderr.png" alt="" /></p>
 
 <h3>Fine-tuning the payload</h3>