Permalink
Browse files

Implement findResource and findResources on ImmutantCL [IMMUTANT-250]

  • Loading branch information...
1 parent 80a6b46 commit fa1d8e6bc37f91f1d6ce0754b1fee16265934943 @tobias tobias committed Mar 19, 2013
@@ -1,9 +1,10 @@
(defproject
basic-ring "1.0.0-SNAPSHOT"
:description "FIXME: write description"
- :dependencies [[org.clojure/clojure "1.3.0"]
+ :dependencies [[org.clojure/clojure "1.5.1"]
;; this will trigger a TLD scanner error if the jar mounts aren't under the app root (IMMUTANT-190)
[org.mortbay.jetty/jsp-2.1 "6.1.14"]
+ [org.clojure/clojurescript "0.0-1586"]
[clj-http "0.5.5"]]
:java-source-paths ["src/java/"]
:compile-path "classes"
@@ -28,6 +28,9 @@
:handler :handler
:ham-biscuit-location hb/location
:current-servlet-request? (not (nil? (web/current-servlet-request)))}]
+ (when (> (:minor *clojure-version*) 3)
+ (require '[cljs.closure :as cljs])
+ (eval '(cljs/get-upstream-deps))) ;; verify clojurescript likes our classloader
(reset! a-value "not-default")
(response body)))
@@ -20,11 +20,13 @@
package org.immutant.core;
import java.io.File;
+import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Enumeration;
import java.util.List;
import org.immutant.common.ClassLoaderFactory;
@@ -56,6 +58,35 @@ public URL getResource(String name) {
return stripVFS( url );
}
+ @Override
+ public URL findResource(String name) {
+ return stripVFS(((ModuleClassLoader)getParent()).findResource(name, false));
+ }
+
+ @Override
+ public Enumeration<URL> findResources(String name) {
+ final Enumeration<URL> urls;
+ try {
+ urls = ((ModuleClassLoader)getParent()).findResources(name, false);
+ } catch (IOException e) {
+ e.printStackTrace();
+
+ return null;
+ }
+
+ return new Enumeration<URL>() {
+ @Override
+ public boolean hasMoreElements() {
+ return urls.hasMoreElements();
+ }
+
+ @Override
+ public URL nextElement() {
+ return stripVFS(urls.nextElement());
+ }
+ };
+ }
+
public List<URL> getResourcePaths() {
ArrayList<URL> urls = new ArrayList<URL>();
try {

0 comments on commit fa1d8e6

Please sign in to comment.