Package org.apache.jasper.runtime

Examples of org.apache.jasper.runtime.HttpJspBase


      Servlet theServlet = ((ServletHandler)sw).getServlet();
      if (theServlet instanceof HttpJspBase)  {
    if( debug > 9 )
        log( "PreServletInit: HttpJspBase.setParentClassLoader" +
       sw );
    HttpJspBase h = (HttpJspBase) theServlet;
    h.setClassLoader(ctx.getClassLoader());
      }
  } catch(Exception ex ) {
      throw new TomcatException( ex );
  }
    }
View Full Code Here


  }

  private void compileAndExecuteJsp(String forwardedUrl, HttpServletRequest request, HttpServletResponse response) {
    try {
      File compilationDir = compileJsp(forwardedUrl);
      HttpJspBase instance = loadJsp(forwardedUrl, compilationDir);
      instance._jspService(request, response);
    } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | ServletException
        | IOException e) {
      throw new RuntimeException("could not compile jsp", e);
    }
  }
View Full Code Here

  private HttpJspBase loadJsp(String forwardedUrl, File compilationDir) throws MalformedURLException,
      ClassNotFoundException, InstantiationException, IllegalAccessException, ServletException {
    String jspClassName = toJspClassName(forwardedUrl);
    URLClassLoader classLoader = URLClassLoader.newInstance(new URL[] { compilationDir.toURI().toURL() });
    Class<?> cls = Class.forName(jspClassName, true, classLoader);
    HttpJspBase instance = (HttpJspBase) cls.newInstance();
    MockServletConfig servletConfig = new MockServletConfig(new MockServletContext());
    servletConfig.getServletContext().setAttribute(InstanceManager.class.getName(),
        new InstanceManagerImplementation());
    JspApplicationContext jspApplicationContext = JspFactory.getDefaultFactory().getJspApplicationContext(
        servletConfig.getServletContext());

    // Register the ELResolver with JSP
    jspApplicationContext.addELResolver(manager.getELResolver());

    // Register ELContextListener with JSP
    jspApplicationContext.addELContextListener(Reflections
        .<ELContextListener> newInstance("org.jboss.weld.el.WeldELContextListener"));

    // Push the wrapped expression factory into the servlet context so that
    // Tomcat or Jetty can hook it in using a container code
    servletConfig.getServletContext().setAttribute(EXPRESSION_FACTORY_NAME,
        manager.wrapExpressionFactory(jspApplicationContext.getExpressionFactory()));
    instance.init(servletConfig);
    JspFactory.setDefaultFactory(new org.apache.jasper.runtime.JspFactoryImpl());
    instance._jspInit();
    return instance;
  }
View Full Code Here

  private void compileAndExecuteJsp(String forwardedUrl, HttpServletRequest request, HttpServletResponse response) {
    try {
      compileJsp(forwardedUrl);
     
      HttpJspBase instance = loadJsp(forwardedUrl, compilationDir);
      instance._jspService(request, response);
    } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | ServletException | IOException e) {
      throw new RuntimeException("could not compile jsp", e);
    }
  }
View Full Code Here

  private HttpJspBase loadJsp(String forwardedUrl, File compilationDir)
      throws MalformedURLException, ClassNotFoundException,
      InstantiationException, IllegalAccessException, ServletException {
    String jspClassName = toJspClassName(forwardedUrl);
    Class<?> cls = Class.forName(jspClassName, true, classLoader);
    HttpJspBase instance = (HttpJspBase) cls.newInstance();
    instance.init(servletConfig);
    instance._jspInit();
    return instance;
  }
View Full Code Here

TOP

Related Classes of org.apache.jasper.runtime.HttpJspBase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.