Skip to content

Commit bbff3b6

Browse files
authored
Jakartified User Guide - first 10 chapters (#4653)
Jakartified User Guide: chapters 1 - 10 Signed-off-by: Maxim Nesen <maxim.nesen@oracle.com>
1 parent cae04f9 commit bbff3b6

File tree

11 files changed

+218
-234
lines changed

11 files changed

+218
-234
lines changed

docs/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@
193193
<javanet.repository.id>snapshots</javanet.repository.id>
194194
<jersey.docs.version>snapshot</jersey.docs.version>
195195
<jersey.apidocs.version>snapshot</jersey.apidocs.version>
196-
<jersey.src.branch>master</jersey.src.branch>
196+
<jersey.src.branch>3.x</jersey.src.branch>
197197
<jaxrs.version>${jaxrs.api.spec.version}</jaxrs.version>
198198
<jaxrs.impl.version>${jaxrs.api.impl.version}</jaxrs.impl.version>
199199
</properties>

docs/src/main/docbook/client.xml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<!--
33
4-
Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
4+
Copyright (c) 2010, 2021 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
@@ -31,7 +31,7 @@
3131

3232
<para>
3333
This section introduces the JAX-RS Client API, which is a fluent Java based API for communication with RESTful Web
34-
services. This standard API that is also part of Java EE 7 is designed to make it very easy to consume a Web service
34+
services. This standard API that is also part of Jakarta EE 9 is designed to make it very easy to consume a Web service
3535
exposed via HTTP protocol and enables developers to concisely and efficiently implement portable client-side solutions
3636
that leverage existing and well established client-side HTTP connector implementations.
3737
</para>
@@ -746,7 +746,7 @@ Client client = ClientBuilder.newClient(clientConfig);</programlisting>
746746
into the &lit.jersey.client.ClientConfig;. The &lit.jersey.grizzly.GrizzlyConnectorProvider; is used as a custom
747747
connector provider in the example above. Please note that the connector provider cannot be registered as a provider
748748
using &lit.jaxrs.core.Configurable;<literal>.register(...)</literal>. Also, please note that in this API has changed
749-
in Jersey 2.5, where the &lit.jersey.client.ConnectorProvider; SPI has been introduced in order to decouple client
749+
since Jersey 2.5, where the &lit.jersey.client.ConnectorProvider; SPI has been introduced in order to decouple client
750750
initialization from the connector instantiation. Starting with Jersey 2.5 it is therefore not possible to directly
751751
register &lit.jersey.client.Connector; instances in the Jersey &jersey.client.ClientConfig;. The new
752752
&lit.jersey.client.ConnectorProvider; SPI must be used instead to configure a custom client-side transport connector.
@@ -822,33 +822,33 @@ System.out.println("Now the connection is closed.");</programlisting>
822822
</para>
823823
<para>
824824
To solve injection of a custom type into a client provider instance
825-
use &jersey.client.ServiceLocatorClientProvider; to
825+
use &jersey.client.InjectionManagerClientProvider; to
826826
extract &hk2.ServiceLocator; which can return the required injection. The following example shows how to utilize
827-
&lit.jersey.client.ServiceLocatorClientProvider;:
827+
&lit.jersey.client.InjectionManagerClientProvider;:
828828
</para>
829829
<example>
830-
<title>ServiceLocatorClientProvider example</title>
830+
<title>InjectionManagerClientProvider example</title>
831831
<programlisting language="java" linenumbering="numbered">public static class MyRequestFilter implements ClientRequestFilter {
832832
// this injection does not work as filter is registered as an instance:
833833
// @Inject
834834
// private MyInjectedService service;
835835

836836
@Override
837837
public void filter(ClientRequestContext requestContext) throws IOException {
838-
// use ServiceLocatorClientProvider to extract HK2 ServiceLocator from request
839-
final ServiceLocator locator = ServiceLocatorClientProvider.getServiceLocator(requestContext);
838+
// use InjectionManagerClientProvider to extract InjectionManager from request
839+
final InjectionManager injectionManager = InjectionManagerClientProvider.getInjectionManager(requestContext);
840840

841841
// and ask for MyInjectedService:
842-
final MyInjectedService service = locator.getService(MyInjectedService.class);
842+
final MyInjectedService service = injectionManager.getInstance(MyInjectedService.class);
843843

844844
final String name = service.getName();
845845
...
846846
}
847847
}</programlisting>
848848
</example>
849849
<para>
850-
For more information see javadoc of &jersey.client.ServiceLocatorClientProvider;
851-
(and javadoc of &jersey.common.ServiceLocatorProvider; which supports common JAX-RS components).
850+
For more information see javadoc of &jersey.client.InjectionManagerClientProvider;
851+
(and javadoc of &jersey.common.InjectionManagerProvider; which supports common JAX-RS components).
852852
</para>
853853
</section>
854854

@@ -897,7 +897,7 @@ Client client = ClientBuilder.newBuilder().sslContext(sslContext).build();</prog
897897
A behaviour of &jdk6.HostnameVerifier; is dependent on an http client implementation.
898898
&lit.jersey.client.HttpUrlConnectorProvider; and &lit.jersey.apache.ApacheConnectorProvider; work properly, that means that after
899899
the unsuccessful URL verification &lit.jdk6.HostnameVerifier; is called and by means of it is possible to
900-
revalidate URL using a custom implementation of &lit.jdk6.HostnameVerifier; and go on in a handskahe processing.
900+
revalidate URL using a custom implementation of &lit.jdk6.HostnameVerifier; and go on in a handshake processing.
901901
&lit.jersey.jetty.JettyConnectorProvider; and &lit.jersey.grizzly.GrizzlyConnectorProvider; provide only host URL verification
902902
and throw a &lit.jdk6.CertificateException; without any possibility to use custom &lit.jdk6.HostnameVerifier;.
903903
Moreover, in case of &lit.jersey.jetty.JettyConnectorProvider; there is a property
@@ -923,12 +923,11 @@ Client client = ClientBuilder.newBuilder().sslContext(sslContext).build();</prog
923923
<para>Jersey supports Basic and Digest HTTP Authentication.</para>
924924
<important>
925925
<para>
926-
In version prior to Jersey 2.5 the support was
927-
provided by <literal>org.glassfish.jersey.client.filter.HttpBasicAuthFilter</literal>
928-
and <literal>org.glassfish.jersey.client.filter.HttpDigestAuthFilter</literal>. Since Jersey
929-
2.5 these filters are deprecated (and removed in 2.6) and both authentication methods
930-
are provided by single &lit.jaxrs.core.Feature;
926+
In version of Jersey 3.x both authentication methods are provided by single &lit.jaxrs.core.Feature;
931927
&jersey.client.HttpAuthenticationFeature;.
928+
For migration of older applications: <literal>org.glassfish.jersey.client.filter.HttpBasicAuthFilter</literal>
929+
and <literal>org.glassfish.jersey.client.filter.HttpDigestAuthFilter</literal> shall be replaced by
930+
those two authentication methods.
932931
</para>
933932
</important>
934933

docs/src/main/docbook/dependencies.xml

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
4+
Copyright (c) 2010, 2021 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
@@ -33,25 +33,18 @@
3333
<title>Java SE Compatibility</title>
3434

3535
<para>
36-
<emphasis>2.x branch: </emphasis>
36+
<emphasis>3.x branch: </emphasis>
3737
<itemizedlist>
3838
<listitem>
39-
<para>Until version 2.6, Jersey was compiled with Java SE 6. This has changed in Jersey 2.7.</para>
39+
<para>This user guide refers only to version 3 and above of Jersey, its compatibility is described below</para>
4040
</listitem>
4141
<listitem>
42-
<para>Up to version 2.25.x almost all Jersey components are compiled with Java SE 7 target.
43-
It means, that you will need at least Java
44-
SE 7 to be able to compile and run your application that is using latest Jersey.
45-
Only <literal>core-common</literal> and <literal>core-client</literal> modules are still compiled with Java class
46-
version runnable with Java SE 6.</para>
47-
</listitem>
48-
<listitem>
49-
<para>Since Jersey 2.26, all modules are build using Java SE 8 and there is no support for running it
50-
on older Java SE distributions.</para>
51-
</listitem>
52-
<listitem>
53-
<para>Since Jersey 2.29, all modules can be built using Java SE 11 and all distributed modules provide support
54-
for Java SE 8+ (9,11).</para>
42+
<para>Since version 3.0.0* all Jersey components are compiled with Java SE 1.8 target.
43+
It means, that you will need at least Java SE 1.8 to be able to compile and run your application
44+
which uses the latest Jersey 3.x.
45+
All modules however are fully compatible with JDK 11 and above. So, it's possible to use JDK 11+ to
46+
build your app.
47+
</para>
5548
</listitem>
5649
</itemizedlist>
5750
</para>
@@ -62,18 +55,18 @@
6255
<para>
6356
Jersey is built, assembled and installed using <link xlink:href="http://maven.apache.org/">Apache Maven</link>.
6457
Non-snapshot Jersey releases are deployed to the
65-
<link xlink:href="http://search.maven.org/">Central Maven Repository</link>. Jersey is also being deployed to
58+
<link xlink:href="https://search.maven.org/">Central Maven Repository</link>. Jersey is also being deployed to
6659
<link xlink:href="https://oss.sonatype.org/">Sonatype Maven repositories</link>, which contain also Jersey SNAPSHOT
6760
versions. In case you would want to test the latest development builds check out the
6861
<link xlink:href="https://oss.sonatype.org/content/repositories/snapshots/org/glassfish/jersey">
6962
Sonatype Snapshots Maven repository</link>.
7063
</para>
7164

7265
<para>
73-
An application that uses Jersey and depends on Jersey modules is in turn required to also include in the application
74-
dependencies the set of 3rd party modules that Jersey modules depend on. Jersey is designed as a pluggable component
66+
An application that uses Jersey and depends on Jersey modules is in turn required to also include a set
67+
of 3rd party modules that Jersey modules depend on. Jersey is designed as a pluggable component
7568
architecture and different applications can therefore require different sets of Jersey modules. This also means that
76-
the set of external Jersey dependencies required to be included in the application dependencies may vary in each
69+
a set of external Jersey dependencies required to be included in the application dependencies may vary in each
7770
application based on the Jersey modules that are being used by the application.
7871
</para>
7972

@@ -129,7 +122,6 @@
129122

130123
<programlisting language="xml">&lt;dependency&gt;
131124
&lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
132-
&lt;!-- if your container implements Servlet API older than 3.0, use "jersey-container-servlet-core" --&gt;
133125
&lt;artifactId&gt;jersey-container-servlet&lt;/artifactId&gt;
134126
&lt;version&gt;&version;&lt;/version&gt;
135127
&lt;/dependency&gt;
@@ -170,7 +162,7 @@
170162
&lt;artifactId&gt;jersey-apache-connector&lt;/artifactId&gt;
171163
&lt;version&gt;&version;&lt;/version&gt;
172164
&lt;/dependency&gt;
173-
165+
<!-- Requires JDK 11+ -->
174166
&lt;dependency&gt;
175167
&lt;groupId&gt;org.glassfish.jersey.connectors&lt;/groupId&gt;
176168
&lt;artifactId&gt;jersey-jetty-connector&lt;/artifactId&gt;
@@ -181,9 +173,10 @@
181173
<section xml:id="server-jdk">
182174
<title>Server-side application on supported containers</title>
183175
<para>Apart for a standard JAX-RS Servlet-based deployment that works with any Servlet container that
184-
supports Servlet 2.5 and higher,
185-
Jersey provides support for programmatic deployment to the following containers: Grizzly 2 (HTTP and Servlet),
186-
JDK Http server, Simple Http server and Jetty Http server. This chapter presents only required maven dependencies,
176+
supports Servlet 5 and higher,
177+
Jersey provides support for programmatic deployment to the following containers: Grizzly 3 (HTTP and Servlet),
178+
JDK Http server, Simple Http server and Jetty Http server (requires JDK 11+). This chapter presents only
179+
required maven dependencies,
187180
more information can be found in <xref linkend="deployment"/>.
188181
</para>
189182

0 commit comments

Comments
 (0)