Package org.apache.tiles.context

Examples of org.apache.tiles.context.TilesRequestContextFactory


    assertEquals("/WEB-INF/search.jsp", response.getIncludedUrls().get(0));
    assertEquals("/WEB-INF/searchNavigation.jsp", response.getIncludedUrls().get(1));
  }

  public void testFlattenAttributeMap() throws Exception {
    TilesRequestContextFactory tilesRequestContextFactory = new ServletTilesRequestContextFactory();
    tilesRequestContextFactory.init(new HashMap<String, String>());
    BasicTilesContainer container = (BasicTilesContainer) ServletUtil.getCurrentContainer(request, servletContext);
    TilesRequestContext tilesRequestContext = tilesRequestContextFactory.createRequestContext(
        container.getApplicationContext(), new Object[] { request, response });
    Definition compositeDefinition = container.getDefinitionsFactory().getDefinition("search", tilesRequestContext);
    Map<String, Attribute> resultMap = new HashMap<String, Attribute>();
    ajaxTilesView.flattenAttributeMap(container, tilesRequestContext, resultMap, compositeDefinition, request,
        response);
View Full Code Here


    /** {@inheritDoc} */
    @Override
    public TilesContainer createContainer(TilesApplicationContext applicationContext) {
        BasicTilesContainer container = instantiateContainer(applicationContext);
        TilesRequestContextFactory requestContextFactory =
            createRequestContextFactory(applicationContext);
        container.setRequestContextFactory(requestContextFactory);
        container.setApplicationContext(applicationContext);
        LocaleResolver resolver = createLocaleResolver(applicationContext,
                requestContextFactory);
View Full Code Here

     * @since 2.1.1
     */
    protected void registerRequestContextFactory(String className,
            List<TilesRequestContextFactory> factories,
            TilesRequestContextFactory parent) {
        TilesRequestContextFactory retValue = null;
        try {
            Class<? extends TilesRequestContextFactory> clazz = ClassUtil
                    .getClass(className, TilesRequestContextFactory.class);
            retValue = clazz.newInstance();
            if (parent != null
View Full Code Here

     * Tests {@link VelocityTilesRequestContextFactory#createRequestContext(TilesApplicationContext, Object...)}.
     */
    @Test
    public void testCreateRequestContext() {
        StringWriter writer = new StringWriter();
        TilesRequestContextFactory parentFactory = createMock(TilesRequestContextFactory.class);
        TilesApplicationContext applicationContext = createMock(TilesApplicationContext.class);
        Context velocityContext = createMock(Context.class);
        HttpServletRequest request = createMock(HttpServletRequest.class);
        HttpServletResponse response = createMock(HttpServletResponse.class);
        TilesRequestContext enclosedRequest = createMock(TilesRequestContext.class);
        expect(enclosedRequest.getRequestObjects()).andReturn(new Object[] {request, response});
        expect(parentFactory.createRequestContext(applicationContext, request, response)).andReturn(enclosedRequest);
        replay(parentFactory, enclosedRequest, applicationContext, velocityContext, request, response);
        factory = new VelocityTilesRequestContextFactory();
        factory.setRequestContextFactory(parentFactory);
        VelocityTilesRequestContext context = (VelocityTilesRequestContext) factory
                .createRequestContext(applicationContext, velocityContext,
View Full Code Here

     */
    @Test
    public void testCreateDefaultAttributeRenderer() {
        TilesApplicationContext applicationContext = createMock(TilesApplicationContext.class);
        TilesContainer container = createMock(TilesContainer.class);
        TilesRequestContextFactory requestContextFactory = createMock(TilesRequestContextFactory.class);
        AttributeEvaluatorFactory attributeEvaluatorFactory = createMock(AttributeEvaluatorFactory.class);
        BasicRendererFactory rendererFactory = createMock(BasicRendererFactory.class);
        AttributeRenderer stringRenderer = createMock(TypeDetectingAttributeRenderer.class);
        AttributeRenderer templateRenderer = createMock(TypeDetectingAttributeRenderer.class);
        AttributeRenderer definitionRenderer = createMock(TypeDetectingAttributeRenderer.class);
View Full Code Here

     * .
     */
    @Test
    public void testCreateAttributeEvaluatorFactory() {
        TilesApplicationContext applicationContext = createMock(TilesApplicationContext.class);
        TilesRequestContextFactory contextFactory = createMock(TilesRequestContextFactory.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);
View Full Code Here

     * @throws IOException If something goes wrong.
     */
    @Test
    public void testGetSourceURLs() throws IOException {
        TilesApplicationContext applicationContext = createMock(TilesApplicationContext.class);
        TilesRequestContextFactory contextFactory = createMock(TilesRequestContextFactory.class);

        URL url1 = new URL("file:///nonexistent/tiles.xml");
        URL url2 = new URL("file:///nonexistent/tiles_it.xml");
        URL url3 = new URL("file:///nonexistent2/tiles.xml");

View Full Code Here

     * .
     */
    @Test
    public void testCreateDefinitionsReader() {
        TilesApplicationContext applicationContext = createMock(TilesApplicationContext.class);
        TilesRequestContextFactory contextFactory = createMock(TilesRequestContextFactory.class);

        replay(applicationContext, contextFactory);
        assertTrue(factory.createDefinitionsReader(applicationContext,
                contextFactory) instanceof CompatibilityDigesterDefinitionsReader);
        verify(applicationContext, contextFactory);
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"),
View Full Code Here

    /**
     * Tests {@link BasicTilesContainerFactory#createRequestContextFactory()}.
     */
    public void testCreateRequestContextFactory() {
        TilesRequestContextFactory contextFactory = factory
                .createRequestContextFactory(null);
        assertTrue("The class of the context factory is not correct",
                contextFactory instanceof ChainedTilesRequestContextFactory);
    }
View Full Code Here

TOP

Related Classes of org.apache.tiles.context.TilesRequestContextFactory

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.