Package org.apache.tiles.servlet.context

Examples of org.apache.tiles.servlet.context.ServletTilesApplicationContext


    /** {@inheritDoc} */
    public TilesApplicationContext createApplicationContext(Object context) {
        if (context instanceof ServletContext) {
            ServletContext servletContext = (ServletContext) context;
            return new ServletTilesApplicationContext(servletContext);
        }

        return null;
    }
View Full Code Here


        HttpServletResponse response = EasyMock
                .createMock(HttpServletResponse.class);
        ServletContext servletContext = EasyMock
                .createMock(ServletContext.class);
        RequestDispatcher rd = EasyMock.createMock(RequestDispatcher.class);
        TilesApplicationContext applicationContext = new ServletTilesApplicationContext(
                servletContext);
        TilesRequestContext requestContext = new ServletTilesRequestContext(
                applicationContext, request, response);
        AttributeContext attributeContext = EasyMock
                .createMock(AttributeContext.class);
View Full Code Here

    /** {@inheritDoc} */
    public TilesApplicationContext createApplicationContext(Object context) {
        if (context instanceof ServletContext) {
            ServletContext servletContext = (ServletContext) context;
            return new ServletTilesApplicationContext(servletContext);
        }

        return null;
    }
View Full Code Here

     * @param context The application context.
     * @return The original servlet context, if found.
     */
    protected ServletContext getServletContext(TilesApplicationContext context) {
        if (context instanceof ServletTilesApplicationContext) {
            ServletTilesApplicationContext app = (ServletTilesApplicationContext) context;
            return app.getServletContext();
        }
        return null;

    }
View Full Code Here

    /** {@inheritDoc} */
    @Override
    protected void setUp() throws Exception {
        super.setUp();
        MockServletContext servletContext = new MockServletContext();
        appContext = new ServletTilesApplicationContext(servletContext);
        MockHttpSession session = new MockHttpSession(servletContext);
        MockHttpServletRequest request = new MockHttpServletRequest(session);
        MockHttpServletResponse response = new MockHttpServletResponse();
        this.request = request;
        this.response = response;
View Full Code Here

        HttpServletResponse response = EasyMock
                .createMock(HttpServletResponse.class);
        ServletContext servletContext = EasyMock
                .createMock(ServletContext.class);
        RequestDispatcher rd = EasyMock.createMock(RequestDispatcher.class);
        TilesApplicationContext applicationContext = new ServletTilesApplicationContext(
                servletContext);
        TilesRequestContext requestContext = new ServletTilesRequestContext(
                applicationContext, request, response);
        AttributeContext attributeContext = EasyMock
                .createMock(AttributeContext.class);
View Full Code Here

        for (String name : attributeContext.getLocalAttributeNames()) {
            context.setInitParameter(name, (String) attributeContext
                    .getAttribute(name).getValue());
        }

        TilesApplicationContext applicationContext = new ServletTilesApplicationContext(
                context);
        AbstractTilesApplicationContextFactory acFactory = AbstractTilesApplicationContextFactory
                .createFactory(applicationContext);
        applicationContext = acFactory.createApplicationContext(context);
View Full Code Here

     */
    @SuppressWarnings("deprecation")
    @Test
    public void testRegisterAttributeRenderers() {
        BasicRendererFactory rendererFactory = createMock(BasicRendererFactory.class);
        ServletTilesApplicationContext applicationContext = createMock(ServletTilesApplicationContext.class);
        TilesRequestContextFactory contextFactory = createMock(TilesRequestContextFactory.class);
        TilesContainer container = createMock(TilesContainer.class);
        AttributeEvaluatorFactory attributeEvaluatorFactory = createMock(AttributeEvaluatorFactory.class);
        ServletContext servletContext = createMock(ServletContext.class);

        rendererFactory.registerRenderer(eq("string"),
                isA(StringAttributeRenderer.class));
        rendererFactory.registerRenderer(eq("template"),
                isA(TemplateAttributeRenderer.class));
        rendererFactory.registerRenderer(eq("definition"),
                isA(DefinitionAttributeRenderer.class));
        rendererFactory.registerRenderer(eq("freemarker"),
                isA(FreeMarkerAttributeRenderer.class));
        rendererFactory.registerRenderer(eq("velocity"),
                isA(VelocityAttributeRenderer.class));

        expect(applicationContext.getContext()).andReturn(servletContext)
                .anyTimes();
        expect(servletContext.getInitParameter(VelocityView.PROPERTIES_KEY))
                .andReturn(null);
        expect(servletContext.getInitParameter(VelocityView.TOOLS_KEY))
                .andReturn(null);
View Full Code Here

     *
     * @param event The intercepted event.
     */
    public void contextInitialized(ServletContextEvent event) {
        ServletContext servletContext = event.getServletContext();
        initializer.initialize(new ServletTilesApplicationContext(
                servletContext));
    }
View Full Code Here

     * @return The created container.
     * @deprecated Use {@link BasicTilesInitializer#createContainer(org.apache.tiles.TilesApplicationContext)}
     * instead.
     */
    protected TilesContainer createContainer(ServletContext context) {
        TilesApplicationContext applicationContext = new ServletTilesApplicationContext(
                context);
        AbstractTilesContainerFactory factory = AbstractTilesContainerFactory
                .getTilesContainerFactory(applicationContext);
        return factory.createContainer(applicationContext);
    }
View Full Code Here

TOP

Related Classes of org.apache.tiles.servlet.context.ServletTilesApplicationContext

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.