(This is all moot at this point, since the author or Noir has made changes
that allow it to be compatible with App Engine.)

Background:

This was with noir version 1.1.0, and appengine-magic version 0.4.3.
 appengine-magic needs a ring handler, which noir provided with
noir.server/gen-handler.   However, that handler had a bunch of default
middlewares added by compojure.handler/site.  One of those middlewares was
the ring multipart-params middleware, added by
ring.middleware.multipart-params/wrap-multipart-params.  This middleware
uses java.rmi.server.UID, which is not an allowed class on app engine.  For
that reason, appengine-magic already has a replacement in
appengine-magic-multipart-params/wrap-multipart-params.  What I was trying
to do was re-bind the var that was bound to the ring middleware, instead
binding it to the appengine-magic replacement, for all threads executing the
servlet.

Since this runs on app engine, who knows which thread initializes the
servlet, who know which threads are executing the code on each request, etc.
 A couple methods worked in the repl, and in local testing, but not in the
live app engine environment.  I believe this may be one of those, but I
tried so many things it is hard to remember:

Code:

------------
(ns test-site.core
  (:require [appengine-magic.core :as gae]
    [noir.server :as server]))

(defn handler []
  (binding [ring.middleware.multipart-params/wrap-multipart-params
            appengine-magic.multipart-params/wrap-multipart-params]
    (server/gen-handler)))

(gae/def-appengine-app test-site-gae (handler))
------------

Relevant code files, if you want to look, but this is all moot at this
point:

ring.middleware.multipart-params  =>
https://raw.github.com/mmcgrana/ring/8dc40e8f38c59c9a1275991d7b7522b620b3a180/ring-core/src/ring/middleware/multipart_params.clj
compojure.handler  =>
https://raw.github.com/weavejester/compojure/master/src/compojure/handler.clj
noir.server  =>
https://raw.github.com/ibdknox/noir/master/src/noir/server.clj
appengine-magic.multipart-params  =>
https://raw.github.com/gcv/appengine-magic/master/src/appengine_magic/multipart_params.clj



On Thu, Aug 11, 2011 at 10:43 AM, Armando Blancas <armando_blan...@yahoo.com
> wrote:

> > My code calls a function in 3rd party library A, which in turn calls a
> > function in 3rd party library B.  The lib B function uses blacklisted
> Java
> > classes, causing my app to crash when lib A calls it.  I would like to
> > replace that function with a safe version, so that lib A is forced to use
> > the safe version instead, all without modifying any 3rd party code.  Is
> this
> > possible?
>
> That should be possible with your simple attempt using (binding); I'm
> surprised it hasn't worked. Can you post which libs you're using and
> which function you want to override?
>
> --
> 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
>

-- 
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