Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1934

weld-servlet-core has hard dependency on Jsp

    XMLWordPrintable

Details

    • Hide

      Try starting a web container with weld-servlet-core, but without e.g. apache-jsp or another jsp implementation

      Show
      Try starting a web container with weld-servlet-core, but without e.g. apache-jsp or another jsp implementation

    Description

      When WeldServletLIfecycle initialises it has a hard dependency on JspFactory.

      However, it ought to be possible to use Weld and the weld-servlet-core in a web container, without having Jsp's (or jsp dependencies). Especially since jsp's are getting more and more rare.

      Would it therefore be possible to change the following code to check if JspFactory is present before initializing the jsp beans?

       if (JspFactory.getDefaultFactory() != null) {
                  JspApplicationContext jspApplicationContext = JspFactory.getDefaultFactory().getJspApplicationContext(context);
      
                  // Register the ELResolver with JSP
                  jspApplicationContext.addELResolver(manager.getELResolver());
      
                  // Register ELContextListener with JSP
                  try {
                      jspApplicationContext.addELContextListener(new WeldELContextListener());
                  } catch (Exception e) {
                      throw WeldServletLogger.LOG.errorLoadingWeldELContextListener(e);
                  }
      
                  // Push the wrapped expression factory into the servlet context so that Tomcat or Jetty can hook it in using a container code
                  context.setAttribute(EXPRESSION_FACTORY_NAME, manager.wrapExpressionFactory(jspApplicationContext.getExpressionFactory()));
              }
      
      

      Attachments

        Activity

          People

            rhn-engineering-jharting Jozef Hartinger
            cbear_jira Frode Carlsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: