This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/juneau-website.git
The following commit(s) were added to refs/heads/asf-site by this push:
new f1c0831 Javadoc updates.
f1c0831 is described below
commit f1c0831e8457b8ec495ae43f01e067beed4e659b
Author: JamesBognar <[email protected]>
AuthorDate: Mon Mar 5 10:22:30 2018 -0500
Javadoc updates.
---
.../juneau-examples-rest.ConfigResource.1.png | Bin 0 -> 153114 bytes
.../juneau-examples-rest.ConfigResource.2.png | Bin 0 -> 269953 bytes
content/site/apidocs/overview-summary.html | 133 ++++++++++-----------
3 files changed, 65 insertions(+), 68 deletions(-)
diff --git
a/content/site/apidocs/doc-files/juneau-examples-rest.ConfigResource.1.png
b/content/site/apidocs/doc-files/juneau-examples-rest.ConfigResource.1.png
new file mode 100644
index 0000000..38fb734
Binary files /dev/null and
b/content/site/apidocs/doc-files/juneau-examples-rest.ConfigResource.1.png
differ
diff --git
a/content/site/apidocs/doc-files/juneau-examples-rest.ConfigResource.2.png
b/content/site/apidocs/doc-files/juneau-examples-rest.ConfigResource.2.png
new file mode 100644
index 0000000..0a33d35
Binary files /dev/null and
b/content/site/apidocs/doc-files/juneau-examples-rest.ConfigResource.2.png
differ
diff --git a/content/site/apidocs/overview-summary.html
b/content/site/apidocs/overview-summary.html
index e6dd9f4..e63b2f0 100644
--- a/content/site/apidocs/overview-summary.html
+++ b/content/site/apidocs/overview-summary.html
@@ -16394,18 +16394,24 @@
<a id="juneau-examples-rest.ConfigResource"></a>
<h4 class='topic' onclick='toggle(this)'>12.15 - ConfigResource</h4>
<div class='topic'>
- <!--p>
+ <p>
The <a
href="org/apache/juneau/microservice/resources/ConfigResource.html"
title="class in
org.apache.juneau.microservice.resources"><code>ConfigResource</code></a> class
is a predefined reusable resource.
<br>It provides a REST interface for reading and altering the
microservice config file.
</p>
<p>
Pointing a browser to the resource shows the following:
</p>
- <img class='bordered'
src='doc-files/juneau-examples-rest.ConfigResource.1.png'>
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/config
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.ConfigResource.1.png' style='width:800px'>
<p>
An edit page is provided for altering the raw config file:
</p>
- <img class='bordered'
src='doc-files/juneau-examples-rest.ConfigResource.3.png'>
+ <p class='bcode' style='width:800px;'>
+ http://localhost:10000/config/edit
+ </p>
+ <img class='bordered'
src='doc-files/juneau-examples-rest.ConfigResource.2.png' style='width:800px'>
<p>
The <a href="org/apache/juneau/config/Config.html" title="class in
org.apache.juneau.config"><code>Config</code></a> class is a serializable POJO,
which makes the resource
relatively straightforward to implement.
@@ -16429,7 +16435,6 @@
)
)
<jk>public class</jk> ConfigResource <jk>extends</jk> BasicRestServlet {
- <jk>private static final long</jk> <jsf>serialVersionUID</jsf> = 1L;
<jd>/**
* [GET /] - Show contents of config file.
@@ -16438,9 +16443,9 @@
* <ja>@throws</ja> Exception
*/</jd>
<ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/"</js>,
description=<js>"Show contents of config file."</js>)
- <jk>public</jk> Config getConfigContents() <jk>throws</jk> Exception {
- <jk>return</jk> getConfig();
- }
+ <jk>public</jk> ObjectMap getConfig() <jk>throws</jk> Exception {
+ <jk>return</jk> getServletConfig().getConfig().asMap();
+ }
<jd>/**
* [GET /edit] - Show config file edit page.
@@ -16449,13 +16454,21 @@
* <ja>@return</ja> The config file as a reader resource.
* <ja>@throws</ja> Exception
*/</jd>
- <ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/edit"</js>,
description=<js>"Show config file edit page."</js>)
- <jk>public</jk> ReaderResource getConfigEditPage(RestRequest req)
<jk>throws</jk> Exception {
- <jc>// Note that you don't want variables in the config file to be
resolved,</jc>
- <jc>// so you need to escape any $ characters that you see.</jc>
- req.setAttribute(<js>"contents"</js>,
getConfig().toString().replaceAll(<js>"\\$"</js>, <js>"\\\\\\$"</js>));
- <jk>return</jk>
req.getClasspathReaderResource(<js>"ConfigEdit.html"</js>, <jk>true</jk>);
- }
+ <ja>@RestMethod</ja>(name=<jsf>GET></jsf>, path="/edit",
description="Edit config file.")
+ <jk>public</jk> Form getConfigEditForm(RestRequest req) <jk>throws</jk>
Exception {
+ <jk>return</jk>
<jsm>form</jsm>().id(<js>"form"</js>).action(<js>"servlet:/"</js>).method(<js>"POST"</js>).enctype(<js>"application/x-www-form-urlencoded"</js>).children(
+ <jsm>div</jsm>()._class(<js>"data"</js>).children(
+ <jsm>table</jsm>(
+
<jsm>tr</jsm>(<jsm>td</jsm>().style(<js>"text-align:right"</js>).children(<jsm>button</jsm>(<js>"submit"</js>,<js>"Submit"</js>),<jsm>button</jsm>(<js>"reset"</js>,<js>"Reset"</js>))),
+ <jsm>tr</jsm>(<jsm>th</jsm>().child(<js>"Contents"</js>)),
+ <jsm>tr</jsm>(<jsm>th</jsm>().child(
+
<jsm>textarea</jsm>().name(<js>"contents"</js>).rows(40).cols(120).style(<js>"white-space:pre;word-wrap:normal;overflow-x:scroll;font-family:monospace;"</js>)
+ .text(getServletConfig().getConfig().toString()))
+ )
+ )
+ )
+ );
+ }
<jd>/**
* [GET /{section}] - Show config file section.
@@ -16466,9 +16479,11 @@
*/</jd>
<ja>@RestMethod</ja>(name=<jsf>GET</jsf>, path=<js>"/{section}"</js>,
description=<js>"Show config file section."</js>,
- parameters={
- <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"section"</js>,
description=<js>"Section name."</js>)
- }
+ swagger=<ja>@MethodSwagger</ja>(
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"path"</js>,
name=<js>"section"</js>, description=<js>"Section name."</js>)
+ }
+ )
)
<jk>public</jk> ObjectMap
getConfigSection(<ja>@Path</ja>(<js>"section"</js>) String section)
<jk>throws</jk> Exception {
<jk>return</jk> getSection(section);
@@ -16484,10 +16499,12 @@
*/</jd>
<ja>@RestMethod</ja>(name=<jsf>GET</jsf>,
path=<js>"/{section}/{key}"</js>,
description=<js>"Show config file entry."</js>,
- parameters={
- <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"section"</js>,
description=<js>"Section name."</js>),
- <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"key"</js>,
description=<js>"Entry name."</js>)
- }
+ swagger=<ja>@MethodSwagger</ja>(
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"path"</js>,
name=<js>"section"</js>, description=<js>"Section name."</js>),
+ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"key"</js>,
description=<js>"Entry name."</js>)
+ }
+ )
)
<jk>public</jk> String getConfigEntry(<ja>@Path</ja>(<js>"section"</js>)
String section, <ja>@Path</ja>(<js>"key"</js>) String key) <jk>throws</jk>
Exception {
<jk>return</jk> getSection(section).getString(key);
@@ -16502,9 +16519,11 @@
*/</jd>
<ja>@RestMethod</ja>(name=<jsf>POST</jsf>, path=<js>"/"</js>,
description=<js>"Sets contents of config file from a FORM
post."</js>,
- parameters={
- <ja>@Parameter</ja>(in=<js>"formData"</js>,
name=<js>"contents"</js>, description=<js>"New contents in INI file
format."</js>)
- }
+ swagger=<ja>@MethodSwagger</ja>(
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"formData"</js>,
name=<js>"contents"</js>, description=<js>"New contents in INI file
format."</js>)
+ }
+ )
)
<jk>public</jk> Config
setConfigContentsFormPost(<ja>@FormData</ja>(<js>"contents"</js>) String
contents) <jk>throws</jk> Exception {
<jk>return</jk> setConfigContents(<jk>new</jk>
StringReader(contents));
@@ -16519,13 +16538,14 @@
*/</jd>
<ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/"</js>,
description=<js>"Sets contents of config file."</js>,
- parameters={
- <ja>@Parameter</ja>(in=<js>"body"</js>, description=<js>"New
contents in INI file format."</js>)
- }
+ swagger=<ja>@MethodSwagger</ja>(
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"body"</js>, description=<js>"New
contents in INI file format."</js>)
+ }
+ )
)
<jk>public</jk> Config setConfigContents(<ja>@Body</ja> Reader contents)
<jk>throws</jk> Exception {
- Config cf2 = Config.<jsm>create</jsm>().build().load(contents);
- <jk>return</jk> getConfig().merge(cf2).save();
+ <jk>return</jk> getServletConfig().getConfig().load(contents,
<jk>true</jk>).asMap();
}
<jd>/**
@@ -16538,13 +16558,15 @@
*/</jd>
<ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/{section}"</js>,
description=<js>"Add or overwrite a config file section."</js>,
- parameters={
- <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"section"</js>,
description=<js>"Section name."</js>),
- <ja>@Parameter</ja>(in=<js>"body"</js>, description=<js>"New
contents for section as a simple map with string keys and values."</js>)
- }
+ swagger=<ja>@MethodSwagger</ja>(
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"path"</js>,
name=<js>"section"</js>, description=<js>"Section name."</js>),
+ <ja>@Parameter</ja>(in=<js>"body"</js>, description=<js>"New
contents for section as a simple map with string keys and values."</js>)
+ }
+ )
)
<jk>public</jk> ObjectMap
setConfigSection(<ja>@Path</ja>(<js>"section"</js>) String section,
<ja>@Body</ja> Map<String,String> contents) <jk>throws</jk> Exception {
- getConfig().setSection(section, contents);
+ getServletConfig().getConfig().setSection(section, contents);
<jk>return</jk> getSection(section);
}
@@ -16559,52 +16581,27 @@
*/</jd>
<ja>@RestMethod</ja>(name=<jsf>PUT</jsf>,
path=<js>"/{section}/{key}"</js>,
description=<js>"Add or overwrite a config file entry."</js>,
- parameters={
- <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"section"</js>,
description=<js>"Section name."</js>),
- <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"key"</js>,
description=<js>"Entry name."</js>),
- <ja>@Parameter</ja>(in=<js>"body"</js>, description=<js>"New value
as a string."</js>)
- }
+ swagger=<ja>@MethodSwagger</ja>(
+ parameters={
+ <ja>@Parameter</ja>(in=<js>"path"</js>,
name=<js>"section"</js>, description=<js>"Section name."</js>),
+ <ja>@Parameter</ja>(in=<js>"path"</js>, name=<js>"key"</js>,
description=<js>"Entry name."</js>),
+ <ja>@Parameter</ja>(in=<js>"body"</js>, description=<js>"New
value as a string."</js>)
+ }
+ )
)
<jk>public</jk> String
setConfigSection(<ja>@Path</ja>(<js>"section"</js>) String section,
<ja>@Path</ja>(<js>"key"</js>) String key, <ja>@Body</ja> String value)
<jk>throws</jk> Exception {
- getConfig().put(section, key, value, <jk>false</jk>);
+ getServletConfig().getConfig().put(section, key, value,
<jk>false</jk>);
<jk>return</jk> getSection(section).getString(key);
}
<jk>private</jk> ObjectMap getSection(String name) {
- ObjectMap m = getConfig().getSectionMap(name);
+ ObjectMap m = getServletConfig().getConfig().getSectionMap(name);
<jk>if</jk> (m == <jk>null</jk>)
<jk>throw new</jk> RestException(SC_NOT_FOUND, <js>"Section not
found."</js>);
<jk>return</jk> m;
}
}
</p>
-
- <h5 class='figure'>ConfigEdit.html</h5>
- <b>TODO - Needs update</b>
- <p class='bcode'>
- <xt><html></xt>
- <xt><head></xt>
- <xt><meta</xt> <xa>http-equiv</xa>=<xs>'Content-Type'</xs>
<xa>content</xa>=<xs>'text/html; <xa>charset</xa>=UTF-8'</xs><xt>></xt>
- <xt><style</xt> <xa>type</xa>=<xs>'text/css'</xs><xt>></xt>
- <xt>@import</xt> <xs>'$R{servletURI}/style.css'</xs>;
- <xt></style></xt>
- <xt></head></xt>
- <xt><body></xt>
- <xt><h1></xt>$R{resourceTitle}<xt></h1></xt>
- <xt><h2></xt>Edit config file<xt></h2></xt>
- <xt><p</xt>
<xa>class</xa>=<xs>'links'</xs><xt>></xt><xt><a</xt>
<xa>href</xa>=<xs>'$R{requestParentURI}'</xs><xt>></xt>up<xt></a></xt>
- <xt><a</xt>
<xa>href=<xs>'$R{servletURI}?method</xa>=OPTIONS'</xs><xt>></xt>options<xt></a></xt><xt></p></xt>
- <xt><form</xt> <xa>id</xa>=<xs>'form'</xs>
<xa>action</xa>=<xs>'$R{servletURI}'</xs> <xa>method</xa>=<xs>'POST'</xs>
<xa>enctype</xa>=<xs>'application/x-www-form-urlencoded'</xs><xt>></xt>
- <xt><div</xt> <xa>class</xa>=<xs>'data'</xs><xt>></xt>
- <xt><table></xt>
- <xt><tr></xt><xt><td</xt>
<xa>colspan</xa>=<xs>'2'</xs>
<xa>align</xa>=<xs>'right'</xs><xt>></xt><xt><button</xt>
<xa>type</xa>=<xs>'submit'</xs><xt>></xt>Submit<xt></button></xt><xt><button</xt>
<xa>type</xa>=<xs>'reset'</xs><xt>></xt>Reset<xt></button></xt><xt></td></xt><xt></tr></xt>
- <xt><tr></xt><xt><th</xt>
<xa>colspan</xa>=<xs>'2'</xs><xt>></xt>Contents<xt></th></xt><xt></tr></xt>
- <xt><tr></xt><xt><td</xt>
<xa>colspan</xa>=<xs>'2'</xs><xt>></xt><xt><textarea</xt>
<xa>name</xa>=<xs>'contents'</xs> <xa>rows</xa>=<xs>'40'</xs>
<xa>cols</xa>=<xs>'120'</xs> <xa>style</xa>=<xs>'white-space: pre; word-wrap:
normal; overflow-x:
scroll;'</xs><xt>></xt>$SA{contents}<xt></textarea></xt><xt></td></xt><xt></tr></xt>
- <xt></table></xt>
- <xt></div></xt>
- <xt></form></xt>
- <xt></body></xt>
- <xt></html></xt>
- </p-->
</div>
<!--
=======================================================================================================
-->
--
To stop receiving notification emails like this one, please contact
[email protected].