Examples of ApplicationResource


Examples of com.vaadin.terminal.ApplicationResource

        if (value instanceof ExternalResource) {
            addAttribute(name, ((ExternalResource) value).getURL());

        } else if (value instanceof ApplicationResource) {
            final ApplicationResource r = (ApplicationResource) value;
            final Application a = r.getApplication();
            if (a == null) {
                throw new PaintException(
                        "Application not specified for resorce "
                                + value.getClass().getName());
            }
View Full Code Here

Examples of com.vaadin.terminal.ApplicationResource

            final int next = relativeUri.indexOf('/', index + 1);
            if (next < 0) {
                return null;
            }
            final String key = relativeUri.substring(index + 1, next);
            final ApplicationResource resource = (ApplicationResource) keyResourceMap
                    .get(key);
            if (resource != null) {
                DownloadStream stream = resource.getStream();
                if (stream != null) {
                    stream.setCacheTime(resource.getCacheTime());
                    return stream;
                } else {
                    return null;
                }
            } else {
View Full Code Here

Examples of org.apache.tiles.request.ApplicationResource

    @Test
    public void testRender() throws IOException {
        Request request = createMock(Request.class);
        Writer writer = createMock(Writer.class);
        ApplicationContext applicationContext = createMock(ApplicationContext.class);
        ApplicationResource applicationResource = createMock(ApplicationResource.class);
        expect(applicationResource.getInputStream()).andReturn(getClass().getResource("/test.html").openStream());

        Map<String,Object> context = Collections.singletonMap("testKey", (Object)"test value");

        expect(request.getApplicationContext()).andReturn(applicationContext);
        expect(applicationContext.getResource(isA(String.class))).andReturn(applicationResource).anyTimes();
View Full Code Here

Examples of org.apache.tiles.request.ApplicationResource

    @Test
    public void testRender() throws IOException {
        Request request = createMock(Request.class);
        StringWriter writer = new StringWriter();
        ApplicationContext applicationContext = createMock(ApplicationContext.class);
        ApplicationResource applicationResource = createMock(ApplicationResource.class);

        Map<String,Object> context = Collections.singletonMap("testKey", (Object)"test value");

        expect(applicationContext.getResource(isA(String.class))).andReturn(applicationResource).anyTimes();
        expect(request.getAvailableScopes()).andReturn(Arrays.asList(Request.REQUEST_SCOPE, "session", Request.APPLICATION_SCOPE));
View Full Code Here

Examples of org.apache.tiles.request.ApplicationResource

        expect(portletContext.getResource("/my/path.html")).andReturn(url);
        expect(portletContext.getResource("/my/path_fr.html")).andReturn(urlFr);
        expect(portletContext.getResource("/null/path.html")).andReturn(null);

        replay(portletContext);
        ApplicationResource resource = context.getResource("/my/path.html");
        assertNotNull(resource);
        assertEquals(resource.getLocalePath(), "/my/path.html");
        assertEquals(resource.getPath(), "/my/path.html");
        assertEquals(Locale.ROOT, resource.getLocale());
        ApplicationResource resourceFr = context.getResource(resource, Locale.FRENCH);
        assertNotNull(resourceFr);
        assertEquals("/my/path_fr.html", resourceFr.getLocalePath());
        assertEquals("/my/path.html", resourceFr.getPath());
        assertEquals(Locale.FRENCH, resourceFr.getLocale());
        ApplicationResource nullResource = context.getResource("/null/path.html");
        assertNull(nullResource);
        verify(portletContext);
    }
View Full Code Here

Examples of org.apache.tiles.request.ApplicationResource

        expect(servletContext.getResource("/my/path.html")).andReturn(url);
        expect(servletContext.getResource("/my/path_fr.html")).andReturn(urlFr);
        expect(servletContext.getResource("/null/path.html")).andReturn(null);

        replay(servletContext);
        ApplicationResource resource = context.getResource("/my/path.html");
        assertNotNull(resource);
        assertEquals(resource.getLocalePath(), "/my/path.html");
        assertEquals(resource.getPath(), "/my/path.html");
        assertEquals(Locale.ROOT, resource.getLocale());
        ApplicationResource resourceFr = context.getResource(resource, Locale.FRENCH);
        assertNotNull(resourceFr);
        assertEquals("/my/path_fr.html", resourceFr.getLocalePath());
        assertEquals("/my/path.html", resourceFr.getPath());
        assertEquals(Locale.FRENCH, resourceFr.getLocale());
        ApplicationResource nullResource = context.getResource("/null/path.html");
        assertNull(nullResource);
        verify(servletContext);
    }
View Full Code Here

Examples of org.apache.tiles.request.ApplicationResource

    }

    /** {@inheritDoc} */
    @Override
    public ApplicationResource getResource(String localePath) {
        ApplicationResource retValue = null;
        Collection<ApplicationResource> urlSet = getResources(localePath);
        if (urlSet != null && !urlSet.isEmpty()) {
            retValue = urlSet.iterator().next();
        }
        return retValue;
View Full Code Here

Examples of org.apache.tiles.request.ApplicationResource

    }

    /** {@inheritDoc} */
    @Override
    public ApplicationResource getResource(ApplicationResource base, Locale locale) {
        ApplicationResource retValue = null;
        Collection<ApplicationResource> urlSet = getResources(base.getLocalePath(locale));
        if (urlSet != null && !urlSet.isEmpty()) {
            retValue = urlSet.iterator().next();
        }
        return retValue;
View Full Code Here

Examples of org.apache.tiles.request.ApplicationResource

    }

    /** {@inheritDoc} */
    @Override
    public ApplicationResource getResource(String localePath) {
        ApplicationResource retValue = null;
        Collection<ApplicationResource> resourceSet = getResources(localePath);
        if (resourceSet != null && !resourceSet.isEmpty()) {
            retValue = resourceSet.iterator().next();
        }
        return retValue;
View Full Code Here

Examples of org.apache.tiles.request.ApplicationResource

    }

    /** {@inheritDoc} */
    @Override
    public ApplicationResource getResource(ApplicationResource base, Locale locale) {
        ApplicationResource retValue = null;
        Collection<ApplicationResource> resourceSet = getResources(base.getLocalePath(locale));
        if (resourceSet != null && !resourceSet.isEmpty()) {
            retValue = resourceSet.iterator().next();
        }
        return retValue;
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.