Package org.apache.tapestry.ioc.internal.util

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


    public void protected_asset_client_URL()
    {
        ResourceCache cache = mockResourceCache();
        ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();

        Resource r = new ClasspathResource("foo/Bar.txt");

        train_requiresDigest(cache, r, true);

        expect(cache.getDigest(r)).andReturn("ABC123");
View Full Code Here


        URL url = new URL("http", "localhost", JETTY_PORT, "/assets/app1/pages/nested/tapestry-button.png");

        byte[] downloaded = readContent(url);

        Resource classpathResource = new ClasspathResource(
                "org/apache/tapestry/integration/app1/pages/nested/tapestry-button.png");

        byte[] actual = readContent(classpathResource.toURL());

        assertEquals(downloaded, actual);
    }
View Full Code Here

        train_getComponentClassName(
                model,
                "org.apache.tapestry.internal.services.SubclassComponent");

        train_getBaseResource(model, new ClasspathResource(
                "org/apache/tapestry/internal/services/SubclassComponent.class"));

        train_getParentModel(model, parent);

        train_getComponentClassName(parent, SIMPLE_COMPONENT_CLASS_NAME);
View Full Code Here

        URL url = new URL("http", "localhost", JETTY_PORT, "/assets/app1/pages/tapestry-button.png");

        byte[] downloaded = readContent(url);

        Resource classpathResource = new ClasspathResource(
                "org/apache/tapestry/integration/app1/pages/tapestry-button.png");

        byte[] actual = readContent(classpathResource.toURL());

        assertEquals(downloaded, actual);
    }
View Full Code Here

                .get(parentClassname);

        // 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, log, baseResource,
                parentModel);
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

     *         an error has been sent back to the client)
     * @throws IOException
     */
    private Resource findResourceAndValidateDigest(Response response, String resourcePath) throws IOException
    {
        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

                .get(parentClassname);

        // 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, log, baseResource,
                parentModel);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.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.