Skip to content

Commit ce1bdef

Browse files
senivamjansupol
authored andcommitted
Jersey Configuration documentation (eclipse-ee4j#4371)
Signed-off-by: Maxim Nesen <maxim.nesen@oracle.com> (cherry picked from commit f2ccfd5)
1 parent 2df5080 commit ce1bdef

File tree

3 files changed

+99
-2
lines changed

3 files changed

+99
-2
lines changed

docs/src/main/docbook/jersey.ent

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="iso-8859-1" ?>
22
<!--
33
4-
Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
4+
Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
55
66
This program and the accompanying materials are made available under the
77
terms of the Eclipse Public License v. 2.0, which is available at
@@ -100,6 +100,9 @@
100100
<!ENTITY rxjava.uri "https://github.com/ReactiveX/RxJava">
101101
<!ENTITY wikipedia.uri "http://en.wikipedia.org/wiki/">
102102
<!ENTITY jira.uri.prefix "https://github.com/eclipse-ee4j/jersey/issues">
103+
<!ENTITY microprofile.spec.link "<link xlink:href='https://microprofile.io/project/eclipse/microprofile-config'>Microprofile Config Specification</link>">
104+
<!ENTITY helidon.link "<link xlink:href='https://helidon.io/'>Helidon</link>">
105+
<!ENTITY smallrye.link "<link xlink:href='https://smallrye.io/'>SmallRye</link>">
103106

104107
<!-- API Docs links -->
105108
<!ENTITY bv.Configuration "<link xlink:href='&bv11.javadoc.uri;/javax/validation/Configuration.html'>Configuration</link>">

docs/src/main/docbook/mp-config.xml

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
4+
Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
5+
6+
This program and the accompanying materials are made available under the
7+
terms of the Eclipse Public License v. 2.0, which is available at
8+
http://www.eclipse.org/legal/epl-2.0.
9+
10+
This Source Code may also be made available under the following Secondary
11+
Licenses when the conditions for such availability set forth in the
12+
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
13+
version 2 with the GNU Classpath Exception, which is available at
14+
https://www.gnu.org/software/classpath/license.html.
15+
16+
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
17+
18+
-->
19+
20+
<!DOCTYPE chapter [<!ENTITY % ents SYSTEM "jersey.ent" > %ents; ]>
21+
<chapter xmlns="http://docbook.org/ns/docbook"
22+
version="5.0"
23+
xml:lang="en"
24+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
25+
xmlns:xi="http://www.w3.org/2001/XInclude"
26+
xmlns:xlink="http://www.w3.org/1999/xlink"
27+
xsi:schemaLocation="http://docbook.org/ns/docbook http://docbook.org/xml/5.0/xsd/docbook.xsd
28+
http://www.w3.org/1999/xlink http://www.w3.org/1999/xlink.xsd"
29+
xml:id="jersey-configuration">
30+
<title>Jersey configuration</title>
31+
<para>
32+
This chapter provides Jersey configuration basics which includes configuration using default configuration
33+
provider (included in Jersey by default) using system properties. And micro-profile configuration extension
34+
which allows plugging-in of configuration modules based on micro profile configuration specification
35+
</para>
36+
<section xml:id="default-config">
37+
<title>Jersey default configuration provider</title>
38+
<para>
39+
Since Jersey 2.29 it is possible to turn on the ability to convert the System properties into
40+
Configuration properties. That can be done by using the System property, too:
41+
<programlisting language="bash" linenumbering="unnumbered">java -Djersey.config.allowSystemPropertiesProvider=true -DNAME=VALUE
42+
</programlisting>
43+
Note that with the security manager turned on, write access permission is required to execute
44+
System.getProperties(). With insufficient permissions, the warning message is logged (with Level.FINER) and
45+
only &jersey.common.CommonProperties;, &jersey.client.ClientProperties;,
46+
and &jersey.server.ServerProperties;
47+
properties are used, as the property names are known and System.getProperty(name) method can be used,
48+
which does not require the write access permission.
49+
</para>
50+
</section>
51+
<section xml:id="mp-config">
52+
<title>Micro profile configuration provider</title>
53+
<para>
54+
Microprofile platform became very popular lately and &microprofile.spec.link;
55+
is a recommended way in the Jakarta EE world to configure the specifications under the Jakarta EE umbrella.
56+
</para>
57+
<para>
58+
Jersey 2.29 comes with support for Microprofile Config implementation such as &helidon.link; or &smallrye.link;.
59+
To configure the Jersey application, the microprofile-config.properties file needs to be created in the
60+
META-INF folder. The required properties are then simply set in the microprofile-config.properties:
61+
<programlisting language="java" linenumbering="unnumbered">
62+
NAME=VALUE
63+
</programlisting>
64+
</para>
65+
<para>
66+
Then Jersey Microprofile Config extension is needed to be added:
67+
<programlisting language="xml" linenumbering="unnumbered">
68+
&lt;dependency>
69+
&lt;groupId>org.glassfish.jersey.ext.microprofile&lt;/groupId>
70+
&lt;artifactId>jersey-mp-config&lt;/artifactId>
71+
&lt;version>2.30&lt;/scope>
72+
&lt;/dependency>
73+
</programlisting>
74+
And the Microprofile Config implementation, such as Helidon:
75+
<programlisting language="xml" linenumbering="unnumbered">
76+
&lt;dependency>
77+
&lt;groupId>io.helidon.microprofile.config&lt;/groupId>
78+
&lt;artifactId>helidon-microprofile-config&lt;/artifactId>
79+
&lt;version>1.3.1&lt;/version>
80+
&lt;/dependency>
81+
</programlisting>
82+
Or SmallRye:
83+
<programlisting language="xml" linenumbering="unnumbered">
84+
&lt;dependency>
85+
&lt;groupId>io.smallrye&lt;/groupId>
86+
&lt;artifactId>smallrye-config&lt;/artifactId>
87+
&lt;version>1.3.6&lt;/version>
88+
&lt;/dependency>
89+
</programlisting>
90+
or any other suitable Microprofile Config implementation.
91+
</para>
92+
</section>
93+
</chapter>

docs/src/main/docbook/user-guide.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<!--
33
4-
Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
4+
Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
55
66
This program and the accompanying materials are made available under the
77
terms of the Eclipse Public License v. 2.0, which is available at
@@ -104,6 +104,7 @@ This line fits the page width.
104104
<xi:include href="uris-and-links.xml" />
105105
<xi:include href="declarative-linking.xml" />
106106
<xi:include href="resource-builder.xml" />
107+
<xi:include href="mp-config.xml" />
107108
<xi:include href="sse.xml" />
108109
<xi:include href="security.xml" />
109110
<xi:include href="wadl.xml" />

0 commit comments

Comments
 (0)