Implementing an asynchronous EJB method
In our implementation example, we will use the same scenario as in the example of an Event in CDI. 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 type of extension received, the file received will be saved on the filesystem at its respective directory. To develop this example, we will use the following classes:
FileUploadResource
: This is a class that represents the resource to receive all request to upload, and calls the respective EJB according to the file extension.JpgHandler
: This is an EJB with an asynchronous method to treat the process save of a JPG file on disk.PdfHandler
: This is an EJB with an asynchronous method to treat the process save of a PDF file on disk.ZipHandler
: This is an EJB with an asynchronous method to treat the process save of a ZIP file on disk.FileSystemUtils
: This is a utility class intended to handle issues with the...