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 2020/01/05 18:00:42 UTC
[juneau] branch master updated: JUNEAU-174 Allow configuration
properties to be set globally
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 11aa683 JUNEAU-174 Allow configuration properties to be set globally
11aa683 is described below
commit 11aa68319c666cc78b4a639c714fa24cf1fbc9b6
Author: JamesBognar <ja...@apache.org>
AuthorDate: Sun Jan 5 13:00:23 2020 -0500
JUNEAU-174 Allow configuration properties to be set globally
---
.../src/main/java/org/apache/juneau/PropertyStore.java | 10 ++++++++++
juneau-doc/docs/ReleaseNotes/8.1.3.html | 6 ++++++
.../Topics/02.juneau-marshall/06.ConfigurableProperties.html | 9 +++++++--
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java
index 7cca861..0e005d8 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java
@@ -240,6 +240,16 @@ public final class PropertyStore {
if (s != null)
return PropertyStoreBuilder.MutableProperty.create(k, s).build();
+ try {
+ String ke = key.replace('.', '_');
+ s = System.getenv(ke);
+ if (s != null)
+ return PropertyStoreBuilder.MutableProperty.create(k, s).build();
+ s = System.getenv(ke.toUpperCase());
+ if (s != null)
+ return PropertyStoreBuilder.MutableProperty.create(k, s).build();
+ } catch (SecurityException e) {}
+
return null;
}
diff --git a/juneau-doc/docs/ReleaseNotes/8.1.3.html b/juneau-doc/docs/ReleaseNotes/8.1.3.html
index 05cb78c..c8f5748 100644
--- a/juneau-doc/docs/ReleaseNotes/8.1.3.html
+++ b/juneau-doc/docs/ReleaseNotes/8.1.3.html
@@ -25,6 +25,12 @@
Better representation of nulls for XML and HTML content properties.
<br>Old: <js>"<myBean><null></myBean>"</js>
<br>New: <js>"<myBean nil='true'></myBean>"</js>
+ <li>
+ Configurable properties such as {@link oaj.BeanContext#BEAN_debug} can now be set globally by either
+ system properties or environment variables.
+ <br>For <jsf>BEAN_debug</jsf> which resolves to <js>"BEAN_debug"</js>, you can use either the system
+ property <js>"BeanContext.debug.b"</js> or environment variables <js>"BeanContext_debug_b"</js> or
+ <js>"BEANCONTEXT_DEBUG_B"</js>.
</ul>
<h5 class='topic w800'>juneau-rest-server</h5>
diff --git a/juneau-doc/docs/Topics/02.juneau-marshall/06.ConfigurableProperties.html b/juneau-doc/docs/Topics/02.juneau-marshall/06.ConfigurableProperties.html
index d8e5c8f..1fcc51a 100644
--- a/juneau-doc/docs/Topics/02.juneau-marshall/06.ConfigurableProperties.html
+++ b/juneau-doc/docs/Topics/02.juneau-marshall/06.ConfigurableProperties.html
@@ -13,7 +13,7 @@
***************************************************************************************************************************/
-->
-Configurable Properties
+{updated} Configurable Properties
<p>
Serializers and parsers have a wide variety of configurable properties. They all extend from the
@@ -78,8 +78,13 @@ Configurable Properties
<p class='bpcode w800'>
<jc>// Clone and customize an existing serializer.</jc>
WriterSerializer s = SimpleJsonSerializer.<jsf>DEFAULT</jsf>
-
.builder() <jc>// Create a new builder with copied settings.</jc>
.quoteChar(<js>'"'</js>) <jc>// Use a different quote character.</jc>
.build();
</p>
+<p>
+ Configurable properties can be set globally using either system properties or environment variables.
+ <br>For example, the <jsf>WSERIALIZER_useWhitespace</jsf> variable resolves to the string <js>"WriterSerializer.useWhitespace.b"</js>.
+ This setting can be enabled by setting the system property <js>"WriterSerializer.useWhitespace"</js> or environment
+ variables <js>"WriterSerializer_useWhitespace"</js> or <js>"WRITERSERIALIZER_USEWHITESPACE"</js> to <js>"true"</js>.
+</p>