json/src/main/java/net/java/html/json/package.html
author Jaroslav Tulach <jaroslav.tulach@netbeans.org>
Fri, 07 Feb 2014 07:44:34 +0100
changeset 551 7ca2253fa86d
parent 483 c52158f52e8c
child 612 3f5b6d009177
permissions -rw-r--r--
Updating copyright headers to mention current year
     1 <!--
     2 
     3     DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     4 
     5     Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
     6 
     7     Oracle and Java are registered trademarks of Oracle and/or its affiliates.
     8     Other names may be trademarks of their respective owners.
     9 
    10     The contents of this file are subject to the terms of either the GNU
    11     General Public License Version 2 only ("GPL") or the Common
    12     Development and Distribution License("CDDL") (collectively, the
    13     "License"). You may not use this file except in compliance with the
    14     License. You can obtain a copy of the License at
    15     http://www.netbeans.org/cddl-gplv2.html
    16     or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    17     specific language governing permissions and limitations under the
    18     License.  When distributing the software, include this License Header
    19     Notice in each file and include the License file at
    20     nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    21     particular file as subject to the "Classpath" exception as provided
    22     by Oracle in the GPL Version 2 section of the License file that
    23     accompanied this code. If applicable, add the following below the
    24     License Header, with the fields enclosed by brackets [] replaced by
    25     your own identifying information:
    26     "Portions Copyrighted [year] [name of copyright owner]"
    27 
    28     Contributor(s):
    29 
    30     The Original Software is NetBeans. The Initial Developer of the Original
    31     Software is Oracle. Portions Copyright 2013-2014 Oracle. All Rights Reserved.
    32 
    33     If you wish your version of this file to be governed by only the CDDL
    34     or only the GPL Version 2, indicate your decision by adding
    35     "[Contributor] elects to include this software in this distribution
    36     under the [CDDL or GPL Version 2] license." If you do not indicate a
    37     single choice of license, a recipient has the option to distribute
    38     your version of this file under either the CDDL, the GPL Version 2 or
    39     to extend the choice of license to its licensees as provided above.
    40     However, if you add GPL Version 2 code and therefore, elected the GPL
    41     Version 2 license, then the option applies only if the new code is
    42     made subject to such option by the copyright holder.
    43 
    44 -->
    45 <body>
    46     
    47     <p>
    48     This API allows you to write your application logic in Java and 
    49     present it using modern HTML rendering technologies like 
    50     <a href="http://knockoutjs.com">Knockout</a>
    51     and communicate with
    52     a server via <a href="OnReceive.html">REST</a> or 
    53     <a href="doc-files/websockets.html">WebSocket</a>s.
    54     </p>
    55     <img src="doc-files/html4j.png">
    56     <p>
    57     Use <a href="Model.html">@Model</a> annotation to define one or more
    58     model classes with <a href="Property.html">properties</a>. Don't waste
    59     time writing setters or getters - they will be generated for you. 
    60     Just instantiate your classes and use them!
    61     </p>
    62     <p>
    63     The class generator does not stop with getters and setters -- internally
    64     it generates bindings for various HTML technologies. Just include appropriate
    65     technology implementation on classpath of your application and your model
    66     class(es) will automatically be bound to your HTML elements (after calling
    67     <code>applyBindings()</code> on your model).
    68     </p>
    69     <p>
    70     You don't have bother with JavaScript. All your application logic is in
    71     Java. The necessary JavaScript needed for the HTML bindings remains hidden
    72     as an implementation detail of communication between the generated model
    73     class(es) and appropriate technology bridge. For example
    74     the <code>ko4j</code> module:
    75     </p>
    76     <pre>
    77 &lt;dependency&gt;
    78   &lt;groupId&gt;org.netbeans.html&lt;/groupId&gt;
    79   &lt;artifactId&gt;ko4j&lt;/artifactId&gt;
    80   &lt;scope&gt;runtime&lt;/scope&gt;
    81 &lt;/dependency&gt;
    82     </pre>
    83     
    84     <p>
    85     The model classes can be used for JSON based server communication. Just
    86     use <a href="OnReceive.html">@OnReceive</a> annotation to define a communication
    87     point in the model class. Please note, that the model classes can easily
    88     be used on server as well - the same code can run
    89     in your browser as well as on your server. Just add following to your <em>pom.xml</em>
    90     to use your classes generated by <a href="Model.html">@Model</a> annotation
    91     as <a href="http://jersey.java.net" target="new">Jersey</a> entities:
    92     </p>
    93     <pre>
    94 &lt;dependency&gt;
    95   &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
    96   &lt;artifactId&gt;html-json&lt;/artifactId&gt;
    97   &lt;version&gt;2.6&lt;/version&gt; &lt;-- or 2.6-SNAPSHOT until it gets released --&gt;
    98   &lt;scope&gt;runtime&lt;/scope&gt;
    99 &lt;/dependency&gt;
   100     </pre>
   101     <p>
   102     Behavior of model classes can be enriched by using 
   103     <a href="ComputedProperty.html">@ComputedProperty</a> annotation (to
   104     define <em>derived</em> properties) and by 
   105     <a href="Function.html">@Function</a> annotation to define handlers
   106     to be invoked from the HTML elements.
   107     </p>
   108 </body>