Using a javax.servlet.Filter with Compojure

Posted by mikera on Stack Overflow See other posts from Stack Overflow or by mikera
Published on 2010-05-10T21:21:50Z Indexed on 2010/05/10 21:44 UTC
Read the original article Hit count: 536

I'm trying to build a simple web site using Clojure / Compojure and want to feed apply a servlet filter to the request / response (i.e. a standard javax.servlet.Filter instance).

e.g. if the current source code is:

(defroutes my-app
  (GET "/*"
    (html [:h1 "Hello Foo!!"]))
)

I would like to add a filter like this:

(defroutes my-app
  (GET "/*"
    (FILTER my-filter-name
      (html [:h1 "Hello Foo!!"])))
)

Where my-filter-name is some arbitrary instance of javax.servlet.Filter.

Any idea how to do this effectively and elegantly?

© Stack Overflow or respective owner

Related posts about clojure

Related posts about compojure