(ServletConfig config)
| 72 | |
| 73 | |
| 74 | @Override |
| 75 | public void init(ServletConfig config) throws ServletException { |
| 76 | |
| 77 | super.init(config); |
| 78 | this.config = config; |
| 79 | this.context = config.getServletContext(); |
| 80 | |
| 81 | // Initialize the JSP Runtime Context |
| 82 | // Check for a custom Options implementation |
| 83 | String engineOptionsName = config.getInitParameter("engineOptionsClass"); |
| 84 | if (engineOptionsName != null) { |
| 85 | // Instantiate the indicated Options implementation |
| 86 | try { |
| 87 | ClassLoader loader = Thread.currentThread().getContextClassLoader(); |
| 88 | Class<?> engineOptionsClass = loader.loadClass(engineOptionsName); |
| 89 | Class<?>[] ctorSig = { ServletConfig.class, ServletContext.class }; |
| 90 | Constructor<?> ctor = engineOptionsClass.getConstructor(ctorSig); |
| 91 | Object[] args = { config, context }; |
| 92 | options = (Options) ctor.newInstance(args); |
| 93 | } catch (Throwable t) { |
| 94 | Throwable throwable = ExceptionUtils.unwrapInvocationTargetException(t); |
| 95 | ExceptionUtils.handleThrowable(throwable); |
| 96 | // Need to localize this. |
| 97 | log.warn(Localizer.getMessage("jsp.warning.engineOptionsClass", engineOptionsName), throwable); |
| 98 | // Use the default Options implementation |
| 99 | options = new EmbeddedServletOptions(config, context); |
| 100 | } |
| 101 | } else { |
| 102 | // Use the default Options implementation |
| 103 | options = new EmbeddedServletOptions(config, context); |
| 104 | } |
| 105 | rctxt = new JspRuntimeContext(context, options); |
| 106 | if (config.getInitParameter("jspFile") != null) { |
| 107 | jspFile = config.getInitParameter("jspFile"); |
| 108 | try { |
| 109 | if (null == context.getResource(jspFile)) { |
| 110 | return; |
| 111 | } |
| 112 | } catch (MalformedURLException e) { |
| 113 | throw new ServletException(Localizer.getMessage("jsp.error.no.jsp", jspFile), e); |
| 114 | } |
| 115 | try { |
| 116 | serviceJspFile(null, null, jspFile, true); |
| 117 | } catch (IOException ioe) { |
| 118 | throw new ServletException(Localizer.getMessage("jsp.error.precompilation", jspFile), ioe); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | if (log.isDebugEnabled()) { |
| 123 | log.debug(Localizer.getMessage("jsp.message.scratch.dir.is", options.getScratchDir().toString())); |
| 124 | log.debug(Localizer.getMessage("jsp.message.dont.modify.servlets")); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | |
| 129 | /** |
nothing calls this directly
no test coverage detected