Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Java EE 8 Design Patterns and Best Practices

You're reading from   Java EE 8 Design Patterns and Best Practices Build enterprise-ready scalable applications with architectural design patterns

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher Packt
ISBN-13 9781788830621
Length 314 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (3):
Arrow left icon
 Alberto Simoes Alberto Simoes
Author Profile Icon Alberto Simoes
Alberto Simoes
 Rocha Rocha
Author Profile Icon Rocha
Rocha
 Purificação Purificação
Author Profile Icon Purificação
Purificação
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Preface
1. Introduction to Design Patterns FREE CHAPTER 2. Presentation Patterns 3. Business Patterns 4. Integration Patterns 5. Aspect-Oriented Programming and Design Patterns 6. Reactive Patterns 7. Microservice Patterns 8. Cloud-Native Application Patterns 9. Security Patterns 10. Deployment Patterns 11. Operational Patterns 12. MicroProfile 1. Other Books You May Enjoy Index

Implementing an asynchronous REST service


As an example of implementing an asynchronous REST service, we will use the same scenario used in the example of the event in the CDI and the asynchronous EJB method. Here, we will create an application that makes it possible to upload three types (or extensions) of files—ZIP, JPG, and PDF extensions. Depending on the extension received, we want the file received to be kept in its respective directory on the filesystem. To develop this example, we have the following classes:

  • FileUploadResource: This is a class that represents the resource that works with asynchronous processes to receive all requests to upload, and calls the respective EJB according to the file extension.
  • JpgHandler: This is an EJB with an available method for saving a JPG file on a disk.
  • PdfHandler: This is an EJB with an available method for saving a PDF file on a disk.
  • ZipHandler: This is an EJB with an available method for saving a ZIP file on a disk.
  • FileSystemUtils: This is a utility...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime
Visually different images