Index: src/main/java/de/mpiwg/itgroup/annotations/restlet/BaseRestlet.java
===================================================================
--- src/main/java/de/mpiwg/itgroup/annotations/restlet/BaseRestlet.java	(revision 71)
+++ src/main/java/de/mpiwg/itgroup/annotations/restlet/BaseRestlet.java	(revision 72)
@@ -130,12 +130,12 @@
     public static final String ANNOTATIONS_URI_KEY = "annotationmanager.uris.annotations";
 
-    /**
-     * constructor
-     * 
-     * @param context
-     */
-    public BaseRestlet(Context context) {
-        super(context);
-        configure(context);
+
+    /* (non-Javadoc)
+     * @see org.restlet.Application#start()
+     */
+    @Override
+    public synchronized void start() throws Exception {
+        configure(getContext());
+        super.start();
     }
 
@@ -147,19 +147,11 @@
      */
     protected void configure(Context context) {
-        Context ctx = Context.getCurrent();
-        ConcurrentMap<String, Object> attrs = ctx.getAttributes();
-        ServletContext sc = null;
-        if (context != null) {
-            Restlet a = context.getServerDispatcher();
-            Context b = a.getContext();
-            ConcurrentMap<String, Object> c = b.getAttributes();
-            sc = (ServletContext) context.getServerDispatcher().getContext().getAttributes()
-                .get("org.restlet.ext.servlet.ServletContext");
-        }
-        if (attrs != null) {
-            if (attrs.get("annotationserver.log4j.configured") == null) {
+        ConcurrentMap<String, Object> attrs = context.getAttributes();
+        ServletContext sc = (ServletContext) attrs.get("org.restlet.ext.servlet.ServletContext");
+        if (sc != null) {
+            if (sc.getAttribute("annotationserver.log4j.configured") == null) {
                 // TODO: is this the right place to run the log4j configurator?
                 BasicConfigurator.configure();
-                attrs.put("annotationserver.log4j.configured", "done");
+                sc.setAttribute("annotationserver.log4j.configured", "done");
             }
             logger.info(getVersion() + " starting...");
@@ -168,5 +160,5 @@
              * read config from webapp
              */
-            serverConfig = (Properties) attrs.get(SERVERCONFIG_KEY);
+            serverConfig = (Properties) sc.getAttribute(SERVERCONFIG_KEY);
             if (serverConfig == null) {
                 serverConfig = new Properties();
@@ -204,8 +196,8 @@
                 }
                 // store config
-                attrs.put(SERVERCONFIG_KEY, serverConfig);
+                sc.setAttribute(SERVERCONFIG_KEY, serverConfig);
             }
             // look for database service in context
-            graphDb = (GraphDatabaseService) attrs.get(GRAPHDB_KEY);
+            graphDb = (GraphDatabaseService) sc.getAttribute(GRAPHDB_KEY);
             if (graphDb == null) {
                 /*
@@ -220,13 +212,13 @@
                     registerShutdownHook(graphDb);
                     // store in context
-                    attrs.put(GRAPHDB_KEY, graphDb);
+                    sc.setAttribute(GRAPHDB_KEY, graphDb);
                     // AnnotationStore
                     store = new AnnotationStore(graphDb);
-                    attrs.put(ANNSTORE_KEY, store);
+                    sc.setAttribute(ANNSTORE_KEY, store);
                     // admin server
                     srv = new WrappingNeoServerBootstrapper((GraphDatabaseAPI) graphDb);
                     logger.debug("Starting DB admin server...");
                     // store in context
-                    attrs.put(GRAPHDBSRV_KEY, srv);
+                    sc.setAttribute(GRAPHDBSRV_KEY, srv);
                     srv.start();
                 } else {
@@ -235,10 +227,10 @@
             } else {
                 // get existing AnnotationStore
-                store = (AnnotationStore) attrs.get(ANNSTORE_KEY);
+                store = (AnnotationStore) sc.getAttribute(ANNSTORE_KEY);
             }
             /*
              * read consumerKeys from webapp
              */
-            consumerKeys = (Properties) attrs.get(CONSUMERKEYS_KEY);
+            consumerKeys = (Properties) sc.getAttribute(CONSUMERKEYS_KEY);
             if (consumerKeys == null) {
                 consumerKeys = new Properties();
@@ -257,5 +249,5 @@
                 }
                 // store config
-                attrs.put(CONSUMERKEYS_KEY, consumerKeys);
+                sc.setAttribute(CONSUMERKEYS_KEY, consumerKeys);
             }
         } else {
@@ -356,11 +348,16 @@
         InputStream ps = null;
         if (sc == null) {
+            // no servlet context -> use class loader
             ps = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
+            /* Request request = new Request(Method.GET, "riap://component/ping");
+               Response response = getContext().getClientDispatcher().handle(request);
+               Representation repr = response.getEntity(); */
         } else {
+            // try path in webapp first
             ps = sc.getResourceAsStream(path);
             if (ps == null) {
                 // try as file
                 File pf = new File(sc.getRealPath(path));
-                if (pf != null) {
+                if (pf.canRead()) {
                     logger.debug("trying file for: " + pf);
                     try {
@@ -369,4 +366,7 @@
                         logger.error(e);
                     }
+                } else {
+                    // use class loader
+                    ps = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);                    
                 }
             }
