This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 4b5dc15d5 Javadocs
4b5dc15d5 is described below
commit 4b5dc15d5ba02d905e414039a5e32fe3089d1c28
Author: JamesBognar <[email protected]>
AuthorDate: Wed Jun 29 10:31:42 2022 -0400
Javadocs
---
juneau-doc/docs/Topics/01.Overview.html | 92 +-
.../{01.o.Core.html => 01.o.Marshalling.html} | 95 +-
.../{04.o.Rest.html => 02.o.EndToEndRest.html} | 3 +-
.../{05.o.RestServer.html => 03.o.RestServer.html} | 2 +-
.../{06.o.RestClient.html => 04.o.RestClient.html} | 3 +-
.../01.Overview/{02.o.Dto.html => 05.o.Dtos.html} | 5 +-
.../{03.o.Config.html => 06.o.ConfigFiles.html} | 5 +-
.../Topics/01.Overview/07.o.FluentAssertions.html | 78 +
....GeneralDesign.html => 08.o.GeneralDesign.html} | 0
.../03.o.ConfigFiles.html} | 5 +-
juneau-doc/docs/overview_template.html | 94 --
.../main/javadoc/doc-files/03.o.ConfigFiles.html} | 5 +-
juneau-doc/src/main/javadoc/overview.html | 1483 ++++++++++----------
juneau-doc/src/main/javadoc/resources/docs.txt | 13 +-
.../src/main/javadoc/resources/fragments/toc.html | 13 +-
15 files changed, 882 insertions(+), 1014 deletions(-)
diff --git a/juneau-doc/docs/Topics/01.Overview.html
b/juneau-doc/docs/Topics/01.Overview.html
index eb58d2d87..756433ca3 100644
--- a/juneau-doc/docs/Topics/01.Overview.html
+++ b/juneau-doc/docs/Topics/01.Overview.html
@@ -19,8 +19,11 @@
<div class='topic'>
<p>
Apache Juneau™ is a single cohesive Java ecosystem for
marshalling Java objects to a wide variety of
- language types and creating annotation-based REST server and
client APIs.
+ language types and creating annotation-based REST end-to-end
server and client APIs. The modules
+ have as few prereqs as possible making them ideal for usage in
uber-jars. All modules work with
+ Java 8 through 18.
</p>
+
<p>
The Juneau ecosystem consists of the following parts:
</p>
@@ -29,19 +32,16 @@
<th>Category</th><th>Maven
Artifacts</th><th>Description</th><th>Prereqs</th>
</tr>
<tr class='dark bb'>
- <td rowspan="4"
style='text-align:center;font-weight:bold;padding:20px;'
class='code'>juneau-core</td>
+ <td rowspan="5"
style='text-align:center;font-weight:bold;padding:20px;'
class='code'>juneau-core</td>
<td class='code'><a class='doclink'
href='#juneau-marshall'>juneau-marshall</a></td>
<td>
<ul>
- <li>Serializers and parsers for various
languages.
- <li>Marshalling support for HTTP
headers/parts/requests/responses.
- <li>Marshaller-based assertions for
simplified unit testing.
+ <li>Serializers and parsers for JSON
(various flavors), XML, HTML, URL-Encoding, UON, OpenAPI, PlainText, CSV, SOAP,
and MessagePack.</li>
</ul>
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8
- <li>Apache HttpCore 4.4.13
+ <li>Apache HttpCore 4.4</li>
</ul>
</td>
</tr>
@@ -49,13 +49,13 @@
<td class='code'><a class='doclink'
href='#juneau-marshall-rdf'>juneau-marshall-rdf</a></td>
<td>
<ul>
- <li>Serializers and parsers for various
RDF languages.
+ <li>Serializers and parsers for RDF/XML
(various flavors), N3, NTriple, and Turtle.
<ul>
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8
- <li>Apache Jena 2.7.1
+ <li>Apache HttpCore 4.4</li>
+ <li>Apache Jena 2.7.1</li>
</ul>
</td>
</tr>
@@ -66,19 +66,53 @@
<li>Data Transfer Objects for HTML5,
Atom, Cognos, JSON-Schema, and Swagger
</ul>
</td>
- <td><ul style='margin:0px 10px;'><li>Java
8+</li></ul></td>
+ <td>
+ <ul style='margin:0px 10px;'>
+ <li><i>None</i></li>
+ </ul>
+ </td>
</tr>
<tr class='dark bb'>
<td class='code'><a class='doclink'
href='#juneau-config'>juneau-config</a></td>
<td>
<ul>
- <li>Configuration File API
+ <li>Configuration File API</li>
+ </ul>
+ </td>
+ <td>
+ <ul style='margin:0px 10px;'>
+ <li><i>None</i></li>
+ </ul>
+ </td>
+ </tr>
+ <tr class='dark bb'>
+ <td class='code'><a class='doclink'
href='#juneau-assertions'>juneau-assertions</a></td>
+ <td>
+ <ul>
+ <li>Fluent-style assertions API</li>
+ </ul>
+ </td>
+ <td>
+ <ul style='margin:0px 10px;'>
+ <li><i>None</i></li>
+ </ul>
+ </td>
+ </tr>
+ <tr class='light bb'>
+ <td rowspan="7"
style='text-align:center;font-weight:bold;padding:20px;'
class='code'>juneau-rest</td>
+ <td class='code'><a class='doclink'
href='#juneau-rest-server'>juneau-rest-common</a></td>
+ <td>
+ <ul>
+ <li>REST APIs common to client and
server side.</li>
+ <ul>
+ </td>
+ <td>
+ <ul style='margin:0px 10px;'>
+ <li>Apache HttpCore 4.4</li>
</ul>
</td>
- <td><ul style='margin:0px 10px;'><li>Java
8+</li></ul></td>
</tr>
<tr class='light bb'>
- <td rowspan="6"
style='text-align:center;font-weight:bold;padding:20px;'
class='code'>juneau-rest</td>
<td class='code'><a class='doclink'
href='#juneau-rest-server'>juneau-rest-server</a></td>
<td>
<ul>
@@ -87,8 +121,7 @@
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8
- <li>Servlet 3.1+
+ <li>Servlet 3.1+</li>
</ul>
</td>
</tr>
@@ -101,8 +134,7 @@
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8+
- <li>Spring Boot 2.0+
+ <li>Spring Boot 2.0+</li>
</ul>
</td>
</tr>
@@ -115,8 +147,7 @@
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8+
- <li>JAX-RS 2.0
+ <li>JAX-RS 2+</li>
</ul>
</td>
</tr>
@@ -129,8 +160,7 @@
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8+
- <li>Apache HttpClient 4.5+
+ <li>Apache HttpClient 4.5</li>
</ul>
</td>
</tr>
@@ -138,13 +168,12 @@
<td class='code'><a class='doclink'
href='#juneau-rest-client'>juneau-rest-mock</a></td>
<td>
<ul>
- <li>REST Testing API
+ <li>REST Testing API</li>
<ul>
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8+
- <li>Apache HttpClient 4.5+
+ <li>Apache HttpClient 4.5</li>
</ul>
</td>
</tr>
@@ -152,13 +181,12 @@
<td class='code'><a class='doclink'
href='#my-springboot-microservice'>my-springboot-microservice</a></td>
<td>
<ul>
- <li>Spring Boot developer template
+ <li>Spring Boot developer template</li>
<ul>
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8+
- <li>Spring Boot 2.0+
+ <li>Spring Boot 2.0+</li>
</ul>
</td>
</tr>
@@ -167,7 +195,7 @@
<td class='code'>juneau-examples-core</td>
<td>
<ul>
- <li>Core code examples
+ <li>Core code examples</li>
<ul>
</td>
<td></td>
@@ -176,7 +204,7 @@
<td class='code'>juneau-examples-rest</td>
<td>
<ul>
- <li>REST code examples
+ <li>REST code examples</li>
<ul>
</td>
<td></td>
@@ -190,15 +218,15 @@
<li>juneau-marshall
<li>juneau-dto
<li>juneau-config
+ <li>juneau-assertions
+ <li>juneau-rest-common
<li>juneau-rest-server
<li>juneau-rest-client
</ul>
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8+
<li>Servlet 3.1+
- <li>Apache HttpCore 4.4.13
<li>Apache HttpClient 4.5+
</ul>
</td>
diff --git a/juneau-doc/docs/Topics/01.Overview/01.o.Core.html
b/juneau-doc/docs/Topics/01.Overview/01.o.Marshalling.html
similarity index 83%
rename from juneau-doc/docs/Topics/01.Overview/01.o.Core.html
rename to juneau-doc/docs/Topics/01.Overview/01.o.Marshalling.html
index 26b80209c..442c5fc3c 100644
--- a/juneau-doc/docs/Topics/01.Overview/01.o.Core.html
+++ b/juneau-doc/docs/Topics/01.Overview/01.o.Marshalling.html
@@ -13,12 +13,11 @@
***************************************************************************************************************************/
-->
-{title:'Core Overview', created:'9.0.0'}
+{title:'Marshalling', created:'9.0.0'}
-<h5 class='topic'>Marshalling APIs</h5>
<div class='topic'>
<p>
- The <c>juneau-marshall</c> library includes easy-to-use and
highly customizable serializers and parsers based around
+ The {@doc juneau-marshall juneau-marshall} and {@doc
juneau-marshall-rdf juneau-marshall-rdf} libraries includes easy-to-use and
highly customizable serializers and parsers based around
a common API. It allows you to marshall Java POJOs directly to
and from a wide variety of language types
without the need for intermediate Document Object Models making
them extremely efficient.
</p>
@@ -42,6 +41,11 @@
<li>N3
</ul>
</p>
+ <ul>
+ <li class='note'>
+ The marshalling support can be thought of as similar to
Jackson except for support of a wide variety of languages.
+ Additionally, JSON marshalling is about 20% faster than
Jackson yet supports the same usecases.
+ </ul>
<p>
The default serializers can often be used to serialize POJOs in
a single line of code:
</p>
@@ -54,7 +58,7 @@
|
| <jc>// Produces:
| // "{"name":"John Smith","age":21}"</jc>
- | String <jv>json</jv> =
JsonSerializer.<jsf>DEFAULT</jsf>.serialize(<jk>new</jk> Person());
+ | String <jv>json</jv> = Json.<jsm>of</jsm>(<jk>new</jk>
Person());
</p>
<p>
Parsing back into POJOs is equally simple for any of the
supported languages
@@ -63,21 +67,10 @@
<p class='bjava'>
| <jc>// Parse a JSON object as a bean.</jc>
| String <jv>json</jv> = <js>"{\"name\":\"John
Smith\","\age\":21}"</js>;
- | Person <jv>person</jv> =
<jv>parser</jv>.parse(<jv>json</jv>, Person.<jk>class</jk>);
- </p>
- <p>
- Marshalls are pairings of serializers and parsers in a single
class for even simpler code:
- </p>
- <p class='bjava'>
- | <jc>// Serialize</jc>
- | String <jv>json</jv> =
Json.<jsf>DEFAULT</jsf>.write(<jv>person</jv>);
- |
- | <jc>// Parse</jc>
- | Person <jv>person</jv> =
Json.<jsf>DEFAULT</jsf>.read(<jv>json</jv>, Person.<jk>class</jk>);
+ | Person <jv>person</jv> =
Json.<jsm>from</jsm>(<jv>json</jv>, Person.<jk>class</jk>);
</p>
<p>
- Marshalling support is provided for a wide variety of POJO types
- including:
+ Marshalling support is provided for a wide variety of POJO
types including:
</p>
<ul>
<li>Primitives and primitive objects
@@ -91,9 +84,10 @@
</ul>
</div>
-<h5 class='topic'>Marshaller Builders</h5>
+<h5 class='topic'>Serializer/Parser Builders</h5>
<div class='topic'>
<p>
+ Marshallers like the one shown above are pairings of
serializers and parsers.
Serializers and parsers are builder-based using fluent methods
allowing you to quickly create, clone, and modify them
in single lines of code.
</p>
@@ -122,7 +116,7 @@
For other objects, "transforms" allow you to perform various
mutations on them before serialization and after parsing.
</p>
<p>
- {@doc jm.Swaps Object swaps} allow you to replace
non-serializable objects with serializable equivalents.
+ {@doc jm.Swaps Swaps} allow you to replace non-serializable
objects with serializable equivalents.
The {@link oaj.swaps} package contains a variety of predefined
swaps.
</p>
<p class='bjava'>
@@ -439,66 +433,3 @@
<li class='link'>{@doc jm.SimpleVariableLanguage Simple
Variable Language} for more information.
</ul>
</div>
-
-<h5 class='topic'>Assertions API</h5>
-<div class='topic'>
- <p>
- The {@link oaj.assertions} package in Juneau is a powerful API
for performing fluent style assertions.
- </p>
- <h5 class='figure'>Examples:</h5>
- <p class='bjava'>
- | <jk>import static</jk>
org.apache.juneau.assertions.Assertions.*;
- | <jk>import static</jk>
org.apache.juneau.assertions.AssertionPredicates.*;
- |
- | <jc>// Check the contents of a string.</jc>
- | <jsm>assertString</jsm>(<js>"foo, bar"</js>)
- | .split(<js>","</js>)
- | .trim()
- | .has(<js>"foo"</js>, <js>"bar"</js>);
- |
- | <jc>// Extract a subset of properties from a list of
beans and compare using Simplified JSON.</jc>
- | List<MyBean> <jv>myListOfBeans</jv> = ...;
- | <jsm>assertBeanList</jsm>(<jv>myListOfBeans</jv>)
- | .extract(<js>"a,b"</js>)
- | .asJson().is(<js>"[{a:1,b:'foo'}]"</js>);
- |
- | <jc>// Perform an arbitrary Predicate check against a
bean.</jc>
- | MyBean <jv>myBean</jv> = ...;
- | <jsm>assertBean</jsm>(<jv>myBean</jv>)
- | .is(<jv>x</jv> ->
<jsm>isValidCheck</jsm>(<jv>x</jv>))
- |
- | <jc>// Check that a list of strings has less than 10
entries and the first</jc>
- | <jc>// 3 entries are [foo, bar*, null] using assertion
predicates.</jc>
- | List<String> <jv>myListOfStrings</jv> = ...;
- | <jsm>assertStringList</jsm>(<jv>myListOfStrings</jv>)
- | .size().isLt(10)
- | .first(3)
- |
.each(<jsm>eq</jsm>(<js>"foo"</js>),<jsm>match</jsm>(<js>"bar*"</js>),<jsm>isNull</jsm>())
- |
- | <jc>// Check that an exception is thrown and is the
specified type and has the specified message.</jc>
- |
<jsm>assertThrown</jsm>(()-><jv>myBean</jv>.runBadMethod())
- | .exists()
- | .isExactType(RuntimeException.<jk>class</jk>)
- | .message().is(<js>"foo"</js>);
- </p>
- <p>
- The Assertions APIs are used throughout the REST client and
server APIs for performing inline assertions on REST requests and responses.
- </p>
-
- <h5 class='figure'>Example:</h5>
- <p class='bjava'>
- | <jc>// Create a basic REST client with JSON support and
download a bean.</jc>
- | MyBean <jv>bean</jv> = RestClient.<jsm>create</jsm>()
- | .simpleJson()
- | .build()
- | .get(<jsf>URI</jsf>)
- | .run()
- | .assertStatus().asCode().is(200)
- |
.assertHeader(<js>"Content-Type"</js>).isMatches(<js>"application/json*"</js>)
- |
.getContent().assertValue().asString().isContains(<js>"OK"</js>)
- | .getContent().as(MyBean.<jk>class</jk>);
- </p>
- <ul class='seealso'>
- <li class='link'>{@doc ja.Overview Fluent Assertions} for more
information.
- </ul>
-</div>
\ No newline at end of file
diff --git a/juneau-doc/docs/Topics/01.Overview/04.o.Rest.html
b/juneau-doc/docs/Topics/01.Overview/02.o.EndToEndRest.html
similarity index 97%
rename from juneau-doc/docs/Topics/01.Overview/04.o.Rest.html
rename to juneau-doc/docs/Topics/01.Overview/02.o.EndToEndRest.html
index 8bcb1fd20..27f44eba7 100644
--- a/juneau-doc/docs/Topics/01.Overview/04.o.Rest.html
+++ b/juneau-doc/docs/Topics/01.Overview/02.o.EndToEndRest.html
@@ -13,9 +13,8 @@
***************************************************************************************************************************/
-->
-{title:'REST Overview', created:'9.0.0'}
+{title:'End-to-End REST', created:'9.0.0'}
-<h5 class='topic'>REST Server/Client APIs</h5>
<div class='topic'>
<p>
The {@doc juneau-rest-server juneau-rest-server} and {@doc
juneau-rest-client juneau-rest-client} libraries
diff --git a/juneau-doc/docs/Topics/01.Overview/05.o.RestServer.html
b/juneau-doc/docs/Topics/01.Overview/03.o.RestServer.html
similarity index 99%
rename from juneau-doc/docs/Topics/01.Overview/05.o.RestServer.html
rename to juneau-doc/docs/Topics/01.Overview/03.o.RestServer.html
index 17b959d22..0aa8890bb 100644
--- a/juneau-doc/docs/Topics/01.Overview/05.o.RestServer.html
+++ b/juneau-doc/docs/Topics/01.Overview/03.o.RestServer.html
@@ -13,7 +13,7 @@
***************************************************************************************************************************/
-->
-{title:'REST Server Overview'}
+{title:'REST Server'}
<h5 class='topic'>@Rest-Annotated Resources</h5>
<div class='topic'>
diff --git a/juneau-doc/docs/Topics/01.Overview/06.o.RestClient.html
b/juneau-doc/docs/Topics/01.Overview/04.o.RestClient.html
similarity index 97%
rename from juneau-doc/docs/Topics/01.Overview/06.o.RestClient.html
rename to juneau-doc/docs/Topics/01.Overview/04.o.RestClient.html
index 6e5829400..e133eaf99 100644
--- a/juneau-doc/docs/Topics/01.Overview/06.o.RestClient.html
+++ b/juneau-doc/docs/Topics/01.Overview/04.o.RestClient.html
@@ -13,9 +13,8 @@
***************************************************************************************************************************/
-->
-{title:'REST Client Overview', created:'9.0.0'}
+{title:'REST Client', created:'9.0.0'}
-<h5 class='topic'>REST Client</h5>
<div class='topic'>
<p>
Built upon the feature-rich Apache HttpClient library, the
Juneau RestClient API adds support for fluent-style
diff --git a/juneau-doc/docs/Topics/01.Overview/02.o.Dto.html
b/juneau-doc/docs/Topics/01.Overview/05.o.Dtos.html
similarity index 97%
rename from juneau-doc/docs/Topics/01.Overview/02.o.Dto.html
rename to juneau-doc/docs/Topics/01.Overview/05.o.Dtos.html
index d07a18a4f..0937c9406 100644
--- a/juneau-doc/docs/Topics/01.Overview/02.o.Dto.html
+++ b/juneau-doc/docs/Topics/01.Overview/05.o.Dtos.html
@@ -13,12 +13,11 @@
***************************************************************************************************************************/
-->
-{title:'DTO Library Overview', created:'9.0.0'}
+{title:'DTOs', created:'9.0.0'}
-<h5 class='topic'>DTO Libraries</h5>
<div class='topic'>
<p>
- The <c>juneau-dto</c> library contains several predefined POJOs
for generating commonly-used document types that
+ The {@doc juneau-dto juneau-dto} library contains several
predefined POJOs for generating commonly-used document types that
are designed to be used with the Juneau Marshaller APIs for
both serializing and parsing.
</p>
</div>
diff --git a/juneau-doc/docs/Topics/01.Overview/03.o.Config.html
b/juneau-doc/docs/Topics/01.Overview/06.o.ConfigFiles.html
similarity index 92%
copy from juneau-doc/docs/Topics/01.Overview/03.o.Config.html
copy to juneau-doc/docs/Topics/01.Overview/06.o.ConfigFiles.html
index 0d7dab0fb..9a20cc0e7 100644
--- a/juneau-doc/docs/Topics/01.Overview/03.o.Config.html
+++ b/juneau-doc/docs/Topics/01.Overview/06.o.ConfigFiles.html
@@ -13,12 +13,11 @@
***************************************************************************************************************************/
-->
-{title:'Config API Overview', created:'9.0.0'}
+{title:'Config Files', created:'9.0.0'}
-<h5 class='topic'>Config API</h5>
<div class='topic'>
<p>
- The <c>juneau-config</c> library contains a powerful API for
creating and using INI-style config files.
+ The {@doc juneau-config juneau-config} library contains a
powerful API for creating and using INI-style config files.
</p>
<h5 class='figure'>Example configuration file:</h5>
<p class='bini'>
diff --git a/juneau-doc/docs/Topics/01.Overview/07.o.FluentAssertions.html
b/juneau-doc/docs/Topics/01.Overview/07.o.FluentAssertions.html
new file mode 100644
index 000000000..008c4420f
--- /dev/null
+++ b/juneau-doc/docs/Topics/01.Overview/07.o.FluentAssertions.html
@@ -0,0 +1,78 @@
+<!--
+/***************************************************************************************************************************
+ * 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.
+
***************************************************************************************************************************/
+ -->
+
+{title:'Fluent Assertions', created:'9.0.0'}
+
+<div class='topic'>
+ <p>
+ The {@doc juneau-assertions} module in Juneau is a powerful API
for performing fluent style assertions.
+ </p>
+ <h5 class='figure'>Examples:</h5>
+ <p class='bjava'>
+ | <jk>import static</jk>
org.apache.juneau.assertions.Assertions.*;
+ | <jk>import static</jk>
org.apache.juneau.assertions.AssertionPredicates.*;
+ |
+ | <jc>// Check the contents of a string.</jc>
+ | <jsm>assertString</jsm>(<js>"foo, bar"</js>)
+ | .split(<js>","</js>)
+ | .trim()
+ | .has(<js>"foo"</js>, <js>"bar"</js>);
+ |
+ | <jc>// Extract a subset of properties from a list of
beans and compare using Simplified JSON.</jc>
+ | List<MyBean> <jv>myListOfBeans</jv> = ...;
+ | <jsm>assertBeanList</jsm>(<jv>myListOfBeans</jv>)
+ | .extract(<js>"a,b"</js>)
+ | .asJson().is(<js>"[{a:1,b:'foo'}]"</js>);
+ |
+ | <jc>// Perform an arbitrary Predicate check against a
bean.</jc>
+ | MyBean <jv>myBean</jv> = ...;
+ | <jsm>assertBean</jsm>(<jv>myBean</jv>)
+ | .is(<jv>x</jv> ->
<jsm>isValidCheck</jsm>(<jv>x</jv>))
+ |
+ | <jc>// Check that a list of strings has less than 10
entries and the first</jc>
+ | <jc>// 3 entries are [foo, bar*, null] using assertion
predicates.</jc>
+ | List<String> <jv>myListOfStrings</jv> = ...;
+ | <jsm>assertStringList</jsm>(<jv>myListOfStrings</jv>)
+ | .size().isLt(10)
+ | .first(3)
+ |
.each(<jsm>eq</jsm>(<js>"foo"</js>),<jsm>match</jsm>(<js>"bar*"</js>),<jsm>isNull</jsm>())
+ |
+ | <jc>// Check that an exception is thrown and is the
specified type and has the specified message.</jc>
+ |
<jsm>assertThrown</jsm>(()-><jv>myBean</jv>.runBadMethod())
+ | .exists()
+ | .isExactType(RuntimeException.<jk>class</jk>)
+ | .message().is(<js>"foo"</js>);
+ </p>
+ <p>
+ The Assertions APIs are used throughout the REST client and
server APIs for performing inline assertions on REST requests and responses.
+ </p>
+
+ <h5 class='figure'>Example:</h5>
+ <p class='bjava'>
+ | <jc>// Create a basic REST client with JSON support and
download a bean.</jc>
+ | MyBean <jv>bean</jv> = RestClient.<jsm>create</jsm>()
+ | .simpleJson()
+ | .build()
+ | .get(<jsf>URI</jsf>)
+ | .run()
+ | .assertStatus().asCode().is(200)
+ |
.assertHeader(<js>"Content-Type"</js>).isMatches(<js>"application/json*"</js>)
+ |
.getContent().assertValue().asString().isContains(<js>"OK"</js>)
+ | .getContent().as(MyBean.<jk>class</jk>);
+ </p>
+ <ul class='seealso'>
+ <li class='link'>{@doc ja.Overview Fluent Assertions} for more
information.
+ </ul>
+</div>
\ No newline at end of file
diff --git a/juneau-doc/docs/Topics/01.Overview/07.o.GeneralDesign.html
b/juneau-doc/docs/Topics/01.Overview/08.o.GeneralDesign.html
similarity index 100%
rename from juneau-doc/docs/Topics/01.Overview/07.o.GeneralDesign.html
rename to juneau-doc/docs/Topics/01.Overview/08.o.GeneralDesign.html
diff --git a/juneau-doc/docs/Topics/01.Overview/03.o.Config.html
b/juneau-doc/docs/Topics/01.Overview/doc-files/03.o.ConfigFiles.html
similarity index 92%
copy from juneau-doc/docs/Topics/01.Overview/03.o.Config.html
copy to juneau-doc/docs/Topics/01.Overview/doc-files/03.o.ConfigFiles.html
index 0d7dab0fb..9a20cc0e7 100644
--- a/juneau-doc/docs/Topics/01.Overview/03.o.Config.html
+++ b/juneau-doc/docs/Topics/01.Overview/doc-files/03.o.ConfigFiles.html
@@ -13,12 +13,11 @@
***************************************************************************************************************************/
-->
-{title:'Config API Overview', created:'9.0.0'}
+{title:'Config Files', created:'9.0.0'}
-<h5 class='topic'>Config API</h5>
<div class='topic'>
<p>
- The <c>juneau-config</c> library contains a powerful API for
creating and using INI-style config files.
+ The {@doc juneau-config juneau-config} library contains a
powerful API for creating and using INI-style config files.
</p>
<h5 class='figure'>Example configuration file:</h5>
<p class='bini'>
diff --git a/juneau-doc/docs/overview_template.html
b/juneau-doc/docs/overview_template.html
index a41e70145..fde677754 100644
--- a/juneau-doc/docs/overview_template.html
+++ b/juneau-doc/docs/overview_template.html
@@ -62,100 +62,6 @@
}
}
</script>
-<p>
- Apache Juneau™ is a single cohesive Java ecosystem consisting of
the following parts:
-</p>
-<table class='styled w800'>
- <tr>
- <th>Group</th><th>Component</th><th>Description</th>
- </tr>
-
- <tr class='dark bb'>
- <td rowspan="4"
style='text-align:center;font-weight:bold;padding:20px;'>Juneau Core</td>
- <td class='code'><a class='doclink'
href='#juneau-marshall'>juneau-marshall</a></td>
- <td style='padding:10px'>
- A universal toolkit for marshalling POJOs to a wide
variety of content types using a common framework with no external library
dependencies.
- </td>
- </tr>
- <tr class='dark bb'>
- <td class='code'><a class='doclink'
href='#juneau-marshall-rdf'>juneau-marshall-rdf</a></td>
- <td style='padding:10px'>
- Extended marshalling support for RDF languages.
- </td>
- </tr>
- <tr class='dark bb'>
- <td class='code'><a class='doclink'
href='#juneau-dto'>juneau-dto</a></td>
- <td style='padding:10px'>
- A variety of predefined DTOs for serializing and
parsing languages such as HTML5, Swagger and ATOM.
- </td>
- </tr>
- <tr class='dark bb'>
- <td class='code'><a class='doclink'
href='#juneau-config'>juneau-config</a></td>
- <td style='padding:10px'>
- A sophisticated configuration file API.
- </td>
- </tr>
-
- <tr class='light bb'>
- <td rowspan="5"
style='text-align:center;font-weight:bold;padding:20px;'>Juneau REST</td>
- <td class='code'><a class='doclink'
href='#juneau-rest-server'>juneau-rest-server</a></td>
- <td style='padding:10px'>
- A universal REST server API for creating Swagger-based
self-documenting REST interfaces using POJOs, simply deployed as
- one or more top-level servlets in any Servlet 3.1.0+
container.
- </td>
- </tr>
- <tr class='light bb'>
- <td class='code'><a class='doclink'
href='#juneau-rest-server-springboot'>juneau-rest-server-springboot</a></td>
- <td style='padding:10px'>
- Spring boot integration support.
- </td>
- </tr>
- <tr class='light bb'>
- <td class='code'><a class='doclink'
href='#juneau-rest-server-jaxrs'>juneau-rest-server-jaxrs</a></td>
- <td style='padding:10px'>
- JAX/RS integration support.
- </td>
- </tr>
- <tr class='light bb'>
- <td class='code'><a class='doclink'
href='#juneau-rest-client'>juneau-rest-client</a></td>
- <td style='padding:10px'>
- A universal REST client API for interacting with Juneau
or 3rd-party REST interfaces using POJOs and proxy interfaces.
- </td>
- </tr>
- <tr class='light bb'>
- <td class='code'><a class='doclink'
href='#juneau-rest-mock'>juneau-rest-mock</a></td>
- <td style='padding:10px'>
- Mocking APIs for server-less end-to-end testing of REST
server and client APIs.
- </td>
- </tr>
-
- <tr class='dark bb'>
- <td rowspan="4"
style='text-align:center;font-weight:bold;padding:20px;'>Examples</td>
- <td class='code'>juneau-examples-core</td>
- <td style='padding:10px'>
- Juneau Core API examples.
- </td>
- </tr>
- <tr class='dark bb'>
- <td class='code'>juneau-examples-rest</td>
- <td style='padding:10px'>
- Juneau REST API examples.
- </td>
- </tr>
- <tr class='dark bb'>
- <td class='code'>juneau-examples-rest-jetty</td>
- <td style='padding:10px'>
- Juneau REST API examples using Jetty deployment.
- </td>
- </tr>
- <tr class='dark bb'>
- <td class='code'>juneau-examples-rest-springboot</td>
- <td style='padding:10px'>
- Juneau REST API examples using Spring Boot deployment.
- </td>
- </tr>
-
-</table>
<a href='#TOC' id='TOC'></a><h5 class='toc'>Table of Contents</h5>
{TOC-CONTENTS}
diff --git a/juneau-doc/docs/Topics/01.Overview/03.o.Config.html
b/juneau-doc/src/main/javadoc/doc-files/03.o.ConfigFiles.html
similarity index 92%
rename from juneau-doc/docs/Topics/01.Overview/03.o.Config.html
rename to juneau-doc/src/main/javadoc/doc-files/03.o.ConfigFiles.html
index 0d7dab0fb..9a20cc0e7 100644
--- a/juneau-doc/docs/Topics/01.Overview/03.o.Config.html
+++ b/juneau-doc/src/main/javadoc/doc-files/03.o.ConfigFiles.html
@@ -13,12 +13,11 @@
***************************************************************************************************************************/
-->
-{title:'Config API Overview', created:'9.0.0'}
+{title:'Config Files', created:'9.0.0'}
-<h5 class='topic'>Config API</h5>
<div class='topic'>
<p>
- The <c>juneau-config</c> library contains a powerful API for
creating and using INI-style config files.
+ The {@doc juneau-config juneau-config} library contains a
powerful API for creating and using INI-style config files.
</p>
<h5 class='figure'>Example configuration file:</h5>
<p class='bini'>
diff --git a/juneau-doc/src/main/javadoc/overview.html
b/juneau-doc/src/main/javadoc/overview.html
index 1cc64e1ca..d97e19b21 100644
--- a/juneau-doc/src/main/javadoc/overview.html
+++ b/juneau-doc/src/main/javadoc/overview.html
@@ -62,111 +62,18 @@
}
}
</script>
-<p>
- Apache Juneau™ is a single cohesive Java ecosystem consisting of
the following parts:
-</p>
-<table class='styled w800'>
- <tr>
- <th>Group</th><th>Component</th><th>Description</th>
- </tr>
-
- <tr class='dark bb'>
- <td rowspan="4"
style='text-align:center;font-weight:bold;padding:20px;'>Juneau Core</td>
- <td class='code'><a class='doclink'
href='#juneau-marshall'>juneau-marshall</a></td>
- <td style='padding:10px'>
- A universal toolkit for marshalling POJOs to a wide
variety of content types using a common framework with no external library
dependencies.
- </td>
- </tr>
- <tr class='dark bb'>
- <td class='code'><a class='doclink'
href='#juneau-marshall-rdf'>juneau-marshall-rdf</a></td>
- <td style='padding:10px'>
- Extended marshalling support for RDF languages.
- </td>
- </tr>
- <tr class='dark bb'>
- <td class='code'><a class='doclink'
href='#juneau-dto'>juneau-dto</a></td>
- <td style='padding:10px'>
- A variety of predefined DTOs for serializing and
parsing languages such as HTML5, Swagger and ATOM.
- </td>
- </tr>
- <tr class='dark bb'>
- <td class='code'><a class='doclink'
href='#juneau-config'>juneau-config</a></td>
- <td style='padding:10px'>
- A sophisticated configuration file API.
- </td>
- </tr>
-
- <tr class='light bb'>
- <td rowspan="5"
style='text-align:center;font-weight:bold;padding:20px;'>Juneau REST</td>
- <td class='code'><a class='doclink'
href='#juneau-rest-server'>juneau-rest-server</a></td>
- <td style='padding:10px'>
- A universal REST server API for creating Swagger-based
self-documenting REST interfaces using POJOs, simply deployed as
- one or more top-level servlets in any Servlet 3.1.0+
container.
- </td>
- </tr>
- <tr class='light bb'>
- <td class='code'><a class='doclink'
href='#juneau-rest-server-springboot'>juneau-rest-server-springboot</a></td>
- <td style='padding:10px'>
- Spring boot integration support.
- </td>
- </tr>
- <tr class='light bb'>
- <td class='code'><a class='doclink'
href='#juneau-rest-server-jaxrs'>juneau-rest-server-jaxrs</a></td>
- <td style='padding:10px'>
- JAX/RS integration support.
- </td>
- </tr>
- <tr class='light bb'>
- <td class='code'><a class='doclink'
href='#juneau-rest-client'>juneau-rest-client</a></td>
- <td style='padding:10px'>
- A universal REST client API for interacting with Juneau
or 3rd-party REST interfaces using POJOs and proxy interfaces.
- </td>
- </tr>
- <tr class='light bb'>
- <td class='code'><a class='doclink'
href='#juneau-rest-mock'>juneau-rest-mock</a></td>
- <td style='padding:10px'>
- Mocking APIs for server-less end-to-end testing of REST
server and client APIs.
- </td>
- </tr>
-
- <tr class='dark bb'>
- <td rowspan="4"
style='text-align:center;font-weight:bold;padding:20px;'>Examples</td>
- <td class='code'>juneau-examples-core</td>
- <td style='padding:10px'>
- Juneau Core API examples.
- </td>
- </tr>
- <tr class='dark bb'>
- <td class='code'>juneau-examples-rest</td>
- <td style='padding:10px'>
- Juneau REST API examples.
- </td>
- </tr>
- <tr class='dark bb'>
- <td class='code'>juneau-examples-rest-jetty</td>
- <td style='padding:10px'>
- Juneau REST API examples using Jetty deployment.
- </td>
- </tr>
- <tr class='dark bb'>
- <td class='code'>juneau-examples-rest-springboot</td>
- <td style='padding:10px'>
- Juneau REST API examples using Spring Boot deployment.
- </td>
- </tr>
-
-</table>
<a href='#TOC' id='TOC'></a><h5 class='toc'>Table of Contents</h5>
<ol class='toc'>
<li><p class='toc2'><a class='doclink' href='#Overview'>Overview</a></p>
<ol>
- <li><p><a class='doclink' href='#Overview.o.Core'>Core
Overview</a><span class='update'>created: <b>9.0.0</b></span></p>
- <li><p><a class='doclink' href='#Overview.o.Dto'>DTO Library
Overview</a><span class='update'>created: <b>9.0.0</b></span></p>
- <li><p><a class='doclink' href='#Overview.o.Config'>Config API
Overview</a><span class='update'>created: <b>9.0.0</b></span></p>
- <li><p><a class='doclink' href='#Overview.o.Rest'>REST
Overview</a><span class='update'>created: <b>9.0.0</b></span></p>
- <li><p><a class='doclink' href='#Overview.o.RestServer'>REST
Server Overview</a></p>
- <li><p><a class='doclink' href='#Overview.o.RestClient'>REST
Client Overview</a><span class='update'>created: <b>9.0.0</b></span></p>
+ <li><p><a class='doclink'
href='#Overview.o.Marshalling'>Marshalling</a><span class='update'>created:
<b>9.0.0</b></span></p>
+ <li><p><a class='doclink'
href='#Overview.o.EndToEndRest'>End-to-End REST</a><span
class='update'>created: <b>9.0.0</b></span></p>
+ <li><p><a class='doclink' href='#Overview.o.RestServer'>REST
Server</a></p>
+ <li><p><a class='doclink' href='#Overview.o.RestClient'>REST
Client</a><span class='update'>created: <b>9.0.0</b></span></p>
+ <li><p><a class='doclink' href='#Overview.o.Dtos'>DTOs</a><span
class='update'>created: <b>9.0.0</b></span></p>
+ <li><p><a class='doclink' href='#Overview.o.ConfigFiles'>Config
Files</a><span class='update'>created: <b>9.0.0</b></span></p>
+ <li><p><a class='doclink'
href='#Overview.o.FluentAssertions'>Fluent Assertions</a><span
class='update'>created: <b>9.0.0</b></span></p>
<li><p><a class='doclink'
href='#Overview.o.GeneralDesign'>General Design</a><span
class='update'>created: <b>9.0.0</b></span></p>
</ol>
<li><p class='toc2'><a class='doclink'
href='#juneau-marshall'>juneau-marshall</a></p>
@@ -537,8 +444,11 @@
<div class='topic'>
<p>
Apache Juneau™ is a single cohesive Java ecosystem for
marshalling Java objects to a wide variety of
- language types and creating annotation-based REST server and
client APIs.
+ language types and creating annotation-based REST end-to-end
server and client APIs. The modules
+ have as few prereqs as possible making them ideal for usage in
uber-jars. All modules work with
+ Java 8 through 18.
</p>
+
<p>
The Juneau ecosystem consists of the following parts:
</p>
@@ -547,19 +457,16 @@
<th>Category</th><th>Maven
Artifacts</th><th>Description</th><th>Prereqs</th>
</tr>
<tr class='dark bb'>
- <td rowspan="4"
style='text-align:center;font-weight:bold;padding:20px;'
class='code'>juneau-core</td>
+ <td rowspan="5"
style='text-align:center;font-weight:bold;padding:20px;'
class='code'>juneau-core</td>
<td class='code'><a class='doclink'
href='#juneau-marshall'>juneau-marshall</a></td>
<td>
<ul>
- <li>Serializers and parsers for various
languages.
- <li>Marshalling support for HTTP
headers/parts/requests/responses.
- <li>Marshaller-based assertions for
simplified unit testing.
+ <li>Serializers and parsers for JSON
(various flavors), XML, HTML, URL-Encoding, UON, OpenAPI, PlainText, CSV, SOAP,
and MessagePack.</li>
</ul>
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8
- <li>Apache HttpCore 4.4.13
+ <li>Apache HttpCore 4.4</li>
</ul>
</td>
</tr>
@@ -567,13 +474,13 @@
<td class='code'><a class='doclink'
href='#juneau-marshall-rdf'>juneau-marshall-rdf</a></td>
<td>
<ul>
- <li>Serializers and parsers for various
RDF languages.
+ <li>Serializers and parsers for RDF/XML
(various flavors), N3, NTriple, and Turtle.
<ul>
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8
- <li>Apache Jena 2.7.1
+ <li>Apache HttpCore 4.4</li>
+ <li>Apache Jena 2.7.1</li>
</ul>
</td>
</tr>
@@ -584,19 +491,53 @@
<li>Data Transfer Objects for HTML5,
Atom, Cognos, JSON-Schema, and Swagger
</ul>
</td>
- <td><ul style='margin:0px 10px;'><li>Java
8+</li></ul></td>
+ <td>
+ <ul style='margin:0px 10px;'>
+ <li><i>None</i></li>
+ </ul>
+ </td>
</tr>
<tr class='dark bb'>
<td class='code'><a class='doclink'
href='#juneau-config'>juneau-config</a></td>
<td>
<ul>
- <li>Configuration File API
+ <li>Configuration File API</li>
+ </ul>
+ </td>
+ <td>
+ <ul style='margin:0px 10px;'>
+ <li><i>None</i></li>
+ </ul>
+ </td>
+ </tr>
+ <tr class='dark bb'>
+ <td class='code'><a class='doclink'
href='#juneau-assertions'>juneau-assertions</a></td>
+ <td>
+ <ul>
+ <li>Fluent-style assertions API</li>
+ </ul>
+ </td>
+ <td>
+ <ul style='margin:0px 10px;'>
+ <li><i>None</i></li>
+ </ul>
+ </td>
+ </tr>
+ <tr class='light bb'>
+ <td rowspan="7"
style='text-align:center;font-weight:bold;padding:20px;'
class='code'>juneau-rest</td>
+ <td class='code'><a class='doclink'
href='#juneau-rest-server'>juneau-rest-common</a></td>
+ <td>
+ <ul>
+ <li>REST APIs common to client and
server side.</li>
+ <ul>
+ </td>
+ <td>
+ <ul style='margin:0px 10px;'>
+ <li>Apache HttpCore 4.4</li>
</ul>
</td>
- <td><ul style='margin:0px 10px;'><li>Java
8+</li></ul></td>
</tr>
<tr class='light bb'>
- <td rowspan="6"
style='text-align:center;font-weight:bold;padding:20px;'
class='code'>juneau-rest</td>
<td class='code'><a class='doclink'
href='#juneau-rest-server'>juneau-rest-server</a></td>
<td>
<ul>
@@ -605,8 +546,7 @@
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8
- <li>Servlet 3.1+
+ <li>Servlet 3.1+</li>
</ul>
</td>
</tr>
@@ -619,8 +559,7 @@
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8+
- <li>Spring Boot 2.0+
+ <li>Spring Boot 2.0+</li>
</ul>
</td>
</tr>
@@ -633,8 +572,7 @@
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8+
- <li>JAX-RS 2.0
+ <li>JAX-RS 2+</li>
</ul>
</td>
</tr>
@@ -647,8 +585,7 @@
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8+
- <li>Apache HttpClient 4.5+
+ <li>Apache HttpClient 4.5</li>
</ul>
</td>
</tr>
@@ -656,13 +593,12 @@
<td class='code'><a class='doclink'
href='#juneau-rest-client'>juneau-rest-mock</a></td>
<td>
<ul>
- <li>REST Testing API
+ <li>REST Testing API</li>
<ul>
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8+
- <li>Apache HttpClient 4.5+
+ <li>Apache HttpClient 4.5</li>
</ul>
</td>
</tr>
@@ -670,13 +606,12 @@
<td class='code'><a class='doclink'
href='#my-springboot-microservice'>my-springboot-microservice</a></td>
<td>
<ul>
- <li>Spring Boot developer template
+ <li>Spring Boot developer template</li>
<ul>
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8+
- <li>Spring Boot 2.0+
+ <li>Spring Boot 2.0+</li>
</ul>
</td>
</tr>
@@ -685,7 +620,7 @@
<td class='code'>juneau-examples-core</td>
<td>
<ul>
- <li>Core code examples
+ <li>Core code examples</li>
<ul>
</td>
<td></td>
@@ -694,7 +629,7 @@
<td class='code'>juneau-examples-rest</td>
<td>
<ul>
- <li>REST code examples
+ <li>REST code examples</li>
<ul>
</td>
<td></td>
@@ -708,15 +643,15 @@
<li>juneau-marshall
<li>juneau-dto
<li>juneau-config
+ <li>juneau-assertions
+ <li>juneau-rest-common
<li>juneau-rest-server
<li>juneau-rest-client
</ul>
</td>
<td>
<ul style='margin:0px 10px;'>
- <li>Java 8+
<li>Servlet 3.1+
- <li>Apache HttpCore 4.4.13
<li>Apache HttpClient 4.5+
</ul>
</td>
@@ -782,12 +717,11 @@
<!--
====================================================================================================
-->
-<h3 class='topic' onclick='toggle(this)'><a href='#Overview.o.Core'
id='Overview.o.Core'>1.1 - Core Overview</a><span class='update'>created:
<b>9.0.0</b></span></h3>
-<div class='topic'><!-- START: 1.1 - Overview.o.Core -->
-<h5 class='topic'>Marshalling APIs</h5>
+<h3 class='topic' onclick='toggle(this)'><a href='#Overview.o.Marshalling'
id='Overview.o.Marshalling'>1.1 - Marshalling</a><span class='update'>created:
<b>9.0.0</b></span></h3>
+<div class='topic'><!-- START: 1.1 - Overview.o.Marshalling -->
<div class='topic'>
<p>
- The <c>juneau-marshall</c> library includes easy-to-use and
highly customizable serializers and parsers based around
+ The {@doc juneau-marshall juneau-marshall} and {@doc
juneau-marshall-rdf juneau-marshall-rdf} libraries includes easy-to-use and
highly customizable serializers and parsers based around
a common API. It allows you to marshall Java POJOs directly to
and from a wide variety of language types
without the need for intermediate Document Object Models making
them extremely efficient.
</p>
@@ -811,6 +745,11 @@
<li>N3
</ul>
</p>
+ <ul>
+ <li class='note'>
+ The marshalling support can be thought of as similar to
Jackson except for support of a wide variety of languages.
+ Additionally, JSON marshalling is about 20% faster than
Jackson yet supports the same usecases.
+ </ul>
<p>
The default serializers can often be used to serialize POJOs in
a single line of code:
</p>
@@ -823,7 +762,7 @@
<jc>// Produces:
// "{"name":"John Smith","age":21}"</jc>
- String <jv>json</jv> =
JsonSerializer.<jsf>DEFAULT</jsf>.serialize(<jk>new</jk> Person());
+ String <jv>json</jv> = Json.<jsm>of</jsm>(<jk>new</jk> Person());
</p>
<p>
Parsing back into POJOs is equally simple for any of the
supported languages
@@ -832,21 +771,10 @@
<p class='bjava'>
<jc>// Parse a JSON object as a bean.</jc>
String <jv>json</jv> = <js>"{\"name\":\"John Smith\","\age\":21}"</js>;
- Person <jv>person</jv> = <jv>parser</jv>.parse(<jv>json</jv>,
Person.<jk>class</jk>);
- </p>
- <p>
- Marshalls are pairings of serializers and parsers in a single
class for even simpler code:
- </p>
- <p class='bjava'>
- <jc>// Serialize</jc>
- String <jv>json</jv> = Json.<jsf>DEFAULT</jsf>.write(<jv>person</jv>);
-
- <jc>// Parse</jc>
- Person <jv>person</jv> = Json.<jsf>DEFAULT</jsf>.read(<jv>json</jv>,
Person.<jk>class</jk>);
+ Person <jv>person</jv> = Json.<jsm>from</jsm>(<jv>json</jv>,
Person.<jk>class</jk>);
</p>
<p>
- Marshalling support is provided for a wide variety of POJO types
- including:
+ Marshalling support is provided for a wide variety of POJO
types including:
</p>
<ul>
<li>Primitives and primitive objects
@@ -860,9 +788,10 @@
</ul>
</div>
-<h5 class='topic'>Marshaller Builders</h5>
+<h5 class='topic'>Serializer/Parser Builders</h5>
<div class='topic'>
<p>
+ Marshallers like the one shown above are pairings of
serializers and parsers.
Serializers and parsers are builder-based using fluent methods
allowing you to quickly create, clone, and modify them
in single lines of code.
</p>
@@ -1208,709 +1137,762 @@
<li class='link'>{@doc jm.SimpleVariableLanguage Simple
Variable Language} for more information.
</ul>
</div>
+</div><!-- END: 1.1 - Overview.o.Marshalling -->
+
+<!--
====================================================================================================
-->
-<h5 class='topic'>Assertions API</h5>
+<h3 class='topic' onclick='toggle(this)'><a href='#Overview.o.EndToEndRest'
id='Overview.o.EndToEndRest'>1.2 - End-to-End REST</a><span
class='update'>created: <b>9.0.0</b></span></h3>
+<div class='topic'><!-- START: 1.2 - Overview.o.EndToEndRest -->
<div class='topic'>
<p>
- The {@link org.apache.juneau.assertions} package in Juneau is a
powerful API for performing fluent style assertions.
+ The {@doc juneau-rest-server juneau-rest-server} and {@doc
juneau-rest-client juneau-rest-client} libraries
+ provide server and client side REST capabilities that can be
used by themselves, or together to create
+ simplified yet sophisticated Java-based REST communications
layers that completely hide away the complexities
+ of the REST protocol.
</p>
- <h5 class='figure'>Examples:</h5>
- <p class='bjava'>
- <jk>import static</jk> org.apache.juneau.assertions.Assertions.*;
- <jk>import static</jk>
org.apache.juneau.assertions.AssertionPredicates.*;
-
- <jc>// Check the contents of a string.</jc>
- <jsm>assertString</jsm>(<js>"foo, bar"</js>)
- .split(<js>","</js>)
- .trim()
- .has(<js>"foo"</js>, <js>"bar"</js>);
-
- <jc>// Extract a subset of properties from a list of beans and compare
using Simplified JSON.</jc>
- List<MyBean> <jv>myListOfBeans</jv> = ...;
- <jsm>assertBeanList</jsm>(<jv>myListOfBeans</jv>)
- .extract(<js>"a,b"</js>)
- .asJson().is(<js>"[{a:1,b:'foo'}]"</js>);
-
- <jc>// Perform an arbitrary Predicate check against a bean.</jc>
- MyBean <jv>myBean</jv> = ...;
- <jsm>assertBean</jsm>(<jv>myBean</jv>)
- .is(<jv>x</jv> -> <jsm>isValidCheck</jsm>(<jv>x</jv>))
+ <p>
+ A typical pattern is to define a REST API on the server side:
+ </p>
+ <p class='bjava'>
+ <ja>@Rest</ja>(path=<js>"/petstore"</js>)
+ <jk>public class</jk> PetStore {
+
+ <ja>@RestPost</ja>(path=<js>"/pets"</js>,
guards=AdminGuard.<jk>class</jk>)
+ <jk>public</jk> Ok addPet(
+ <ja>@Content</ja> CreatePet <jv>createPetBean</jv>,
+ <ja>@Header</ja>(<js>"E-Tag"</js>) UUID <jv>etag</jv>,
+ <ja>@Query</ja>(<js>"debug"</js>) <jk>boolean</jk>
<jv>debug</jv>
+ ) <jk>throws</jk> BadRequest, Unauthorized, InternalServerError
{
+ <jc>// Process request.</jc>
+ <jk>return</jk> Ok.<jsf>OK</jsf>; <jc>// Standard
400-OK response.</jc>
+ }
+ }
+ </p>
+ <p>
+ Then define a Java interface that can be provided to consumers
of your API to access your REST API:
+ </p>
+ <p class='bjava'>
+ <ja>@Remote</ja>(path=<js>"/petstore"</js>)
+ <jk>public interface</jk> PetStoreService {
+
+ <ja>@RemotePost</ja>(<js>"/pets"</js>)
+ Ok addPet(
+ <ja>@Content</ja> CreatePet <jv>createPet</jv>,
+ <ja>@Header</ja>(<js>"E-Tag"</js>) UUID <jv>etag</jv>,
+ <ja>@Query</ja>(<js>"debug"</js>) <jk>boolean</jk>
<jv>debug</jv>
+ ) <jk>throws</jk> BadRequest, Unauthorized, InternalServerError;
+ }
+ </p>
+ <p>
+ Note that you may choose to have your service class implement
your interface. The REST libraries will
+ happily look for annotations defined on methods of parent
classes and interfaces. It's up to you how
+ you want to design it.
+ </p>
+ <p>
+ Finally, the {@link org.apache.juneau.rest.client.RestClient}
class is used to construct a remote proxy to our REST service:
+ <p class='bjava'>
+ <jc>// Use a RestClient with default Simple JSON support and BASIC
auth.</jc>
+ RestClient <jv>client</jv> =
RestClient.<jsm>create</jsm>().simpleJson().basicAuth(...).build();
- <jc>// Check that a list of strings has less than 10 entries and the
first</jc>
- <jc>// 3 entries are [foo, bar*, null] using assertion predicates.</jc>
- List<String> <jv>myListOfStrings</jv> = ...;
- <jsm>assertStringList</jsm>(<jv>myListOfStrings</jv>)
- .size().isLt(10)
- .first(3)
-
.each(<jsm>eq</jsm>(<js>"foo"</js>),<jsm>match</jsm>(<js>"bar*"</js>),<jsm>isNull</jsm>())
+ <jc>// Instantiate our proxy interface.</jc>
+ PetStore <jv>store</jv> =
<jv>client</jv>.getRemote(PetStore.<jk>class</jk>,
<js>"http://localhost:10000"</js>);
- <jc>// Check that an exception is thrown and is the specified type and
has the specified message.</jc>
- <jsm>assertThrown</jsm>(()-><jv>myBean</jv>.runBadMethod())
- .exists()
- .isExactType(RuntimeException.<jk>class</jk>)
- .message().is(<js>"foo"</js>);
+ <jc>// Use it to create a pet.</jc>
+ CreatePet <jv>createPet</jv> = <jk>new</jk>
CreatePet(<js>"Fluffy"</js>, 9.99);
+ Pet <jv>pet</jv> = <jv>store</jv>.addPet(<jv>createPet</jv>,
UUID.<jsm>randomUUID</jsm>(), <jk>true</jk>);
</p>
<p>
- The Assertions APIs are used throughout the REST client and
server APIs for performing inline assertions on REST requests and responses.
+ The call above translates to the following REST call:
</p>
-
- <h5 class='figure'>Example:</h5>
- <p class='bjava'>
- <jc>// Create a basic REST client with JSON support and download a
bean.</jc>
- MyBean <jv>bean</jv> = RestClient.<jsm>create</jsm>()
- .simpleJson()
- .build()
- .get(<jsf>URI</jsf>)
- .run()
- .assertStatus().asCode().is(200)
-
.assertHeader(<js>"Content-Type"</js>).isMatches(<js>"application/json*"</js>)
- .getContent().assertValue().asString().isContains(<js>"OK"</js>)
- .getContent().as(MyBean.<jk>class</jk>);
+ <p class='bcode'>
+ POST http://localhost:10000/petstore/pets?debug=true HTTP/1.1
+ Accept: application/json
+ Content-Type: application/json
+ Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
+ E-Tag: 475588d4-0b27-4f56-9296-cc683251d314
+
+ {
+ name: 'Fluffy',
+ price: 9.99
+ }
+ </p>
+ <p>
+ It looks simplistic, but the server and client APIs are highly
sophisticated libraries that allow you
+ to perform complex tasks using very little code.
</p>
- <ul class='seealso'>
- <li class='link'>{@doc ja.Overview Fluent Assertions} for more
information.
- </ul>
</div>
-</div><!-- END: 1.1 - Overview.o.Core -->
+</div><!-- END: 1.2 - Overview.o.EndToEndRest -->
<!--
====================================================================================================
-->
-<h3 class='topic' onclick='toggle(this)'><a href='#Overview.o.Dto'
id='Overview.o.Dto'>1.2 - DTO Library Overview</a><span class='update'>created:
<b>9.0.0</b></span></h3>
-<div class='topic'><!-- START: 1.2 - Overview.o.Dto -->
-<h5 class='topic'>DTO Libraries</h5>
+<h3 class='topic' onclick='toggle(this)'><a href='#Overview.o.RestServer'
id='Overview.o.RestServer'>1.3 - REST Server</a></h3>
+<div class='topic'><!-- START: 1.3 - Overview.o.RestServer -->
+<h5 class='topic'>@Rest-Annotated Resources</h5>
<div class='topic'>
<p>
- The <c>juneau-dto</c> library contains several predefined POJOs
for generating commonly-used document types that
- are designed to be used with the Juneau Marshaller APIs for
both serializing and parsing.
+ A REST resource is simply a Java class annotated with {@link
org.apache.juneau.rest.annotation.Rest}.
+ The most common case is a class that extends {@link
org.apache.juneau.rest.servlet.BasicRestServlet}, which itself is simply an
+ extension of {@link javax.servlet.http.HttpServlet} which
allows it to be deployed as a servlet.
</p>
-</div>
-
-<h5 class='topic'>HTML5</h5>
-<div class='topic'>
- <p>
- The Juneau HTML5 DTOs are simply beans with fluent-style
setters that allow you to quickly construct HTML
- fragments as Java objects. These object can then be serialized
to HTML using one of the existing HTML
- serializers, or to other languages such as JSON using the JSON
serializers.
+ <p class='bjava'>
+ <jc>// Sample REST resource that prints out a simple "Hello world!"
message.</jc>
+ <ja>@Rest</ja>(
+ path=<js>"/helloWorld"</js>,
+ title=<js>"Hello World"</js>,
+ description=<js>"An example of the simplest-possible
resource"</js>
+ )
+ <ja>@HtmlDoc</ja>(
+ navlinks={
+ <js>"up: request:/.."</js>,
+ <js>"options: servlet:/?method=OPTIONS"</js>
+ },
+ aside={
+ <js>"<div style='max-width:400px'
class='text'>"</js>,
+ <js>" <p>This page shows a resource that simply
response with a 'Hello world!' message</p>"</js>,
+ <js>" <p>The POJO serialized is a simple
String.</p>"</js>,
+ <js>"</div>"</js>
+ }
+ )
+ <ja>@BeanConfig</ja>(sortProperties=<js>"true"</js>)
+ <jk>public class</jk> HelloWorldResource <jk>extends</jk>
BasicRestServlet <jk>implements</jk> BasicUniveralConfig {
+
+ <ja>@RestGet</ja>(path=<js>"/*"</js>, summary=<js>"Responds
with \"Hello world!\""</js>)
+ <jk>public</jk> String sayHello() {
+ <jk>return</jk> <js>"Hello world!"</js>;
+ }
+ }
</p>
<p>
- The {@link org.apache.juneau.dto.html5.HtmlBuilder} class is a
utility class with predefined static methods
- that allow you to easily construct DTO instances in a minimal
amount of code.
+ This is what it looks like in a browser.
</p>
- <h5 class='figure'>Examples:</h5>
- <p class='bjava'>
- <jk>import static</jk> org.apache.juneau.dto.html5.HtmlBuilder.*;
-
- <jc>// An HTML table</jc>
- Object <jv>mytable</jv> =
- <jsm>table</jsm>(
- <jsm>tr</jsm>(
- <jsm>th</jsm>(<js>"c1"</js>),
- <jsm>th</jsm>(<js>"c2"</js>)
- ),
- <jsm>tr</jsm>(
- <jsm>td</jsm>(<js>"v1"</js>),
- <jsm>td</jsm>(<js>"v2"</js>)
- )
- );
-
- String <jv>html</jv> =
HtmlSerializer.<jsf>DEFAULT</jsf>.serialize(<jv>mytable</jv>);
+ <p class='bcode'>
+ http://localhost:10000/helloWorld
</p>
- <p class='bxml'><xt>
- <table>
- <tr>
- <th><xv>c1</xv></th>
- <th><xv>c2</xv></th>
- </tr>
- <tr>
- <td><xv>v1</xv></td>
- <td><xv>v2</xv></td>
- </tr>
- </table>
- </xt></p>
- <ul class='seealso'>
- <li class='link'>{@doc jd.Html5 HTML5} for more information.
+ <img class='bordered w800' src='doc-files/jrs.HelloWorldExample.1.png'>
+ <ul>
+ <li>Parsers for request bodies are selected based on the
request <c>Content-Type</c> header.
+ <li>Serializers for response bodies are selected based on the
request <c>Accept</c> header.
+ <ul>
+ <li>In this case, it's the {@link
org.apache.juneau.html.HtmlDocSerializer} serializer based on the
+ browser's default <c>Accept</c> header that's
asking for HTML.
+ </ul>
+ <li>REST resource classes and methods can be annotated with
configuration annotations for the serializers and parsers (such as
<ja>@HtmlConfig</ja> and <ja>@BeanConfig</ja> shown above).
+ <li>Annotations such as the title, summary, and descriptions
shown above are used for auto-generated Swagger UI pages (described later).
</ul>
</div>
-<h5 class='topic'>ATOM</h5>
+<h5 class='topic'>REST Children</h5>
<div class='topic'>
<p>
- The Juneau ATOM feed DTOs are simply beans with fluent-style
setters.
- The following code shows a feed being created programmatically
using the
- {@link org.apache.juneau.dto.atom.AtomBuilder} class.
+ Child Resources are REST servlets or objects that are linked to
parent resources through the
+ {@link org.apache.juneau.rest.annotation.Rest#children()
@Rest(children)} annotation.
</p>
<h5 class='figure'>Example:</h5>
<p class='bjava'>
- <jk>import static</jk> org.apache.juneau.dto.atom.AtomBuilder.*;
-
- Feed <jv>feed</jv> =
- <jsm>feed</jsm>(<js>"tag:juneau.apache.org"</js>, <js>"Juneau
ATOM specification"</js>, <js>"2016-01-02T03:04:05Z"</js>)
- .subtitle(<jsm>text</jsm>(<js>"html"</js>).text(<js>"Describes
<em>stuff</em> about Juneau"</js>))
- .links(
- <jsm>link</jsm>(<js>"alternate"</js>,
<js>"text/html"</js>,
<js>"http://juneau.apache.org"</js>).hreflang(<js>"en"</js>),
- <jsm>link</jsm>(<js>"self"</js>,
<js>"application/atom+xml"</js>, <js>"http://juneau.apache.org/feed.atom"</js>)
- )
- .rights(<js>"Copyright (c) ..."</js>)
- .generator(
-
<jsm>generator</jsm>(<js>"Juneau"</js>).uri(<js>"http://juneau.apache.org/"</js>).version(<js>"1.0"</js>)
- )
- .entries(
-
<jsm>entry</jsm>(<js>"tag:juneau.sample.com,2013:1.2345"</js>, <js>"Juneau ATOM
specification snapshot"</js>, <js>"2016-01-02T03:04:05Z"</js>)
- .links(
- <jsm>link</jsm><js>"alternate"</js>,
<js>"text/html"</js>, <js>"http://juneau.apache.org/juneau.atom"</js>),
- <jsm>link</jsm>(<js>"enclosure"</js>,
<js>"audio/mpeg"</js>,
<js>"http://juneau.apache.org/audio/juneau_podcast.mp3"</js>).length(1337)
- )
- .published(<js>"2016-01-02T03:04:05Z"</js>)
- .authors(
- <jsm>person</jsm>(<js>"Jane
Smith"</js>).uri(<js>"http://juneau.apache.org/"</js>).email(<js>"[email protected]"</js>)
- )
- .contributors(
- <jsm>person</jsm>(<js>"John Smith"</js>)
- )
- .content(
- <jsm>content</jsm>(<js>"xhtml"</js>)
- .lang(<js>"en"</js>)
- .base(<js>"http://www.apache.org/"</js>)
-
.text(<js>"<div><p><i>[Update: Juneau supports
ATOM.]</i></p></div>"</js>)
- )
- );
-
- <jc>// Create a serializer with readable output, no namespaces yet.</jc>
- XmlSerializer <jv>serializer</jv> =
XmlSerializer.<jsm>create</jsm>().sq().ws().build();
-
- <jc>// Serialize to ATOM/XML</jc>
- String <jv>atomXml</jv> = <jv>serializer</jv>.serialize(<jv>feed</jv>);
- </p>
- <ul class='seealso'>
- <li class='link'>{@doc jd.Atom Atom} for more information.
- </ul>
-</div>
-
-<h5 class='topic'>Swagger</h5>
-<div class='topic'>
- <p>
- The Juneau Swagger DTOs are simply beans with fluent-style
setters that allow you to quickly construct
- Swagger documents as Java objects.
- These object can then be serialized to JSON using one of the
existing JSON serializers, or to other
- languages such as XML or HTML using the other serializers.
+ <jd>/** Parent Resource */</jd>
+ <ja>@Rest</ja>(
+ path=<js>"/parent"</js>,
+ children={
+ MyChildResource.<jk>class</jk>
+ }
+ )
+ <jk>public</jk> MyParentResource <jk>extends</jk> BasicRestServlet
<jk>implements</jk> BasicUniversalConfig {...}
</p>
- <h5 class='figure'>Example:</h5>
<p class='bjava'>
- <jk>static import</jk> org.apache.juneau.dto.swagger.SwaggerBuilder.*;
-
- Swagger <jv>swagger</jv> = <jsm>swagger</jsm>()
- .swagger(<js>"2.0"</js>)
- .info(
- <jsm>info</jsm>(<js>"Swagger Petstore"</js>,
<js>"1.0.0"</js>)
- .description(<js>"This is a sample server
Petstore server."</js>)
-
.termsOfService(<js>"http://swagger.io/terms/"</js>)
- .contact(
-
<jsm>contact</jsm>().email(<js>"[email protected]"</js>)
- )
- .license(
- <jsm>license</jsm>(<js>"Apache
2.0"</js>).url(<js>"http://www.apache.org/licenses/LICENSE-2.0.html"</js>)
- )
- )
- .host(<js>"petstore.swagger.io"</js>)
- .basePath(<js>"/v2"</js>)
- .tags(
-
<jsm>tag</jsm>(<js>"pet"</js>).description(<js>"Everything about your
Pets"</js>)
- .externalDocs(
-
<jsm>externalDocumentation</jsm>(<js>"http://swagger.io"</js>,
<js>"http://swagger.io"</js>)
- )
- )
- .schemes(<js>"http"</js>)
- .path(<js>"/pet"</js>, <js>"post"</js>,
- <jsm>operation</jsm>()
- .tags(<js>"pet"</js>)
- .summary(<js>"Add a new pet to the store"</js>)
- .description(<js>""</js>)
- .operationId(<js>"addPet"</js>)
- .consumes(MediaType.<jsf>JSON</jsf>,
MediaType.<jsf>XML</jsf>)
- .produces(MediaType.<jsf>JSON</jsf>,
MediaType.<jsf>XML</jsf>)
- .parameters(
-
<jsm>parameterInfo</jsm>(<js>"body"</js>, <js>"body"</js>)
- .description(<js>"Pet object
that needs to be added to the store"</js>)
- .required(<jk>true</jk>)
- )
- .response(405,
<jsm>responseInfo</jsm>(<js>"Invalid input"</js>))
- );
-
- <jc>// Serialize using JSON serializer.</jc>
- String <jv>swaggerJson</jv> =
JsonSerializer.<jsf>DEFAULT_READABLE</jsf>.serialize(<jv>swagger</jv>);
-
- <jc>// Or just use toString().</jc>
- String <jv>swaggerJson</jv> = <jv>swagger</jv>.toString();
- </p>
- <ul class='seealso'>
- <li class='link'>{@doc jd.Swagger Swagger} for more information.
- </ul>
-</div>
-
-<h5 class='topic'>SwaggerUI</h5>
-<div class='topic'>
- <p>
- The {@link org.apache.juneau.dto.swagger.ui.SwaggerUI} class is
a DTO class for generating Swagger user interfaces
- from {@link org.apache.juneau.dto.swagger.Swagger} beans.
+ <jd>/** Child Resource */</jd>
+ <ja>@Rest</ja>(
+ path=<js>"/child"</js> <jc>// Path relative to parent
resource.</jc>
+ )
+ <jk>public</jk> MyChildResource {...} <jc>// Note that we don't need to
extend from RestServlet.</jc>
</p>
<p>
- The <c>PetStore</c> example described later provides an example
of auto-generated Swagger JSON:
+ The path of the child resource gets appended to the path of the
parent resource.
+ So in the example above, the child resource is accessed through
the URL <l>/parent/child</l>.
</p>
- <img class='bordered w900' src='doc-files/jd.SwaggerUI.json.png'>
<p>
- Using {@link org.apache.juneau.dto.swagger.ui.SwaggerUI}, we're
able to render that JSON as a Swagger user interface
- when the request is asking for HTML:
+ A HUGE advantage of using child resources is that they do not
need to be declared in the JEE <l>web.xml</l>
+ file.
+ Initialization of and access to the child resources occurs
through the parent resource.
+ Children can be nested arbitrary deep to create complex REST
interfaces with a single top-level REST servlet.
</p>
- <img class='bordered w900' src='doc-files/jd.SwaggerUI.html.png'>
- <ul class='seealso'>
- <li class='link'>{@doc jd.SwaggerUi Swagger UI} for more
information.
- </ul>
</div>
-</div><!-- END: 1.2 - Overview.o.Dto -->
-
-<!--
====================================================================================================
-->
-<h3 class='topic' onclick='toggle(this)'><a href='#Overview.o.Config'
id='Overview.o.Config'>1.3 - Config API Overview</a><span
class='update'>created: <b>9.0.0</b></span></h3>
-<div class='topic'><!-- START: 1.3 - Overview.o.Config -->
-<h5 class='topic'>Config API</h5>
+<h5 class='topic'>REST Group Pages</h5>
<div class='topic'>
<p>
- The <c>juneau-config</c> library contains a powerful API for
creating and using INI-style config files.
- </p>
- <h5 class='figure'>Example configuration file:</h5>
- <p class='bini'>
- <cc># A set of entries</cc>
- <cs>[Section1]</cs>
-
- <cc># An integer</cc>
- <ck>key1</ck> = <cv>1</cv>
-
- <cc># A boolean</cc>
- <ck>key2</ck> = <cv>true</cv>
-
- <cc># An array</cc>
- <ck>key3</ck> = <cv>1,2,3</cv>
-
- <cc># A POJO</cc>
- <ck>key4</ck> = <cv>http://bar</cv>
- </p>
+ The {@link
org.apache.juneau.rest.servlet.BasicRestServletGroup} class provides a default
"router" page for
+ child resources when a parent resource is nothing more than a
grouping of child resources.
+ </p>
<p>
- Config files are accessed through the {@link
org.apache.juneau.config.Config} class which
- are created through the {@link
org.apache.juneau.config.Config.Builder} class.
- Builder creator methods are provided on the <c>Config</c> class:
+ The <l>RootResources</l> class in the Samples project is an
example of a router page:
</p>
- <p class='bjava'>
- <jc>// Create a Config object</jc>
- Config <jv>config</jv> =
Config.<jsm>create</jsm>().name(<js>"MyConfig.cfg"</js>).build();
-
- <jc>// Read values from section #1</jc>
- <jk>int</jk> <jv>key1</jv> =
<jv>config</jv>.getInt(<js>"Section1/key1"</js>);
- <jk>boolean</jk> <jv>key2</jv> =
<jv>config</jv>.getBoolean(<js>"Section1/key2"</js>);
- <jk>int</jk>[] <jv>key3</jv> =
<jv>config</jv>.getObject(<js>"Section1/key3"</js>,
<jk>int</jk>[].<jk>class</jk>);
- URL <jv>key4</jv> = <jv>config</jv>.getObject(<js>"Section1/key4"</js>,
URL.<jk>class</jk>);
+ <p class='bjava'>
+ <jd>/**
+ * Sample REST resource showing how to implement a "router" resource
page.
+ */</jd>
+ <ja>@Rest</ja>(
+ path=<js>"/"</js>,
+ title=<js>"Root resources"</js>,
+ description=<js>"Example of a router resource page."</js>,
+ children={
+ HelloWorldResource.<jk>class</jk>,
+ PetStoreResource.<jk>class</jk>,
+ DtoExamples.<jk>class</jk>,
+ ConfigResource.<jk>class</jk>,
+ LogsResource.<jk>class</jk>,
+ ShutdownResource.<jk>class</jk>
+ }
+ )
+ <jk>public class</jk> RootResources <jk>extends</jk>
BasicRestServletGroup <jk>implements</jk> BasicUniversalConfig {
+ <jc>// NO CODE!!!</jc>
+ }
</p>
<p>
- The config language may look simple, but it is a very powerful
feature with many capabilities.
+ When you bring up this resource in a browser, you see the
following that provides a list
+ of navigable links to your child resources:
</p>
- <ul class='seealso'>
- <li class='link'>{@doc juneau-config juneau-config} for more
information.
- </ul>
+ <p class='bcode'>
+ http://localhost:10000
+ </p>
+ <img class='bordered w800' src='doc-files/jrs.RouterPages.1.png'/>
</div>
-</div><!-- END: 1.3 - Overview.o.Config -->
-
-<!--
====================================================================================================
-->
-<h3 class='topic' onclick='toggle(this)'><a href='#Overview.o.Rest'
id='Overview.o.Rest'>1.4 - REST Overview</a><span class='update'>created:
<b>9.0.0</b></span></h3>
-<div class='topic'><!-- START: 1.4 - Overview.o.Rest -->
-<h5 class='topic'>REST Server/Client APIs</h5>
+<h5 class='topic'>REST Resource Methods</h5>
<div class='topic'>
<p>
- The {@doc juneau-rest-server juneau-rest-server} and {@doc
juneau-rest-client juneau-rest-client} libraries
- provide server and client side REST capabilities that can be
used by themselves, or together to create
- simplified yet sophisticated Java-based REST communications
layers that completely hide away the complexities
- of the REST protocol.
+ The real power behind the REST server API is the ability to
define Java methods as REST endpoints.
+ </p>
+ <h5 class='figure'>Example:</h5>
+ <p class='bjava'>
+ <ja>@RestPost</ja>(path=<js>"/pets"</js>,
guards=AdminGuard.<jk>class</jk>)
+ <jk>public</jk> Ok addPet(
+ <ja>@Content</ja> CreatePet <jv>createPetBean</jv>,
+ <ja>@Header</ja>(<js>"E-Tag"</js>) UUID <jv>etag</jv>,
+ <ja>@Query</ja>(<js>"debug"</js>) <jk>boolean</jk>
<jv>debug</jv>
+ ) <jk>throws</jk> BadRequest, Unauthorized, InternalServerError {
+ <jc>// Process request.</jc>
+ <jk>return</jk> Ok.<jsf>OK</jsf>;
+ }
</p>
<p>
- A typical pattern is to define a REST API on the server side:
+ Java methods on {@link org.apache.juneau.rest.annotation.Rest
@Rest}-annotated classes have the following format:
</p>
- <p class='bjava'>
- <ja>@Rest</ja>(path=<js>"/petstore"</js>)
- <jk>public class</jk> PetStore {
-
- <ja>@RestPost</ja>(path=<js>"/pets"</js>,
guards=AdminGuard.<jk>class</jk>)
- <jk>public</jk> Ok addPet(
- <ja>@Content</ja> CreatePet <jv>createPetBean</jv>,
- <ja>@Header</ja>(<js>"E-Tag"</js>) UUID <jv>etag</jv>,
- <ja>@Query</ja>(<js>"debug"</js>) <jk>boolean</jk>
<jv>debug</jv>
- ) <jk>throws</jk> BadRequest, Unauthorized, InternalServerError
{
- <jc>// Process request.</jc>
- <jk>return</jk> Ok.<jsf>OK</jsf>; <jc>// Standard
400-OK response.</jc>
- }
+ <p class='bjava'>
+ <ja>@RestOp</ja>(method=<js>"..."</js>, path=<js>"..."</js>)
+ <ja><i><config-annotations></i></ja>
+ <jk>public</jk> <i><return-type></i> method(<i><args></i>)
<jk>throws</jk> <i><throwables></i> {
+ ...
}
- </p>
+ </p>
<p>
- Then define a Java interface that can be provided to consumers
of your API to access your REST API:
+ The various parts require their own topics to fully appreciate
the scope of abilities, but the following is a summary:
</p>
- <p class='bjava'>
- <ja>@Remote</ja>(path=<js>"/petstore"</js>)
- <jk>public interface</jk> PetStoreService {
-
- <ja>@RemotePost</ja>(<js>"/pets"</js>)
- Ok addPet(
- <ja>@Content</ja> CreatePet <jv>createPet</jv>,
- <ja>@Header</ja>(<js>"E-Tag"</js>) UUID <jv>etag</jv>,
- <ja>@Query</ja>(<js>"debug"</js>) <jk>boolean</jk>
<jv>debug</jv>
- ) <jk>throws</jk> BadRequest, Unauthorized, InternalServerError;
- }
- </p>
- <p>
- Note that you may choose to have your service class implement
your interface. The REST libraries will
- happily look for annotations defined on methods of parent
classes and interfaces. It's up to you how
- you want to design it.
- </p>
- <p>
- Finally, the {@link org.apache.juneau.rest.client.RestClient}
class is used to construct a remote proxy to our REST service:
- <p class='bjava'>
- <jc>// Use a RestClient with default Simple JSON support and BASIC
auth.</jc>
- RestClient <jv>client</jv> =
RestClient.<jsm>create</jsm>().simpleJson().basicAuth(...).build();
-
- <jc>// Instantiate our proxy interface.</jc>
- PetStore <jv>store</jv> =
<jv>client</jv>.getRemote(PetStore.<jk>class</jk>,
<js>"http://localhost:10000"</js>);
+ <ul class='spaced-list'>
+ <li>Annotated with {@link
org.apache.juneau.rest.annotation.RestOp @RestOp}.
+ <ul>
+ <li>Also available: {@link
org.apache.juneau.rest.annotation.RestGet @RestGet} / {@link
org.apache.juneau.rest.annotation.RestPut @RestPut} / {@link
org.apache.juneau.rest.annotation.RestPost @RestPost} / {@link
org.apache.juneau.rest.annotation.RestDelete @RestDelete}.
+ <li>Annotation optional if using standard naming
conventions (e.g. <c>getFoo()</c> equivalent to
<c><ja>@RestGet</ja>(path=<js>"/foo"</js>)</c>).
+ </ul>
+ <li>Optionally annotated with config annotations such as {@link
org.apache.juneau.annotation.BeanConfig @BeanConfig} and {@link
org.apache.juneau.html.annotation.HtmlDocConfig @HtmlDocConfig} that
+ customize the behavior of serializers and parsers at
the method level.
+ <li>Returned object gets serialized as the HTTP response body.
+ <ul>
+ <li>Typically a POJO serialized based on {@link
org.apache.juneau.http.header.Accept} request header.
+ <li>Support for raw values such as <c>Readers</c> and
<c>InputStreams</c> (among others).
+ <li>Support for response beans annotated with {@link
org.apache.juneau.http.annotation.Response @Response}.
+ <li>Support for Apache Http Core interfaces: {@link
org.apache.http.HttpEntity} / {@link org.apache.http.HttpResponse} / {@link
org.apache.juneau.http.resource.HttpResource}.
+ <li>Standard HTTP responses such as {@link
org.apache.juneau.http.response.Ok} and {@link
org.apache.juneau.http.response.TemporaryRedirect} provided in {@link
org.apache.juneau.http.response} package.
+ <li>Extensible API for defining custom return types.
+ </ul>
+ <li>A wide range of possible argument types including:
+ <ul>
+ <li>Standard {@link
javax.servlet.http.HttpServletRequest} / {@link
javax.servlet.http.HttpServletResponse} objects.
+ <li>Extended {@link org.apache.juneau.rest.RestRequest}
/ {@link org.apache.juneau.rest.RestResponse} objects.
+ <li>Parsed HTTP parts with either the arguments or
beans annotated with {@link org.apache.juneau.http.annotation.Path @Path} /
{@link org.apache.juneau.http.annotation.Header @Header} / {@link
org.apache.juneau.http.annotation.Query @Query} / {@link
org.apache.juneau.http.annotation.FormData @FormData}.
+ <li>Parsed HTTP body with either the argument or bean
annotated with {@link org.apache.juneau.http.annotation.Content @Content}.
+ <li>Raw HTTP request body with <c>InputStream</c> or
<c>Reader</c>.
+ <li>Raw HTTP response body with <c>OutputStream</c> or
<c>Writer</c>.
+ <li>Request beans annotated with {@link
org.apache.juneau.http.annotation.Request @Request}.
+ <li>Response beans annotated with {@link
org.apache.juneau.http.annotation.Response @Response}.
+ <li>Standard HTTP headers such as {@link
org.apache.juneau.http.header.Accept} and {@link
org.apache.juneau.http.header.ContentType} provided in {@link
org.apache.juneau.http.header} package.
+ <li>Auto-generated {@link
org.apache.juneau.dto.swagger.Swagger}.
+ <li>Various other standard objects such as {@link
java.security.Principal}, {@link javax.servlet.http.Cookie}, {@link
javax.servlet.http.HttpSession}, and {@link java.util.ResourceBundle}.
+ <li>Spring beans or other injectable beans.
+ <li>Extensible API for defining custom argument types.
+ </ul>
+ <li>Throwables can be anything.
+ <ul>
+ <li>Typically one of the standard HTTP responses such
as {@link org.apache.juneau.http.response.BadRequest} or {@link
org.apache.juneau.http.response.NotFound} provided in {@link
org.apache.juneau.http.response} package.
+ <li>Can define your own {@link
org.apache.juneau.http.annotation.Response @Response}-annotated throwables.
+ <li>Anything else gets converted to an {@link
org.apache.juneau.http.response.InternalServerError}.
+ </ul>
+ </ul>
+</div>
- <jc>// Use it to create a pet.</jc>
- CreatePet <jv>createPet</jv> = <jk>new</jk>
CreatePet(<js>"Fluffy"</js>, 9.99);
- Pet <jv>pet</jv> = <jv>store</jv>.addPet(<jv>createPet</jv>,
UUID.<jsm>randomUUID</jsm>(), <jk>true</jk>);
- </p>
+<h5 class='topic'>Deploying as a Servlet</h5>
+<div class='topic'>
<p>
- The call above translates to the following REST call:
+ The {@link org.apache.juneau.rest.servlet.BasicRestServlet}
class is the entry point for your REST resources.
+ It extends directly from <l>HttpServlet</l> and is deployed
like any other servlet (such as a standard <c>web.xml</c> file).
</p>
- <p class='bcode'>
- POST http://localhost:10000/petstore/pets?debug=true HTTP/1.1
- Accept: application/json
- Content-Type: application/json
- Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
- E-Tag: 475588d4-0b27-4f56-9296-cc683251d314
-
- {
- name: 'Fluffy',
- price: 9.99
- }
+ <p>
+ When the servlet <l>init()</l> method is called, it triggers
the code to find and process the <l>@Rest</l>
+ annotations on that class and all child classes.
+ These get constructed into a {@link
org.apache.juneau.rest.RestContext} object that holds all the configuration
+ information about your resource in a read-only object.
</p>
<p>
- It looks simplistic, but the server and client APIs are highly
sophisticated libraries that allow you
- to perform complex tasks using very little code.
+ Most developers are not going to be using the
<l>RestServlet</l> class itself, and instead will
+ extend from one of the preconfigured default servlets such as
{@link org.apache.juneau.rest.servlet.BasicRestServlet} and {@link
org.apache.juneau.rest.servlet.BasicRestServletGroup}
+ which provides universal language support, basic
instrumentation, and auto-generated Swagger UI.
</p>
</div>
-</div><!-- END: 1.4 - Overview.o.Rest -->
-
-<!--
====================================================================================================
-->
-<h3 class='topic' onclick='toggle(this)'><a href='#Overview.o.RestServer'
id='Overview.o.RestServer'>1.5 - REST Server Overview</a></h3>
-<div class='topic'><!-- START: 1.5 - Overview.o.RestServer -->
-<h5 class='topic'>@Rest-Annotated Resources</h5>
+<h5 class='topic'>Deploying in Spring Boot</h5>
<div class='topic'>
<p>
- A REST resource is simply a Java class annotated with {@link
org.apache.juneau.rest.annotation.Rest}.
- The most common case is a class that extends {@link
org.apache.juneau.rest.servlet.BasicRestServlet}, which itself is simply an
- extension of {@link javax.servlet.http.HttpServlet} which
allows it to be deployed as a servlet.
+ The {@link
org.apache.juneau.rest.springboot.BasicSpringRestServlet} class is typically
entry point for your REST resources
+ when working within a Spring Boot environment.
+ </p>
+ <p>
+ The <c>SpringRestServlet</c> class provides additional
capabilities including:
</p>
+ <ul>
+ <li>Your REST resources can be defined as injectable Spring
beans.
+ <li>Various capabilities within the REST Server library (e.g.
logging, instrumentation, call handling, API extensions) can be defined via
+ Spring beans and automatically pulled into the
framework.
+ </ul>
+ <p>
+ Most developers are not going to be using the
<l>RestServlet</l> class itself, and instead will
+ extend from one of the preconfigured default servlets such as
{@link org.apache.juneau.rest.springboot.BasicSpringRestServlet} and {@link
org.apache.juneau.rest.springboot.BasicSpringRestServletGroup}
+ that have the same capabilites as the {@link
org.apache.juneau.rest.servlet.BasicRestServlet} and {@link
org.apache.juneau.rest.servlet.BasicRestServletGroup} counterparts.
+ </p>
+ <h5 class='figure'>Example configuration file:</h5>
<p class='bjava'>
- <jc>// Sample REST resource that prints out a simple "Hello world!"
message.</jc>
- <ja>@Rest</ja>(
- path=<js>"/helloWorld"</js>,
- title=<js>"Hello World"</js>,
- description=<js>"An example of the simplest-possible
resource"</js>
- )
- <ja>@HtmlDoc</ja>(
- navlinks={
- <js>"up: request:/.."</js>,
- <js>"options: servlet:/?method=OPTIONS"</js>
- },
- aside={
- <js>"<div style='max-width:400px'
class='text'>"</js>,
- <js>" <p>This page shows a resource that simply
response with a 'Hello world!' message</p>"</js>,
- <js>" <p>The POJO serialized is a simple
String.</p>"</js>,
- <js>"</div>"</js>
+ <ja>@Configuration</ja>
+ <jk>public class</jk> MySpringConfiguration {
+
+ <jd>/**
+ * Our root REST bean.
+ * Note that this must extend from SpringRestServlet so that
child resources can be
+ * resolved as Spring beans.
+ * All REST objects are attached to this bean using the {@link
org.apache.juneau.rest.annotation.Rest#children()} annotation.
+ */</jd>
+ <ja>@Bean</ja>
+ <jk>public</jk> RootResources getRootResources() {
+ <jk>return new</jk> RootResources();
}
- )
- <ja>@BeanConfig</ja>(sortProperties=<js>"true"</js>)
- <jk>public class</jk> HelloWorldResource <jk>extends</jk>
BasicRestServlet <jk>implements</jk> BasicUniveralConfig {
- <ja>@RestGet</ja>(path=<js>"/*"</js>, summary=<js>"Responds
with \"Hello world!\""</js>)
- <jk>public</jk> String sayHello() {
- <jk>return</jk> <js>"Hello world!"</js>;
+ <jd>/**
+ * Optionally return the HelloWorldResource object as an
injectable bean.
+ */</jd>
+ <ja>@Bean</ja>
+ <jk>public</jk> HelloWorldResource getHelloWorldResource() {
+ <jk>return new</jk> HelloWorldResource();
+ }
+
+ <jd>/**
+ * Map our servlet to a path.
+ */</jd>
+ <ja>@Bean</ja>
+ <jk>public</jk> ServletRegistrationBean<Servlet>
getRootServlet(RootResources <jv>rootResources</jv>) {
+ <jk>return new</jk>
ServletRegistrationBean<>(<jv>rootResources</jv>, <js>"/*"</js>);
}
}
</p>
- <p>
- This is what it looks like in a browser.
- </p>
- <p class='bcode'>
- http://localhost:10000/helloWorld
+ <p class='bjava'>
+ <ja>@Rest</ja>(
+ children={
+ HelloWorldResource.<jk>class</jk>
+ }
+ )
+ <jk>public class</jk> RootResources <jk>extends</jk>
BasicSpringRestServletGroup <jk>implements</jk> BasicUniversalConfig {
+ <jc>// No code!</jc>
+ }
</p>
- <img class='bordered w800' src='doc-files/jrs.HelloWorldExample.1.png'>
- <ul>
- <li>Parsers for request bodies are selected based on the
request <c>Content-Type</c> header.
- <li>Serializers for response bodies are selected based on the
request <c>Accept</c> header.
- <ul>
- <li>In this case, it's the {@link
org.apache.juneau.html.HtmlDocSerializer} serializer based on the
- browser's default <c>Accept</c> header that's
asking for HTML.
- </ul>
- <li>REST resource classes and methods can be annotated with
configuration annotations for the serializers and parsers (such as
<ja>@HtmlConfig</ja> and <ja>@BeanConfig</ja> shown above).
- <li>Annotations such as the title, summary, and descriptions
shown above are used for auto-generated Swagger UI pages (described later).
+</div>
+
+<h5 class='topic'>Additional Information</h5>
+<div class='topic'>
+ <ul class='seealso'>
+ <li class='link'>{@doc juneau-rest-server} for more information.
</ul>
</div>
+</div><!-- END: 1.3 - Overview.o.RestServer -->
-<h5 class='topic'>REST Children</h5>
+<!--
====================================================================================================
-->
+
+<h3 class='topic' onclick='toggle(this)'><a href='#Overview.o.RestClient'
id='Overview.o.RestClient'>1.4 - REST Client</a><span class='update'>created:
<b>9.0.0</b></span></h3>
+<div class='topic'><!-- START: 1.4 - Overview.o.RestClient -->
<div class='topic'>
<p>
- Child Resources are REST servlets or objects that are linked to
parent resources through the
- {@link org.apache.juneau.rest.annotation.Rest#children()
@Rest(children)} annotation.
+ Built upon the feature-rich Apache HttpClient library, the
Juneau RestClient API adds support for fluent-style
+ REST calls and the ability to perform marshalling of POJOs to
and from HTTP parts.
</p>
+
<h5 class='figure'>Example:</h5>
<p class='bjava'>
- <jd>/** Parent Resource */</jd>
- <ja>@Rest</ja>(
- path=<js>"/parent"</js>,
- children={
- MyChildResource.<jk>class</jk>
- }
- )
- <jk>public</jk> MyParentResource <jk>extends</jk> BasicRestServlet
<jk>implements</jk> BasicUniversalConfig {...}
- </p>
- <p class='bjava'>
- <jd>/** Child Resource */</jd>
- <ja>@Rest</ja>(
- path=<js>"/child"</js> <jc>// Path relative to parent
resource.</jc>
- )
- <jk>public</jk> MyChildResource {...} <jc>// Note that we don't need to
extend from RestServlet.</jc>
+ <jc>// Create a basic REST client with JSON support and download a
bean.</jc>
+ MyBean <jv>bean</jv> = RestClient.<jsm>create</jsm>()
+ .simpleJson()
+ .build()
+ .get(<jsf>URI</jsf>)
+ .run()
+ .assertStatus().asCode().is(200)
+
.assertHeader(<js>"Content-Type"</js>).matchesSimple(<js>"application/json*"</js>)
+ .getContent().as(MyBean.<jk>class</jk>);
</p>
+</div>
+
+<h5 class='topic'>REST Testing Framework</h5>
+<div class='topic'>
<p>
- The path of the child resource gets appended to the path of the
parent resource.
- So in the example above, the child resource is accessed through
the URL <l>/parent/child</l>.
+ The {@link org.apache.juneau.rest.mock.MockRestClient} class is
used for performing serverless unit testing of {@link
org.apache.juneau.rest.annotation.Rest @Rest}-annotated
+ and {@link org.apache.juneau.http.remote.Remote
@Remote}-annotated classes.
</p>
- <p>
- A HUGE advantage of using child resources is that they do not
need to be declared in the JEE <l>web.xml</l>
- file.
- Initialization of and access to the child resources occurs
through the parent resource.
- Children can be nested arbitrary deep to create complex REST
interfaces with a single top-level REST servlet.
+ <h5 class='figure'>Example:</h5>
+ <p class='bjava'>
+ <jk>public class</jk> MockTest {
+
+ <jc>// A simple bean with one field.</jc>
+ <jk>public static class</jk> MyBean {
+ <jk>public int</jk> <jf>foo</jf> = 1;
+ }
+
+ <jc>// Our REST resource to test.</jc>
+ <jc>// Simply echos the response.</jc>
+ <ja>@Rest</ja>
+ <jk>public static class</jk> EchoRest <jk>implements</jk>
BasicRestServlet {
+
+ <ja>@RestPut</ja>
+ <jk>public</jk> MyBean echo(<ja>@Content</ja> MyBean
<jv>bean</jv>) {
+ <jk>return</jk> <jv>bean</jv>;
+ }
+ }
+
+ <jc>// Our JUnit test.</jc>
+ <ja>@Test</ja>
+ <jk>public void</jk> testEcho() <jk>throws</jk> Exception {
+
+ MyBean <jv>myBean</jv> = <jk>new</jk> MyBean();
+
+ <jc>// Do a round-trip on the bean through the REST
interface</jc>
+ <jv>myBean</jv> = MockRestClient
+ .<jsm>create</jsm>(EchoRest.<jk>class</jk>)
+ .simpleJson()
+ .build()
+ .put(<js>"/echo"</js>, <jv>myBean</jv>)
+ .run()
+ .assertStatus().is(200)
+ .assertContent().is(<js>"{foo:1}"</js>)
+ .getContent().as(MyBean.<jk>class</jk>);
+
+ <jsm>assertEquals</jsm>(1,
<jv>myBean</jv>.<jf>foo</jf>);
+ }
+ }
</p>
</div>
-<h5 class='topic'>REST Group Pages</h5>
+
+<h5 class='topic'>Additional Information</h5>
+<div class='topic'>
+ <ul class='seealso'>
+ <li class='link'>{@doc juneau-rest-client} for more information.
+ </ul>
+</div>
+</div><!-- END: 1.4 - Overview.o.RestClient -->
+
+<!--
====================================================================================================
-->
+
+<h3 class='topic' onclick='toggle(this)'><a href='#Overview.o.Dtos'
id='Overview.o.Dtos'>1.5 - DTOs</a><span class='update'>created:
<b>9.0.0</b></span></h3>
+<div class='topic'><!-- START: 1.5 - Overview.o.Dtos -->
<div class='topic'>
<p>
- The {@link
org.apache.juneau.rest.servlet.BasicRestServletGroup} class provides a default
"router" page for
- child resources when a parent resource is nothing more than a
grouping of child resources.
- </p>
- <p>
- The <l>RootResources</l> class in the Samples project is an
example of a router page:
+ The {@doc juneau-dto juneau-dto} library contains several
predefined POJOs for generating commonly-used document types that
+ are designed to be used with the Juneau Marshaller APIs for
both serializing and parsing.
</p>
- <p class='bjava'>
- <jd>/**
- * Sample REST resource showing how to implement a "router" resource
page.
- */</jd>
- <ja>@Rest</ja>(
- path=<js>"/"</js>,
- title=<js>"Root resources"</js>,
- description=<js>"Example of a router resource page."</js>,
- children={
- HelloWorldResource.<jk>class</jk>,
- PetStoreResource.<jk>class</jk>,
- DtoExamples.<jk>class</jk>,
- ConfigResource.<jk>class</jk>,
- LogsResource.<jk>class</jk>,
- ShutdownResource.<jk>class</jk>
- }
- )
- <jk>public class</jk> RootResources <jk>extends</jk>
BasicRestServletGroup <jk>implements</jk> BasicUniversalConfig {
- <jc>// NO CODE!!!</jc>
- }
+</div>
+
+<h5 class='topic'>HTML5</h5>
+<div class='topic'>
+ <p>
+ The Juneau HTML5 DTOs are simply beans with fluent-style
setters that allow you to quickly construct HTML
+ fragments as Java objects. These object can then be serialized
to HTML using one of the existing HTML
+ serializers, or to other languages such as JSON using the JSON
serializers.
</p>
<p>
- When you bring up this resource in a browser, you see the
following that provides a list
- of navigable links to your child resources:
+ The {@link org.apache.juneau.dto.html5.HtmlBuilder} class is a
utility class with predefined static methods
+ that allow you to easily construct DTO instances in a minimal
amount of code.
</p>
- <p class='bcode'>
- http://localhost:10000
+ <h5 class='figure'>Examples:</h5>
+ <p class='bjava'>
+ <jk>import static</jk> org.apache.juneau.dto.html5.HtmlBuilder.*;
+
+ <jc>// An HTML table</jc>
+ Object <jv>mytable</jv> =
+ <jsm>table</jsm>(
+ <jsm>tr</jsm>(
+ <jsm>th</jsm>(<js>"c1"</js>),
+ <jsm>th</jsm>(<js>"c2"</js>)
+ ),
+ <jsm>tr</jsm>(
+ <jsm>td</jsm>(<js>"v1"</js>),
+ <jsm>td</jsm>(<js>"v2"</js>)
+ )
+ );
+
+ String <jv>html</jv> =
HtmlSerializer.<jsf>DEFAULT</jsf>.serialize(<jv>mytable</jv>);
</p>
- <img class='bordered w800' src='doc-files/jrs.RouterPages.1.png'/>
+ <p class='bxml'><xt>
+ <table>
+ <tr>
+ <th><xv>c1</xv></th>
+ <th><xv>c2</xv></th>
+ </tr>
+ <tr>
+ <td><xv>v1</xv></td>
+ <td><xv>v2</xv></td>
+ </tr>
+ </table>
+ </xt></p>
+ <ul class='seealso'>
+ <li class='link'>{@doc jd.Html5 HTML5} for more information.
+ </ul>
</div>
-<h5 class='topic'>REST Resource Methods</h5>
+<h5 class='topic'>ATOM</h5>
<div class='topic'>
<p>
- The real power behind the REST server API is the ability to
define Java methods as REST endpoints.
+ The Juneau ATOM feed DTOs are simply beans with fluent-style
setters.
+ The following code shows a feed being created programmatically
using the
+ {@link org.apache.juneau.dto.atom.AtomBuilder} class.
</p>
<h5 class='figure'>Example:</h5>
<p class='bjava'>
- <ja>@RestPost</ja>(path=<js>"/pets"</js>,
guards=AdminGuard.<jk>class</jk>)
- <jk>public</jk> Ok addPet(
- <ja>@Content</ja> CreatePet <jv>createPetBean</jv>,
- <ja>@Header</ja>(<js>"E-Tag"</js>) UUID <jv>etag</jv>,
- <ja>@Query</ja>(<js>"debug"</js>) <jk>boolean</jk>
<jv>debug</jv>
- ) <jk>throws</jk> BadRequest, Unauthorized, InternalServerError {
- <jc>// Process request.</jc>
- <jk>return</jk> Ok.<jsf>OK</jsf>;
- }
+ <jk>import static</jk> org.apache.juneau.dto.atom.AtomBuilder.*;
+
+ Feed <jv>feed</jv> =
+ <jsm>feed</jsm>(<js>"tag:juneau.apache.org"</js>, <js>"Juneau
ATOM specification"</js>, <js>"2016-01-02T03:04:05Z"</js>)
+ .subtitle(<jsm>text</jsm>(<js>"html"</js>).text(<js>"Describes
<em>stuff</em> about Juneau"</js>))
+ .links(
+ <jsm>link</jsm>(<js>"alternate"</js>,
<js>"text/html"</js>,
<js>"http://juneau.apache.org"</js>).hreflang(<js>"en"</js>),
+ <jsm>link</jsm>(<js>"self"</js>,
<js>"application/atom+xml"</js>, <js>"http://juneau.apache.org/feed.atom"</js>)
+ )
+ .rights(<js>"Copyright (c) ..."</js>)
+ .generator(
+
<jsm>generator</jsm>(<js>"Juneau"</js>).uri(<js>"http://juneau.apache.org/"</js>).version(<js>"1.0"</js>)
+ )
+ .entries(
+
<jsm>entry</jsm>(<js>"tag:juneau.sample.com,2013:1.2345"</js>, <js>"Juneau ATOM
specification snapshot"</js>, <js>"2016-01-02T03:04:05Z"</js>)
+ .links(
+ <jsm>link</jsm><js>"alternate"</js>,
<js>"text/html"</js>, <js>"http://juneau.apache.org/juneau.atom"</js>),
+ <jsm>link</jsm>(<js>"enclosure"</js>,
<js>"audio/mpeg"</js>,
<js>"http://juneau.apache.org/audio/juneau_podcast.mp3"</js>).length(1337)
+ )
+ .published(<js>"2016-01-02T03:04:05Z"</js>)
+ .authors(
+ <jsm>person</jsm>(<js>"Jane
Smith"</js>).uri(<js>"http://juneau.apache.org/"</js>).email(<js>"[email protected]"</js>)
+ )
+ .contributors(
+ <jsm>person</jsm>(<js>"John Smith"</js>)
+ )
+ .content(
+ <jsm>content</jsm>(<js>"xhtml"</js>)
+ .lang(<js>"en"</js>)
+ .base(<js>"http://www.apache.org/"</js>)
+
.text(<js>"<div><p><i>[Update: Juneau supports
ATOM.]</i></p></div>"</js>)
+ )
+ );
+
+ <jc>// Create a serializer with readable output, no namespaces yet.</jc>
+ XmlSerializer <jv>serializer</jv> =
XmlSerializer.<jsm>create</jsm>().sq().ws().build();
+
+ <jc>// Serialize to ATOM/XML</jc>
+ String <jv>atomXml</jv> = <jv>serializer</jv>.serialize(<jv>feed</jv>);
</p>
+ <ul class='seealso'>
+ <li class='link'>{@doc jd.Atom Atom} for more information.
+ </ul>
+</div>
+
+<h5 class='topic'>Swagger</h5>
+<div class='topic'>
<p>
- Java methods on {@link org.apache.juneau.rest.annotation.Rest
@Rest}-annotated classes have the following format:
+ The Juneau Swagger DTOs are simply beans with fluent-style
setters that allow you to quickly construct
+ Swagger documents as Java objects.
+ These object can then be serialized to JSON using one of the
existing JSON serializers, or to other
+ languages such as XML or HTML using the other serializers.
</p>
+ <h5 class='figure'>Example:</h5>
<p class='bjava'>
- <ja>@RestOp</ja>(method=<js>"..."</js>, path=<js>"..."</js>)
- <ja><i><config-annotations></i></ja>
- <jk>public</jk> <i><return-type></i> method(<i><args></i>)
<jk>throws</jk> <i><throwables></i> {
- ...
- }
- </p>
- <p>
- The various parts require their own topics to fully appreciate
the scope of abilities, but the following is a summary:
+ <jk>static import</jk> org.apache.juneau.dto.swagger.SwaggerBuilder.*;
+
+ Swagger <jv>swagger</jv> = <jsm>swagger</jsm>()
+ .swagger(<js>"2.0"</js>)
+ .info(
+ <jsm>info</jsm>(<js>"Swagger Petstore"</js>,
<js>"1.0.0"</js>)
+ .description(<js>"This is a sample server
Petstore server."</js>)
+
.termsOfService(<js>"http://swagger.io/terms/"</js>)
+ .contact(
+
<jsm>contact</jsm>().email(<js>"[email protected]"</js>)
+ )
+ .license(
+ <jsm>license</jsm>(<js>"Apache
2.0"</js>).url(<js>"http://www.apache.org/licenses/LICENSE-2.0.html"</js>)
+ )
+ )
+ .host(<js>"petstore.swagger.io"</js>)
+ .basePath(<js>"/v2"</js>)
+ .tags(
+
<jsm>tag</jsm>(<js>"pet"</js>).description(<js>"Everything about your
Pets"</js>)
+ .externalDocs(
+
<jsm>externalDocumentation</jsm>(<js>"http://swagger.io"</js>,
<js>"http://swagger.io"</js>)
+ )
+ )
+ .schemes(<js>"http"</js>)
+ .path(<js>"/pet"</js>, <js>"post"</js>,
+ <jsm>operation</jsm>()
+ .tags(<js>"pet"</js>)
+ .summary(<js>"Add a new pet to the store"</js>)
+ .description(<js>""</js>)
+ .operationId(<js>"addPet"</js>)
+ .consumes(MediaType.<jsf>JSON</jsf>,
MediaType.<jsf>XML</jsf>)
+ .produces(MediaType.<jsf>JSON</jsf>,
MediaType.<jsf>XML</jsf>)
+ .parameters(
+
<jsm>parameterInfo</jsm>(<js>"body"</js>, <js>"body"</js>)
+ .description(<js>"Pet object
that needs to be added to the store"</js>)
+ .required(<jk>true</jk>)
+ )
+ .response(405,
<jsm>responseInfo</jsm>(<js>"Invalid input"</js>))
+ );
+
+ <jc>// Serialize using JSON serializer.</jc>
+ String <jv>swaggerJson</jv> =
JsonSerializer.<jsf>DEFAULT_READABLE</jsf>.serialize(<jv>swagger</jv>);
+
+ <jc>// Or just use toString().</jc>
+ String <jv>swaggerJson</jv> = <jv>swagger</jv>.toString();
</p>
- <ul class='spaced-list'>
- <li>Annotated with {@link
org.apache.juneau.rest.annotation.RestOp @RestOp}.
- <ul>
- <li>Also available: {@link
org.apache.juneau.rest.annotation.RestGet @RestGet} / {@link
org.apache.juneau.rest.annotation.RestPut @RestPut} / {@link
org.apache.juneau.rest.annotation.RestPost @RestPost} / {@link
org.apache.juneau.rest.annotation.RestDelete @RestDelete}.
- <li>Annotation optional if using standard naming
conventions (e.g. <c>getFoo()</c> equivalent to
<c><ja>@RestGet</ja>(path=<js>"/foo"</js>)</c>).
- </ul>
- <li>Optionally annotated with config annotations such as {@link
org.apache.juneau.annotation.BeanConfig @BeanConfig} and {@link
org.apache.juneau.html.annotation.HtmlDocConfig @HtmlDocConfig} that
- customize the behavior of serializers and parsers at
the method level.
- <li>Returned object gets serialized as the HTTP response body.
- <ul>
- <li>Typically a POJO serialized based on {@link
org.apache.juneau.http.header.Accept} request header.
- <li>Support for raw values such as <c>Readers</c> and
<c>InputStreams</c> (among others).
- <li>Support for response beans annotated with {@link
org.apache.juneau.http.annotation.Response @Response}.
- <li>Support for Apache Http Core interfaces: {@link
org.apache.http.HttpEntity} / {@link org.apache.http.HttpResponse} / {@link
org.apache.juneau.http.resource.HttpResource}.
- <li>Standard HTTP responses such as {@link
org.apache.juneau.http.response.Ok} and {@link
org.apache.juneau.http.response.TemporaryRedirect} provided in {@link
org.apache.juneau.http.response} package.
- <li>Extensible API for defining custom return types.
- </ul>
- <li>A wide range of possible argument types including:
- <ul>
- <li>Standard {@link
javax.servlet.http.HttpServletRequest} / {@link
javax.servlet.http.HttpServletResponse} objects.
- <li>Extended {@link org.apache.juneau.rest.RestRequest}
/ {@link org.apache.juneau.rest.RestResponse} objects.
- <li>Parsed HTTP parts with either the arguments or
beans annotated with {@link org.apache.juneau.http.annotation.Path @Path} /
{@link org.apache.juneau.http.annotation.Header @Header} / {@link
org.apache.juneau.http.annotation.Query @Query} / {@link
org.apache.juneau.http.annotation.FormData @FormData}.
- <li>Parsed HTTP body with either the argument or bean
annotated with {@link org.apache.juneau.http.annotation.Content @Content}.
- <li>Raw HTTP request body with <c>InputStream</c> or
<c>Reader</c>.
- <li>Raw HTTP response body with <c>OutputStream</c> or
<c>Writer</c>.
- <li>Request beans annotated with {@link
org.apache.juneau.http.annotation.Request @Request}.
- <li>Response beans annotated with {@link
org.apache.juneau.http.annotation.Response @Response}.
- <li>Standard HTTP headers such as {@link
org.apache.juneau.http.header.Accept} and {@link
org.apache.juneau.http.header.ContentType} provided in {@link
org.apache.juneau.http.header} package.
- <li>Auto-generated {@link
org.apache.juneau.dto.swagger.Swagger}.
- <li>Various other standard objects such as {@link
java.security.Principal}, {@link javax.servlet.http.Cookie}, {@link
javax.servlet.http.HttpSession}, and {@link java.util.ResourceBundle}.
- <li>Spring beans or other injectable beans.
- <li>Extensible API for defining custom argument types.
- </ul>
- <li>Throwables can be anything.
- <ul>
- <li>Typically one of the standard HTTP responses such
as {@link org.apache.juneau.http.response.BadRequest} or {@link
org.apache.juneau.http.response.NotFound} provided in {@link
org.apache.juneau.http.response} package.
- <li>Can define your own {@link
org.apache.juneau.http.annotation.Response @Response}-annotated throwables.
- <li>Anything else gets converted to an {@link
org.apache.juneau.http.response.InternalServerError}.
- </ul>
+ <ul class='seealso'>
+ <li class='link'>{@doc jd.Swagger Swagger} for more information.
</ul>
</div>
-
-<h5 class='topic'>Deploying as a Servlet</h5>
+
+<h5 class='topic'>SwaggerUI</h5>
<div class='topic'>
<p>
- The {@link org.apache.juneau.rest.servlet.BasicRestServlet}
class is the entry point for your REST resources.
- It extends directly from <l>HttpServlet</l> and is deployed
like any other servlet (such as a standard <c>web.xml</c> file).
+ The {@link org.apache.juneau.dto.swagger.ui.SwaggerUI} class is
a DTO class for generating Swagger user interfaces
+ from {@link org.apache.juneau.dto.swagger.Swagger} beans.
</p>
<p>
- When the servlet <l>init()</l> method is called, it triggers
the code to find and process the <l>@Rest</l>
- annotations on that class and all child classes.
- These get constructed into a {@link
org.apache.juneau.rest.RestContext} object that holds all the configuration
- information about your resource in a read-only object.
+ The <c>PetStore</c> example described later provides an example
of auto-generated Swagger JSON:
</p>
+ <img class='bordered w900' src='doc-files/jd.SwaggerUI.json.png'>
<p>
- Most developers are not going to be using the
<l>RestServlet</l> class itself, and instead will
- extend from one of the preconfigured default servlets such as
{@link org.apache.juneau.rest.servlet.BasicRestServlet} and {@link
org.apache.juneau.rest.servlet.BasicRestServletGroup}
- which provides universal language support, basic
instrumentation, and auto-generated Swagger UI.
+ Using {@link org.apache.juneau.dto.swagger.ui.SwaggerUI}, we're
able to render that JSON as a Swagger user interface
+ when the request is asking for HTML:
</p>
+ <img class='bordered w900' src='doc-files/jd.SwaggerUI.html.png'>
+ <ul class='seealso'>
+ <li class='link'>{@doc jd.SwaggerUi Swagger UI} for more
information.
+ </ul>
</div>
+</div><!-- END: 1.5 - Overview.o.Dtos -->
-<h5 class='topic'>Deploying in Spring Boot</h5>
+<!--
====================================================================================================
-->
+
+<h3 class='topic' onclick='toggle(this)'><a href='#Overview.o.ConfigFiles'
id='Overview.o.ConfigFiles'>1.6 - Config Files</a><span class='update'>created:
<b>9.0.0</b></span></h3>
+<div class='topic'><!-- START: 1.6 - Overview.o.ConfigFiles -->
<div class='topic'>
<p>
- The {@link
org.apache.juneau.rest.springboot.BasicSpringRestServlet} class is typically
entry point for your REST resources
- when working within a Spring Boot environment.
+ The {@doc juneau-config juneau-config} library contains a
powerful API for creating and using INI-style config files.
</p>
- <p>
- The <c>SpringRestServlet</c> class provides additional
capabilities including:
+ <h5 class='figure'>Example configuration file:</h5>
+ <p class='bini'>
+ <cc># A set of entries</cc>
+ <cs>[Section1]</cs>
+
+ <cc># An integer</cc>
+ <ck>key1</ck> = <cv>1</cv>
+
+ <cc># A boolean</cc>
+ <ck>key2</ck> = <cv>true</cv>
+
+ <cc># An array</cc>
+ <ck>key3</ck> = <cv>1,2,3</cv>
+
+ <cc># A POJO</cc>
+ <ck>key4</ck> = <cv>http://bar</cv>
</p>
- <ul>
- <li>Your REST resources can be defined as injectable Spring
beans.
- <li>Various capabilities within the REST Server library (e.g.
logging, instrumentation, call handling, API extensions) can be defined via
- Spring beans and automatically pulled into the
framework.
- </ul>
<p>
- Most developers are not going to be using the
<l>RestServlet</l> class itself, and instead will
- extend from one of the preconfigured default servlets such as
{@link org.apache.juneau.rest.springboot.BasicSpringRestServlet} and {@link
org.apache.juneau.rest.springboot.BasicSpringRestServletGroup}
- that have the same capabilites as the {@link
org.apache.juneau.rest.servlet.BasicRestServlet} and {@link
org.apache.juneau.rest.servlet.BasicRestServletGroup} counterparts.
+ Config files are accessed through the {@link
org.apache.juneau.config.Config} class which
+ are created through the {@link
org.apache.juneau.config.Config.Builder} class.
+ Builder creator methods are provided on the <c>Config</c> class:
</p>
- <h5 class='figure'>Example configuration file:</h5>
<p class='bjava'>
- <ja>@Configuration</ja>
- <jk>public class</jk> MySpringConfiguration {
-
- <jd>/**
- * Our root REST bean.
- * Note that this must extend from SpringRestServlet so that
child resources can be
- * resolved as Spring beans.
- * All REST objects are attached to this bean using the {@link
org.apache.juneau.rest.annotation.Rest#children()} annotation.
- */</jd>
- <ja>@Bean</ja>
- <jk>public</jk> RootResources getRootResources() {
- <jk>return new</jk> RootResources();
- }
-
- <jd>/**
- * Optionally return the HelloWorldResource object as an
injectable bean.
- */</jd>
- <ja>@Bean</ja>
- <jk>public</jk> HelloWorldResource getHelloWorldResource() {
- <jk>return new</jk> HelloWorldResource();
- }
+ <jc>// Create a Config object</jc>
+ Config <jv>config</jv> =
Config.<jsm>create</jsm>().name(<js>"MyConfig.cfg"</js>).build();
- <jd>/**
- * Map our servlet to a path.
- */</jd>
- <ja>@Bean</ja>
- <jk>public</jk> ServletRegistrationBean<Servlet>
getRootServlet(RootResources <jv>rootResources</jv>) {
- <jk>return new</jk>
ServletRegistrationBean<>(<jv>rootResources</jv>, <js>"/*"</js>);
- }
- }
+ <jc>// Read values from section #1</jc>
+ <jk>int</jk> <jv>key1</jv> =
<jv>config</jv>.getInt(<js>"Section1/key1"</js>);
+ <jk>boolean</jk> <jv>key2</jv> =
<jv>config</jv>.getBoolean(<js>"Section1/key2"</js>);
+ <jk>int</jk>[] <jv>key3</jv> =
<jv>config</jv>.getObject(<js>"Section1/key3"</js>,
<jk>int</jk>[].<jk>class</jk>);
+ URL <jv>key4</jv> = <jv>config</jv>.getObject(<js>"Section1/key4"</js>,
URL.<jk>class</jk>);
</p>
- <p class='bjava'>
- <ja>@Rest</ja>(
- children={
- HelloWorldResource.<jk>class</jk>
- }
- )
- <jk>public class</jk> RootResources <jk>extends</jk>
BasicSpringRestServletGroup <jk>implements</jk> BasicUniversalConfig {
- <jc>// No code!</jc>
- }
+ <p>
+ The config language may look simple, but it is a very powerful
feature with many capabilities.
</p>
-</div>
-
-<h5 class='topic'>Additional Information</h5>
-<div class='topic'>
<ul class='seealso'>
- <li class='link'>{@doc juneau-rest-server} for more information.
+ <li class='link'>{@doc juneau-config juneau-config} for more
information.
</ul>
</div>
-</div><!-- END: 1.5 - Overview.o.RestServer -->
+</div><!-- END: 1.6 - Overview.o.ConfigFiles -->
<!--
====================================================================================================
-->
-<h3 class='topic' onclick='toggle(this)'><a href='#Overview.o.RestClient'
id='Overview.o.RestClient'>1.6 - REST Client Overview</a><span
class='update'>created: <b>9.0.0</b></span></h3>
-<div class='topic'><!-- START: 1.6 - Overview.o.RestClient -->
-<h5 class='topic'>REST Client</h5>
+<h3 class='topic' onclick='toggle(this)'><a
href='#Overview.o.FluentAssertions' id='Overview.o.FluentAssertions'>1.7 -
Fluent Assertions</a><span class='update'>created: <b>9.0.0</b></span></h3>
+<div class='topic'><!-- START: 1.7 - Overview.o.FluentAssertions -->
<div class='topic'>
<p>
- Built upon the feature-rich Apache HttpClient library, the
Juneau RestClient API adds support for fluent-style
- REST calls and the ability to perform marshalling of POJOs to
and from HTTP parts.
+ The {@doc juneau-assertions} module in Juneau is a powerful API
for performing fluent style assertions.
</p>
+ <h5 class='figure'>Examples:</h5>
+ <p class='bjava'>
+ <jk>import static</jk> org.apache.juneau.assertions.Assertions.*;
+ <jk>import static</jk>
org.apache.juneau.assertions.AssertionPredicates.*;
+
+ <jc>// Check the contents of a string.</jc>
+ <jsm>assertString</jsm>(<js>"foo, bar"</js>)
+ .split(<js>","</js>)
+ .trim()
+ .has(<js>"foo"</js>, <js>"bar"</js>);
+
+ <jc>// Extract a subset of properties from a list of beans and compare
using Simplified JSON.</jc>
+ List<MyBean> <jv>myListOfBeans</jv> = ...;
+ <jsm>assertBeanList</jsm>(<jv>myListOfBeans</jv>)
+ .extract(<js>"a,b"</js>)
+ .asJson().is(<js>"[{a:1,b:'foo'}]"</js>);
+
+ <jc>// Perform an arbitrary Predicate check against a bean.</jc>
+ MyBean <jv>myBean</jv> = ...;
+ <jsm>assertBean</jsm>(<jv>myBean</jv>)
+ .is(<jv>x</jv> -> <jsm>isValidCheck</jsm>(<jv>x</jv>))
+
+ <jc>// Check that a list of strings has less than 10 entries and the
first</jc>
+ <jc>// 3 entries are [foo, bar*, null] using assertion predicates.</jc>
+ List<String> <jv>myListOfStrings</jv> = ...;
+ <jsm>assertStringList</jsm>(<jv>myListOfStrings</jv>)
+ .size().isLt(10)
+ .first(3)
+
.each(<jsm>eq</jsm>(<js>"foo"</js>),<jsm>match</jsm>(<js>"bar*"</js>),<jsm>isNull</jsm>())
+ <jc>// Check that an exception is thrown and is the specified type and
has the specified message.</jc>
+ <jsm>assertThrown</jsm>(()-><jv>myBean</jv>.runBadMethod())
+ .exists()
+ .isExactType(RuntimeException.<jk>class</jk>)
+ .message().is(<js>"foo"</js>);
+ </p>
+ <p>
+ The Assertions APIs are used throughout the REST client and
server APIs for performing inline assertions on REST requests and responses.
+ </p>
+
<h5 class='figure'>Example:</h5>
<p class='bjava'>
<jc>// Create a basic REST client with JSON support and download a
bean.</jc>
@@ -1920,73 +1902,20 @@
.get(<jsf>URI</jsf>)
.run()
.assertStatus().asCode().is(200)
-
.assertHeader(<js>"Content-Type"</js>).matchesSimple(<js>"application/json*"</js>)
+
.assertHeader(<js>"Content-Type"</js>).isMatches(<js>"application/json*"</js>)
+ .getContent().assertValue().asString().isContains(<js>"OK"</js>)
.getContent().as(MyBean.<jk>class</jk>);
</p>
-</div>
-
-<h5 class='topic'>REST Testing Framework</h5>
-<div class='topic'>
- <p>
- The {@link org.apache.juneau.rest.mock.MockRestClient} class is
used for performing serverless unit testing of {@link
org.apache.juneau.rest.annotation.Rest @Rest}-annotated
- and {@link org.apache.juneau.http.remote.Remote
@Remote}-annotated classes.
- </p>
- <h5 class='figure'>Example:</h5>
- <p class='bjava'>
- <jk>public class</jk> MockTest {
-
- <jc>// A simple bean with one field.</jc>
- <jk>public static class</jk> MyBean {
- <jk>public int</jk> <jf>foo</jf> = 1;
- }
-
- <jc>// Our REST resource to test.</jc>
- <jc>// Simply echos the response.</jc>
- <ja>@Rest</ja>
- <jk>public static class</jk> EchoRest <jk>implements</jk>
BasicRestServlet {
-
- <ja>@RestPut</ja>
- <jk>public</jk> MyBean echo(<ja>@Content</ja> MyBean
<jv>bean</jv>) {
- <jk>return</jk> <jv>bean</jv>;
- }
- }
-
- <jc>// Our JUnit test.</jc>
- <ja>@Test</ja>
- <jk>public void</jk> testEcho() <jk>throws</jk> Exception {
-
- MyBean <jv>myBean</jv> = <jk>new</jk> MyBean();
-
- <jc>// Do a round-trip on the bean through the REST
interface</jc>
- <jv>myBean</jv> = MockRestClient
- .<jsm>create</jsm>(EchoRest.<jk>class</jk>)
- .simpleJson()
- .build()
- .put(<js>"/echo"</js>, <jv>myBean</jv>)
- .run()
- .assertStatus().is(200)
- .assertContent().is(<js>"{foo:1}"</js>)
- .getContent().as(MyBean.<jk>class</jk>);
-
- <jsm>assertEquals</jsm>(1,
<jv>myBean</jv>.<jf>foo</jf>);
- }
- }
- </p>
-</div>
-
-
-<h5 class='topic'>Additional Information</h5>
-<div class='topic'>
<ul class='seealso'>
- <li class='link'>{@doc juneau-rest-client} for more information.
+ <li class='link'>{@doc ja.Overview Fluent Assertions} for more
information.
</ul>
</div>
-</div><!-- END: 1.6 - Overview.o.RestClient -->
+</div><!-- END: 1.7 - Overview.o.FluentAssertions -->
<!--
====================================================================================================
-->
-<h3 class='topic' onclick='toggle(this)'><a href='#Overview.o.GeneralDesign'
id='Overview.o.GeneralDesign'>1.7 - General Design</a><span
class='update'>created: <b>9.0.0</b></span></h3>
-<div class='topic'><!-- START: 1.7 - Overview.o.GeneralDesign -->
+<h3 class='topic' onclick='toggle(this)'><a href='#Overview.o.GeneralDesign'
id='Overview.o.GeneralDesign'>1.8 - General Design</a><span
class='update'>created: <b>9.0.0</b></span></h3>
+<div class='topic'><!-- START: 1.8 - Overview.o.GeneralDesign -->
<div class='topic'>
<p>
The Juneau framework uses the design pattern of builders,
context, and session objects:
@@ -2057,7 +1986,7 @@
for reuse by all serializers and parsers that share the same
bean context configuration settings.
</p>
</div>
-</div><!-- END: 1.7 - Overview.o.GeneralDesign -->
+</div><!-- END: 1.8 - Overview.o.GeneralDesign -->
</div><!-- END: 1 - Overview -->
<!--
====================================================================================================
-->
diff --git a/juneau-doc/src/main/javadoc/resources/docs.txt
b/juneau-doc/src/main/javadoc/resources/docs.txt
index b0d9c98c8..95184112c 100644
--- a/juneau-doc/src/main/javadoc/resources/docs.txt
+++ b/juneau-doc/src/main/javadoc/resources/docs.txt
@@ -320,13 +320,14 @@ msm.Installing =
#my-springboot-microservice.msm.Installing, Overview > my-sprin
msm.Running = #my-springboot-microservice.msm.Running, Overview >
my-springboot-microservice > Running in Eclipse
my-jetty-microservice = #my-jetty-microservice, Overview >
my-jetty-microservice
my-springboot-microservice = #my-springboot-microservice, Overview >
my-springboot-microservice
-o.Config = #Overview.o.Config, Overview > Overview > Config API Overview
-o.Core = #Overview.o.Core, Overview > Overview > Core Overview
-o.Dto = #Overview.o.Dto, Overview > Overview > DTO Library Overview
+o.ConfigFiles = #Overview.o.ConfigFiles, Overview > Overview > Config Files
+o.Dtos = #Overview.o.Dtos, Overview > Overview > DTOs
+o.EndToEndRest = #Overview.o.EndToEndRest, Overview > Overview > End-to-End
REST
+o.FluentAssertions = #Overview.o.FluentAssertions, Overview > Overview >
Fluent Assertions
o.GeneralDesign = #Overview.o.GeneralDesign, Overview > Overview > General
Design
-o.Rest = #Overview.o.Rest, Overview > Overview > REST Overview
-o.RestClient = #Overview.o.RestClient, Overview > Overview > REST Client
Overview
-o.RestServer = #Overview.o.RestServer, Overview > Overview > REST Server
Overview
+o.Marshalling = #Overview.o.Marshalling, Overview > Overview > Marshalling
+o.RestClient = #Overview.o.RestClient, Overview > Overview > REST Client
+o.RestServer = #Overview.o.RestServer, Overview > Overview > REST Server
package-summary.html = package-summary.html, package-summary.html
s.Marshall = #Security.s.Marshall, Overview > Security Best-Practices >
juneau-marshall
s.Rest = #Security.s.Rest, Overview > Security Best-Practices >
juneau-rest-server
diff --git a/juneau-doc/src/main/javadoc/resources/fragments/toc.html
b/juneau-doc/src/main/javadoc/resources/fragments/toc.html
index 7d82615ed..09fae218e 100644
--- a/juneau-doc/src/main/javadoc/resources/fragments/toc.html
+++ b/juneau-doc/src/main/javadoc/resources/fragments/toc.html
@@ -15,12 +15,13 @@
<ol class='toc'>
<li><p class='toc2'><a class='doclink'
href='{OVERVIEW_URL}#Overview'>Overview</a></p>
<ol>
- <li><p><a class='doclink'
href='{OVERVIEW_URL}#Overview.o.Core'>Core Overview</a><span
class='update'>created: <b>9.0.0</b></span></p>
- <li><p><a class='doclink'
href='{OVERVIEW_URL}#Overview.o.Dto'>DTO Library Overview</a><span
class='update'>created: <b>9.0.0</b></span></p>
- <li><p><a class='doclink'
href='{OVERVIEW_URL}#Overview.o.Config'>Config API Overview</a><span
class='update'>created: <b>9.0.0</b></span></p>
- <li><p><a class='doclink'
href='{OVERVIEW_URL}#Overview.o.Rest'>REST Overview</a><span
class='update'>created: <b>9.0.0</b></span></p>
- <li><p><a class='doclink'
href='{OVERVIEW_URL}#Overview.o.RestServer'>REST Server Overview</a></p>
- <li><p><a class='doclink'
href='{OVERVIEW_URL}#Overview.o.RestClient'>REST Client Overview</a><span
class='update'>created: <b>9.0.0</b></span></p>
+ <li><p><a class='doclink'
href='{OVERVIEW_URL}#Overview.o.Marshalling'>Marshalling</a><span
class='update'>created: <b>9.0.0</b></span></p>
+ <li><p><a class='doclink'
href='{OVERVIEW_URL}#Overview.o.EndToEndRest'>End-to-End REST</a><span
class='update'>created: <b>9.0.0</b></span></p>
+ <li><p><a class='doclink'
href='{OVERVIEW_URL}#Overview.o.RestServer'>REST Server</a></p>
+ <li><p><a class='doclink'
href='{OVERVIEW_URL}#Overview.o.RestClient'>REST Client</a><span
class='update'>created: <b>9.0.0</b></span></p>
+ <li><p><a class='doclink'
href='{OVERVIEW_URL}#Overview.o.Dtos'>DTOs</a><span class='update'>created:
<b>9.0.0</b></span></p>
+ <li><p><a class='doclink'
href='{OVERVIEW_URL}#Overview.o.ConfigFiles'>Config Files</a><span
class='update'>created: <b>9.0.0</b></span></p>
+ <li><p><a class='doclink'
href='{OVERVIEW_URL}#Overview.o.FluentAssertions'>Fluent Assertions</a><span
class='update'>created: <b>9.0.0</b></span></p>
<li><p><a class='doclink'
href='{OVERVIEW_URL}#Overview.o.GeneralDesign'>General Design</a><span
class='update'>created: <b>9.0.0</b></span></p>
</ol>
<li><p class='toc2'><a class='doclink'
href='{OVERVIEW_URL}#juneau-marshall'>juneau-marshall</a></p>