I get around this for servlets by combining gen-class and proxy in my
servlet file;

(ns my-servlets.MyServlet
  (:import (javax.servlet.http HttpServlet HttpServletRequest
     HttpServletResponse))
  (:gen-class :extends HttpServlet)
  )

(defn req-do
  [#^HttpServlet svlt #^HttpServletRequest req #^HttpServletResponse rsp]
  (do-stuff))

(defn -service
  [#^HttpServlet svlt #^HttpServletRequest req #^HttpServletResponse rsp]
  (req-do svlt req rsp)
  )

(def my-servlet
  (proxy [HttpServlet] []
    (service [req rsp]
        (req-do this req rsp))))

Then for production (tomcat), an ant build compiles and deploys the
war with web.xml referring to myservlets.MyServlet and in my dev
environment, I launch a jetty instance with my-servlet in a jetty
servlet holder.

I haven't done this with Filters yet, but I'm pretty sure you could
use a similar approach?

Hth, Adrian.


On Wed, Jul 22, 2009 at 4:40 AM, Chouser<chou...@gmail.com> wrote:
>
> On Tue, Jul 21, 2009 at 8:04 PM, Howard Lewis Ship<hls...@gmail.com> wrote:
>>
>> Basically, what I want is for AOT to be an optional optimization, not
>> a requirement.  Currently if your code relies on gen-class, AOT
>> becomes necessary for operation, period.
>
> This is how gen-class used to behave.  Unfortunately, it
> causes problems because named classes can't be changed once
> they're loaded in the JVM.  I think there are also
> classloader issues that I don't yet fully understand.
>
> Named classes and named interfaces must be created before
> the JVM is started.
>
> --Chouser
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to