Package org.apache.tapestry5.ioc.internal.util

Examples of org.apache.tapestry5.ioc.internal.util.ClasspathResource


        String path = packageName.replace('.', '/') + "/" + file;

        ClassLoader loader = getClass().getClassLoader();

        return new ClasspathResource(loader, path);
    }
View Full Code Here


        File f = new File(packageDir, "Biff.tml");

        f.createNewFile();

        Resource baseResource = new ClasspathResource(loader, "baz/Biff.class");
        Resource localized = baseResource.withExtension(InternalConstants.TEMPLATE_EXTENSION);

        TemplateParser parser = mockTemplateParser();
        ComponentTemplate template = mockComponentTemplate();
        InvalidationListener listener = mockInvalidationListener();
View Full Code Here

        verify();
    }

    private Resource newResource(String name)
    {
        return new ClasspathResource(loader, PATH + "/" + name);
    }
View Full Code Here

                }

                // TODO: Check that the name is not already in the map. But I think that can't happen,
                // because the classloader itself is synchronized.

                Resource baseResource = new ClasspathResource(classname.replace(".", "/") + ".class");

                ComponentModel parentModel = nameToComponentModel.get(parentClassname);

                MutableComponentModel model = new MutableComponentModelImpl(classname, logger, baseResource,
                        parentModel);
View Full Code Here

            {
                return mockMessages;
            }
        };

        Resource rootResource = new ClasspathResource("/");
        source = new ValidationMessagesSourceImpl(Arrays.asList("org/apache/tapestry5/internal/ValidationMessages",
                "org/apache/tapestry5/internal/ValidationTestMessages"), rootResource, new PropertiesFileParserImpl(),
                mockMessagesSource, new ClasspathURLConverterImpl());
    }
View Full Code Here

        File f = new File(packageDir, "Biff.tml");

        f.createNewFile();

        Resource baseResource = new ClasspathResource(loader, "baz/Biff.class");
        Resource localized = baseResource.withExtension(TapestryConstants.TEMPLATE_EXTENSION);

        TemplateParser parser = mockTemplateParser();
        ComponentTemplate template = mockComponentTemplate();
        InvalidationListener listener = mockInvalidationListener();
        ComponentTemplateLocator locator = mockComponentTemplateLocator();
View Full Code Here

        verify();
    }

    private Resource newResource(String name)
    {
        return new ClasspathResource(loader, PATH + "/" + name);
    }
View Full Code Here

        if (path.startsWith(applicationAssetPrefix))
            return findContextResource(path.substring(applicationAssetPrefix.length()));

        String resourcePath = aliasManager.toResourcePath(path);

        Resource resource = new ClasspathResource(resourcePath);

        if (!resourceCache.requiresDigest(resource)) return resource;

        String file = resource.getFile();

        // Somehow this code got real ugly, but it's all about preventing NPEs when a resource
        // that should have a digest doesn't.

        boolean valid = false;
        Resource result = resource;

        int lastdotx = file.lastIndexOf('.');

        if (lastdotx > 0)
        {
            int prevdotx = file.lastIndexOf('.', lastdotx - 1);

            if (prevdotx > 0)
            {

                String requestDigest = file.substring(prevdotx + 1, lastdotx);

                // Strip the digest out of the file name.

                String realFile = file.substring(0, prevdotx) + file.substring(lastdotx);

                result = resource.forFile(realFile);

                String actualDigest = resourceCache.getDigest(result);

                valid = requestDigest.equals(actualDigest);
            }
View Full Code Here

        if (path.startsWith(applicationAssetPrefix))
            return findContextResource(path.substring(applicationAssetPrefix.length()));

        String resourcePath = aliasManager.toResourcePath(path);

        Resource resource = new ClasspathResource(resourcePath);

        if (!resourceCache.requiresDigest(resource)) return resource;

        String file = resource.getFile();

        // Somehow this code got real ugly, but it's all about preventing NPEs when a resource
        // that should have a digest doesn't.

        boolean valid = false;
        Resource result = resource;

        int lastdotx = file.lastIndexOf('.');

        if (lastdotx > 0)
        {
            int prevdotx = file.lastIndexOf('.', lastdotx - 1);

            if (prevdotx > 0)
            {

                String requestDigest = file.substring(prevdotx + 1, lastdotx);

                // Strip the digest out of the file name.

                String realFile = file.substring(0, prevdotx) + file.substring(lastdotx);

                result = resource.forFile(realFile);

                String actualDigest = resourceCache.getDigest(result);

                valid = requestDigest.equals(actualDigest);
            }
View Full Code Here

    {
        this.cache = cache;
        this.aliasManager = aliasManager;
        this.converter = converter;

        rootResource = new ClasspathResource("");

        invariant = converter.isInvariant();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.ioc.internal.util.ClasspathResource

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.