I'm currently using TomEE 8.0.8 WebProfile. I can't use Spring nor anything else besides what's included in TomEE.
I'm trying to implement a 3 tier application. The application has already been implemented in a 2 tier way (Business logic is written in HTTPServlet classes, which call DAOs and then dispatch to .jsp files). I'm having some difficulties trying not to tie up business logic with Servlet implementation details.
All my service classes are Stateless EJB with methods which may take DTOs as parameters and return other DTOs as result.
These service classes should return more than one error if needed (for example: bad length for attr 1, bad format for attr 2, empty attr 3): my idea was to create a custom Exception with a List<>
of errors to throw from service layer. However, I don't know if this is approach is correct nor if there is some clean way to handle these exception on the controllers, without "try/catch" everywhere. (Maybe an interceptor? Is it possible with vanilla servlets?)