-
-
Save ansell/1945499 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.restlet.Context; | |
import org.restlet.Request; | |
import org.restlet.Response; | |
import org.restlet.data.Reference; | |
import org.restlet.resource.Directory; | |
public class ClassLoaderDirectory extends Directory { | |
private ClassLoader _cl; | |
public ClassLoaderDirectory(Context context, Reference rootLocalReference, ClassLoader cl) { | |
super(context, rootLocalReference); | |
this._cl = cl; | |
} | |
@Override | |
public void handle(Request request, Response response) { | |
final ClassLoader saveCL = Thread.currentThread().getContextClassLoader(); | |
Thread.currentThread().setContextClassLoader(_cl); | |
super.handle(request, response); | |
Thread.currentThread().setContextClassLoader(saveCL); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment