void enableJsp(final WebMetaData metadata) {
final ModelNode config = this.config.get(JSP_CONFIGURATION);
if (config.get(DISABLED).asBoolean(false)) {
return;
}
final ServletMetaData servlet = new ServletMetaData();
servlet.setName("jsp");
servlet.setLoadOnStartup("" + 3);
servlet.setServletClass("org.apache.jasper.servlet.JspServlet");
final List<ParamValueMetaData> initParams = new ArrayList<ParamValueMetaData>();
initParams.add(createParameter("development", config.require(DEVELOPMENT).asString()));
initParams.add(createParameter("keepgenerated", config.require(KEEP_GENERATED).asString()));
initParams.add(createParameter("trimSpaces", config.require(TRIM_SPACES).asString()));
initParams.add(createParameter("enablePooling", config.require(TAG_POOLING).asString()));
initParams.add(createParameter("mappedfile", config.require(MAPPED_FILE).asString()));
initParams.add(createParameter("checkInterval", config.require(CHECK_INTERVAL).asString()));
initParams.add(createParameter("modificationTestInterval", config.require(MODIFICATION_TEST_INTERVAL).asString()));
initParams.add(createParameter("recompileOnFail", config.require(RECOMPILE_ON_FAIL).asString()));
initParams.add(createParameter("suppressSmap", config.require(SMAP).asString()));
initParams.add(createParameter("dumpSmap", config.require(DUMP_SMAP).asString()));
initParams.add(createParameter("genStringAsCharArray", config.require(GENERATE_STRINGS_AS_CHAR_ARRAYS).asString()));
initParams.add(createParameter("errorOnUseBeanInvalidClassAttribute", config.require(ERROR_ON_USE_BEAN_INVALID_CLASS_ATTRIBUTE).asString()));
if (config.hasDefined(SCRATCH_DIR)) {
initParams.add(createParameter("scratchdir", config.require(SCRATCH_DIR).asString()));
}
// jasper will find the right defaults.
initParams.add(createParameter("compilerSourceVM", config.require(SOURCE_VM).asString()));
initParams.add(createParameter("compilerTargetVM", config.require(TARGET_VM).asString()));
initParams.add(createParameter("javaEncoding", config.require(JAVA_ENCODING).asString()));
initParams.add(createParameter("xpoweredBy", config.require(X_POWERED_BY).asString()));
initParams.add(createParameter("displaySourceFragment", config.require(DISPLAY_SOURCE_FRAGMENT).asString()));
servlet.setInitParam(initParams);
metadata.getServlets().add(servlet);
addServletMapping("jsp", metadata, "*.jsp", "*.jspx");
}