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
commit 43dd1068b555ac3de7a8e9546080a7f04fe80a81 Author: JamesBognar <[email protected]> AuthorDate: Fri Jun 17 09:08:35 2022 -0400 Javadocs --- .../24.jrs.ResponseProcessors.html | 2 +- .../26.jrs.SerializingUris.html | 12 +- .../06.juneau-rest-server/28.jrs.UtilityBeans.html | 104 ++++++++++++++++- .../06.juneau-rest-server/29.jrs.HtmlBeans.html | 126 +++++++++++++++++++++ .../29.jrs.UsingWithHtmlBeans.html | 27 ----- ....jrs.OtherNotes.html => 30.jrs.OtherNotes.html} | 0 .../doc-files/jrs.HtmlBeans.div.json.png | Bin 0 -> 76677 bytes .../doc-files/jrs.HtmlBeans.div.png | Bin 0 -> 64941 bytes .../doc-files/jrs.HtmlBeans.form.json.png | Bin 0 -> 141793 bytes .../doc-files/jrs.HtmlBeans.form.png | Bin 0 -> 75720 bytes .../doc-files/jrs.HtmlBeans.json.png | Bin 0 -> 80462 bytes .../doc-files/jrs.HtmlBeans.png | Bin 0 -> 92212 bytes .../doc-files/jrs.HtmlBeans.table.json.png | Bin 0 -> 79407 bytes .../doc-files/jrs.HtmlBeans.table.png | Bin 0 -> 65106 bytes .../jrs.UtilityBeans.BeanDescription.json.png | Bin 0 -> 118047 bytes .../doc-files/jrs.UtilityBeans.BeanDescription.png | Bin 0 -> 123915 bytes .../doc-files/jrs.UtilityBeans.Hyperlink.json.png | Bin 0 -> 52285 bytes .../doc-files/jrs.UtilityBeans.Hyperlink.png | Bin 0 -> 74561 bytes .../doc-files/jrs.UtilityBeans.json.png | Bin 0 -> 85771 bytes .../doc-files/jrs.UtilityBeans.png | Bin 0 -> 105911 bytes ...tyBeansResource.java => HtmlBeansResource.java} | 93 +++++++-------- .../apache/juneau/examples/rest/RootResources.java | 1 + .../juneau/examples/rest/UtilityBeansResource.java | 11 +- 23 files changed, 289 insertions(+), 87 deletions(-) diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/24.jrs.ResponseProcessors.html b/juneau-doc/docs/Topics/06.juneau-rest-server/24.jrs.ResponseProcessors.html index a9d310390..51549bff6 100644 --- a/juneau-doc/docs/Topics/06.juneau-rest-server/24.jrs.ResponseProcessors.html +++ b/juneau-doc/docs/Topics/06.juneau-rest-server/24.jrs.ResponseProcessors.html @@ -13,7 +13,7 @@ ***************************************************************************************************************************/ --> -{title:'Fluent Assertions', created:'9.0.0', flags:'TODO'} +{title:'Response Processors', created:'9.0.0', flags:'TODO'} <div class='topic'> <p> diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/26.jrs.SerializingUris.html b/juneau-doc/docs/Topics/06.juneau-rest-server/26.jrs.SerializingUris.html index e9a5460eb..ae94e3632 100644 --- a/juneau-doc/docs/Topics/06.juneau-rest-server/26.jrs.SerializingUris.html +++ b/juneau-doc/docs/Topics/06.juneau-rest-server/26.jrs.SerializingUris.html @@ -13,7 +13,7 @@ ***************************************************************************************************************************/ --> -{title:'URIs', flags:'todo'} +{title:'Serializing URIs', updated:'9.0.0'} <div class='topic'> <p> @@ -83,12 +83,12 @@ URI resolution is controlled by the following settings: </p> <ul class='javatree'> - <li class='jc'>{@link oajr.RestContext} + <li class='jc'>{@link oajr.RestContext.Builder} <ul class='javatreec'> - <li class='jf'>{@del oajr.RestContext#REST_uriAuthority REST_uriAuthority} - <li class='jf'>{@del oajr.RestContext#REST_uriContext REST_uriContext} - <li class='jf'>{@del oajr.RestContext#REST_uriRelativity REST_uriRelativity} - <li class='jf'>{@del oajr.RestContext#REST_uriResolution REST_uriResolution} + <li class='jm'>{@link oajr.RestContext.Builder#uriAuthority(String) uriAuthority(String)} + <li class='jm'>{@link oajr.RestContext.Builder#uriContext(String) uriContext(String)} + <li class='jm'>{@link oajr.RestContext.Builder#uriRelativity(UriRelativity) uriRelativity(UriRelativity)} + <li class='jm'>{@link oajr.RestContext.Builder#uriResolution(UriResolution) uriResolution(UriResolution)} </ul> </li> </ul> diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/28.jrs.UtilityBeans.html b/juneau-doc/docs/Topics/06.juneau-rest-server/28.jrs.UtilityBeans.html index 2d82b9b52..0dfda1ff1 100644 --- a/juneau-doc/docs/Topics/06.juneau-rest-server/28.jrs.UtilityBeans.html +++ b/juneau-doc/docs/Topics/06.juneau-rest-server/28.jrs.UtilityBeans.html @@ -13,16 +13,118 @@ ***************************************************************************************************************************/ --> -{title:'Utility Beans', created:'9.0.0', flags:'TODO'} +{title:'Utility Beans', created:'9.0.0'} <div class='topic'> <p> The {@link oajr.beans} package contains a set of reusable utility beans meant to help with putting together explorable REST interfaces. </p> + <p> + The {@link oaj.examples.rest.UtilityBeansResource} class shows how these beans are used. + The resource class is hosted in the example REST applications rendered below: + </p> + <img class='bordered w800' src='doc-files/jrs.UtilityBeans.png'> <h5 class='topic'>ResourceDescriptions</h5> + <p> + The {@link oaj.examples.rest.UtilityBeansResource#getChildDescriptions() getChildDescriptions()} method shows an example + of rendering a list of descriptive links for child endpoints. + </p> + <p class='bjava'> + | <ja>@RestGet</ja>(<js>"/"</js>) + | <jk>public</jk> ResourceDescriptions getChildDescriptions() { + | <jk>return</jk> ResourceDescriptions + | .<jsm>create</jsm>() + | .append(<js>"BeanDescription"</js>, <js>"Example of BeanDescription bean"</js>) + | .append(<js>"Hyperlink"</js>, <js>"Example of Hyperlink bean"</js>) + | .append(<js>"SeeOtherRoot"</js>, <js>"Example of SeeOtherRoot bean"</js>); + | } + </p> + + <h5 class='figure'>HTML representation</h5> + <img class='bordered w800' src='doc-files/jrs.UtilityBeans.png'> + + <h5 class='figure'>JSON representation</h5> + <img class='bordered w800' src='doc-files/jrs.UtilityBeans.json.png'> + <h5 class='topic'>BeanDescription</h5> + <p> + The {@link oaj.examples.rest.UtilityBeansResource#aBeanDescription() aBeanDescription()} method shows an example + of rendering simple schema information about an arbitrary bean class. + </p> + + <p class='bjava'> + | <ja>@RestGet</ja>(<js>"/BeanDescription"</js>) + | <ja>@HtmlDocConfig</ja>( + | aside={ + | <js>"<div class='text'>"</js>, + | <js>" <p>Example of serialized org.apache.juneau.rest.utilitybeans.ResourceDescriptions bean.</p>"</js>, + | <js>"</div>"</js> + | } + | ) + | <jk>public</jk> BeanDescription aBeanDescription() { + | <jk>return</jk> BeanDescription.<jsm>of</jsm>(Address.<jk>class</jk>); + | } + </p> + + <h5 class='figure'>HTML representation</h5> + <img class='bordered w800' src='doc-files/jrs.UtilityBeans.BeanDescription.png'> + + <h5 class='figure'>JSON representation</h5> + <img class='bordered w800' src='doc-files/jrs.UtilityBeans.BeanDescription.json.png'> + <h5 class='topic'>Hyperlink</h5> + <p> + The {@link oaj.examples.rest.UtilityBeansResource#aHyperlink() aHyperlink()} method shows an example + of rendering a simple hyperlink. + </p> + <p class='bjava'> + | <ja>@RestGet</ja>(<js>"/Hyperlink"</js>) + | <ja>@HtmlDocConfig</ja>( + | aside={ + | <js>"<div class='text'>"</js>, + | <js>" <p>Example of serialized org.apache.juneau.rest.utilitybeans.Hyperlink bean.</p>"</js>, + | <js>"</div>"</js> + | } + | ) + | <jk>public</jk> Hyperlink aHyperlink() { + | <jk>return</jk> Hyperlink.<jsm>create</jsm>(<js>"/utilitybeans"</js>, <js>"Back to /utilitybeans"</js>); + | } + </p> + + <h5 class='figure'>HTML representation</h5> + <img class='bordered w800' src='doc-files/jrs.UtilityBeans.Hyperlink.png'> + + <h5 class='figure'>JSON representation</h5> + <img class='bordered w800' src='doc-files/jrs.UtilityBeans.Hyperlink.json.png'> + <h5 class='topic'>SeeOtherRoot</h5> + <p> + The {@link oaj.examples.rest.UtilityBeansResource#aSeeOtherRoot() aSeeOtherRoot()} method shows an example + of sending a <c>303 See Other</c> with a <c>Location</c> header pointing to the servlet root. + </p> + <p class='bjava'> + | <ja>@RestGet</ja>(<js>"/SeeOtherRoot"</js>) + | <ja>@HtmlDocConfig</ja>( + | aside={ + | <js>"<div class='text'>"</js>, + | <js>" <p>Example of serialized org.apache.juneau.rest.utilitybeans.SeeOtherRoot bean.</p>"</js>, + | <js>"</div>"</js> + | } + | ) + | <jk>public</jk> SeeOtherRoot aSeeOtherRoot() { + | <jk>return</jk> SeeOtherRoot.<jsf>INSTANCE</jsf>; + | } + </p> + + <p> + Clicking on the link will just redirect to this same page. + </p> + <img class='bordered w800' src='doc-files/jrs.UtilityBeans.png'> + + <p> + Typically this is useful for endpoints where you want to redirect back to the servlet root, such as a DELETE. + </p> + </div> \ No newline at end of file diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/29.jrs.HtmlBeans.html b/juneau-doc/docs/Topics/06.juneau-rest-server/29.jrs.HtmlBeans.html new file mode 100644 index 000000000..47a9c52ea --- /dev/null +++ b/juneau-doc/docs/Topics/06.juneau-rest-server/29.jrs.HtmlBeans.html @@ -0,0 +1,126 @@ +<!-- +/*************************************************************************************************************************** + * 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:'Using with HTML Beans', created:'9.0.0'} + +<div class='topic'> + <p> + The {@link oaj.examples.rest.HtmlBeansResource} class shows how {@link oaj.dto.html5 HTML5 beans} can be + used to generate arbitrary HTML on REST endpoints. + </p> + <img class='bordered w800' src='doc-files/jrs.HtmlBeans.png'> + + <h5 class='topic'>table</h5> + <p> + The {@link oaj.examples.rest.HtmlBeansResource#aTable() aTable()} method shows an example + of rendering an HTML table. + </p> + + <p class='bjava'> + <jk>import static</jk> org.apache.juneau.dto.html5.HtmlBuilder.*; + + <ja>@RestGet</ja>(<js>"/table"</js>) + <ja>@HtmlDocConfig</ja>( + aside={ + <js>"<div class='text'>"</js>, + <js>" <p>Example of serialized table.</p>"</js>, + <js>"</div>"</js> + } + ) + <jk>public</jk> Table aTable() { + <jk>return</jk> <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>) + ) + ); + } + </p> + + <h5 class='figure'>HTML representation</h5> + <img class='bordered w800' src='doc-files/jrs.HtmlBeans.table.png'> + + <h5 class='figure'>JSON representation</h5> + <img class='bordered w800' src='doc-files/jrs.HtmlBeans.table.json.png'> + + <h5 class='topic'>div</h5> + <p> + The {@link oaj.examples.rest.HtmlBeansResource#aDiv() aDiv()} method shows an example + of rendering a div tag with mixed content. + </p> + <p class='bjava'> + <jk>import static</jk> org.apache.juneau.dto.html5.HtmlBuilder.*; + + <ja>@RestGet</ja>(<js>"/div"</js>) + <ja>@HtmlDocConfig</ja>( + aside={ + <js>"<div class='text'>"</js>, + <js>" <p>Example of serialized div tag.</p>"</js>, + <js>"</div>"</js> + } + ) + <jk>public</jk> HtmlElement aDiv() { + <jk>return</jk> <jsm>div</jsm>() + .children( + <jsm>p</jsm>(<js>"Juneau supports "</js>, <jsm>b</jsm>(<jsm>i</jsm>(<js>"mixed"</js>)), <js>" content!"</js>) + ) + .onmouseover(<js>"alert(\"boo!\");"</js>); + } + </p> + + <h5 class='figure'>HTML representation</h5> + <img class='bordered w800' src='doc-files/jrs.HtmlBeans.div.png'> + + <h5 class='figure'>JSON representation</h5> + <img class='bordered w800' src='doc-files/jrs.HtmlBeans.div.json.png'> + + <h5 class='topic'>form</h5> + <p> + The {@link oaj.examples.rest.HtmlBeansResource#aForm() aForm()} method shows an example + of rendering an HTML form. + </p> + <p class='bjava'> + <jk>import static</jk> org.apache.juneau.dto.html5.HtmlBuilder.*; + + <ja>@RestGet</ja>(<js>"/form"</js>) + <ja>@HtmlDocConfig</ja>( + aside={ + <js>"<div class='text'>"</js>, + <js>" <p>Example of serialized HTML form.</p>"</js>, + <js>"</div>"</js> + } + ) + <jk>public Form</jk> aForm() { + <jk>return</jk> <jsm>form</jsm>().action(<js>"/submit"</js>).method(<js>"POST"</js>) + .children( + <js>"Position (1-10000): "</js>, <jsm>input</jsm>(<js>"number"</js>).name(<js>"pos"</js>).value(1), <jsm>br</jsm>(), + <js>"Limit (1-10000): "</js>, <jsm>input</jsm>(<js>"number"</js>).name(<js>"limit"</js>).value(100), <jsm>br</jsm>(), + <jsm>button</jsm>(<js>"submit"</js>, <js>"Submit"</js>), + <jsm>button</jsm>(<js>"reset"</js>, <js>"Reset"</js>) + ); + } + </p> + + <h5 class='figure'>HTML representation</h5> + <img class='bordered w800' src='doc-files/jrs.HtmlBeans.form.png'> + + <h5 class='figure'>JSON representation</h5> + <img class='bordered w800' src='doc-files/jrs.HtmlBeans.form.json.png'> + +</div> \ No newline at end of file diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/29.jrs.UsingWithHtmlBeans.html b/juneau-doc/docs/Topics/06.juneau-rest-server/29.jrs.UsingWithHtmlBeans.html deleted file mode 100644 index 1dca235cf..000000000 --- a/juneau-doc/docs/Topics/06.juneau-rest-server/29.jrs.UsingWithHtmlBeans.html +++ /dev/null @@ -1,27 +0,0 @@ -<!-- -/*************************************************************************************************************************** - * 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:'Utility Beans', created:'9.0.0', flags:'TODO'} - -<div class='topic'> - <p> - TODO - </p> - - BeanDescription - ChildResourceDescriptions - Hyperlink - ResourceDescription -</div> \ No newline at end of file diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/29.jrs.OtherNotes.html b/juneau-doc/docs/Topics/06.juneau-rest-server/30.jrs.OtherNotes.html similarity index 100% rename from juneau-doc/docs/Topics/06.juneau-rest-server/29.jrs.OtherNotes.html rename to juneau-doc/docs/Topics/06.juneau-rest-server/30.jrs.OtherNotes.html diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.div.json.png b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.div.json.png new file mode 100644 index 000000000..a4fcba0ae Binary files /dev/null and b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.div.json.png differ diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.div.png b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.div.png new file mode 100644 index 000000000..e67312cc7 Binary files /dev/null and b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.div.png differ diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.form.json.png b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.form.json.png new file mode 100644 index 000000000..8c8da1695 Binary files /dev/null and b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.form.json.png differ diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.form.png b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.form.png new file mode 100644 index 000000000..4e2fb01a9 Binary files /dev/null and b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.form.png differ diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.json.png b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.json.png new file mode 100644 index 000000000..9580fe2c1 Binary files /dev/null and b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.json.png differ diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.png b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.png new file mode 100644 index 000000000..d698d5bf6 Binary files /dev/null and b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.png differ diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.table.json.png b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.table.json.png new file mode 100644 index 000000000..e3064b692 Binary files /dev/null and b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.table.json.png differ diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.table.png b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.table.png new file mode 100644 index 000000000..b2220cefb Binary files /dev/null and b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.HtmlBeans.table.png differ diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.BeanDescription.json.png b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.BeanDescription.json.png new file mode 100644 index 000000000..88d49ada4 Binary files /dev/null and b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.BeanDescription.json.png differ diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.BeanDescription.png b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.BeanDescription.png new file mode 100644 index 000000000..727212961 Binary files /dev/null and b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.BeanDescription.png differ diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.Hyperlink.json.png b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.Hyperlink.json.png new file mode 100644 index 000000000..d09081cb3 Binary files /dev/null and b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.Hyperlink.json.png differ diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.Hyperlink.png b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.Hyperlink.png new file mode 100644 index 000000000..8f9696d56 Binary files /dev/null and b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.Hyperlink.png differ diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.json.png b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.json.png new file mode 100644 index 000000000..3447a7c0b Binary files /dev/null and b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.json.png differ diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.png b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.png new file mode 100644 index 000000000..6fa1a0c7a Binary files /dev/null and b/juneau-doc/docs/Topics/06.juneau-rest-server/doc-files/jrs.UtilityBeans.png differ diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UtilityBeansResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/HtmlBeansResource.java similarity index 57% copy from juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UtilityBeansResource.java copy to juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/HtmlBeansResource.java index cd6a44163..95fef74b9 100644 --- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UtilityBeansResource.java +++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/HtmlBeansResource.java @@ -12,9 +12,9 @@ // *************************************************************************************************************************** package org.apache.juneau.examples.rest; -import org.apache.juneau.annotation.*; -import org.apache.juneau.examples.parser.*; -import org.apache.juneau.examples.serializer.*; +import static org.apache.juneau.dto.html5.HtmlBuilder.*; + +import org.apache.juneau.dto.html5.*; import org.apache.juneau.html.annotation.*; import org.apache.juneau.rest.annotation.*; import org.apache.juneau.rest.beans.*; @@ -27,15 +27,14 @@ import org.apache.juneau.rest.widget.*; * * <ul class='seealso'> * <li class='link'>{@doc jrs.Marshalling REST Marshalling} - * <li class='jc'>{@link ImageSerializer} - * <li class='jc'>{@link ImageParser} + * <li class='link'>{@doc jrs.HtmlBeans HtmlBeans} * <li class='extlink'>{@source} * </ul> */ @Rest( - path="/utilitybeans", - title="Utility beans examples", - description="Examples of utility bean usage." + path="/htmlbeans", + title="HTML bean examples", + description="Examples of serialized HTML beans." ) @HtmlDocConfig( widgets={ @@ -46,91 +45,95 @@ import org.apache.juneau.rest.widget.*; "api: servlet:/api", "stats: servlet:/stats", "$W{ContentTypeMenuItem}", - "source: $C{Source/gitHub}/org/apache/juneau/examples/rest/UtilityBeansResource.java" + "source: $C{Source/gitHub}/org/apache/juneau/examples/rest/HtmlBeansResource.java" }, aside={ "<div class='text'>", - " <p>Examples of serialized beans in the org.apache.juneau.rest.utilitybeans package.</p>", + " <p>Examples of serialized HTML beans.</p>", "</div>" }, asideFloat="RIGHT" ) @SuppressWarnings("javadoc") -public class UtilityBeansResource extends BasicRestObject implements BasicUniversalConfig { +public class HtmlBeansResource extends BasicRestObject implements BasicUniversalConfig { @SuppressWarnings("unused") private static final long serialVersionUID = 1L; /** - * [HTTP GET /utilitybeans] + * [HTTP GET /htmlbeans] * Returns descriptive links to the child endpoints. */ @RestGet("/") public ResourceDescriptions getChildDescriptions() { return ResourceDescriptions .create() - .append("BeanDescription", "Example of BeanDescription bean") - .append("Hyperlink", "Example of Hyperlink bean") - .append("SeeOtherRoot", "Example of SeeOtherRoot bean"); + .append("table", "Example of a serialized table") + .append("div", "Example of a serialized div tag") + .append("form", "Example of a serialized form"); } /** - * [HTTP GET /utilitybeans/BeanDescription] - * Example of serialized org.apache.juneau.rest.utilitybeans.ResourceDescriptions bean. + * [HTTP GET /htmlbeans/table] */ - @RestGet("/BeanDescription") + @RestGet("/table") @HtmlDocConfig( aside={ "<div class='text'>", - " <p>Example of serialized org.apache.juneau.rest.utilitybeans.ResourceDescriptions bean.</p>", + " <p>Example of serialized table.</p>", "</div>" } ) - public BeanDescription aBeanDescription() { - return BeanDescription.of(Address.class); - } - - @Bean(p="street,city,state,zip,isCurrent") - public static class Address { - public String street; - public String city; - public String state; - public int zip; - public boolean isCurrent; - - public Address() {} + public Table aTable() { + return table( + tr( + th("c1"), + th("c2") + ), + tr( + td("v1"), + td("v2") + ) + ); } /** - * [HTTP GET /utilitybeans/Hyperlink] - * Example of serialized org.apache.juneau.rest.utilitybeans.Hyperlink bean. + * [HTTP GET /htmlbeans/div] */ - @RestGet("/Hyperlink") + @RestGet("/div") @HtmlDocConfig( aside={ "<div class='text'>", - " <p>Example of serialized org.apache.juneau.rest.utilitybeans.Hyperlink bean.</p>", + " <p>Example of serialized div tag.</p>", "</div>" } ) - public Hyperlink aHyperlink() { - return Hyperlink.create("/utilitybeans", "Back to /utilitybeans"); + public HtmlElement aDiv() { + return div() + .children( + p("Juneau supports ", b(i("mixed")), " content!") + ) + .onmouseover("alert(\"boo!\");"); } /** - * [HTTP GET /utilitybeans/SeeOtherRoot] - * Example of serialized org.apache.juneau.rest.utilitybeans.SeeOtherRoot bean. - * This just redirects back to the servlet root. + * [HTTP GET /htmlbeans/form] */ - @RestGet("/SeeOtherRoot") + @RestGet("/form") @HtmlDocConfig( aside={ "<div class='text'>", - " <p>Example of serialized org.apache.juneau.rest.utilitybeans.SeeOtherRoot bean.</p>", + " <p>Example of serialized HTML form.</p>", "</div>" } ) - public SeeOtherRoot aSeeOtherRoot() { - return SeeOtherRoot.INSTANCE; + public Form aForm() { + return form().action("/submit").method("POST") + .children( + "Position (1-10000): ", input("number").name("pos").value(1), br(), + "Limit (1-10000): ", input("number").name("limit").value(100), br(), + button("submit", "Submit"), + button("reset", "Reset") + ); } } \ No newline at end of file diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RootResources.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RootResources.java index be53a7d2c..f90517184 100644 --- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RootResources.java +++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/RootResources.java @@ -39,6 +39,7 @@ import org.apache.juneau.serializer.annotation.*; HelloWorldResource.class, DtoExamples.class, UtilityBeansResource.class, + HtmlBeansResource.class, ConfigResource.class, ShutdownResource.class } diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UtilityBeansResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UtilityBeansResource.java index cd6a44163..e4870f58e 100644 --- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UtilityBeansResource.java +++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UtilityBeansResource.java @@ -13,8 +13,6 @@ package org.apache.juneau.examples.rest; import org.apache.juneau.annotation.*; -import org.apache.juneau.examples.parser.*; -import org.apache.juneau.examples.serializer.*; import org.apache.juneau.html.annotation.*; import org.apache.juneau.rest.annotation.*; import org.apache.juneau.rest.beans.*; @@ -27,8 +25,7 @@ import org.apache.juneau.rest.widget.*; * * <ul class='seealso'> * <li class='link'>{@doc jrs.Marshalling REST Marshalling} - * <li class='jc'>{@link ImageSerializer} - * <li class='jc'>{@link ImageParser} + * <li class='link'>{@doc jrs.UtilityBeans Utility Beans} * <li class='extlink'>{@source} * </ul> */ @@ -82,7 +79,7 @@ public class UtilityBeansResource extends BasicRestObject implements BasicUniver @HtmlDocConfig( aside={ "<div class='text'>", - " <p>Example of serialized org.apache.juneau.rest.utilitybeans.ResourceDescriptions bean.</p>", + " <p>Example of serialized ResourceDescriptions bean.</p>", "</div>" } ) @@ -109,7 +106,7 @@ public class UtilityBeansResource extends BasicRestObject implements BasicUniver @HtmlDocConfig( aside={ "<div class='text'>", - " <p>Example of serialized org.apache.juneau.rest.utilitybeans.Hyperlink bean.</p>", + " <p>Example of serialized Hyperlink bean.</p>", "</div>" } ) @@ -119,7 +116,7 @@ public class UtilityBeansResource extends BasicRestObject implements BasicUniver /** * [HTTP GET /utilitybeans/SeeOtherRoot] - * Example of serialized org.apache.juneau.rest.utilitybeans.SeeOtherRoot bean. + * Example of serialized SeeOtherRoot bean. * This just redirects back to the servlet root. */ @RestGet("/SeeOtherRoot")
