Closed MorganMaison closed 7 years ago
@MorganMaison yes, makes total sense, and I do not see what it should not be possible. This is the reason why Snow uses the servlet container request flow.
I can see only one issue, which I can fix if this is the case, is that the Snow webcontroller close the websocket when it ends. So, the filter is designed to add things after the servlet, I might need to add this support.
But other than that, this is more a configuration issue than anything.
So, try to embed your servlet fitler, and let me know if something does not work.
@jeremychone You are right, servlet filter are working out of the box.
I was too quick to blame it on the framework when it didn't work. We were loosing the request information and I thought that it was because of something going wrong with the way Snow generates its RequestContext from the ServletRequest. It turns out it was due to a conflict between our version of Jackson and the one provided by our 3rd party filter lib.
Sorry about that.
@MorganMaison Ok, no problem, glad it works. Just remember that SnowController does close the connection at the end, and if you need to not do it, let me know, I can add a switch for it.
I may be wrong here but for what I see in your demo, the idea for Snow is to have a generic web.xml and to handle everything down the line with Snow. I'm not saying it is a bad thing per se but it could be quite a burden to be unable to plug 3rd party libs acting as servlet filters.
In our case (JWT auth) I would have to use the snow AppAuthRequest to generate the token, instead of simply plugging our usual lib as a filter in the web.xml.
More broadly I would say that it’s a fairly common thing to have 3rd party librairies plugging themselves at the servlet entry point level. Is there a way to “bind” a servlet filter class with Snow ?