You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2017/10/20 15:16:57 UTC
[2/3] incubator-juneau-website git commit: Upload pages for v7.0.0
http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/4e699954/content/7.0.0/index.html
----------------------------------------------------------------------
diff --git a/content/7.0.0/index.html b/content/7.0.0/index.html
new file mode 100644
index 0000000..be3b0ab
--- /dev/null
+++ b/content/7.0.0/index.html
@@ -0,0 +1,204 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <link rel="icon" type="image/png" href="http://www.apache.org/favicons/favicon-32x32.png" sizes="32x32">
+ <link rel="icon" type="image/png" href="http://www.apache.org/favicons/favicon-194x194.png" sizes="194x194">
+ <link rel="icon" type="image/png" href="http://www.apache.org/favicons/favicon-96x96.png" sizes="96x96">
+ <link rel="icon" type="image/png" href="http://www.apache.org/favicons/android-chrome-192x192.png" sizes="192x192">
+ <link rel="icon" type="image/png" href="http://www.apache.org/favicons/favicon-16x16.png" sizes="16x16">
+ <link rel="shortcut icon" href="http://www.apache.org/favicons/favicon.ico">
+
+ <meta name="description" content="Apache Juneau Universal Serialization and REST API Library" />
+ <meta name="keywords" content="Apache Juneau,Apache,Juneau,REST,JSON,HTML,XML,MessagePack,Java,UON,urlencoding,Swagger,Jackson,SOAP,ATOM,Cognos,INI,Jena,CSV,JSON-Schema,XML-Schema,Servlet,JAX-RS,JAXRS,JAX-WS,JAXWS,bean" />
+ <title>Apache Juneau Universal Serialization and REST API Library</title>
+ <style>
+ @import url("styles/juneau-code.css");
+ @import url("styles/juneau-doc.css");
+
+ html, body { margin:0px; height: 100%; width: 100%; font-family: sans-serif;}
+ header {
+ background-color: #e8ebef;
+ font-size: 2.0em;
+ height: 50px;
+ color: #2874A6;
+ clear: left;
+ margin: 0px;
+ padding: 20px 20px 0px 20px;
+ box-shadow: 5px 5px 2px #999999;
+ text-shadow: rgba(0,0,0,.2) 2px 6px 5px,rgba(125,32,191,.4) 0 -4px 30px;
+ white-space: nowrap;
+ }
+ footer {
+ padding: 0px 10px;
+ color: black;
+ background-color: #e8ebef;
+ text-align: left;
+ font-size: 0.9em;
+ }
+ div.container {
+ width: 100%;
+ height: 100%;
+ }
+ nav {
+ float: left;
+ width: 150px;
+ margin: 40px 20px;
+ padding: 1em;
+ border: 1px solid gray;
+ box-shadow: 5px 5px 2px #999999;
+ color: rgb(44, 69, 87);
+ background-color: #eef3f7;
+ font-size: 1.0em;
+ text-transform: uppercase;
+ font-weight: lighter;
+ }
+ nav ul { list-style-type: none; padding: 0; }
+ nav ul li { padding: 5px 0px; }
+ nav ul ul { padding: 0px 10px; }
+ nav ul ul li { padding: 5px 0px 0px 3px; font-size: smaller; }
+ nav ul a { text-decoration: none; color: rgb(44, 69, 87); }
+ nav ul a:hover { font-weight: normal; }
+ nav ul a.selected { font-weight: normal; }
+ article {
+ margin: 0px 20px 20px 170px;
+ padding: 10px 2px;
+ overflow: hidden;
+ min-height: 500px;
+ }
+ p.download {
+ color: #2C4557;
+ padding: 5px 20px;
+ margin: 10px 0px 10px 0px;
+ text-decoration: none;
+ font-size: 0.9em;
+ font-weight: bold;
+ background: linear-gradient(to bottom, #F5F5F5, #DEE3E9) repeat scroll 0% 0% transparent;
+ }
+ </style>
+
+ <script>
+ var selectedNode;
+
+ function select(node) {
+ if (selectedNode)
+ selectedNode.classList.remove("selected");
+ node.classList.add("selected");
+ selectedNode = node;
+ var buff = document.getElementById("buff");
+ buff.src = node.id + ".html";
+ history.pushState(null, null, "#" + node.id + ".html");
+ return false;
+ }
+
+ // Load results from IFrame into this document.
+ function loadResults(buff) {
+ var doc = buff.contentDocument || buff.contentWindow.document;
+ var body = doc.body;
+ var article = document.getElementById('article');
+ var header = document.getElementById('header');
+ var footer = document.getElementById('footer');
+ if (body != null) {
+ article.innerHTML = body.innerHTML;
+ nodeScriptReplace(article);
+ }
+ var availableHeight = window.innerHeight - header.clientHeight - footer.clientHeight - 40;
+ article.style.minHeight = availableHeight + 'px';
+ }
+
+ window.onload = function() {
+ var hash = window.location.hash;
+ if (hash == null || hash.length == 0) {
+ hash = "#about.html";
+ }
+ var id = hash.substring(1, hash.length - 5);
+ document.getElementById(id).click();
+ }
+
+ function nodeScriptReplace(node) {
+ if (node.tagName === 'SCRIPT') {
+ node.parentNode.replaceChild(nodeScriptClone(node) , node);
+ } else {
+ node.childNodes.forEach(nodeScriptReplace);
+ }
+ return node;
+ }
+
+ function nodeScriptClone(node) {
+ var script = document.createElement("script");
+ script.text = node.innerHTML;
+ var attrs = node.attributes;
+ for (var i = attrs.length - 1; i >= 0; i--) {
+ script.setAttribute(attrs[i].name, attrs[i].value);
+ }
+ return script;
+ }
+ </script>
+</head>
+
+<body>
+<div class="container">
+
+ <header id='header'>
+ <img src='images/juneau2.png' style='position:absolute;left:20px;height:50px;top:10px'>
+ <span style='vertical-align: top;color: #cc1b1b; font-weight: lighter; padding-left: 100px'>APACHE JUNEAU <small>™</small></span>
+ <a href="http://incubator.apache.org/" target="_blank"><img src='images/feather_small.png' style='position:absolute;right:20px;height:50px;top:10px'></a>
+ </header>
+
+ <nav>
+ <ul>
+ <li><a href='about.html' id='about' onclick="return select(this)">About</a>
+ <li><a href='components.html' id='components' onclick="return select(this)">Components</a>
+ <ul>
+ <li><a href='marshall.html' id='marshall' onclick="return select(this)">marshall</a>
+ <li><a href='dto.html' id='dto' onclick="return select(this)">dto</a>
+ <li><a href='svl.html' id='svl' onclick="return select(this)">svl</a>
+ <li><a href='config.html' id='config' onclick="return select(this)">config</a>
+ <li><a href='rest-server.html' id='rest-server' onclick="return select(this)">rest-server</a>
+ <li><a href='rest-client.html' id='rest-client' onclick="return select(this)">rest-client</a>
+ <li><a href='microservice.html' id='microservice' onclick="return select(this)">microservice</a>
+ <li><a href='examples.html' id='examples' onclick="return select(this)">examples</a>
+ </ul>
+ </li>
+ <li><a href='documentation.html' id='documentation' onclick="return select(this)">Documentation</a></li>
+ <li><a href='downloads.html' id='downloads' onclick="return select(this)">Downloads</a></li>
+ <li><a href='sourceCode.html' id='sourceCode' onclick="return select(this)">Source Code</a></li>
+ <li><a href='issues.html' id='issues' onclick="return select(this)">Issues</a></li>
+ <li><a href='community.html' id='community' onclick="return select(this)">Community</a></li>
+ <li><a href='twitter.html' id='twitter' onclick="return select(this)">Twitter</a></li>
+ <li><a href="http://www.apache.org/licenses/" target="_blank">License</a></li>
+ <li><a href="http://www.apache.org/security" target="_blank">Security</a></li>
+ <li><a href="http://www.apache.org/foundation/sponsorship.html" target="_blank">Donate</a></li>
+ <li><a href="http://www.apache.org/foundation/thanks.html" target="_blank">Thanks</a></li>
+ <li><a href="http://www.apache.org/foundation" target="_blank">Apache</a></li>
+ </ul>
+ </nav>
+
+ <article id='article'>
+ Loading...
+ </article>
+
+ <footer id='footer'>
+ <table>
+ <tr>
+ <td><a href="http://foundation.apache.org/" target="_blank"><br>
+ <img src="images/asf_short.png"/></a><br>
+ <!-- hitwebcounter Code START -->
+ <a href="http://www.hitwebcounter.com" target="_blank">
+ <img src="http://hitwebcounter.com/counter/counter.php?page=6608331&style=0007&nbdigits=7&type=ip&initCount=0" title="" Alt="" border="0">
+ </a>
+ <!-- hitwebcounter.com -->
+ <a href="http://www.hitwebcounter.com" title="Hitwebcounter.com Free" target="_blank" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #FFFFFF; text-decoration: underline ; display:none;"><strong>Hitwebcounter.com Free</strong></a>
+ </td>
+ <td style="padding-left:10px;">
+ <p>
+ Copyright © 2016, 2017 <a href="http://www.apache.org/">The Apache Software Foundation</a>, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
+ <br>Apache, Apache Juneau, and the Apache feather logo are trademarks of The Apache Software Foundation.
+ Eclipse is a registered trademark of the Eclipse Foundation.
+ </p>
+ </td>
+ </table>
+ </footer>
+</div>
+<iframe id='buff' style='display:none' onload="parent.loadResults(this)" sandbox="allow-same-origin"></iframe>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/4e699954/content/7.0.0/issues.html
----------------------------------------------------------------------
diff --git a/content/7.0.0/issues.html b/content/7.0.0/issues.html
new file mode 100644
index 0000000..ebd0806
--- /dev/null
+++ b/content/7.0.0/issues.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ @import url("styles/juneau-code.css");
+ @import url("styles/juneau-doc.css");
+</style>
+</head>
+<body>
+ <h5 class='toc'>Issues</h5>
+ <p>
+ Juneau has no bugs. However, in the <i>extremely unlikely</i> event that you happen to find a bug, please report it at the JIRA repository listed below.
+ </p>
+ <ul class='spaced-list'>
+ <li><a class='doclink' href='https://issues.apache.org/jira/browse/JUNEAU' target="_top">JIRA</a>
+ </ul>
+ <p>
+ External developers should use the following categories for requests:
+ </p>
+ <ul class='spaced-list'>
+ <li><l>Bug</l> - Broken functionality.
+ <li><l>Feature Request</l> - Requests for brand new functionality.
+ <li><l>Improvement</l> - Requests for improvements to existing functionality.
+ <li><l>Wish</l> - Trivial requests.
+ </ul>
+ <h5 class='toc'>Security Vulnerabilities</h5>
+ <p>
+ If you discover any security vulnerabilities in this code, please refer to the instructions found here:
+ </p>
+ <ul class='spaced-list'>
+ <li><a class='doclink' href='http://www.apache.org/security'>SECURITY</a>
+ </ul>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/4e699954/content/7.0.0/marshall.html
----------------------------------------------------------------------
diff --git a/content/7.0.0/marshall.html b/content/7.0.0/marshall.html
new file mode 100644
index 0000000..5796661
--- /dev/null
+++ b/content/7.0.0/marshall.html
@@ -0,0 +1,417 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ @import url("styles/juneau-code.css");
+ @import url("styles/juneau-doc.css");
+</style>
+</head>
+<body>
+ <!-- ======================================================================================================= -->
+ <!-- === JUNEAU-MARSHALL =================================================================================== -->
+ <!-- ======================================================================================================= -->
+
+ <h5 class='toc' id='juneau-marshall'>juneau-marshall</h5>
+ <div>
+ <h6 class='figure'>Maven Dependency</h6>
+ <p class='bcode' style='width:500px;'>
+ <xt><dependency></xt>
+ <xt><groupId></xt>org.apache.juneau<xt></groupId></xt>
+ <xt><artifactId></xt>juneau-marshall<xt></artifactId></xt>
+ <xt><version></xt>7.0.0<xt></version></xt>
+ <xt></dependency></xt>
+ </p>
+
+ <h6 class='figure'>Java Library</h6>
+ <p class='bcode' style='width:500px;'>
+ juneau-marshall-7.0.0.jar
+ </p>
+
+ <h6 class='figure'>OSGi Module</h6>
+ <p class='bcode' style='width:500px;'>
+ org.apache.juneau.marshall_7.0.0.jar
+ </p>
+
+ <p>
+ The <code>juneau-marshall</code> library includes easy-to-use and highly customizable serializers and parsers
+ based around a common API.
+ They provide support for the following languages:
+ </p>
+ <ul>
+ <li>JSON
+ <li>XML
+ <li>HTML
+ <li>UON (URL-Encoded Object Notation)
+ <li>URL-Encoding
+ <li>MessagePack
+ <li>SOAP/XML
+ <li>CSV
+ <li>BSON (coming soon)
+ <li>YAML (coming soon)
+ <li>Protobuf (coming soon)
+ </ul>
+ <p>
+ The default serializers can often be used to serialize POJOs in a single line of code:
+ </p>
+ <p class='bcode'>
+ <jc>// A simple bean</jc>
+ <jk>public class</jk> Person {
+ <jk>public</jk> String name = <js>"John Smith"</js>;
+ <jk>public int</jk> age = 21;
+ }
+
+ Person p = <jk>new</jk> Person();
+
+ <jc>// Produces:
+ // "{name:'John Smith',age:21}"</jc>
+ String laxJson = JsonSerializer.<jsf>DEFAULT_LAX</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // "{"name":"John Smith","age":21}"</jc>
+ String strictJson = JsonSerializer.<jsf>DEFAULT</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // <object>
+ // <name>John Smith</name>
+ // <age>21</age>
+ // </object></jc>
+ String xml = XmlSerializer.<jsf>DEFAULT_SIMPLE</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // <table>
+ // <tr><td>name</td><td>John Smith</td></tr>
+ // <tr><td>age</td><td>21</td></tr>
+ // </table></jc>
+ String html = HtmlSerializer.<jsf>DEFAULT</jsf>.serialize(p);
+
+ <jc>// Same as Html, but wraps it in HTML and BODY elements with page title/description/links:</jc>
+ String htmlDoc = HtmlDocSerializer.<jsf>DEFAULT</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // name='John+Smith'&age=21</jc>
+ String urlEncoding = UrlEncodingSerializer.<jsf>DEFAULT</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // (name='John Smith',age=21)</jc>
+ String uon = UonSerializer.<jsf>DEFAULT</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // 82 A4 name AA 4A John Smith 68 A3 age 15</jc>
+ <jk>byte</jk>[] messagePack = MsgPackSerializer.<jsf>DEFAULT</jsf>.serialize(p);
+ </p>
+ <p>
+ Parsing back into POJOs is equally simple for any of the supported languages shown above.
+ Language fragments are also supported.
+ </p>
+ <p>
+ JSON parsing shown here:
+ </p>
+ <p class='bcode'>
+ <jc>// Use one of the predefined parsers.</jc>
+ ReaderParser parser = JsonParser.<jsf>DEFAULT</jsf>;
+
+ <jc>// Parse a JSON object (creates a generic ObjectMap).</jc>
+ String json = <js>"{name:'John Smith',age:21}"</js>;
+ Map m1 = parser.parse(json, Map.<jk>class</jk>);
+
+ <jc>// Parse a JSON string.</jc>
+ json = <js>"'foobar'"</js>;
+ String s2 = parser.parse(json, String.<jk>class</jk>);
+
+ <jc>// Parse a JSON number as a Long or Float.</jc>
+ json = <js>"123"</js>;
+ Long l3 = parser.parse(json, Long.<jk>class</jk>);
+ Float f3 = parser.parse(json, Float.<jk>class</jk>);
+
+ <jc>// Parse a JSON object as a bean.</jc>
+ json = <js>"{name:'John Smith',age:21}"</js>;
+ Person p4 = parser.parse(json, Person.<jk>class</jk>);
+
+ <jc>// Parse a JSON object as a HashMap<String,Person>.</jc>
+ json = <js>"{a:{name:'John Smith',age:21},b:{name:'Joe Smith',age:42}}"</js>;
+ Map<String,Person> m5 = parser.parse(json, HashMap.<jk>class</jk>, String.<jk>class</jk>, Person.<jk>class</jk>);
+
+ <jc>// Parse a JSON object as a HashMap<String,LinkedList<Person>>.</jc>
+ json = <js>"{a:[{name:'John Smith',age:21},{name:'Joe Smith',age:42}]}"</js>;
+ Map<String,List<Person>> m6 = parser.parse(json, HashMap.<jk>class</jk>, String.<jk>class</jk>, LinkedList.<jk>class</jk>, Person.<jk>class</jk>);
+
+ <jc>// Parse a JSON array of integers as a Collection of Integers or int[] array.</jc>
+ json = <js>"[1,2,3]"</js>;
+ List<Integer> l7 = parser.parse(json, LinkedList.<jk>class</jk>, Integer.<jk>class</jk>);
+ <jk>int</jk>[] i7 = parser.parse(json, <jk>int</jk>[].<jk>class</jk>);
+
+ <jc>// Parse arbitrary input into ObjectMap or ObjectList objects
+ // (similar to JSONObject/JSONArray but generalized for all languages).</jc>
+ json = <js>"{name:'John Smith',age:21}"</js>;
+ ObjectMap m8a = parser.parse(json, ObjectMap.<jk>class</jk>);
+ <jk>int</jk> age = m8a.getInt(<js>"age"</js>);
+ ObjectMap m8b = (ObjectMap)parser.parse(json, Object.<jk>class</jk>); <jc>// Equivalent.</jc>
+
+ json = <js>"[1,true,null]"</js>;
+ ObjectList l9a = parser.parse(json, ObjectList.<jk>class</jk>);
+ <jk>boolean</jk> b = l9a.getBoolean(1);
+ ObjectList l9b = (ObjectList)parser.parse(json, Object.<jk>class</jk>); <jc>// Equivalent.</jc>
+ </p>
+
+ <h6 class='topic'>Features</h6>
+ <ul class='spaced-list'>
+ <li>Serializers can send output directly to Writers, OutputStreams, Files, Strings, or byte arrays.
+ <li>Parsers can receive input directly from Readers, InputStreams, Files, Strings, or byte arrays.
+ <li>Parsers can reconstruct arbitrarily complex data structures consisting of maps, collections, beans, and other POJOs.
+ <li>Serializers and parsers do not use intermediate DOMs! POJOs are serialized directly to streams and parsed back directly to POJOs, making them extremely efficient and fast.
+ <li>Supported languages are highly-customizable and powerful. For example, JSON support includes:
+ <ul>
+ <li>Support for variants such as LAX syntax (unquoted attributes and single quotes).
+ <li>Support for embedded Javascript comments.
+ <li>Fully RFC1759 compliant.
+ <li>20% faster than Jackson.
+ </ul>
+ </ul>
+ <br><hr>
+ <p>
+ Serializers and parsers are builder-based. Build from scratch or clone existing instances. Lots of configuration options available for all the languages.
+ </p>
+ <p class='bcode'>
+ <jc>// Create a serializer from scratch using a builder</jc>
+ JsonSerializer serializer = <jk>new</jk> JsonSerializerBuilder()
+ .simple() <jc>// Simple mode</jc>
+ .sq() <jc>// Use single quotes</jc>
+ .pojoSwaps( <jc>// Swap unserializable classes with surrogate POJOs</jc>
+ IteratorSwap.<jk>class</jk>, <jc>// Iterators swapped with lists</jc>
+ ByteArrayBase64Swap.<jk>class</jk>, <jc>// byte[] swapped with base-64 encoded strings</jc>
+ CalendarSwap.ISO8601DT.<jk>class</jk> <jc>// Calendars swapped with ISO8601-compliant strings</jc>
+ )
+ .beanFilters(MyBeanFilter.<jk>class</jk>) <jc>// Control how bean properties are handled</jc>
+ .timeZone(TimeZone.<jsf>GMT</jsf>) <jc>// For serializing Calendars</jc>
+ .locale(Locale.<jsf>JAPAN</jsf>) <jc>// For timezone-specific serialization</jc>
+ .sortCollections(<jk>true</jk>) <jc>// For locale-specific serialization</jc>
+ .sortProperties(<jk>true</jk>) <jc>// Various behavior settings</jc>
+ .trimNullProperties(<jk>true</jk>)
+ .trimStrings(<jk>true</jk>)
+ .methodVisibility(<jsf>PROTECTED</jsf>) <jc>// Control which fields/methods are serialized</jc>
+ .beanDictionary( <jc>// Adds type variables for resolution during parsing</jc>
+ MyBeanA.<jk>class</jk>,
+ MyBeanB.<jk>class</jk>
+ )
+ .debug(<jk>true</jk>) <jc>// Add debug output</jc>
+ .build();
+
+ <jc>// Clone an existing serializer and modify it to use single-quotes</jc>
+ JsonSerializer serializer = JsonSerializer.<jsf>DEFAULT</jsf>.builder()
+ .sq()
+ .build();
+ </p>
+ <br><br><hr>
+ <p>
+ Many POJOs such as primitives, beans, collections, arrays, and classes with various known constructors and methods are serializable out-of-the-box.
+ For other objects, "transforms" allow you to perform various mutations on them before serialization and after parsing.
+ </p>
+ <ul class='spaced-list'>
+ <li>Transforms
+ <ul>
+ <li>Bean filters - Control how bean properties are handled (naming conventions, ordering, visibility,...).
+ <li>POJO swaps - Replace non-serializable POJOs with serializable equivalents.
+ <br>Predefined swaps provided for common cases: <code>ByteArrayBase64Swap</code>, 50+ variants of Calendar/Date swaps, <code>Enumeration/Iterator</code> swaps.
+ </ul>
+ <li>Annotations
+ <br>Various annotations available for your POJO classes that are recognized by ALL serializers and parsers:
+ <br><ja>@Bean</ja>, <ja>@Pojo</ja>, <ja>@BeanIgnore</ja>, <ja>@BeanParam</ja>, <ja>@BeanProperty</ja>, <ja>@NameProperty</ja>, <ja>@ParentProperty</ja>
+ <br>
+ <br>Annotations also provided for language-specific behaviors where it makes sense:
+ <br><ja>@Json</ja>, <ja>@Html</ja>, <ja>@Xml</ja>, <ja>@UrlEncoding</ja>
+ <br>
+ <br>All annotations have programmatic equivalents when you don't have access to POJO source.
+
+ <li>Swap methods
+ <br>By default, various instance and static methods and constructors are automatically detected and supported:
+ <br><code>valueOf(String)</code>, <code>parse(String)</code>, <code>parseString(String)</code>, <code>forName(String)</code>, <code>forString(String)</code>,
+ <code>fromString(String)</code>, <code>T(String)</code>, <code>Object swap(BeanSession)</code>, <code>T unswap(BeanSession, T.class)</code>
+ </ul>
+
+ <ul class='doctree'>
+ <li class='link'>See <a class='doclink' href='http://juneau.incubator.apache.org/site/apidocs/overview-summary.html#juneau-marshall.PojoCategories'>POJO Categories</a> for a definition of supported POJOs.
+ </ul>
+
+ <br><hr>
+ <p>
+ UON (URL-Encoded Object Notation) allows JSON-like data structures (OBJECT, ARRAY, NUMBER, BOOLEAN, STRING, NULL) in HTTP constructs (query parameters, form parameters,
+ headers, URL parts) without violating RFC2396.
+ This allows POJOs to be converted directly into these HTTP constructs which is not possible in any other language such as JSON.
+ </p>
+ <p class='bcode'>
+ (
+ id=1,
+ name=<js>'John+Smith'</js>,
+ uri=<js>http://sample/addressBook/person/1</js>,
+ addressBookUri=<js>http://sample/addressBook</js>,
+ birthDate=<js>1946-08-12T00:00:00Z</js>,
+ addresses=@(
+ (
+ uri=<js>http://sample/addressBook/address/1</js>,
+ personUri=<js>http://sample/addressBook/person/1</js>,
+ id=<js>1</js>,
+ street=<js>'100+Main+Street'</js>,
+ city=<js>Anywhereville</js>,
+ state=<js>NY</js>,
+ zip=<js>12345</js>,
+ isCurrent=<jk>true</jk>
+ )
+ )
+ )
+ </p>
+
+ <ul class='doctree'>
+ <li class='link'>See <a class='doclink' href='http://juneau.incubator.apache.org/site/apidocs/org/apache/juneau/uon/package-summary.html#TOC'>org.apache.juneau.uon</a> for more information.
+ </ul>
+
+ <br><hr>
+ <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<String,Object> myMap = <jk>new</jk> ObjectMap(<js>"{foo:'bar'}"</js>);
+ List<Object> 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));
+
+ String message = <jk>new</jk> StringMessage(<js>"My POJO in {0}: {1}"</js>, <js>"JSON"</js>, <jk>new</jk> StringObject(myPojo)).toString();
+
+ <jc>// Create a 'REST-like' wrapper around a POJO.</jc>
+ <jc>// Allows you to manipulate POJO trees using URIs and GET/PUT/POST/DELETE commands.</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
+ to be retrieved by W3C-compliant HTTP <code>Accept</code> and <code>Content-Type</code> values:
+ </p>
+ <p class='bcode'>
+ <jc>// Construct a new serializer group with configuration parameters that get applied to all serializers.</jc>
+ SerializerGroup sg = <jk>new</jk> SerializerGroupBuilder()
+ .append(JsonSerializer.<jk>class</jk>, UrlEncodingSerializer.<jk>class</jk>);
+ .ws() <jc>// or .setUseWhitespace(true)</jc>
+ .pojoSwaps(CalendarSwap.ISO8601DT.<jk>class</jk>)
+ .build();
+
+ <jc>// Find the appropriate serializer by Accept type and serialize our POJO to the specified writer.</jc>
+ <jc>// Fully RFC2616 compliant.</jc>
+ sg.getSerializer(<js>"text/invalid, text/json;q=0.8, text/*;q:0.6, *\/*;q=0.0"</js>)
+ .serialize(myPersonObject, myWriter);
+
+ <jc>// Construct a new parser group with configuration parameters that get applied to all parsers.</jc>
+ ParserGroup pg = <jk>new</jk> ParserGroupBuilder()
+ .append(JsonParser.<jk>class</jk>, UrlEncodingParser.<jk>class</jk>);
+ .pojoSwaps(CalendarSwap.ISO8601DT.<jk>class</jk>)
+ .build();
+
+ Person p = pg.getParser(<js>"text/json"</js>).parse(myReader, Person.<jk>class</jk>);
+ </p>
+
+ <br><br><hr>
+
+ <ul class='doctree'>
+ <li class='link'>See <a class='doclink' href='http://juneau.incubator.apache.org/site/apidocs/overview-summary.html#juneau-marshall'>juneau-marshall</a> for more information.
+ </ul>
+ </div>
+
+ <!-- ======================================================================================================= -->
+ <!-- === JUNEAU-MARSHALL-RDF =============================================================================== -->
+ <!-- ======================================================================================================= -->
+
+ <h5 class='toc' id='juneau-marshall-rdf'>juneau-marshall-rdf</h5>
+ <div>
+ <h6 class='figure'>Maven Dependency</h6>
+ <p class='bcode' style='width:500px;'>
+ <xt><dependency></xt>
+ <xt><groupId></xt>org.apache.juneau<xt></groupId></xt>
+ <xt><artifactId></xt>juneau-marshall-rdf<xt></artifactId></xt>
+ <xt><version></xt>7.0.0<xt></version></xt>
+ <xt></dependency></xt>
+ </p>
+
+ <h6 class='figure'>Java Library</h6>
+ <p class='bcode' style='width:500px;'>
+ juneau-marshall-rdf-7.0.0.jar
+ </p>
+
+ <h6 class='figure'>OSGi Module</h6>
+ <p class='bcode' style='width:500px;'>
+ org.apache.juneau.marshall.rdf_7.0.0.jar
+ </p>
+
+ <p>
+ The <code>juneau-marshall-rdf</code> library provides additional serializers and parsers for RDF.
+ These rely on the Apache Jena library to provide support for the following languages:
+ </p>
+ <ul>
+ <li>RDF/XML
+ <li>RDF/XML-Abbrev
+ <li>N-Triple
+ <li>Turtle
+ <li>N3
+ </ul>
+ <p>
+ The serializers and parsers work identically to those in <code>juneau-marshall</code>, but are
+ packaged separately so that you don't need to pull in the Jena dependency unless you need it.
+ </p>
+
+ <p class='bcode'>
+ <jc>// A simple bean</jc>
+ <jk>public class</jk> Person {
+ <jk>public</jk> String name = <js>"John Smith"</js>;
+ <jk>public int</jk> age = 21;
+ }
+
+ <jc>// Serialize a bean to JSON, XML, or HTML</jc>
+ Person p = <jk>new</jk> Person();
+
+ <jc>// Produces:
+ // <rdf:RDF
+ // xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ // xmlns:jp="http://www.apache.org/juneaubp/"
+ // xmlns:j="http://www.apache.org/juneau/">
+ // <rdf:Description>
+ // <jp:name>John Smith</jp:name>
+ // <jp:age>21</jp:age>
+ // </rdf:Description>
+ // </rdf:RDF></jc>
+ String rdfXml = RdfSerializer.<jsf>DEFAULT_XMLABBREV</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // @prefix jp: <http://www.apache.org/juneaubp/> .
+ // @prefix j: <http://www.apache.org/juneau/> .
+ // [] jp:age "21" ;
+ // jp:name "John Smith" .</jc>
+ String rdfN3 = RdfSerializer.<jsf>DEFAULT_N3</jsf>.serialize(p);
+
+ <jc>// Produces:
+ // _:A3bf53c85X3aX157cf407e2dX3aXX2dX7ffd <http://www.apache.org/juneaubp/name> "John Smith" .
+ // _:A3bf53c85X3aX157cf407e2dX3aXX2dX7ffd <http://www.apache.org/juneaubp/age> "21" .</jc>
+ String rdfNTriple = RdfSerializer.<jsf>DEFAULT_NTRIPLE</jsf>.serialize(p);
+ </p>
+
+ <ul class='doctree'>
+ <li class='link'>See <a class='doclink' href='http://juneau.incubator.apache.org/site/apidocs/overview-summary.html#juneau-marshall-rdf'>juneau-marshall-rdf</a> for more information.
+ </ul>
+ </div>
+</body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/4e699954/content/7.0.0/microservice.html
----------------------------------------------------------------------
diff --git a/content/7.0.0/microservice.html b/content/7.0.0/microservice.html
new file mode 100644
index 0000000..ce7fe29
--- /dev/null
+++ b/content/7.0.0/microservice.html
@@ -0,0 +1,227 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ @import url("styles/juneau-code.css");
+ @import url("styles/juneau-doc.css");
+</style>
+</head>
+<body>
+ <!-- =========================================================================================================== -->
+ <!-- === JUNEAU MICROSERVICE =================================================================================== -->
+ <!-- =========================================================================================================== -->
+
+ <h5 class='toc' id='juneau-microservice'>juneau-microservice</h5>
+ <div>
+
+ <p>
+ Microservices combine all the functionality of the core, server, and client APIs to provide truly powerful
+ and easy-to-use REST interfaces with minimal overhead.
+ </p>
+
+ <!-- ======================================================================================================= -->
+ <!-- === JUNEAU-MICROSERVICE-SERVER ======================================================================== -->
+ <!-- ======================================================================================================= -->
+
+ <h6 class='toc' id='juneau-microservice-server'>juneau-microservice-server</h6>
+ <div>
+
+ <h6 class='figure'>Maven Dependency</h6>
+ <p class='bcode' style='width:500px;'>
+ <xt><dependency></xt>
+ <xt><groupId></xt>org.apache.juneau<xt></groupId></xt>
+ <xt><artifactId></xt>juneau-microservice-server<xt></artifactId></xt>
+ <xt><version></xt>7.0.0<xt></version></xt>
+ <xt></dependency></xt>
+ </p>
+
+ <h6 class='figure'>Java Library</h6>
+ <p class='bcode' style='width:500px;'>
+ juneau-microservice-server-7.0.0.jar
+ </p>
+
+ <h6 class='figure'>OSGi Module</h6>
+ <p class='bcode' style='width:500px;'>
+ org.apache.juneau.microservice.server_7.0.0.jar
+ </p>
+
+ <p>
+ The Microservice API combines all the features above with a built-in Jetty server to produce a lightweight
+ REST service packaged as three simple files:
+ </p>
+ <ul class='spaced-list'>
+ <li>An executable jar file that starts up a REST interface in milliseconds.
+ <li>A configurable <code>jetty.xml</code> file.
+ <li>An external INI file that can be used to configure your REST resources on the fly.
+ </ul>
+ <p>
+ The microservice API was originally designed for and particularly suited for use in Docker containers.
+ </p>
+ <p>
+ REST microservices can also be started programmatically in existing code:
+ </p>
+ <p class='bcode'>
+ RestMicroservice myRestService = <jk>new</jk> RestMicroservice()
+ .setConfig(<js>"microservice.cfg"</js>, <jk>false</jk>)
+ .setJettyXml(<js>"my-jetty.xml"</js>);
+ myRestService.start();
+ URI uri = myRestService.getURI();
+ </p>
+ <p>
+ The provided microservice.cfg template file gives you a starting point for defining your microservice:
+ </p>
+ <p class='bcode'>
+ <cc>#================================================================================
+ # Basic configuration file for SaaS microservices
+ # Subprojects can use this as a starting point.
+ #================================================================================</cc>
+
+ <cc>#================================================================================
+ # REST settings
+ #================================================================================</cc>
+ <cs>[REST]</cs>
+
+ <cc># The location of the jetty.xml file to use for configuring Jetty.</cc>
+ <ck>jettyXml</ck> = <cv>jetty.xml</cv>
+
+ <cc># Stylesheet to use for HTML views.
+ # The default options are:
+ # - styles/juneau.css
+ # - styles/devops.css
+ # Other stylesheets can be referenced relative to the servlet package or working
+ # directory.</cc>
+ <ck>stylesheet</ck> = <cv>styles/devops.css</cv>
+
+ <cc># What to do when the config file is saved.
+ # Possible values:
+ # NOTHING - Don't do anything.
+ # RESTART_SERVER - Restart the Jetty server.
+ # RESTART_SERVICE - Shutdown and exit with code '3'.</cc>
+ <ck>saveConfigAction</ck> = <cv>RESTART_SERVER</cv>
+
+ <cc>#================================================================================
+ # Logger settings
+ # See FileHandler Java class for details.
+ #================================================================================</cc>
+ <cs>[Logging]</cs>
+
+ <cc># The directory where to create the log file.
+ # Default is "."</cc>
+ <ck>logDir</ck> = <cv>logs</cv>
+
+ <cc># The name of the log file to create for the main logger.
+ # The logDir and logFile make up the pattern that's passed to the FileHandler
+ # constructor.
+ # If value is not specified, then logging to a file will not be set up.</cc>
+ <ck>logFile</ck> = <cv>microservice.%g.log</cv>
+
+ <cc># Whether to append to the existing log file or create a new one.
+ # Default is false.</cc>
+ <ck>append</ck> =
+
+ <cc># The SimpleDateFormat format to use for dates.
+ # Default is "yyyy.MM.dd hh:mm:ss".</cc>
+ <ck>dateFormat</ck> =
+
+ <cc># The log message format.
+ # The value can contain any of the following variables:
+ # {date} - The date, formatted per dateFormat.
+ # {class} - The class name.
+ # {method} - The method name.
+ # {logger} - The logger name.
+ # {level} - The log level name.
+ # {msg} - The log message.
+ # {threadid} - The thread ID.
+ # {exception} - The localized exception message.
+ # Default is "[{date} {level}] {msg}%n".</cc>
+ <ck>format</ck> =
+
+ <cc># The maximum log file size.
+ # Suffixes available for numbers.
+ # See ConfigFile.getInt(String,int) for details.
+ # Default is 1M.</cc>
+ <ck>limit</ck> = <cv>10M</cv>
+
+ <cc># Max number of log files.
+ # Default is 1.</cc>
+ <ck>count</ck> = <cv>5</cv>
+
+ <cc># Default log levels.
+ # Keys are logger names.
+ # Values are serialized Level POJOs.</cc>
+ <ck>levels</ck> = <cv>{ org.apache.juneau:'INFO' }</cv>
+
+ <cc># Only print unique stack traces once and then refer to them by a simple 8 character hash identifier.
+ # Useful for preventing log files from filling up with duplicate stack traces.
+ # Default is false.</cc>
+ <ck>useStackTraceHashes</ck> = <cv>true</cv>
+
+ <cc># The default level for the console logger.
+ # Default is WARNING.</cc>
+ <ck>consoleLevel</ck> =
+
+ <cc>#================================================================================
+ # System properties
+ #--------------------------------------------------------------------------------
+ # These are arbitrary system properties that are set during startup.
+ #================================================================================</cc>
+ <cs>[SystemProperties]</cs>
+
+ <cc># Configure Jetty for StdErrLog Logging</cc>
+ <ck>org.eclipse.jetty.util.log.class</ck> = <cv>org.eclipse.jetty.util.log.StrErrLog</cv>
+
+ <cc># Jetty logging level</cc>
+ <ck>org.eclipse.jetty.LEVEL</ck> = <cv>WARN</cv>
+ </p>
+ <p>
+ This external config file is meant to be used for all of your resource configurations.
+ APIs are provided in the REST Server APIs for easily accessing these values programmatically, or
+ by using <js>"$C{...}"</js> variables in your <ja>@RestResource</ja> and <ja>@RestMethod</ja> annotations.
+ </p>
+ <p>
+ Various predefined reusable REST resource classes are provided for accessing log files, viewing and editing the config file, etc...
+ These allow you to quickly put together sophisticated REST microservices.
+ </p>
+
+ <ul class='doctree'>
+ <li class='link'>See <a class='doclink' href='http://juneau.incubator.apache.org/site/apidocs/overview-summary.html#juneau-microservice-server'>juneau-microservice-server</a> for more information.
+ </ul>
+ </div>
+
+ <!-- ======================================================================================================= -->
+ <!-- === JUNEAU-MICROSERVICE-TEMPLATE ====================================================================== -->
+ <!-- ======================================================================================================= -->
+
+ <h6 class='toc' id='juneau-microservice-template'>juneau-microservice-template</h6>
+ <div>
+
+ <h6 class='figure'>Archive File</h6>
+ <p class='bcode' style='width:500px;'>
+ my-microservice-7.0.0.zip
+ </p>
+
+ <p>
+ The <code>juneau-microservice-template</code> module is a bare-bones microservice project that can be
+ used as a starting point for creating your own microservice.
+ </p>
+ <p>
+ The template project ships as a zipped Eclipse project that can be quickly imported into your
+ workspace as an Eclipse project called "my-microservice".
+ </p>
+ <p>
+ Once loaded, you should see the following project structure:
+ </p>
+ <img class='bordered' src='images/juneau-microservice-template.import3.png' style='width:412px'>
+ <p>
+ The microservice can be started from the <code>my-microservice.launch</code> file.
+ It will start up the microservice on port 10000 which you can then view through a browser:
+ </p>
+ <img class='bordered' src='images/juneau-microservice-template.import4.png' style='width:467px'>
+
+ <ul class='doctree'>
+ <li class='link'>See <a class='doclink' href='http://juneau.incubator.apache.org/site/apidocs/overview-summary.html#juneau-microservice-template'>juneau-microservice-template</a> for more information.
+ </ul>
+ </div>
+ </div>
+</body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/4e699954/content/7.0.0/rest-client.html
----------------------------------------------------------------------
diff --git a/content/7.0.0/rest-client.html b/content/7.0.0/rest-client.html
new file mode 100644
index 0000000..088d7d7
--- /dev/null
+++ b/content/7.0.0/rest-client.html
@@ -0,0 +1,168 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ @import url("styles/juneau-code.css");
+ @import url("styles/juneau-doc.css");
+</style>
+</head>
+<body>
+ <!-- ======================================================================================================= -->
+ <!-- === JUNEAU-REST-CLIENT ================================================================================ -->
+ <!-- ======================================================================================================= -->
+
+ <h5 class='toc' id='juneau-rest-client'>juneau-rest-client</h5>
+ <div>
+ <h6 class='figure'>Maven Dependency</h6>
+ <p class='bcode' style='width:500px;'>
+ <xt><dependency></xt>
+ <xt><groupId></xt>org.apache.juneau<xt></groupId></xt>
+ <xt><artifactId></xt>juneau-rest-client<xt></artifactId></xt>
+ <xt><version></xt>7.0.0<xt></version></xt>
+ <xt></dependency></xt>
+ </p>
+
+ <h6 class='figure'>Java Library</h6>
+ <p class='bcode' style='width:500px;'>
+ juneau-rest-client-7.0.0.jar
+ </p>
+
+ <h6 class='figure'>OSGi Module</h6>
+ <p class='bcode' style='width:500px;'>
+ org.apache.juneau.rest.client_7.0.0.jar
+ </p>
+
+ <p>
+ The REST client API allows you to access REST interfaces using POJOs:
+ </p>
+ <p class='bcode'>
+ <jc>// Create a reusable JSON client.</jc>
+ RestClient client = <jk>new</jk> RestClientBuilder().build();
+
+ <jc>// The address of the root resource.</jc>
+ String url = <js>"http://localhost:10000/systemProperties"</js>;
+
+ <jc>// Do a REST GET against a remote REST interface and convert
+ // the response to an unstructured ObjectMap object.</jc>
+ Map m1 = client.doGet(url).getResponse(TreeMap.<jk>class</jk>);
+
+ <jc>// Add some new system properties.
+ // Use XML as the transport medium.</jc>
+ client = <jk>new</jk> RestClientBuilder(XmlSerializer.<jk>class</jk>, XmlParser.<jk>class</jk>).build();
+ Properties p = <jk>new</jk> Properties();
+ p.load(reader);
+ <jk>int</jk> returnCode = client.doPost(url + <js>"/systemProperties"</js>, p).execute();
+ </p>
+ <p>
+ The client API uses the same serializers and parsers (and subsequently their flexibility and configurability) as the server side to marshall POJOs back and forth.
+ </p>
+ <br><hr>
+ <p>
+ 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>
+ IAddressBook ab = restClient.getRemoteableProxy(IAddressBook.<jk>class</jk>);
+
+ <jc>// Invoke a method on the server side and get the returned result.</jc>
+ Person p = ab.createPerson(
+ <jk>new</jk> Person(
+ <js>"John Smith"</js>,
+ <js>"Aug 1, 1999"</js>,
+ <jk>new</jk> Address(<js>"My street"</js>, <js>"My city"</js>, <js>"My state"</js>, 12345, <jk>true</jk>)
+ )
+ );
+ </p>
+ <p>
+ Although the client API is not dependent on the <code>juneau-rest-server</code> module, the server
+ module provides some convenience APIs for exposing remoteable proxies on the server side:
+ </p>
+ <ol>
+ <li>Extending from <code>RemoteableServlet</code>.
+ <li>Using a <code><ja>@RestMethod</ja>(name=<jsf>PROXY</jsf>)</code> annotation on a Java method.
+ </ol>
+ <p>
+ The <code>RemoteableServlet</code> class is a simple specialized servlet with an abstract <code>getServiceMap()</code>
+ method to define the server-side POJOs:
+ </p>
+ <p class='bcode'>
+ <ja>@RestResource</ja>(
+ path=<js>"/remote"</js>
+ )
+ <jk>public class</jk> SampleRemoteableServlet <jk>extends</jk> RemoteableServlet {
+
+ <jc>// Our server-side POJO.</jc>
+ AddressBook <jf>addressBook</jf> = <jk>new</jk> AddressBook();
+
+ <ja>@Override</ja> <jc>/* RemoteableServlet */</jc>
+ <jk>protected</jk> Map<Class<?>,Object> getServiceMap() <jk>throws</jk> Exception {
+ Map<Class<?>,Object> m = <jk>new</jk> LinkedHashMap<Class<?>,Object>();
+
+ <jc>// In this simplified example, we expose the same POJO service under two different interfaces.
+ // One is IAddressBook which only exposes methods defined on that interface, and
+ // the other is AddressBook itself which exposes all methods defined on the class itself (dangerous!).</jc>
+ m.put(IAddressBook.<jk>class</jk>, <jf>addressBook</jf>);
+ m.put(AddressBook.<jk>class</jk>, <jf>addressBook</jf>);
+ <jk>return</jk> m;
+ }
+ }
+ </p>
+ <p>
+ The <code><ja>@RestMethod</ja>(name=<jsf>PROXY</jsf>)</code> approach is easier if you only have a single interface you want to expose.
+ You simply define a Java method whose return type is an interface, and return the implementation of that interface:
+ </p>
+ <p class='bcode'>
+ <jc>// Our exposed proxy object.</jc>
+ <ja>@RestMethod</ja>(name=<jsf>PROXY</jsf>, path=<js>"/addressbookproxy/*"</js>)
+ <jk>public</jk> IAddressBook getProxy() {
+ <jk>return</jk> addressBook;
+ }
+ </p>
+ <p>
+ In either case, the proxy communications layer is pure REST.
+ Parameters passed in on the client side are serialized as an HTTP POST, parsed on the
+ 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 efficient.
+ 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#juneau-marshall.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.
+ </p>
+ <p>
+ The <code>RemoteableServlet</code> class itself shows how sophisticated REST interfaces can be built on the Juneau REST Servlet
+ API using very little code.
+ The class consists of only 53 lines of code, yet is a sophisticated discoverable and self-documenting REST interface.
+ And since the remote proxy API is built on top of REST, it can be debugged using just a browser.
+ </p>
+ <br><hr>
+ <p>
+ Remoteable proxies can also be used to define interface proxies against 3rd-party REST interfaces.
+ This is an extremely powerful feature that allows you to quickly define easy-to-use interfaces against virtually any REST interface.
+ </p>
+ <p>
+ Similar in concept to remoteable services defined above, but in this case we simply define our interface with
+ special annotations that tell us how to convert input and output to HTTP headers, query parameters, form post parameters, or request/response bodies.
+ </p>
+ <p class='bcode'>
+ <ja>@Remoteable</ja>
+ <jk>public interface</jk> MyProxyInterface {
+
+ <ja>@RemoteMethod</ja>(httpMethod=<jsf>POST</jsf>, path=<js>"/method"</js>)
+ String doSomething(<ja>@Header</ja>(<js>"E-Tag"</js>) UUID etag, <ja>@Query</ja>(<js>"debug"</js>) <jk>boolean</jk> debug, <ja>@Body</ja> MyPojo pojo);
+ }
+
+ RestClient client = <jk>new</jk> RestClientBuilder().build(); <jc>// Default is JSON</jc>
+ MyProxyInterface p = client.getRemoteableProxy(MyProxyInterface.<jk>class</jk>, <js>"http://hostname/some/rest/interface"</js>);
+ String response = p.doSomething(UUID.<jsm>generate</jsm>(), <jk>true</jk>, <jk>new</jk> MyPojo());
+ </p>
+
+ <ul class='doctree'>
+ <li class='link'>See <a class='doclink' href='http://juneau.incubator.apache.org/site/apidocs/overview-summary.html#juneau-rest-client'>juneau-rest-client</a> for more information.
+ </ul>
+ </div>
+</body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/4e699954/content/7.0.0/rest-server.html
----------------------------------------------------------------------
diff --git a/content/7.0.0/rest-server.html b/content/7.0.0/rest-server.html
new file mode 100644
index 0000000..a4c2b85
--- /dev/null
+++ b/content/7.0.0/rest-server.html
@@ -0,0 +1,748 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ @import url("styles/juneau-code.css");
+ @import url("styles/juneau-doc.css");
+</style>
+</head>
+<body>
+
+ <!-- ======================================================================================================= -->
+ <!-- === JUNEAU-REST-SERVER ================================================================================ -->
+ <!-- ======================================================================================================= -->
+
+ <h5 class='toc' id='juneau-rest-server'>juneau-rest-server</h5>
+ <div>
+ <h6 class='figure'>Maven Dependency</h6>
+ <p class='bcode' style='width:500px;'>
+ <xt><dependency></xt>
+ <xt><groupId></xt>org.apache.juneau<xt></groupId></xt>
+ <xt><artifactId></xt>juneau-rest-server<xt></artifactId></xt>
+ <xt><version></xt>7.0.0<xt></version></xt>
+ <xt></dependency></xt>
+ </p>
+
+ <h6 class='figure'>Java Library</h6>
+ <p class='bcode' style='width:500px;'>
+ juneau-rest-server-7.0.0.jar
+ </p>
+
+ <h6 class='figure'>OSGi Module</h6>
+ <p class='bcode' style='width:500px;'>
+ org.apache.juneau.rest.server_7.0.0.jar
+ </p>
+
+ <p>
+ The REST server API builds upon the <code>SerializerGroup</code> and <code>ParserGroup</code> classes
+ to provide annotated REST servlets that automatically negotiate the HTTP media types for you.
+ <br>Developers simply work with requests, responses, headers, path variables, query parameters, and form data as POJOs.
+ <br>It allows you to create sophisticated REST interfaces using tiny amounts of code.
+ </p>
+ <p>
+ The end goal is to provide simple and flexible yet sophisticated REST interfaces that allow POJOs to be automatically represented as
+ different content types depending on whatever the particular need:
+ </p>
+ <ul class='spaced-list'>
+ <li>HTML for viewing POJOs in easy-to-read format in a browser.
+ <li>JSON for interacting through Javascript.
+ <li>XML for interacting with other applications.
+ <li>RDF for interacting with triple stores.
+ <li>URL-Encoding for interacting through HTML forms.
+ <li>MessagePack for efficiently transmitting large amounts of data.
+ </ul>
+ <p>
+ A simple example that supports all languages:
+ </p>
+ <p class='bcode'>
+ <ja>@RestResource</ja>(
+ path=<js>"/systemProperties"</js>,
+ title=<js>"System properties resource"</js>
+ )
+ <jk>public class</jk> SystemPropertiesResource <jk>extends</jk> RestServletDefault {
+
+ <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>)
+ <jk>public</jk> Map getSystemProperties(<ja>@Query</ja>(<js>"sort"</js>) <jk>boolean</jk> sort) <jk>throws</jk> Throwable {
+ <jk>if</jk> (sort)
+ <jk>return new</jk> TreeMap(System.<jsm>getProperties</jsm>());
+ <jk>return</jk> System.<jsm>getProperties</jsm>();
+ }
+
+ <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/{propertyName}"</js>)
+ <jk>public</jk> String getSystemProperty(<ja>@Path</ja> String propertyName) <jk>throws</jk> Throwable {
+ <jk>return</jk> System.<jsm>getProperty</jsm>(propertyName);
+ }
+
+ <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/{propertyName}"</js>, guards=AdminGuard.<jk>class</jk>)
+ <jk>public</jk> String setSystemProperty(<ja>@Path</ja> String propertyName, <ja>@Body</ja> String value) {
+ System.<jsm>setProperty</jsm>(propertyName, value);
+ <jk>return</jk> <js>"OK"</js>;
+ }
+
+ <ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/"</js>, guards=AdminGuard.<jk>class</jk>)
+ <jk>public</jk> String setSystemProperties(<ja>@Body</ja> java.util.Properties newProperties) {
+ System.<jsm>setProperties</jsm>(newProperties);
+ <jk>return</jk> <js>"OK"</js>;
+ }
+
+ <ja>@RestMethod</ja>(name=<jsf>DELETE</jsf>, path=<js>"/{propertyName}"</js>, guards=AdminGuard.<jk>class</jk>)
+ <jk>public</jk> String deleteSystemProperty(<ja>@Path</ja> String propertyName) {
+ System.<jsm>clearProperty</jsm>(propertyName);
+ <jk>return</jk> <js>"OK"</js>;
+ }
+ }
+ </p>
+ <p>
+ A more sophisticated example of the same resource using various features, including information
+ for fully populating the Swagger documentation, guards for restricting access to particular
+ methods, customizing supported content types and serialization options, adding g-zip compression,
+ and adding customized branding for the HTML views.
+ </p>
+ <p class='bcode'>
+ <ja>@RestResource</ja>(
+ path=<js>"/systemProperties"</js>,
+ title=<js>"System properties resource"</js>,
+ description=<js>"REST interface for performing CRUD operations on system properties."</js>,
+ messages=<js>"nls/SystemPropertiesResource"</js>, <jc>// Location of localized messages.</jc>
+
+ <jc>// Widget used for content-type pull-down menu.</jc>
+ widgets={
+ ContentTypeMenuItem.<jk>class</jk>
+ },
+
+ <jc>// Links on the HTML rendition page.
+ // "request:/..." URIs are relative to the request URI.
+ // "servlet:/..." URIs are relative to the servlet URI.</jc>
+ htmldoc=<ja>@HtmlDoc</ja>(
+
+ <jc>// Custom navigation links.</jc>
+ links={
+ <js>"up: request:/.."</js>,
+ <js>"options: servlet:/?method=OPTIONS"</js>,
+ <js>"form: servlet:/formPage"</js>,
+ <js>"$W{ContentTypeMenuItem}"</js>,
+ <js>"source: $C{Source/gitHub}/org/apache/juneau/examples/rest/SystemPropertiesResource.java"</js>
+ },
+
+ <jc>// Custom page text in aside section.</jc>
+ aside={
+ <js>"<div style='max-width:800px' class='text'>"</js>,
+ <js>" <p>Shows standard GET/PUT/POST/DELETE operations and use of Swagger annotations.</p>"</js>,
+ <js>"</div>"</js>
+ },
+
+ <jc>// Custom CSS styles applied to HTML view.</jc>
+ style={
+ <js>"aside {display:table-caption;}"</js>
+ }
+ ),
+
+ <jc>// Set serializer, parser, and REST context properties.</jc>
+ properties={
+ <ja>@Property</ja>(name=<jsf>SERIALIZER_quoteChar</jsf>, value=<js>"'"</js>)
+ },
+
+ <jc>// Add compression support.</jc>
+ encoders=GzipEncoder.<jk>class</jk>,
+
+ <jc>// Augment generated Swagger information.</jc>
+ swagger=<ja>@ResourceSwagger</ja>(
+ contact=<js>"{name:'John Smith',email:'john@smith.com'}"</js>,
+ license=<js>"{name:'Apache 2.0',url:'http://www.apache.org/licenses/LICENSE-2.0.html'}"</js>,
+ version=<js>"2.0"</js>,
+ termsOfService=<js>"You're on your own."</js>,
+ tags=<js>"[{name:'Java',description:'Java utility',externalDocs:{description:'Home page',url:'http://juneau.apache.org'}}]"</js>,
+ externalDocs=<js>"{description:'Home page',url:'http://juneau.apache.org'}"</js>
+ )
+ )
+ <jk>public class</jk> SystemPropertiesResource <jk>extends</jk> RestServlet {
+
+ <ja>@RestMethod</ja>(
+ name=<jsf>GET</jsf>, path=<js>"/"</js>,
+ summary=<js>"Show all system properties"</js>,
+ description=<js>"Returns all system properties defined in the JVM."</js>,
+
+ <jc>// Augment generated Swagger information.</jc>
+ swagger=<ja>@MethodSwagger</ja>(
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"query"</js>, name=<js>"sort"</js>, description=<js>"Sort results alphabetically."</js>, _default=<js>"false"</js>)
+ },
+ responses={
+ <ja>@Response</ja>(value=200, description=<js>"Returns a map of key/value pairs."</js>)
+ }
+ )
+ )
+ <jk>public</jk> Map getSystemProperties(<ja>@Query</ja>(<js>"sort"</js>) <jk>boolean</jk> sort) <jk>throws</jk> Throwable {
+ <jk>if</jk> (sort)
+ <jk>return new</jk> TreeMap(System.<jsm>getProperties</jsm>());
+ <jk>return</jk> System.<jsm>getProperties</jsm>();
+ }
+
+ ...
+ }
+ </p>
+
+ <p>
+ In HTML, our resource looks like this:
+ </p>
+ <img class='bordered' src='images/SystemPropertiesResource.png' width="800px">
+
+ <p>
+ When combined with the support for HTML5 beans, simple HTML forms can be constructed for easy input and output
+ using nothing more than Java:
+ </p>
+ <p class='bcode'>
+ <jk>import static</jk> org.apache.juneau.dto.html5.HtmlBuilder.*;
+
+ <ja>@RestMethod</ja>(
+ name=<jsf>GET</jsf>, path=<js>"/formPage"</js>,
+ summary=<js>"Form entry page"</js>,
+ description=<js>"A form post page for setting a single system property value."</js>,
+ guards=AdminGuard.<jk>class</jk>
+ )
+ <jk>public</jk> Form getFormPage() {
+ <jk>return</jk> <jsm>form</jsm>().method(<jsf>POST</jsf>).action(<js>"formPagePost"</js>).children(
+ <jsm>table</jsm>(
+ <jsm>tr</jsm>(
+ <jsm>th</jsm>(<js>"Set system property"</js>).colspan(2)
+ ),
+ <jsm>tr</jsm>(
+ <jsm>td</jsm>(<js>"Name: "</js>), <jsm>td</jsm>(<jsm>input</jsm>(<js>"text"</js>).name(<js>"name"</js>))
+ ),
+ <jsm>tr</jsm>(
+ <jsm>td</jsm>(<js>"Value: "</js>), <jsm>td</jsm>(<jsm>input</jsm>(<js>"text"</js>).name(<js>"value"</js>))
+ )
+ ),
+ <jsm>button</jsm>(<js>"submit"</js>,<js>"Click me!"</js>).<jsm>style</jsm>(<js>"float:right"</js>)
+ );
+ }
+
+ <ja>@RestMethod</ja>(
+ name=<jsf>POST</jsf>, path=<js>"/formPagePost"</js>,
+ description=<js>"Accepts a simple form post of a system property name/value pair."</js>,
+ guards=AdminGuard.<jk>class</jk>
+ )
+ <jk>public</jk> Redirect formPagePost(<ja>@FormData</ja>(<js>"name"</js>) String name, <ja>@FormData</ja>(<js>"value"</js>) String value) {
+ System.<jsm>setProperty</jsm>(name, value);
+ <jk>return new</jk> Redirect(<js>"servlet:/"</js>); <jc>// Redirect to the servlet top page.</jc>
+ }
+ </p>
+ <img class='bordered' src='images/SystemPropertiesForm.png' width="800px">
+ <p>
+ The REST API is built on top of Servlets, making them easy to deploy in any JEE environment.
+ </p>
+ <p>
+ REST Java methods can return any of the following objects:
+ <br>POJOs, <code>Readers</code>, <code>InputStreams</code>, <code>ZipFiles</code>, <code>Redirects</code>, <code>Streamables</code>, and <code>Writables</code>.
+ </p>
+ <p>
+ Or add your own handlers for other types.
+ </p>
+ <p>
+ REST Java methods can be passed any of the following objects in any order:
+ </p>
+ <ul class='spaced-list'>
+ <li>Low-level request/response objects:
+ <br><code>HttpServletRequest</code>, <code>HttpServletResponse</code>, <code>RestRequest</code>, <code>RestResponse</code>.
+ <li>Intermediate-level objects:
+ <br><code>RequestHeaders</code>, <code>RequestQuery</code>, <code>RequestFormData</code>, <code>RequestPathMatch</code>, <code>RequestBody</code>.
+ <li>All RFC 2616 request header objects:
+ <br><code>Accept</code>, <code>AcceptLanguage</code>, <code>AcceptEncoding</code>...
+ <li>Annotated parameters:
+ <br><ja>@Header</ja>, <ja>@Query</ja>, <ja>@FormData</ja>, <ja>@Path</ja>, <ja>@PathRemainder</ja>, <ja>@Body</ja>.
+ <li>Other objects:
+ <br><code>Locale</code>, <code>ResourceBundle</code>, <code>MessageBundle</code>, <code>InputStream</code>, <code>OutputStream</code>, <code>Reader</code>, <code>Writer</code>...
+ <li>User-defined parameter types.
+ </ul>
+ <p>
+ It's up to you how you want to define your REST methods.
+ As a general rule, there are 3 broad approaches typically used:
+ </p>
+
+ <h5 class='topic'>Methodology #1 - Annotated parameters</h5>
+ <p>
+ This approach uses annotated parameters for retrieving input from the request.
+ </p>
+ <p class='bcode'>
+ <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/example1/{p1}/{p2}/{p3}/*"</js>)
+ <jk>public</jk> String example1(
+ <ja>@Method</ja> String method, <jc>// HTTP method.</jc>
+ <ja>@Path</ja> String p1, <jc>// Path variables.</jc>
+ <ja>@Path</ja> <jk>int</jk> p2,
+ <ja>@Path</ja> UUID p3,
+ <ja>@Query</ja>(<js>"q1"</js>) <jk>int</jk> q1, <jc>// Query parameters.</jc>
+ <ja>@Query</ja>(<js>"q2"</js>) String q2,
+ <ja>@Query</ja>(<js>"q3"</js>) UUID q3,
+ <ja>@PathRemainder</ja> String remainder, <jc>// Path remainder after pattern match.</jc>
+ <ja>@Header</ja>(<js>"Accept-Language"</js>) String lang, <jc>// Headers.</jc>
+ <ja>@Header</ja>(<js>"Accept"</js>) String accept,
+ <ja>@Header</ja>(<js>"DNT"</js>) <jk>int</jk> doNotTrack
+ ) {
+
+ <jc>// Send back a simple String response</jc>
+ String output = String.<jsm>format</jsm>(
+ <js>"method=%s, p1=%s, p2=%d, p3=%s, remainder=%s, q1=%d, q2=%s, q3=%s, lang=%s, accept=%s, dnt=%d"</js>,
+ method, p1, p2, p3, remainder, q1, q2, q3, lang, accept, doNotTrack);
+ <jk>return</jk> output;
+ }
+ </p>
+
+ <h5 class='topic'>Methodology #2 - Low-level request/response objects</h5>
+ <p>
+ This approach uses low-level request/response objects to perform the same as above.
+ </p>
+ <p class='bcode'>
+ <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/example2/{p1}/{p2}/{p3}/*"</js>)
+ <jk>public</jk> String example2(
+ RestRequest req, <jc>// A direct subclass of HttpServletRequest.</jc>
+ RestResponse res <jc>// A direct subclass of HttpServletResponse.</jc>
+ ) {
+
+ <jc>// HTTP method.</jc>
+ String method = req.getMethod();
+
+ <jc>// Path variables.</jc>
+ RequestPathMatch path = req.getPathMatch();
+ String p1 = path.get(<js>"p1"</js>, String.<jk>class</jk>);
+ <jk>int</jk> p2 = path.get(<js>"p2"</js>, <jk>int</jk>.<jk>class</jk>);
+ UUID p3 = path.get(<js>"p3"</js>, UUID.<jk>class</jk>);
+
+ <jc>// Query parameters.</jc>
+ RequestQuery query = req.getQuery();
+ <jk>int</jk> q1 = query.get(<js>"q1"</js>, 0, <jk>int</jk>.<jk>class</jk>);
+ String q2 = query.get(<js>"q2"</js>, String.<jk>class</jk>);
+ UUID q3 = query.get(<js>"q3"</js>, UUID.<jk>class</jk>);
+
+ <jc>// Path remainder after pattern match.</jc>
+ String remainder = req.getPathMatch().getRemainder();
+
+ <jc>// Headers.</jc>
+ String lang = req.getHeader(<js>"Accept-Language"</js>);
+ String accept = req.getHeader(<js>"Accept"</js>);
+ <jk>int</jk> doNotTrack = req.getHeaders().get(<js>"DNT"</js>, <jk>int</jk>.<jk>class</jk>);
+
+ <jc>// Send back a simple String response</jc>
+ String output = String.format(
+ <js>"method=%s, p1=%s, p2=%d, p3=%s, remainder=%s, q1=%d, q2=%s, q3=%s, lang=%s, accept=%s, dnt=%d"</js>,
+ method, p1, p2, p3, remainder, q1, q2, q3, lang, accept, doNotTrack);
+ res.setOutput(output); <jc>// Or use getWriter().</jc>
+ }
+ </p>
+
+ <h5 class='topic'>Methodology #3 - Intermediate-level API objects</h5>
+ <p>
+ This approach is sort of the middle ground where you get access functional area APIs.
+ </p>
+ <p class='bcode'>
+ <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/example3/{p1}/{p2}/{p3}/*"</js>)
+ <jk>public</jk> String example3(
+ HttpMethod method, <jc>// HTTP method.</jc>
+ RequestPathMatch path, <jc>// Path variables.</jc>
+ RequestQuery query, <jc>// Query parameters.</jc>
+ RequestHeaders headers, <jc>// Headers.</jc>
+ AcceptLanguage lang, <jc>// Specific header classes.</jc>
+ Accept accept
+ ) {
+
+ <jc>// Path variables.</jc>
+ String p1 = path.get(<js>"p1"</js>, String.<jk>class</jk>);
+ <jk>int</jk> p2 = path.get(<js>"p2"</js>, <jk>int</jk>.<jk>class</jk>);
+ UUID p3 = path.get(<js>"p3"</js>, UUID.<jk>class</jk>);
+
+ <jc>// Query parameters.</jc>
+ <jk>int</jk> q1 = query.get(<js>"q1"</js>, 0, <jk>int</jk>.<jk>class</jk>);
+ String q2 = query.get(<js>"q2"</js>, String.<jk>class</jk>);
+ UUID q3 = query.get(<js>"q3"</js>, UUID.<jk>class</jk>);
+
+ <jc>// Path remainder after pattern match.</jc>
+ String remainder = path.getRemainder();
+
+ <jc>// Headers.</jc>
+ int doNotTrack = headers.get(<js>"DNT"</js>, <jk>int</jk>.<jk>class</jk>);
+
+ <jc>// Send back a simple String response</jc>
+ String output = String.format(
+ <js>"method=%s, p1=%s, p2=%d, p3=%s, remainder=%s, q1=%d, q2=%s, q3=%s, lang=%s, accept=%s, dnt=%d"</js>,
+ method, p1, p2, p3, remainder, q1, q2, q3, lang, accept, doNotTrack);
+ res.setOutput(output);
+ }
+ </p>
+ <p>
+ All three are completely equivalent. It's up to your own coding preferences which methodology you use.
+ </p>
+ <br><hr>
+ <p>
+ Lifecycle hooks allow you to hook into lifecycle events of the servlet or REST call.
+ Like <ja>@RestMethod</ja> methods, the list of parameters are specified by the developer.
+ </p>
+ <p>
+ For example, if you want to add an initialization method to your resource:
+ </p>
+ <p class='bcode'>
+ <ja>@RestResource</ja>(...)
+ <jk>public class</jk> MyResource {
+
+ <jc>// Our database.</jc>
+ <jk>private</jk> Map<Integer,Object> <jf>myDatabase</jf>;
+
+ <ja>@RestHook</ja>(<jsf>INIT</jsf>)
+ <jk>public void</jk> initMyDatabase(RestConfig config) <jk>throws</jk> Exception {
+ <jf>myDatabase</jf> = <jk>new</jk> LinkedHashMap<>();
+ }
+ }
+ </p>
+ <p>
+ Or if you want to intercept REST calls:
+ </p>
+ <p class='bcode'>
+ <ja>@RestResource</ja>(...)
+ <jk>public class</jk> MyResource {
+
+ <jc>// Add a request attribute to all incoming requests.</jc>
+ <ja>@RestHook</ja>(<jsf>PRE_CALL</jsf>)
+ <jk>public void</jk> onPreCall(RestRequest req) {
+ req.setAttribute(<js>"foo"</js>, <js>"bar"</js>);
+ }
+ }
+ </p>
+ <p>
+ The hook events can be broken down into two categories:
+ </p>
+ <ul class='spaced-list'>
+ <li>Resource lifecycle events:
+ <ul>
+ <li><jsf>INIT</jsf> - Right before initialization.
+ <li><jsf>POST_INIT</jsf> - Right after initialization.
+ <li><jsf>POST_INIT_CHILD_FIRST</jsf> - Right after initialization, but run child methods first.
+ <li><jsf>DESTROY</jsf> - Right before servlet destroy.
+ </ul>
+ <li>REST call lifecycle events:
+ <ul>
+ <li><jsf>START_CALL</jsf> - At the beginning of a REST call.
+ <li><jsf>PRE_CALL</jsf> - Right before the <ja>@RestMethod</ja> method is invoked.
+ <li><jsf>POST_CALL</jsf> - Right after the <ja>@RestMethod</ja> method is invoked.
+ <li><jsf>END_CALL</jsf> - At the end of the REST call after the response has been flushed.
+ </ul>
+ </ul>
+ <br><hr>
+ <p>
+ Auto-generated OPTIONS pages are constructed from Swagger DTO beans, here shown serialized as HTML:
+ </p>
+ <img class='bordered' src='images/Swagger.png' width="800px">
+ <p>
+ Swagger documentation can be populated from annotations (as above), resource bundles, or Swagger JSON files.
+ </p>
+ <p>
+ The page shown above is implemented on the RestServletDefault class in the method below which shows that it's doing nothing more than
+ serializing a Swagger bean which is constructed in the RestRequest object:
+ </p>
+ <p class='bcode'>
+ <ja>@RestMethod</ja>(name=<jsf>OPTIONS</jsf>, path=<js>"/*"</js>)
+ <jk>public</jk> Swagger getOptions(RestRequest req) {
+ <jk>return</jk> req.getSwagger();
+ }
+ </p>
+ <br><br><hr>
+ <p>
+ Navigable hierarchies of REST resources are easy to set up either programmatically or through annotations.
+ <br>
+ The following example is the <code>RootResources</code> class from the REST examples showing how to construct
+ a grouping of resources using the <code>children()</code> annotation:
+ </p>
+ <p class='bcode'>
+ <ja>@RestResource</ja>(
+ path=<js>"/"</js>,
+ title=<js>"Root resources"</js>,
+ description=<js>"Example of a router resource page."</js>,
+ widgets={
+ PoweredByApache.<jk>class</jk>,
+ ContentTypeMenuItem.<jk>class</jk>
+ },
+ htmldoc=<ja>@HtmlDoc</ja>(
+ links={
+ <js>"options: ?method=OPTIONS"</js>,
+ <js>"$W{ContentTypeMenuItem}"</js>,
+ <js>"source: $C{Source/gitHub}/org/apache/juneau/examples/rest/RootResources.java"</js>
+ },
+ aside={
+ <js>"<div style='max-width:400px' class='text'>"</js>,
+ <js>" <p>This is an example of a 'router' page that serves as a jumping-off point to child resources.</p>"</js>,
+ <js>" <p>Resources can be nested arbitrarily deep through router pages.</p>"</js>,
+ <js>" <p>Note the options link provided that lets you see the generated swagger doc for this page.</p>"</js>,
+ <js>" <p>Also note the source link on these pages to view the source code for the page.</p>"</js>,
+ <js>" <p>All content on pages in the UI are serialized POJOs. In this case, it's a serialized array of beans with 2 properties, 'name' and 'description'.</p>"</js>,
+ <js>" <p>Other features (such as this aside) are added through annotations.</p>"</js>,
+ <js>"</div>"</js>
+ },
+ footer=<js>"$W{PoweredByApache}"</js>
+ ),
+ children={
+ HelloWorldResource.<jk>class</jk>,
+ PetStoreResource.<jk>class</jk>,
+ SystemPropertiesResource.<jk>class</jk>,
+ MethodExampleResource.<jk>class</jk>,
+ RequestEchoResource.<jk>class</jk>,
+ TempDirResource.<jk>class</jk>,
+ AddressBookResource.<jk>class</jk>,
+ SampleRemoteableServlet.<jk>class</jk>,
+ PhotosResource.<jk>class</jk>,
+ AtomFeedResource.<jk>class</jk>,
+ JsonSchemaResource.<jk>class</jk>,
+ SqlQueryResource.<jk>class</jk>,
+ TumblrParserResource.<jk>class</jk>,
+ CodeFormatterResource.<jk>class</jk>,
+ UrlEncodedFormResource.<jk>class</jk>,
+ ConfigResource.<jk>class</jk>,
+ LogsResource.<jk>class</jk>,
+ DockerRegistryResource.<jk>class</jk>,
+ ShutdownResource.<jk>class</jk>
+ }
+ )
+ <jk>public class</jk> RootResources <jk>extends</jk> RestServletGroupDefault { <jc>/* No code needed! */</jc> }
+ </p>
+ <p>
+ The above resource when rendered in HTML shows how easy it is to discover and navigate to child resources using a browser:
+ </p>
+ <img class='bordered' src='images/Samples_RootResources.png' width="800px">
+ <p>
+ Resources can be nested arbitrarily deep.
+ The <ja>@RestResource</ja> and <ja>@RestMethod</ja> annotations can be applied to any classes, not just
+ servlets. The only requirement is that the top-level resource be a subclass of <code>RestServlet</code> as a hook into
+ the servlet container.
+ </p>
+
+ <p>
+ The <code>juneau-examples-rest</code> project includes various other examples that highlight some of the
+ capabilities of the REST servlet API.
+ <br>
+ For example, the <code>PetStoreResource</code> class shows some advanced features such as using POJO renders
+ and converters, and HTML widgets.
+ </p>
+ <img class='bordered' src='images/PetStore.png' width="1000px">
+
+ <p>
+ The beans being serialized are shown here:
+ </p>
+ <p class='bcode'>
+ <jc>// Our bean class.</jc>
+ <jk>public class</jk> Pet {
+
+ <ja>@Html</ja>(link=<js>"servlet:/{id}"</js>) <jc>// Creates a hyperlink in HTML view.</jc>
+ <ja>@NameProperty</ja> <jc>// Links the parent key to this bean.</jc>
+ <jk>public int</jk> <jf>id</jf>;
+
+ <jk>public</jk> String <jf>name</jf>;
+ <jk>public</jk> Kind <jf>kind</jf>;
+
+ <ja>@BeanProperty</ja>(format=<js>"$%.2f"</js>) <jc>// Renders price in dollars.</jc>
+ <jk>public float</jk> <jf>price</jf>;
+
+ <ja>@BeanProperty</ja>(swap=DateSwap.<jsf>RFC2822D</jsf>.<jk>class</jk>) <jc>// Renders dates in RFC2822 format.</jc>
+ <jk>public</jk> Date <jf>birthDate</jf>;
+
+ <jk>public int</jk> getAge() {
+ Calendar c = <jk>new</jk> GregorianCalendar();
+ c.setTime(<jf>birthDate</jf>);
+ <jk>return new</jk> GregorianCalendar().get(Calendar.<jsf>YEAR</jsf>) - c.get(Calendar.<jsf>YEAR</jsf>);
+ }
+ }
+
+ <ja>@Html</ja>(render=KindRender.<jk>class</jk>) <jc>// Render as an icon in HTML.</jc>
+ <jk>public static enum</jk> Kind {
+ <jsf>CAT</jsf>, <jsf>DOG</jsf>, <jsf>BIRD</jsf>, <jsf>FISH</jsf>, <jsf>MOUSE</jsf>, <jsf>RABBIT</jsf>, <jsf>SNAKE</jsf>
+ }
+
+ <jk>public static class</jk> KindRender <jk>extends</jk> HtmlRender<Kind> {
+ <ja>@Override</ja>
+ <jk>public</jk> Object getContent(SerializerSession session, Kind value) {
+ <jk>return new</jk> Img().src(<js>"servlet:/htdocs/"</js>+value.toString().toLowerCase()+<js>".png"</js>);
+ }
+ <ja>@Override</ja>
+ <jk>public</jk> String getStyle(SerializerSession session, Kind value) {
+ <jk>return</jk> <js>"background-color:#FDF2E9"</js>;
+ }
+ }
+ </p>
+
+ <p>
+ The <code>QUERY</code> menu item shows the capabilities of Converters which are post-processors that
+ work to filter POJOs after they've been returned by your Java method.
+ <br>
+ In this case, we're using the <code>Queryable</code> converter that allows us to perform search/view/sort/paging
+ against collections of beans:
+ </p>
+ <img class='bordered' src='images/PetStore_Query.png' width="1000px">
+
+ <p>
+ The drop-down menu items are implemented through "widgets" which allow you to embed arbitrary HTML, Javascript,
+ and CSS in the HTML view of the page.
+ </p>
+ <p class='bcode'>
+ <ja>@RestMethod</ja>(
+ name=<jsf>GET</jsf>,
+ path=<js>"/"</js>,
+ summary=<js>"The complete list of pets in the store"</js>,
+
+ <jc>// Add 'query' and 'content-types' menu items.</jc>
+ widgets={
+ QueryMenuItem.<jk>class</jk>,
+ ContentTypeMenuItem.<jk>class</jk>,
+ StyleMenuItem.<jk>class</jk>
+ },
+
+ <jc>// Add our converter for POJO query support.</jc>
+ converters=Queryable.<jk>class</jk>,
+
+ <jc>// Add our menu items in the nav links.</jc>
+ htmldoc=<ja>@HtmlDoc</ja>(
+ links={
+ <js>"up: request:/.."</js>,
+ <js>"options: servlet:/?method=OPTIONS"</js>,
+ <js>"$W{QueryMenuItem}"</js>,
+ <js>"$W{ContentTypeMenuItem}"</js>,
+ <js>"$W{StyleMenuItem}"</js>,
+ <js>"source: $C{Source/gitHub}/org/apache/juneau/examples/rest/PetStoreResource.java"</js>
+ }
+ )
+ )
+ <jk>public</jk> Collection<Pet> getPets() {
+ </p>
+
+ <p>
+ HTML views are highly customizable with abilities such as defining your own look-and-feel and even allowing
+ you to define your own templates.
+ </p>
+ <p>
+ For example, the PetStore page above rendered in one of the other predefined stylesheets:
+ </p>
+ <img class='bordered' src='images/PetStore_light.png'>
+ <br><hr>
+ <p>
+ Automatic error handling is provided for a variety of conditions:
+ </p>
+ <ul>
+ <li>Automatic 401 errors (Unauthorized) on failed guards.
+ <li>Automatic 404 errors (Not Found) on unmatched path patterns.
+ <li>Automatic 405 errors (Method Not Implemented) on unimplemented methods.
+ <li>Automatic 406 errors (Not Acceptable) when no matching serializer was found to handle the <l>Accept</l> header.
+ <li>Automatic 412 errors (Precondition Failed) when all matchers failed to match.
+ <li>Automatic 415 errors (Unsupported Media Type) when no matching parser was found was found to handle the <l>Content-Type</l> header.
+ <li>Automatic 500 errors on uncaught exceptions.
+ <li>Throw your own runtime RestException with HTTP status and response object.
+ </ul>
+ <p>
+ Other features include:
+ </p>
+ <ul class='spaced-list'>
+ <li>Extremely simple debuggability using nothing more than your browser.
+ <li>Simplified localization support.
+ <li>Configurability through external INI files.
+ <li>Client-versioned responses (and other customizable heuristic matching APIs).
+ <li>Define and use your own HTML stylesheets.
+ <li>Lots of up-to-date documentation and examples.
+ <li>MUCH MORE!....
+ </ul>
+
+ <ul class='doctree'>
+ <li class='link'>See <a class='doclink' href='http://juneau.incubator.apache.org/site/apidocs/overview-summary.html#juneau-rest-server'>juneau-rest-server</a> for more information.
+ </ul>
+
+ <h6 class='toc' id='juneau-rest-server.UIvsDI'>User Interfaces (UI) vs. Developer Interfaces (DI)</h6>
+ <div>
+ <p>
+ An important distinction needs to be made about the HTML representations produced by the REST
+ API. These should not be considered User Interfaces, but rather Developer Interfaces.
+ </p>
+ <p>
+ UIs should hide the end-user from the underlying architecture.
+ The audience generally consists of non-technical people not interested in how the UI works.
+ </p>
+ <p>
+ DIs, on the other hand, should NOT hide the end-user from the underlying architecture.
+ Instead, it's a thin veneer over the REST interface with the following goals:
+ </p>
+ <ul class='spaced-list'>
+ <li>Make it easy for the developer to explore and understand the REST API.
+ <li>Make it easy for the developer to debug the REST API using simple tools (hopefully just a browser).
+ </ul>
+ <p>
+ As a result, the following guidelines are recommended:
+ </p>
+ <ul class='spaced-list'>
+ <li>
+ Use titles/descriptions/asides to describe why the REST interface exists.
+ A developer knowing little about it should be able to access it with a browser and quickly
+ understand what it is and how to use it.
+ <li>
+ Don't hide the raw data!
+ The HTML view should simply be considered an easier-to-read representation of the data normally
+ rendered in JSON or some other format.
+ <li>
+ Limit your use of Javascript!
+ You can use it sparingly if you want to implement something simple like a pull-down menu to
+ simplify some debug task, but remember that your audience cares more about interacting with your
+ service programmatically using REST.
+ Remember that the HTML is just icing on the cake.
+ <li>
+ Don't use it to implement a Web 2.0 interface!
+ If you want a Web 2.0 UI, implement it separately ON TOP OF this REST interface.
+ The architecture is flexible enough that you could in theory pull in and use jQuery, React,
+ Angular, or any number of sophisticated Javascript UI frameworks. Resist the urge to do so.
+ </ul>
+ </div>
+ </div>
+
+ <!-- ======================================================================================================= -->
+ <!-- === JUNEAU-REST-SERVER-JAXRS ========================================================================== -->
+ <!-- ======================================================================================================= -->
+
+ <h5 class='toc' id='juneau-rest-server-jaxrs'>juneau-rest-server-jaxrs</h5>
+ <div>
+ <h6 class='figure'>Maven Dependency</h6>
+ <p class='bcode' style='width:500px;'>
+ <xt><dependency></xt>
+ <xt><groupId></xt>org.apache.juneau<xt></groupId></xt>
+ <xt><artifactId></xt>juneau-rest-server-jaxrs<xt></artifactId></xt>
+ <xt><version></xt>7.0.0<xt></version></xt>
+ <xt></dependency></xt>
+ </p>
+
+ <h6 class='figure'>Java Library</h6>
+ <p class='bcode' style='width:500px;'>
+ juneau-rest-server-jaxrs-7.0.0.jar
+ </p>
+
+ <h6 class='figure'>OSGi Module</h6>
+ <p class='bcode' style='width:500px;'>
+ org.apache.juneau.rest.server.jaxrs_7.0.0.jar
+ </p>
+
+ <p>
+ The <code>juneau-rest-server-jaxrs</code> module defines predefined <code>MessageBodyReader</code> and
+ <code>MessageBodyWriter</code> implementations for using Juneau serializers and parsers in JAX-RS environments.
+ It consists of the following classes:
+ </p>
+ <ul class='spaced-list'>
+ <li>
+ <code>org.apache.juneau.rest.jaxrs.BaseProvider</code> - The base provider class that implements the JAX-RS
+ <code>MessageBodyReader</code> and <code>MessageBodyWriter</code> interfaces.
+ <li>
+ <code>org.apache.juneau.rest.jaxrs.JuneauProvider</code> - Annotation that is applied to subclasses of <code>BaseProvider</code>
+ to specify the serializers/parsers associated with a provider, and optionally filters and properties to
+ apply to those serializers and parsers.
+ <li>
+ <code>org.apache.juneau.rest.jaxrs.DefaultProvider</code> - A default provider that provides the same level
+ of media type support as the <code>RestServletDefault</code> class.
+ </ul>
+ <p>
+ The JAX/RS support does provide you will the full marshalling capabilities of Juneau.
+ However, it should be noted that you lose some sophisticated functionality by not using the REST servlet
+ API (such as the Developer Interfaces, guards, path matchers, localization, auto-generated Swagger docs, etc...).
+ </p>
+
+ <ul class='doctree'>
+ <li class='link'>See <a class='doclink' href='http://juneau.incubator.apache.org/site/apidocs/overview-summary.html#juneau-rest-server-jaxrs'>juneau-rest-server-jaxrs</a> for more information.
+ </ul>
+ </div>
+</body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/4e699954/content/7.0.0/sitemap.xml
----------------------------------------------------------------------
diff --git a/content/7.0.0/sitemap.xml b/content/7.0.0/sitemap.xml
new file mode 100644
index 0000000..ac114f4
--- /dev/null
+++ b/content/7.0.0/sitemap.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<urlset
+ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
+ http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
+ <url>
+ <loc>http://juneau.apache.org/</loc>
+ <changefreq>weekly</changefreq>
+ </url>
+ <url>
+ <loc>http://juneau.apache.org/about.html</loc>
+ <changefreq>weekly</changefreq>
+ </url>
+ <url>
+ <loc>http://juneau.apache.org/community.html</loc>
+ <changefreq>weekly</changefreq>
+ </url>
+ <url>
+ <loc>http://juneau.apache.org/documentation.html</loc>
+ <changefreq>weekly</changefreq>
+ </url>
+ <url>
+ <loc>http://juneau.apache.org/downloads.html</loc>
+ <changefreq>weekly</changefreq>
+ </url>
+ <url>
+ <loc>http://juneau.apache.org/sourceCode.html</loc>
+ <changefreq>weekly</changefreq>
+ </url>
+</urlset>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/4e699954/content/7.0.0/sourceCode.html
----------------------------------------------------------------------
diff --git a/content/7.0.0/sourceCode.html b/content/7.0.0/sourceCode.html
new file mode 100644
index 0000000..c31bc5a
--- /dev/null
+++ b/content/7.0.0/sourceCode.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ @import url("styles/juneau-code.css");
+ @import url("styles/juneau-doc.css");
+</style>
+</head>
+<body>
+ <h5 class='toc'>Source Code</h5>
+ <p>
+ Source code can be accessed through either GitHub or the Apache Git repository.
+ </p>
+ <p>
+ The GitHub repository is read-only. If you want to make contributions to the source tree, you'll need to use the Apache GIT repository.
+ </p>
+ <ul class='spaced-list'>
+ <li><a class='doclink' href='https://git-wip-us.apache.org/repos/asf/incubator-juneau.git' target="_top">Apache GIT repository</a>
+ <li><a class='doclink' href='http://github.com/apache/incubator-juneau' target="_top">GitHub mirror</a>
+ <li><a class='doclink' href='https://git-wip-us.apache.org/repos/asf/incubator-juneau-website.git' target="_top">GIT repository for this website</a>
+ <li><a class='doclink' href='https://cwiki.apache.org/confluence/display/JUNEAU/Setting+up+your+Eclipse+workspace' target="_top">Workspace setup instructions</a>
+ </ul>
+ <h5 class='toc'>Builds</h5>
+ <ul class='spaced-list'>
+ <li><a class='doclink' href='https://builds.apache.org/job/Juneau-Java-1.8'>Jenkins</a> <a href='https://builds.apache.org/job/Juneau-Java-1.8/'><img src='https://builds.apache.org/job/Juneau-Java-1.8/badge/icon'></a>
+ </ul>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/4e699954/content/7.0.0/styles/juneau-code.css
----------------------------------------------------------------------
diff --git a/content/7.0.0/styles/juneau-code.css b/content/7.0.0/styles/juneau-code.css
new file mode 100644
index 0000000..3db6880
--- /dev/null
+++ b/content/7.0.0/styles/juneau-code.css
@@ -0,0 +1,124 @@
+/***************************************************************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations under the License. *
+ ***************************************************************************************************************************/
+/***************************************************************************************************************************
+ * Styles for embedded highlighted code.
+ *
+ * Allows you to embed paragraphs of highlighted code into HTML documents.
+ * For example:
+ * <p class='bcode'>
+ * <jk>public static void</jk> myMethod(<jk>int</jk> foo, String bar) <jk>throws</jk> Exception {
+ * System.<jsm>err</jsm>.println(<js>"Hello world!"</js>);
+ * }
+ * </p>
+ *
+ * The various tags can also be used outside of code blocks.
+ * For example:
+ * <div>This is how you represent a java <jk>int</jk>.</div>
+ *
+ * Available classes:
+ * code - Unbordered code block
+ * bcode - Bordered code block
+ *
+ * Available tags:
+ * <jc> - Java comment
+ * <jd> - Javadoc comment
+ * <jt> - Javadoc tag
+ * <jk> - Java keyword
+ * <js> - Java string
+ * <jf> - Java field
+ * <jsf> - Java static field
+ * <jsm> - Java static method
+ * <ja> - Java annotation
+ * <xt> - XML tag
+ * <xa> - XML attribute
+ * <xc> - XML comment
+ * <xs> - XML string
+ * <xv> - XML value
+ * <mk> - Manifest file key
+ * <mv> - Manifest file value
+ * <cc> - Config file comment
+ * <cs> - Config file section
+ * <ck> - Config file key
+ * <ce> - Config file entry
+ ***************************************************************************************************************************/
+
+/* Monospaced font size */
+.code,
+.bcode,
+jc,jd,jt,jk,js,jf,jsf,jsm,ja,
+xt,xa,xc,xs,
+mk,mv,
+cc,cs,ck,ce {
+ font-size: 9pt;
+ white-space: pre;
+ font-family: monospace;
+ tab-size: 3;
+ -moz-tab-size: 3;
+ -o-tab-size: 3;
+}
+
+/*--- Bordered code ---*/
+p.bcode {
+ border: 1px solid black;
+ margin: 0px 20px;
+ border-radius: 10px;
+ overflow: hidden;
+ background-color: #f8f8f8;
+ border-color: #cccccc;
+ box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.5);
+}
+
+/*--- Bordered code in a section of a method doc ---*/
+dd p.bcode {
+ margin-left:0px;
+ margin-right:20px;
+}
+
+/* Override padding bottom in javadoc comments. */
+.blockList p.bcode {
+ padding-bottom: 0px !important;
+}
+
+/*--- Unbordered code ---*/
+p.code {
+ padding-bottom: 15px;
+ margin: -15px;
+}
+
+/*--- Java code effects ---*/
+jc { color: green; }
+jd { color: #3f5fbf; }
+jt { color: #7f9fbf; font-weight: bold; }
+jk { color: #7f0055; font-weight: bold; }
+js { color: blue; }
+jf { color: DarkBlue; }
+jsf { color: DarkBlue; font-style: italic; }
+jsm { font-style: italic; }
+ja { color: grey; }
+
+/*--- XML code effects ---*/
+xt { color: DarkCyan; }
+xa { color: purple; }
+xc { color: mediumblue; }
+xs { color: blue; font-style: italic; }
+xv { color: black; }
+
+/*--- Manifest-file code effects ---*/
+mk { color: DarkRed; font-weight: bold; }
+mv { color: DarkBlue;}
+
+/*--- Config file effects ---*/
+cc { color: green; }
+cs { color: DarkRed;font-weight: bold;}
+ck { color: DarkRed; }
+cv { color: DarkBlue; }