Java 类javax.servlet.jsp.JspFactory 实例源码

项目:ontopia    文件:JSPEngineWrapper.java   
private static WrapperIF getWrapper() {
  if (wrapper != null)
    return wrapper;

  if (JspFactory.getDefaultFactory() == null)
    // ontojsp can't set the default factory, since ontojsp needs to
    // be able to run inside app servers, which will set the default.
    // in the test suite there will therefore be no default factory.
    return new JSP12Wrapper(); 

  JspEngineInfo engine = JspFactory.getDefaultFactory().getEngineInfo();
  String version = engine.getSpecificationVersion();
  switch (version) {
    case "2.0": return new JSP20Wrapper();
    case "1.2": return new JSP12Wrapper();
    default: return new JSP11Wrapper();
  }
}
项目:class-guard    文件:TilesConfigurer.java   
public AttributeEvaluator createEvaluator() {
    try {
        // jsp-api-2.1 doesn't default instantiate a factory for us
        JspFactory factory = JspFactory.getDefaultFactory();
        if ((factory != null) && (factory.getJspApplicationContext(servletContext).getExpressionFactory() != null)) {
            logger.info("Found JSP 2.1 ExpressionFactory");
            ELAttributeEvaluator evaluator = new ELAttributeEvaluator();
            evaluator.setExpressionFactory(factory.getJspApplicationContext(servletContext).getExpressionFactory());
            evaluator.setResolver(new CompositeELResolverImpl());
            return evaluator;
        }
    }
    catch (Throwable ex) {
        logger.warn("Could not obtain JSP 2.1 ExpressionFactory", ex);
    }
    return null;
}
项目:zeprs    文件:RenderPageAction.java   
protected ActionForward doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {

        JspFactory _jspxFactory = null;
        PageContext pageContext = null;
        _jspxFactory = JspFactory.getDefaultFactory();
        response.setContentType("text/html");

        pageContext = _jspxFactory.getPageContext(this.getServlet(), request, response, null, true, 8192, true);
        JspContext jspContext = pageContext;
        java.util.ArrayList _jspx_nested = null;
        java.util.ArrayList _jspx_at_begin = null;
        java.util.ArrayList _jspx_at_end = null;
        jspContext = new org.apache.jasper.runtime.JspContextWrapper(jspContext, _jspx_nested, _jspx_at_begin, _jspx_at_end, null);

        /*patientid_005fdistricts_tag tag = new patientid_005fdistricts_tag();
        tag.setJspContext(jspContext);
        try {
            tag.doTag();
        } catch (JspException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }*/

        return mapping.findForward(SUCCESS_FORWARD);
    }
