protected final void prepareWebClient(String webXmlName, String contextPath) throws Exception {
// Servlet container
File webInf = new File(srcdir, "WEB-INF");
File webXml = new File(webInf, defaultIfEmpty(webXmlName, "web.xml"));
ServletRunner servletRunner = new PatchedServletRunner(webXml, contextPath);
// Servlet client
client = servletRunner.newClient();
client.setExceptionsThrownOnErrorStatus(false);
client.getClientProperties().setAutoRedirect(false);
// Ignore script error
JavaScript.setThrowExceptionsOnError(false);