You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2017/02/21 14:44:28 UTC

incubator-juneau-website git commit: Add to config file section.

Repository: incubator-juneau-website
Updated Branches:
  refs/heads/asf-site 356633127 -> c426760d8


Add to config file section.

Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/commit/c426760d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/tree/c426760d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/diff/c426760d

Branch: refs/heads/asf-site
Commit: c426760d87f6197d32b525106deb28ce3dda2561
Parents: 3566331
Author: JamesBognar <ja...@apache.org>
Authored: Tue Feb 21 09:44:25 2017 -0500
Committer: JamesBognar <ja...@apache.org>
Committed: Tue Feb 21 09:44:25 2017 -0500

----------------------------------------------------------------------
 content/about.html | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/c426760d/content/about.html
----------------------------------------------------------------------
diff --git a/content/about.html b/content/about.html
index 5f732ac..112e699 100644
--- a/content/about.html
+++ b/content/about.html
@@ -742,6 +742,23 @@
 	String myArg = cf.getString(<js>"MySection/myArg"</js>); 
 	String firstArg = cf.getString(<js>"MySection/firstArg"</js>); 
 	</p>
+	<p>
+		One of the more powerful aspects of the REST servlets is that you can pull values directly from
+		config files by using the <js>"$C"</js> variable in annotations.
+		<br>For example, the HTML stylesheet for your REST servlet can be defined in a config file like so:
+	</p>
+	<p class='bcode'>
+	<ja>@RestResource</ja>(
+		path=<js>"/myResource"</js>,
+		config=<js>"$S{my.config.file}"</js>,  <js>// Path to config file (here pulled from a system property)</js>
+		stylesheet=<js>"$C{MyResourceSettings/myStylesheet}"</js>  <js>// Stylesheet location pulled from config file.</js>
+	)
+	<jk>public class</jk> MyResource <jk>extends</jk> RestServlet {
+	</p>
+	<p>
+		The Config API also contains a listener API that allows you to, for example, reinitialize your REST
+		resource if the config file changes.
+	</p>
 	<br><br><hr>
 	<p>
 		The microservice API combines all the features above with a built-in Jetty server to produce a lightweight