Repository: incubator-juneau-website
Updated Branches:
  refs/heads/asf-site 236aea453 -> 62e848c2b


Add more examples to the page.

Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/commit/62e848c2
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/tree/62e848c2
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/diff/62e848c2

Branch: refs/heads/asf-site
Commit: 62e848c2b96f605e78a8cee89fdc07337aef0f7e
Parents: 236aea4
Author: JamesBognar <[email protected]>
Authored: Wed Mar 29 16:00:20 2017 -0400
Committer: JamesBognar <[email protected]>
Committed: Wed Mar 29 16:00:20 2017 -0400

----------------------------------------------------------------------
 content/about.html | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/62e848c2/content/about.html
----------------------------------------------------------------------
diff --git a/content/about.html b/content/about.html
index 0538300..016c862 100644
--- a/content/about.html
+++ b/content/about.html
@@ -178,6 +178,37 @@
                Serializers can send output directly to Writers, OutputStreams, 
Files, Strings, or byte arrays.
                <br>Parsers can receive input directly from Readers, 
InputStreams, Files, Strings, or byte arrays.
        </p>
+       <p>
+               Lots of shortcuts are provided throughout the API to simplify 
tasks, and the APIs are often useful for debugging and logging purposes as 
well...
+       </p>
+       <p class='bcode'>
+       <jc>// Create JSON strings from scratch using fluent-style code.</jc>
+       String jsonObject = <jk>new</jk> 
ObjectMap().append(<js>"foo"</js>,<js>"bar"</js>).toString(); 
+       String jsonArray = <jk>new</jk> 
ObjectList().append(<js>"foo"</js>).append(123).append(<jk>null</jk>).toString();
 
+       
+       <jc>// Create maps and beans directly from JSON.</jc>
+       Map&lt;String,Object&gt; myMap = <jk>new</jk> 
ObjectMap(<js>"{foo:'bar'}"</js>); 
+       List&lt;Object&gt; myList = <jk>new</jk> 
ObjectList(<js>"['foo',123,null]"</js>); 
+
+       <jc>// Load a POJO from a JSON file.</jc>
+       MyPojo myPojo = JsonParser.<jsf>DEFAULT</jsf>.parse(<jk>new</jk> 
File(<js>"myPojo.json"</js>));
+
+       <jc>// Serialize POJOs and ignore exceptions (great for logging)</jc>
+       String json = JsonSerializer.<jsf>DEFAULT_LAX</jsf>.toString(myPojo);
+       
+       <jc>// Dump a POJO to the console.</jc>
+       JsonSerializer.<jsf>DEFAULT_LAX</jsf>.println(myPojo);
+       
+       <jc>// Delayed serialization.</jc>
+       <jc>// (e.g. don't serialize an object if it's not going to be 
logged).</jc>
+       logger.log(<jsf>FINE</jsf>, <js>"My POJO was: {0}"</js>, <jk>new</jk> 
StringObject(myPojo));
+       logger.log(<jsf>FINE</jsf>, <js>"My POJO in XML was: {0}"</js>, 
<jk>new</jk> StringObject(XmlSerializer.<jsf>DEFAULT</jsf>, myPojo));
+       
+       <jc>// Create a 'REST' wrapper around a POJO.</jc>
+       PojoRest pojoRest = <jk>new</jk> PojoRest(myPojo);
+       pojoRest.get(String.<jk>class</jk>, <js>"addressBook/0/name"</js>);
+       pojoRest.put(<js>"addressBook/0/name"</js>, <js>"John Smith"</js>);
+       </p>
        <br><br><hr>
        <p>
                <code>SerializerGroup</code> and <code>ParserGroup</code> 
classes allow serializers and parsers 
@@ -727,7 +758,7 @@
        </p>
        <br><br><hr>
        <p>
-               The remote proxy interface API allows you to invoke server-side 
POJO methods on the client side using REST:
+               The remote proxy interface API allows you to invoke server-side 
POJO methods on the client side using REST (i.e. RPC over REST):
        </p>
        <p class='bcode'>
        <jc>// Get an interface proxy.</jc>
@@ -792,6 +823,10 @@
                server side, and then passed to the invocation method.  The 
returned POJO is then marshalled back as an HTTP response.
        </p>
        <p>
+               In most cases, you'll want to use JSON or MessagePack as your 
communications layer since these are the most efficent.
+               Although remoteable proxies work perfectly well for any of the 
other supported languages.  For example, RPC over Turtle!
+       </p>
+       <p>
                The parameters and return types of the Java methods can be any 
of the supported serializable and parsable types in <a class='doclink' 
href='http://juneau.incubator.apache.org/site/apidocs/overview-summary.html#Core.PojoCategories'>POJO
 Categories</a>.
                This ends up being WAY more flexible than other proxy 
interfaces since Juneau can handle so may POJO types out-of-the-box.
                Most of the time you don't even need to modify your existing 
Java implementation code.

Reply via email to