Pro Jakarta EE 10: Open Source Enterprise Java-based Cloud-native Applications Development Peter Späth - Download the ebook and start exploring right away
Pro Jakarta EE 10: Open Source Enterprise Java-based Cloud-native Applications Development Peter Späth - Download the ebook and start exploring right away
https://ebookmass.com/product/beginning-cloud-native-development-with-
microprofile-jakarta-ee-and-kubernetes-1st-edition-tarun-telang/
https://ebookmass.com/product/pro-spring-security-securing-spring-
framework-6-and-boot-3-based-java-applications-third-edition-massimo-
nardone/
https://ebookmass.com/product/modern-enterprise-architecture-using-
devsecops-and-cloud-native-in-large-enterprises-1st-edition-jeroen-
mulder/
https://ebookmass.com/product/beginning-ejb-3-java-ee-7-edition-
jonathan-wetherbee/
https://ebookmass.com/product/cloud-native-computing-pethuru-raj/
Pro
Jakarta EE 10
Open Source Enterprise Java-based
Cloud-native Applications Development
—
Peter Späth
Pro Jakarta EE 10
Open Source Enterprise
Java-based Cloud-native
Applications Development
Peter Späth
Pro Jakarta EE 10: Open Source Enterprise Java-based Cloud-native Applications
Development
Peter Späth
Leipzig, Sachsen, Germany
Introduction������������������������������������������������������������������������������������������������������������xix
v
Table of Contents
vii
Table of Contents
viii
Table of Contents
ix
Table of Contents
Alternatives������������������������������������������������������������������������������������������������������������������������������� 249
Producers���������������������������������������������������������������������������������������������������������������������������������� 251
Scope���������������������������������������������������������������������������������������������������������������������������������������� 253
Interceptors������������������������������������������������������������������������������������������������������������������������������� 255
Decorators�������������������������������������������������������������������������������������������������������������������������������� 255
x
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Table of Contents
xi
Table of Contents
xii
Table of Contents
xiii
Table of Contents
Index��������������������������������������������������������������������������������������������������������������������� 481
xiv
About the Author
Peter Späth graduated in 2002 as a physicist and became an IT consultant, mainly for
Java-related projects. In 2016, he decided to concentrate on writing books on various
technology-related topics, with his main focus on software development. With two
books about graphics and sound processing, two books about Android app
development, and several books about Java, Späth continues his efforts in writing
software development-related literature.
xv
About the Technical Reviewer
Massimo Nardone has more than 25 years of experience
in security, web/mobile development, cloud, and IT
architecture. His true IT passions are security and Android.
He has been programming and teaching others how to
program with Android, Perl, PHP, Java, VB, Python, C/C++,
and MySQL for more than 20 years. He holds a Master of
Science degree in computing science from the University
of Salerno, Italy. He has worked as a CISO, CSO, security
executive, IoT executive, project manager, software engineer,
research engineer, chief security architect, PCI/SCADA
auditor, and senior lead IT security/cloud/SCADA architect for many years. His technical
skills include security, Android, cloud, Java, MySQL, Drupal, Cobol, Perl, web and
mobile development, MongoDB, D3, Joomla, Couchbase, C/C++, WebGL, Python, Pro
Rails, Django CMS, Jekyll, Scratch, and more. He was a visiting lecturer and supervisor
for exercises at the Networking Laboratory of the Helsinki University of Technology
(Aalto University). He also holds four international patents (in the PKI, SIP, SAML,
and Proxy areas). He is currently working for Cognizant as the head of cybersecurity
and CISO to help clients in areas of information and cybersecurity, including strategy,
planning, processes, policies, procedures, governance, awareness, and so forth. In
June, 2017, he became a permanent member of the ISACA Finland Board. Massimo has
reviewed more than 45 IT books for different publishing companies and is the co-author
of Pro Spring Security: Securing Spring Framework 5 and Boot 2-based Java Applications
(Apress, 2019), Beginning EJB in Java EE 8 (Apress, 2018), Pro JPA 2 in Java EE 8 (Apress,
2018), and Pro Android Games (Apress, 2015).
xvii
Introduction
Java is not just a programming language, it’s also a platform used to host software. As
far as enterprise environments go, Java Enterprise Edition Jakarta EE (formerly JEE) has
an extensive collection of APIs that are particularly useful for addressing corporate IT
requirements.
This book covers advanced topics of Jakarta EE development. This includes pro-
level web tier development, architecture-related matters, advanced XML and JSON
processing, application clients and scripting languages, resource handling, high-level
security enhancements, and advanced monitoring and logging techniques.
The target version of Jakarta EE is version 10. Unless otherwise noted, server scripts
have been tested on Ubuntu 22.04. Switching to Debian, Fedora, or OpenSUSE Leap
should not impose any problems.
The book is for advanced enterprise software developers with knowledge of
Java Standard Edition version 8 or later and some experience in Jakarta EE (or JEE)
development. Having read the book titled Beginning Jakarta EE from the same author
and publisher (ISBN: 978-1-4842-5078-5) will surely help, but it’s not a strict prerequisite.
I keep references to the beginner book at a bare minimum. I also assume that you can
use the online API references, so this book is not a complete reference in the sense that
not all API classes and methods are listed. Instead, the book includes techniques and
technologies that will help professional Java enterprise-level developers deal with topics
and master problems that arise in a corporate environment.
The book uses the Linux operating system as its development platform, although
the code can run on other platforms without requiring complex changes. The server
installations—like version control, continuous integration systems, and operating
instructions—all target the Linux operating system. This book also does not cover
hardware issues, except for some cases where hardware performance has a noticeable
impact on the software.
After finishing this book, you will be able to develop and run Jakarta EE 10 programs
of mid- to high-level complexity.
xix
Introduction
Source Code
All the source code in this book can be found at github.com/Apress/pro-jakarta-ee10.
xx
PART I
Development Workflow
Proposal
CHAPTER 1
Installing a Development
Server
This book uses GlassFish version 7.0.1 as a Jakarta EE server, although I try to avoid
vendor lock-in, so that, unless otherwise noted, you can test all the examples on different
Jakarta EE servers.
For the Eclipse IDE, there is a GlassFish plugin called GlassFish Tools, which you can
use if you want to. I don’t use it in this book for several reasons. First of all, the plugin
can have issues with your Eclipse installation. Second, if you don’t use the plugin and
instead use a terminal to start and stop the server and then use a build tool like Gradle to
install and uninstall Enterprise applications, you are already close to what you need for
integration testing and production setups. Third, it is easier to switch between different
Jakarta EE servers and different IDEs. Fourth, you don’t have to learn how to use that
plugin, including any peculiarities that might arise.
So for now, simply download and install the GlassFish server, version 7.0.1, from this
location:
https://glassfish.org/download.html
Note GlassFish 7.0.1 runs on JDK 11 through 19. You can try higher JDK
versions for GlassFish 7.0.1, but they might not work.
3
© Peter Späth 2023
P. Späth, Pro Jakarta EE 10, https://doi.org/10.1007/978-1-4842-8214-4_1
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Other documents randomly have
different content
There was quite a mediæval-looking heavy steel mace, and
many sabres, and sword sticks, some made with crutch handles
terminating in horses’ heads. There were also a number of steel
cuirasses. I believe this armoury was arranged by Mr Kipling, the
father of Mr Rudyard Kipling, who was head of the art school of
Lahore for many years, and to whom is due the extremely
interesting museum.
There were relics of elaborate decoration on the walls and vaults
of what remained of the palace, and some of the glass (convex-
mirror-mosaic) work united with gesso-relief ornament, which we
saw at Udaipur, Amber, Delhi, and other places: but the British
occupation had tried its best, by introducing hideous chunks of
barrack buildings, to take the romance and beauty out of the place.
Close to the Fort outside its gate is the Samadh, or burning-
place of Ranjit Singh. A carved lotus flower, surrounded by eleven
smaller ones, on a raised platform inside the pavilion-like building,
mark the place where his body was burned with eleven ladies of his
Zenana. Not far off rises the dome of the Jama Musjid and its noble
minarets of red sandstone.
There is a fine park-like country beyond the walls on this side of
the city with groups of old trees. The minarets and domes of Lahore
have a striking effect seen from outside the gate. We returned
through the bazaars a different way, passing the golden domed
mosque and also the Wazar Khan mosque, the latter a very fine one
fronting a small square in the middle of the city, and having two
large minarets faced with enamelled tiles in blue and green and
other colours, cobalt predominating. The spandrils of the main
entrance, and in fact the whole of the front, being decorated with
tiles in large arabesques and borderings, a large Arabic text in blue
written boldly over the arch, and panels down each flank of smaller
scale work. It was the first tiled mosque we had seen, and quite
characteristic of the art of a district which culminates in the
renowned tombs at Multan.
At the English club house on the Mall, the pipers of a Highland
regiment were playing on the lawn in front. The club had well laid
out and ample lawn tennis courts, large blue durries being hung at
each end of the courts to stop the balls, and the players had native
caddies to pick them up. There were zoological gardens near by
where we saw nylghaus and antelopes and birds of various sorts.
A Victoria memorial on a large scale was in progress at a place
where branching roads met. The work of the British sculptor in India
cannot be said to be much more exhilarating than the work of the
British architect, as a rule, to judge from the specimens we saw,
chiefly of statues of the late Queen Victoria.
The courts of Justice at Lahore are more successful than most of
the modern examples in India, perhaps because designed in what
might be called the local style—the Mogul. Near by in a little garden
enclosed by clipped hedges was a bronze statue of Lord Laurence
offering the choice of government by pen or sword to the passer by.
It had some dramatic expression, though the choice of a momentary
attitude in a portrait statue is perhaps open to criticism.
We visited the museum, where Mr Percy Brown has succeeded
Mr Kipling as director. Here is a most interesting collection of typical
native textiles, including the raised wax designs gilded, silvered, and
lacquered on grounds of different coloured cloths, an art which is
still practised in the district with success, traditional designs of
flowers and birds being repeated in a very skilful and effective way,
and applied to the adornment of portières, covers, etc. There were
also good collections of native jewellery and enamels. Champlévé
enamel, such as is done at Lucknow, was illustrated by specimens in
different stages from the commencement to the finish, side by side
with cloissoné (Japanese) illustrated in the same complete way, as
well as complete models showing native industries and handicrafts in
operation; interesting old Hindu herbals and manuscripts on vellum
with characteristic miniatures; drawings of local palaces and gardens
in plan, elevation and bird’s-eye perspective.
There was a very notable collection of Greco-Buddhist
sculptures, which were extremely interesting and unusual.
Very little wood-carving, curiously enough, except modern
examples in screens and furniture, the work of the Art School,
exhibited in a separate room. The city of Lahore being so rich in
carved wood-work it was less necessary to have it in the museum,
and, of course, much better to see it in situ. The modern way of
selling the spoils of old buildings to private collections or to
museums is carried on in Europe to an alarming extent, so that one
begins to fear, in view of the rapid destruction of ancient houses now
going on, whether there will soon be left any genuine bits of
antiquity in this commercial world. It is better of course that relics of
ancient art should find a haven in a public museum than that it
should perish altogether, but any destruction or removal for the
express purpose of transportation to a museum should be
deprecated.
On the whole the Lahore museum was a well-chosen and
arranged museum, judiciously limited to Indian art, and it was
interesting to see the groups of natives—men, women, and children
—apparently scanning the different objects with the greatest interest
and with much animated conversation among themselves. One
afternoon we drove to the Waza Khan Mosque, and I made the
sketch reproduced here of the entrance to the mosque from the
carriage. The crowd was curious, but not nearly so troublesome as
elsewhere, and our conductor, or running footman, kept them off
pretty well. The square had large pools of mud in it here and there
after recent rains. Zebus were straying about, or lying down. Fruit
and good stalls occupied other parts of the ground, and ox-carts
deposited loads of wood. Men sat in groups in the porch of the
mosque, or on the steps, from which boys flew their little diamond-
shaped paper kites. The mysterious-looking white figures of the
Mohammedan women wandered about like substantial ghosts. We
saw a pretty little gazelle at one of the stalls, perfectly tame, and a
great pet of the native who owned it.
The Cashmere travelling merchants, who display their tempting
wares at all the hotels, spread out their stuffs in profusion—Bokhara
embroideries, Persian covers, kincobs, turbans, and portières of
black, red, or green grounds, effectively decorated with designs in
the raised wax, such as we saw in the museum—and used all their
persuasive arts to effect sales.
We did not stay long enough in Lahore to see much of the
Society there, but before leaving we had a visit from the Princess
Duleep Singh and her sister, who, hearing from friends at Amritzar
that we were there, came to see us at the hotel. The princess was
dressed as a Parsee lady in beautiful classical draperies, white with
embroidered borders, and she drove herself in a dog-cart, but the
sister was in European dress. The princess recalled the circumstance
of my having made a little sketch in her brother the prince’s cottage
on the Norfolk coast, which had been designed for him by Mr
Detmar Blow, which we visited when staying in the neighbourhood.
THE MERCHANTS OF KASHMIR
We left Lahore the mid-day Lucknow Mail, after a long wait, the
platform covered with picturesque groups of squatting natives. We
eventually shared a compartment, as far as Umballa, with an English
official, his German wife and a little girl. As far as Umballa on this
line, coming north, we had already journeyed. The chief incident
after leaving Lahore was the catching fire of one of the boxes of one
of the carriages of our train, which caused the passengers hastily to
leave it, and crowd into other parts of the train, when it was stopped
and the burning carriage taken off at a small station just before
Amritzar.
LAHORE—THE MOSQUE OF WAZA KHAN
LUCKNOW
There was “a little rift within the lute,” however, which rather
marred the first moments of our arrival at Lucknow, my wife having
unfortunately got a little bit of grit in her eye from the engine while
in the train. There was nothing for it but to drive to the hospital the
first thing after breakfast. Luckily we caught the chief surgeon (Col.
Anderson) just as he was attending to some native cases in waiting.
He at once took us to the “operating room,” which sounded rather
fearsome, and was indeed a severe place with a polished marble
floor, a case of surgical instruments and an operating table being the
only furniture visible. The poor eye-patient had to extend herself on
the table, while the Colonel very deftly found and quickly removed a
tiny black speck which had caused all the trouble—working up right
under the upper lid of the eye. He put some cocaine into the eye
first of all, and afterwards applied a little lint and lotion. The relief
must have been worth anything—it might have been described as a
lesser Relief of Lucknow!
BENARES
At the Burning Ghat they pile up logs of wood to form the pyre,
and the white turbaned dark figures, with nothing on but waist
cloths, are kept busy at their ghastly work. Some of the bodies are
brought down with flowers and chanting: others lie there with no
following or ceremony: some are swathed in red or white cloth like
mummies, others as they were born are lifted on to the piles of logs,
which being set alight, soon reduce all to the same condition. Some
of the bodies are carefully dipped in the Ganges before being
burned, and are often left at the water’s edge while the pyre is being
prepared. Wood was placed over as well as under the bodies, and a
torch was put to the mouth. Other bodies, again, are taken out in
boats unburned and apparently dressed and seated in chairs, and
suddenly in mid-stream are toppled over into the water. We saw an
old man disposed of in this way. Our boatman pointed him out as a
specially holy person, and we did not realise he was a corpse. The
bodies of infants, swathed in white, are also treated in this way.
The Maharajah’s secretary explained that the Ganges water had
been analysed by European experts and pronounced to be the best
water in the world, having a peculiar property of destroying the
germs of disease. It was difficult, however, to see how even “the
best water” could avoid getting fouled with such operations
constantly going on; but of course there is a strong stream all the
time, so that everything must eventually be carried down to the sea.
A continuous many-coloured stream of pilgrims, bearing huge
bundles of bedding, were constantly moving along behind this busy
life of the bathing ghats, ascending or descending the great flights
of steps leading up through the various gates to the city. It seemed
to be part of that universal exodus we had witnessed at every
railway station in India. It is said that representatives from every
village in the peninsula may be found at Benares.
Then, as a no less striking background to these extraordinary
human groups, rise the domes of temples and minarets of palaces,
their golden vanes and finials glittering against the deep blue sky.
Windows, balconies and terraces placed high up, with vast walls
below them. These great walls, which give so much distinction and
breadth to the river front of Benares, have a practical reason,
inasmuch as it is a necessity thus to raise the temple and palace
floors, owing to the sudden rising of the Ganges in the rainy season,
when these walls are sometimes hidden in the waters.
The musical accompaniments of the spectacle consist in the
weird and wandering notes which issue from the temples, produced
by a sort of hautboy, and the subdued thud of the tom-toms. I saw a
dusky long-haired fakir stand on the steps at the Mahikarunika ghat
and sound a long straight brass trumpet.
After voyaging in the peacock boat the whole length of the
ghats, we returned to our carriage-in-waiting at a convenient point
from which to approach the Golden Temple. From the main street of
the Bazaar we were conducted by the secretary down a very narrow
passage crowded with worshippers, and then up a dark staircase to
a terrace from which we could see the cluster of gilded copper
domes. Afterwards in the sacred precincts we saw the “well of
knowledge,” but did not drink of it, having too much foreknowledge
of the condition of its water.
Our next excursion was to pay a visit to the Maharajah at his
palace. We were conducted by his secretary in the carriage as
before, driving to the river side opposite the palace some six miles
off. On the road we stopped to see the famous Monkey Temple—a
Hindu Temple in an arcaded court of the usual type. This court was
full of monkeys—a sandy-brown coloured sort with pink faces,
probably Macaques—not so handsome as the wild silver grey ones
we had seen at Ahmedabad. They accepted offerings, but not so
greedily, as they were evidently well fed, and dried peas lay about
untouched. They gambolled about the temple at their sweet will.
These monkeys are sacred to Vishnu, and represent Hunuman the
monkey god.
There was a fine tank with steps to the water’s edge, close by
the temple. Just before this we passed the Hindu College which Mrs
Annie Besant has established for the higher education of native
children of both sexes—but not a mixed school. This work has been
liberally endowed by the Maharajah of Benares, who also granted
the site. Mrs Besant is the principal, but owing to the illness of
Colonel Alcott, she was not then there, being at Madras nursing the
Colonel in what proved to be his last illness.
Reaching the river side, a boat was in waiting to take us across
to the palace, rowed by two Hindu boys—at least they started
rowing, but soon we got into shallows, where they took to poling,
and finally had to get out and push the boat along, until getting into
deeper water again they rowed us to the palace steps.
It was quite a high steep flight, no doubt existing for the same
river reason as the high walls of Benares—to be out of the reach of
the floods. There were numbers of natives ascending and
descending or grouped on the steps.
We climbed up, and entered the palace up more stairs, and were
shown into a large reception salon, where much of the furniture was
“under canvas,” but there was one handsome couch displayed, inlaid
with ivory. Presently H.H. the Maharajah entered, accompanied by
his two chief officers, who spoke English well, his painter in ordinary,
and several attendants. Chairs were placed in the centre of the
room, around a small marble table. The Maharajah seated himself,
and we with the private secretary grouped ourselves about him. The
Maharajah was dressed in a small-patterned long tunic of pink
brocaded with gold, a small round cap on his head, close fitting
white trousers and patent leather shoes. He seemed quite merry and
pleased to see us. I showed him my book of sketches, which
interested him, as he said he had never seen drawings of the kind
before. His painter in ordinary, to whom I was introduced, was also
interested, and asked some questions through the secretary, not
himself speaking English. He had painted the full length portraits of
the Maharajahs which hung aloft in this salon. The Prince presently
rose and invited us to the terrace, to which we passed after him,
through an arcade, an attendant holding a large silk umbrella over
him. There was a very fine view from this terrace up and down the
river. The city of Benares, with its domes and minarets, seen far
down on the left, and the open plain country opposite. The secretary
said that when the Ganges rose the city looked as if it was floating
on the surface of the water.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookmass.com