Errai Spring Server project update
ruzkant Mar 6, 2018 11:17 PMHello Forum
I have just gone through a round of changes to the errai-spring-server library I added to github. My hope with this project is that Errai might gain some more traction if it can be more easily used in a Spring environment.
This project is being done in my personal capacity, but to the end of using it in production apps I am working on for fledgling pre-startup
There was some hair tearing trying to come to grips with how to send appropriate responses to the client MessageBus (and REST client) when using the Spring Security filter to cover the Errai servlet, but I have a sample project where this is in a working state. I have some custom Spring AuthenticationEntryPoint classes that can write UnauthenticatedException responses to both the client message bus and the rest client when spring redirects to login. This effectively means that in addition to @RestrictedAccess one can now use Spring Security annotations on MessageBus services and have the appropriate exception translation from Spring to Errai. @RestrictedAccess now also supports custom RequiredRolesProvider implementations that are Spring managed beans. And you can use the JAX-RS rest client to talk to a Spring web mvc controller with appropriate security annotations (it might be better to reuse JAX-RS interface for client side, but I wanted to support web mvc as well).
Anyway you can check the main features on the main github repo:
GitHub - expansel/errai-spring-server
And here is the sample webapp:
There are a number of things to still explore and test, partly because I don't know all the message bus deployment scenarios very well. I still need to try using web sockets and async. I am unfamilar with test infrastructure for both Spring BeanFactoryPostProcessor's and Errai MessageBus, so that needs to be explored and added. I am not sure if it is worth trying to support server side CDI event handling, as I don't know this well.
I think the project can benefit from some targeted changes to Errai to improve reuse and ensure parallel growth introduces minimal differences in behaviour, but I am still too unfamiliar with the Errai code base to confidently make such contributions at this stage. There are some smaller ones, like handling 401 responses from Rest services that I hope to discuss in a pull request or two.
cheers
Zach