Examples of InternalContextAdapter


Examples of org.apache.velocity.context.InternalContextAdapter

                  /*
                   *  init.  be a good citizen and give it an ICA
                   */

                  InternalContextAdapter ica
                    = new InternalContextAdapterImpl(new VelocityContext());

                  ica.pushCurrentTemplateName("VMProxyArg : "
                    + ParserTreeConstants.jjtNodeName[type]);

                  nodeTree.init(ica, rsvc);
                    }
                }
View Full Code Here

Examples of org.apache.velocity.context.InternalContextAdapter

         * to prevent any changes to the current context.
         */

        if (nodeTree != null)
        {
            InternalContextAdapter ica = new EvaluateContext(context, rsvc);

            ica.pushCurrentTemplateName( templateName );

            try
            {
                try
                {
                    nodeTree.init( ica, rsvc );
                }
                catch (TemplateInitException pex)
                {
                    Info info = new Info( templateName, node.getLine(), node.getColumn() );
                    throw  new ParseErrorException( pex.getMessage(), info );
                }

                try
                {
                    preRender(ica);

                    /*
                     *  now render, and let any exceptions fly
                     */
                    nodeTree.render( ica, writer );
                }
                catch (StopCommand stop)
                {
                    if (!stop.isFor(this))
                    {
                        throw stop;
                    }
                    else if (rsvc.getLog().isDebugEnabled())
                    {
                        rsvc.getLog().debug(stop.getMessage());
                    }
                }
                catch (ParseErrorException pex)
                {
                    // convert any parsing errors to the correct line/col
                    Info info = new Info( templateName, node.getLine(), node.getColumn() );
                    throw  new ParseErrorException( pex.getMessage(), info );
                }
            }
            finally
            {
                ica.popCurrentTemplateName();
                postRender(ica);
            }
            return true;
        }

View Full Code Here

Examples of org.apache.velocity.context.InternalContextAdapter

     * @throws IOException If something goes wrong.
     */
    @Test
    public void testRenderAttribute() throws IOException {
        TilesContainer container = createMock(TilesContainer.class);
        InternalContextAdapter internalContextAdapter = createMock(InternalContextAdapter.class);
        ApplicationContext applicationContext = createMock(ApplicationContext.class);
        StringWriter writer = new StringWriter();
        Attribute attribute = new Attribute("myValue");

        Map<String, Object> requestScope = new HashMap<String, Object>();
View Full Code Here

Examples of org.apache.velocity.context.InternalContextAdapter

     * @throws IOException If something goes wrong.
     */
    @Test
    public void testRenderDefinition() throws IOException {
        TilesContainer container = createMock(TilesContainer.class);
        InternalContextAdapter internalContextAdapter = createMock(InternalContextAdapter.class);
        ApplicationContext applicationContext = createMock(ApplicationContext.class);
        StringWriter writer = new StringWriter();

        Map<String, Object> requestScope = new HashMap<String, Object>();
        Map<String, Object> applicationScope = new HashMap<String, Object>();
View Full Code Here

Examples of org.apache.velocity.context.InternalContextAdapter

     * @throws IOException If something goes wrong.
     */
    @Test
    public void testRenderAttributeContext() throws IOException {
        TilesContainer container = createMock(TilesContainer.class);
        InternalContextAdapter internalContextAdapter = createMock(InternalContextAdapter.class);
        ApplicationContext applicationContext = createMock(ApplicationContext.class);
        StringWriter writer = new StringWriter();

        Map<String, Object> requestScope = new HashMap<String, Object>();
        Map<String, Object> applicationScope = new HashMap<String, Object>();
View Full Code Here

Examples of org.apache.velocity.context.InternalContextAdapter

                    /*
                     *  init.  be a good citizen and give it an ICA
                     */

                    InternalContextAdapter ica
                            = new InternalContextAdapterImpl(new VelocityContext());

                    ica.pushCurrentTemplateName("VMProxyArg : "
                            + ParserTreeConstants.jjtNodeName[type]);

                    nodeTree.init(ica, rsvc);
                }
                catch ( Exception e )
View Full Code Here

Examples of org.apache.velocity.context.InternalContextAdapter

         * to prevent any changes to the current context.
         */

        if (nodeTree != null)
        {
            InternalContextAdapter ica = new EvaluateContext(context, rsvc);

            ica.pushCurrentTemplateName( templateName );

            try
            {
                try
                {
                    nodeTree.init( ica, rsvc );
                }
                catch (TemplateInitException pex)
                {
                    Info info = new Info( templateName, node.getLine(), node.getColumn() );
                    throw  new ParseErrorException( pex.getMessage(), info );
                }

                try
                {
                    /*
                     *  now render, and let any exceptions fly
                     */
                    nodeTree.render( ica, writer );
                }
                catch (ParseErrorException pex)
                {
                    // convert any parsing errors to the correct line/col
                    Info info = new Info( templateName, node.getLine(), node.getColumn() );
                    throw  new ParseErrorException( pex.getMessage(), info );
                }
            }
            finally
            {
                ica.popCurrentTemplateName();
            }

            return true;
        }

View Full Code Here

Examples of org.apache.velocity.context.InternalContextAdapter

     */
    @Test
    public void testStart() {
        HttpServletRequest request = createMock(HttpServletRequest.class);
        HttpServletResponse response = createMock(HttpServletResponse.class);
        InternalContextAdapter velocityContext = createMock(InternalContextAdapter.class);
        TilesContainer container = createMock(TilesContainer.class);
        Map<String, Object> params = createParams();
        ArrayStack<Object> composeStack = new ArrayStack<Object>();
        Writer writer = createMock(Writer.class);
        ServletContext servletContext = createMock(ServletContext.class);
View Full Code Here

Examples of org.apache.velocity.context.InternalContextAdapter

     */
    @Test
    public void testEnd() throws IOException {
        HttpServletRequest request = createMock(HttpServletRequest.class);
        HttpServletResponse response = createMock(HttpServletResponse.class);
        InternalContextAdapter velocityContext = createMock(InternalContextAdapter.class);
        Writer writer = createMock(Writer.class);
        ServletContext servletContext = createMock(ServletContext.class);
        TilesContainer container = createMock(TilesContainer.class);
        ArrayStack<Object> composeStack = new ArrayStack<Object>();
        Map<String, Object> params = createParams();
View Full Code Here

Examples of org.apache.velocity.context.InternalContextAdapter

     */
    @Test
    public void testStart() {
        HttpServletRequest request = createMock(HttpServletRequest.class);
        HttpServletResponse response = createMock(HttpServletResponse.class);
        InternalContextAdapter velocityContext = createMock(InternalContextAdapter.class);
        Map<String, Object> params = createParams();
        ArrayStack<Object> composeStack = new ArrayStack<Object>();
        Writer writer = createMock(Writer.class);
        ServletContext servletContext = createMock(ServletContext.class);

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.