ClassLoader original = Thread.currentThread().getContextClassLoader();
try {
String path = request.getUrl().getPath();
WebApplicationDeploymentContext deployment = this.getContext(path);
if (deployment == null)
throw new MockBrowserException(request, "No context could be found to handle request", null);
MockHttpServletContext ctx = (MockHttpServletContext) deployment.getServletContext();
path = path.length() == ctx.getContextPath().length() ? "/" : path.substring(ctx.getContextPath().length());
if (!path.startsWith("/")) path = "/" + path;