play2war / play2-war-plugin

WAR Plugin for Play framework 2.x
Apache License 2.0
443 stars 71 forks source link

Servlet filters and Play Framework filters #309

Closed cecton closed 8 years ago

cecton commented 8 years ago

Hello,

I have a small question here for play2-war-plugin's developers.

I have built a caching filter using the Play framework 2.3.x and it works fine in a sample Play web application. But I wonder if it is possible to export this filter as a Servlet filter. If I understood properly, Servlet have a filter mechanism, but I don't think they are the same thing at all despite the purpose look very similar.

So, my question is: are the Play filters compatible at all with Servlet?

Best

dlecan commented 8 years ago

are the Play filters compatible at all with Servlet

No, Play filters work only on Play. Play doesn't use a servlet engine, so servlet are useless for a "native" Play application.

With a Play2War application, servlet filters can be used. But Play filters do the work, so why would you want to change ?

cecton commented 8 years ago

It's because the application already exists and is not even written in Java, I want to put a cache on top of it. One way to do it would be to add a Servlet filter so every call made to this application would use the filter first.

dlecan commented 8 years ago

Good luck!