项目:tomcat7    文件:Validator.java   
ValidateVisitor(Compiler compiler) {
    this.pageInfo = compiler.getPageInfo();
    this.err = compiler.getErrorDispatcher();
    this.loader = compiler.getCompilationContext().getClassLoader();
    // Get the cached EL expression factory for this context
    expressionFactory =
            JspFactory.getDefaultFactory().getJspApplicationContext(
            compiler.getCompilationContext().getServletContext()).
            getExpressionFactory();
}
项目:tomcat7    文件:TestPageContextImpl.java   
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {

    PageContext pageContext = JspFactory.getDefaultFactory().getPageContext(
            this, req, resp, null, false, JspWriter.DEFAULT_BUFFER, true);
    JspWriter out = pageContext.getOut();
    if (Constants.DEFAULT_BUFFER_SIZE == out.getBufferSize()) {
        resp.getWriter().println("OK");
    } else {
        resp.getWriter().println("FAIL");
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:Validator.java   
ValidateVisitor(Compiler compiler) {
    this.pageInfo = compiler.getPageInfo();
    this.err = compiler.getErrorDispatcher();
    this.loader = compiler.getCompilationContext().getClassLoader();
    // Get the cached EL expression factory for this context
    expressionFactory =
            JspFactory.getDefaultFactory().getJspApplicationContext(
            compiler.getCompilationContext().getServletContext()).
            getExpressionFactory();
}
项目:apache-tomcat-7.0.73-with-comment    文件:TestPageContextImpl.java   
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {

    PageContext pageContext = JspFactory.getDefaultFactory().getPageContext(
            this, req, resp, null, false, JspWriter.DEFAULT_BUFFER, true);
    JspWriter out = pageContext.getOut();
    if (Constants.DEFAULT_BUFFER_SIZE == out.getBufferSize()) {
        resp.getWriter().println("OK");
    } else {
        resp.getWriter().println("FAIL");
    }
}
项目:lazycat    文件:Validator.java   
ValidateVisitor(Compiler compiler) {
    this.pageInfo = compiler.getPageInfo();
    this.err = compiler.getErrorDispatcher();
    this.loader = compiler.getCompilationContext().getClassLoader();
    // Get the cached EL expression factory for this context
    expressionFactory = JspFactory.getDefaultFactory()
            .getJspApplicationContext(compiler.getCompilationContext().getServletContext())
            .getExpressionFactory();
}
项目:spring4-understanding    文件:TilesConfigurer.java   
@Override
protected AttributeEvaluatorFactory createAttributeEvaluatorFactory(ApplicationContext context,
        LocaleResolver resolver) {
    AttributeEvaluator evaluator;
    if (tilesElPresent && JspFactory.getDefaultFactory() != null) {
        evaluator = new TilesElActivator().createEvaluator();
    }
    else {
        evaluator = new DirectAttributeEvaluator();
    }
    return new BasicAttributeEvaluatorFactory(evaluator);
}
项目:spring4-understanding    文件:TilesConfigurer.java   
public AttributeEvaluator createEvaluator() {
    ELAttributeEvaluator evaluator = new ELAttributeEvaluator();
    evaluator.setExpressionFactory(
            JspFactory.getDefaultFactory().getJspApplicationContext(servletContext).getExpressionFactory());
    evaluator.setResolver(new CompositeELResolverImpl());
    return evaluator;
}
项目:spring4-understanding    文件:TilesConfigurer.java   
@Override
protected AttributeEvaluatorFactory createAttributeEvaluatorFactory(TilesApplicationContext applicationContext,
        TilesRequestContextFactory contextFactory, LocaleResolver resolver) {
    AttributeEvaluator evaluator;
    if (tilesElPresent && JspFactory.getDefaultFactory() != null) {
        evaluator = TilesElActivator.createEvaluator(applicationContext);
    }
    else {
        evaluator = new DirectAttributeEvaluator();
    }
    return new BasicAttributeEvaluatorFactory(evaluator);
}
项目:beyondj    文件:Validator.java   
ValidateVisitor(Compiler compiler) {
    this.pageInfo = compiler.getPageInfo();
    this.err = compiler.getErrorDispatcher();
    this.loader = compiler.getCompilationContext().getClassLoader();
    // Get the cached EL expression factory for this context
    expressionFactory =
            JspFactory.getDefaultFactory().getJspApplicationContext(
            compiler.getCompilationContext().getServletContext()).
            getExpressionFactory();
}
项目:ward    文件:CommonConfiguration.java   
@Override
public void setServletContext(ServletContext servletContext) {
    super.setServletContext(servletContext);
    DynamicELResolver elResolver = (DynamicELResolver) servletContext
            .getAttribute(EL_RESOLVER_KEY);
    if (elResolver == null) {
        elResolver = new DynamicELResolver();
        JspFactory jspFactory = JspFactory.getDefaultFactory();
        JspApplicationContext jspContext = jspFactory
                .getJspApplicationContext(servletContext);
        jspContext.addELResolver(elResolver);
        servletContext.setAttribute(EL_RESOLVER_KEY, elResolver);
    }
    elResolver.setBeanFactory(this.beanFactory);
}
项目:ldadmin    文件:EscapeXmlELResolverListener.java   
public void contextInitialized(ServletContextEvent event) {
    // APF-1379: Prevent NPE when using Tomcat Maven Plugin
    try {
        Class.forName("org.apache.jasper.compiler.JspRuntimeContext");
    } catch (ClassNotFoundException cnfe) {
        // ignore
    }
    JspFactory.getDefaultFactory()
            .getJspApplicationContext(event.getServletContext())
            .addELResolver(new EscapeXmlELResolver());
}
项目:class-guard    文件:TilesConfigurer.java   
public boolean isExpressionFactoryAvailable() {
    try {
        JspFactory factory = JspFactory.getDefaultFactory();
        if (factory != null &&
                factory.getJspApplicationContext(servletContext).getExpressionFactory() != null) {
            logger.info("Found JSP 2.1 ExpressionFactory");
            return true;
        }
    }
    catch (Throwable ex) {
        logger.warn("Could not obtain JSP 2.1 ExpressionFactory", ex);
    }
    return false;
}
项目:class-guard    文件:Validator.java   
ValidateVisitor(Compiler compiler) {
    this.pageInfo = compiler.getPageInfo();
    this.err = compiler.getErrorDispatcher();
    this.loader = compiler.getCompilationContext().getClassLoader();
    // Get the cached EL expression factory for this context
    expressionFactory =
            JspFactory.getDefaultFactory().getJspApplicationContext(
            compiler.getCompilationContext().getServletContext()).
            getExpressionFactory();
}
项目:class-guard    文件:TestPageContextImpl.java   
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {

    PageContext pageContext = JspFactory.getDefaultFactory().getPageContext(
            this, req, resp, null, false, JspWriter.DEFAULT_BUFFER, true);
    JspWriter out = pageContext.getOut();
    if (Constants.DEFAULT_BUFFER_SIZE == out.getBufferSize()) {
        resp.getWriter().println("OK");
    } else {
        resp.getWriter().println("FAIL");
    }
}
项目:musicrecital    文件:EscapeXmlELResolverListener.java   
public void contextInitialized(ServletContextEvent event) {
    // APF-1379: Prevent NPE when using Tomcat Maven Plugin
    try {
        Class.forName("org.apache.jasper.compiler.JspRuntimeContext");
    } catch (ClassNotFoundException cnfe) {
        // ignore
    }
    JspFactory.getDefaultFactory()
            .getJspApplicationContext(event.getServletContext())
            .addELResolver(new EscapeXmlELResolver());
}
项目:TechnologyReadinessTool    文件:CoreServletContextListener.java   
@Override
public void contextInitialized(ServletContextEvent sce) {
    JspApplicationContext jspApplicationContext = JspFactory.getDefaultFactory().getJspApplicationContext(
            sce.getServletContext());
    jspApplicationContext.addELResolver(new StrutsActionELResolver());
    jspApplicationContext.addELResolver(new ExtendedAttributeELResolver());
    jspApplicationContext.addELResolver(new MultimapELResolver());
}
项目:apache-tomcat-7.0.57    文件:Validator.java   
ValidateVisitor(Compiler compiler) {
    this.pageInfo = compiler.getPageInfo();
    this.err = compiler.getErrorDispatcher();
    this.loader = compiler.getCompilationContext().getClassLoader();
    // Get the cached EL expression factory for this context
    expressionFactory =
            JspFactory.getDefaultFactory().getJspApplicationContext(
            compiler.getCompilationContext().getServletContext()).
            getExpressionFactory();
}
项目:apache-tomcat-7.0.57    文件:TestPageContextImpl.java   
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {

    PageContext pageContext = JspFactory.getDefaultFactory().getPageContext(
            this, req, resp, null, false, JspWriter.DEFAULT_BUFFER, true);
    JspWriter out = pageContext.getOut();
    if (Constants.DEFAULT_BUFFER_SIZE == out.getBufferSize()) {
        resp.getWriter().println("OK");
    } else {
        resp.getWriter().println("FAIL");
    }
}
项目:apache-tomcat-7.0.57    文件:TestPageContextImpl.java   
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {

    PageContext pageContext = JspFactory.getDefaultFactory().getPageContext(
            this, req, resp, null, false, JspWriter.DEFAULT_BUFFER, true);
    JspWriter out = pageContext.getOut();
    if (Constants.DEFAULT_BUFFER_SIZE == out.getBufferSize()) {
        resp.getWriter().println("OK");
    } else {
        resp.getWriter().println("FAIL");
    }
}
项目:apache-tomcat-7.0.57    文件:Validator.java   
ValidateVisitor(Compiler compiler) {
    this.pageInfo = compiler.getPageInfo();
    this.err = compiler.getErrorDispatcher();
    this.loader = compiler.getCompilationContext().getClassLoader();
    // Get the cached EL expression factory for this context
    expressionFactory =
            JspFactory.getDefaultFactory().getJspApplicationContext(
            compiler.getCompilationContext().getServletContext()).
            getExpressionFactory();
}
项目:birt    文件:ViewerPlugin.java   
private void setupJspFactory() {

        try {
            if (JspFactory.getDefaultFactory() == null) {
                // enforce setting the jspfactory instance as we know it here
                Class clz = Class.forName("org.apache.jasper.runtime.JspFactoryImpl"); //$NON-NLS-1$
                if (clz != null) {
                    JspFactory.setDefaultFactory((JspFactory) clz.newInstance());
                }
            }
        } catch (Exception ex) {

        }
    }
项目:tomee    文件:OpenEJBLifecycle.java   
/**
 * On Tomcat we need to sometimes force a class load to get our hands on the JspFactory
 */
private static void setJspELFactory(ServletContext startupObject, ELResolver resolver)
{
    JspFactory factory = JspFactory.getDefaultFactory();
    if (factory == null)
    {
        try
        {
            try {
                Class.forName("org.apache.jasper.servlet.JasperInitializer");
            } catch (final Throwable th) {
                Class.forName("org.apache.jasper.compiler.JspRuntimeContext");
            }
            factory = JspFactory.getDefaultFactory();
        }
        catch (Exception e)
        {
            // ignore
        }

    }

    if (factory != null)
    {
        JspApplicationContext applicationCtx = factory.getJspApplicationContext(startupObject);
        applicationCtx.addELResolver(resolver);
    }
    else
    {
        logger.debug("Default JSPFactroy instance has not found. Skipping OWB JSP handling");
    }
}
项目:beyondj    文件:Jsp21ExpressionExecutor.java   
/** Creates an ExpressionFactory using the JspApplicationContext. */
protected ExpressionFactory getExpressionFactory() {
    ServletContext ctx = StripesFilter.getConfiguration().getServletContext();
    JspApplicationContext jspCtx = JspFactory.getDefaultFactory().getJspApplicationContext(ctx);
    return jspCtx.getExpressionFactory();
}
项目:packagedrone    文件:PageContextImpl.java   
PageContextImpl(JspFactory factory) {
       this.factory = factory;
this.outs = new BodyContentImpl[0];
this.attributes = new HashMap<String, Object>(16);
this.depth = -1;
   }
项目:package-drone    文件:PageContextImpl.java   
PageContextImpl(JspFactory factory) {
       this.factory = factory;
this.outs = new BodyContentImpl[0];
this.attributes = new HashMap<String, Object>(16);
this.depth = -1;
   }
项目:stripes    文件:Jsp21ExpressionExecutor.java   
/** Creates an ExpressionFactory using the JspApplicationContext. */
protected ExpressionFactory getExpressionFactory() {
    ServletContext ctx = StripesFilter.getConfiguration().getServletContext();
    JspApplicationContext jspCtx = JspFactory.getDefaultFactory().getJspApplicationContext(ctx);
    return jspCtx.getExpressionFactory();
}
项目:stripesframework    文件:Jsp21ExpressionExecutor.java   
/** Creates an ExpressionFactory using the JspApplicationContext. */
protected ExpressionFactory getExpressionFactory() {
    ServletContext ctx = StripesFilter.getConfiguration().getServletContext();
    JspApplicationContext jspCtx = JspFactory.getDefaultFactory().getJspApplicationContext(ctx);
    return jspCtx.getExpressionFactory();
}