Package javax.servlet.jsp

Examples of javax.servlet.jsp.JspFactory


    @Test
    public void testCreateAttributeEvaluatorFactory() {
        ApplicationContext applicationContext = createMock(ApplicationContext.class);
        LocaleResolver resolver = createMock(LocaleResolver.class);
        ServletContext servletContext = createMock(ServletContext.class);
        JspFactory jspFactory = createMock(JspFactory.class);
        JspApplicationContext jspApplicationContext = createMock(JspApplicationContext.class);
        ExpressionFactory expressionFactory = createMock(ExpressionFactory.class);

        expect(applicationContext.getContext()).andReturn(servletContext);
        expect(jspFactory.getJspApplicationContext(servletContext)).andReturn(jspApplicationContext);
        expect(jspApplicationContext.getExpressionFactory()).andReturn(expressionFactory);

        replay(applicationContext, resolver, servletContext, jspFactory, jspApplicationContext, expressionFactory);
        JspFactory.setDefaultFactory(jspFactory);
        AttributeEvaluatorFactory attributeEvaluatorFactory = factory.createAttributeEvaluatorFactory(
View Full Code Here


     */
    @Test
    public void testGetExpressionFactory() {
        ApplicationContext applicationContext = createMock(ApplicationContext.class);
        ServletContext servletContext = createMock(ServletContext.class);
        JspFactory jspFactory = createMock(JspFactory.class);
        JspApplicationContext jspApplicationContext = createMock(JspApplicationContext.class);
        ExpressionFactory expressionFactory = createMock(ExpressionFactory.class);

        expect(applicationContext.getContext()).andReturn(servletContext);
        expect(jspFactory.getJspApplicationContext(servletContext)).andReturn(jspApplicationContext);
        expect(jspApplicationContext.getExpressionFactory()).andReturn(expressionFactory);

        replay(applicationContext, servletContext, jspFactory,
                jspApplicationContext, expressionFactory);
        JspFactory.setDefaultFactory(jspFactory);
View Full Code Here

        //Application is configured as JSP
        if(getWebBeansContext().getOpenWebBeansConfiguration().isJspApplication())
        {
            logger.debug("Application is configured as JSP. Adding EL Resolver.");
           
            JspFactory factory = JspFactory.getDefaultFactory();
            if (factory != null)
            {
                JspApplicationContext applicationCtx = factory.getJspApplicationContext((ServletContext)(startupObject));
                applicationCtx.addELResolver(resolver);               
            }           
            else
            {
                logger.debug("Default JSPFactroy instance has not found");
View Full Code Here

            jsonResponse.put("_urlWidgetHtml", string.toString());
        }

        // Evaluate all dynamic texts.
        List<String> dynamicTexts = new ArrayList<String>();
        JspFactory jspFactory = JspFactory.getDefaultFactory();
        PageContext pageContext = jspFactory.getPageContext(this, page.getRequest(), page.getResponse(), null, false, 0, false);

        try {
            ExpressionFactory expressionFactory = jspFactory.getJspApplicationContext(getServletContext()).getExpressionFactory();
            ELContext elContext = pageContext.getELContext();
            List<UUID> contentIds = page.params(UUID.class, "_dti");
            int contentIdsSize = contentIds.size();
            List<String> templates = page.params(String.class, "_dtt");

            for (int i = 0, size = templates.size(); i < size; ++ i) {
                try {
                    Object content = i < contentIdsSize ? findContent(object, contentIds.get(i)) : null;

                    if (content != null) {
                        pageContext.setAttribute("content", content);
                        dynamicTexts.add(((String) expressionFactory.createValueExpression(elContext, templates.get(i), String.class).getValue(elContext)));

                    } else {
                        dynamicTexts.add(null);
                    }

                } catch (RuntimeException error) {
                    if (Settings.isProduction()) {
                        dynamicTexts.add("");

                    } else {
                        StringWriter string = new StringWriter();

                        error.printStackTrace(new PrintWriter(string));
                        dynamicTexts.add(string.toString());
                    }
                }
            }

        } finally {
            jspFactory.releasePageContext(pageContext);
        }

        jsonResponse.put("_dynamicTexts", dynamicTexts);

        // Write the JSON response.
View Full Code Here

        final ELResolver resolver = elAdaptor.getOwbELResolver();
        //Application is configured as JSP
        if (context.getOpenWebBeansConfiguration().isJspApplication()) {
            logger.debug("Application is configured as JSP. Adding EL Resolver.");

            final JspFactory factory = JspFactory.getDefaultFactory();
            if (factory != null) {
                final JspApplicationContext applicationCtx = factory.getJspApplicationContext(servletContext);
                applicationCtx.addELResolver(resolver);
            } else {
                logger.debug("Default JspFactory instance was not found");
            }
        }
View Full Code Here

*/
public class Task extends HttpServlet {

   public void doPost(HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {

       JspFactory jspFactory;
       PageContext pageContext;
       Group group;
       String action;
       try {
           // If the Group bean hasn't been added to the session alerady, add it
           // this allows the user to go directly to ANY page
           jspFactory = JspFactory.getDefaultFactory();
           pageContext = jspFactory.getPageContext(this, request, response, "/error.jsp", true, 8192, true );

           group = (Group)pageContext.getAttribute("group",PageContext.SESSION_SCOPE);
           if (group == null) {
               group=(Group)Beans.instantiate(this.getClass().getClassLoader(), "addressbook.Group" );
               pageContext.setAttribute("group", group, PageContext.SESSION_SCOPE );
View Full Code Here

        ELResolver resolver = elAdaptor.getOwbELResolver();
        //Application is configured as JSP
        if (context.getOpenWebBeansConfiguration().isJspApplication()) {
            logger.debug("Application is configured as JSP. Adding EL Resolver.");

            JspFactory factory = JspFactory.getDefaultFactory();
            if (factory != null) {
                JspApplicationContext applicationCtx = factory.getJspApplicationContext(servletContext);
                applicationCtx.addELResolver(resolver);
            } else {
                logger.debug("Default JspFactory instance was not found");
            }
        }
View Full Code Here

            } catch (Exception e) {
                logger.error("Error merging Java EE JNDI entries in to war " + standardContext.getPath() + ": Exception: " + e.getMessage(), e);
            }

            final JspFactory factory = JspFactory.getDefaultFactory();
            if (factory != null) {
                final JspApplicationContext applicationCtx = factory.getJspApplicationContext(standardContext.getServletContext());
                final WebBeansContext context = appContext.getWebBeansContext();
                if (context != null && context.getBeanManagerImpl().isInUse()) {
                    // Registering ELResolver with JSP container
                    final ELAdaptor elAdaptor = context.getService(ELAdaptor.class);
                    final ELResolver resolver = elAdaptor.getOwbELResolver();
View Full Code Here

            } catch (Exception e) {
                logger.error("Error merging Java EE JNDI entries in to war " + standardContext.getPath() + ": Exception: " + e.getMessage(), e);
            }

            final JspFactory factory = JspFactory.getDefaultFactory();
            if (factory != null) {
                final JspApplicationContext applicationCtx = factory.getJspApplicationContext(standardContext.getServletContext());
                final WebBeansContext context = appContext.getWebBeansContext();
                if (context != null && context.getBeanManagerImpl().isInUse()) {
                    // Registering ELResolver with JSP container
                    final ELAdaptor elAdaptor = context.getService(ELAdaptor.class);
                    final ELResolver resolver = elAdaptor.getOwbELResolver();
View Full Code Here

        ELResolver resolver = elAdaptor.getOwbELResolver();
        //Application is configured as JSP
        if (context.getOpenWebBeansConfiguration().isJspApplication()) {
            logger.debug("Application is configured as JSP. Adding EL Resolver.");

            JspFactory factory = JspFactory.getDefaultFactory();
            if (factory != null) {
                JspApplicationContext applicationCtx = factory.getJspApplicationContext(servletContext);
                applicationCtx.addELResolver(resolver);
            } else {
                logger.debug("Default JspFactory instance was not found");
            }
        }
View Full Code Here

TOP

Related Classes of javax.servlet.jsp.JspFactory

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.