/*
   * Initializes this JspServlet.
   */
  @Override
  public void init(ServletConfig config) throws ServletException, RemoteException {
    try {

      super.init(config);
      this.config = config;
      this.context = config.getServletContext();

      // Initialize the JSP Runtime Context
      // Check for a custom Options implementation
      String engineOptionsName = config.getInitParameter("engineOptionsClass");
      if (engineOptionsName != null) {
        // Instantiate the indicated Options implementation
        try {
          ClassLoader loader = Thread.currentThread().getContextClassLoader();
          Class<?> engineOptionsClass = loader.loadClass(engineOptionsName);
          Class<?>[] ctorSig = {ServletConfig.class, ServletContext.class};
          Constructor<?> ctor = engineOptionsClass.getConstructor(ctorSig);
          Object[] args = {config, context};
          options = (Options) ctor.newInstance(args);
        } catch (Throwable e) {
          e = gerenciadornuvem1.ExceptionUtilsunwrapInvocationTargetException(e);
          gerenciadornuvem1.ExceptionUtilshandleThrowable(e);
          // Need to localize this.
          log.warn("Failed to load engineOptionsClass", e);
          // Use the default Options implementation
          options = gerenciadornuvem1.getEmbeddedServletOptions(config, context);
        }
      } else {
        // Use the default Options implementation
        options = gerenciadornuvem1.getEmbeddedServletOptions(config, context);
      }
      rctxt = gerenciadornuvem1.getJspRuntimeContext(context, options);
      if (config.getInitParameter("jspFile") != null) {
        jspFile = config.getInitParameter("jspFile");
        try {
          if (null == context.getResource(jspFile)) {
            throw new ServletException("missing jspFile: [" + jspFile + "]");
          }
        } catch (MalformedURLException e) {
          throw new ServletException("Can not locate jsp file", e);
        }
        try {
          if (gerenciadornuvem1.SecurityUtil2isPackageProtectionEnabled()) {
            AccessController.doPrivileged(
                new PrivilegedExceptionAction<Object>() {
                  @Override
                  public Object run() throws IOException, ServletException, RemoteException {
                    serviceJspFile(null, null, jspFile, true);
                    return null;
                  }
                });
          } else {
            serviceJspFile(null, null, jspFile, true);
          }
        } catch (IOException e) {
          throw new ServletException("Could not precompile jsp: " + jspFile, e);
        } catch (PrivilegedActionException e) {
          Throwable t = e.getCause();
          if (t instanceof ServletException) throw (ServletException) t;
          throw new ServletException("Could not precompile jsp: " + jspFile, e);
        }
      }

      if (log.isDebugEnabled()) {
        log.debug(
            gerenciadornuvem0.LocalizergetMessage(
                "jsp.message.scratch.dir.is", options.getScratchDir().toString()));
        log.debug(gerenciadornuvem0.LocalizergetMessage("jsp.message.dont.modify.servlets"));
      }
    } catch (Exception excp) {
      excp.printStackTrace();
    }
  }
  @SuppressWarnings("deprecation") // Use of JSP_FILE to be removed in 9.0.x
  @Override
  public void service(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException, RemoteException {
    try {
      // jspFile may be configured as an init-param for this servlet instance
      String jspUri = jspFile;

      if (jspUri == null) {
        // JSP specified via <jsp-file> in <servlet> declaration and
        // supplied through custom servlet container code
        String jspFile = (String) request.getAttribute(gerenciadornuvem1.Constants28getJspFile());
        if (jspFile != null) {
          jspUri = jspFile;
          request.removeAttribute(gerenciadornuvem1.Constants28getJspFile());
        }
      }
      if (jspUri == null) {
        /*
         * Check to see if the requested JSP has been the target of a
         * RequestDispatcher.include()
         */
        jspUri = (String) request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
        if (jspUri != null) {
          /*
           * Requested JSP has been target of
           * RequestDispatcher.include(). Its path is assembled from the
           * relevant javax.servlet.include.* request attributes
           */
          String pathInfo = (String) request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO);
          if (pathInfo != null) {
            jspUri += pathInfo;
          }
        } else {
          /*
           * Requested JSP has not been the target of a
           * RequestDispatcher.include(). Reconstruct its path from the
           * request's getServletPath() and getPathInfo()
           */
          jspUri = request.getServletPath();
          String pathInfo = request.getPathInfo();
          if (pathInfo != null) {
            jspUri += pathInfo;
          }
        }
      }

      if (log.isDebugEnabled()) {
        log.debug("JspEngine --> " + jspUri);
        log.debug("\t     ServletPath: " + request.getServletPath());
        log.debug("\t        PathInfo: " + request.getPathInfo());
        log.debug("\t        RealPath: " + context.getRealPath(jspUri));
        log.debug("\t      RequestURI: " + request.getRequestURI());
        log.debug("\t     QueryString: " + request.getQueryString());
      }

      try {
        boolean precompile = preCompile(request);
        serviceJspFile(request, response, jspUri, precompile);
      } catch (RuntimeException e) {
        throw e;
      } catch (ServletException e) {
        throw e;
      } catch (IOException e) {
        throw e;
      } catch (Throwable e) {
        gerenciadornuvem1.ExceptionUtilshandleThrowable(e);
        throw new ServletException(e);
      }

    } catch (Exception excp) {
      excp.printStackTrace();
    }
  }