Package com.volantis.mcs.runtime.packagers

Examples of com.volantis.mcs.runtime.packagers.PackageResources$Asset


    @Test
    public void import_stylesheet_as_asset()
    {
        DocumentLinker linker = mockDocumentLinker();
        Asset stylesheet = mockAsset("style.css");

        StylesheetLink link = new StylesheetLink("style.css");
        linker.addStylesheetLink(link);

        replay();
View Full Code Here


        return newMock(JavaScriptSupport.class);
    }

    protected final Asset mockAsset(String assetURL)
    {
        Asset asset = mockAsset();

        train_toClientURL(asset, assetURL);

        return asset;
    }
View Full Code Here

    @Override
    public Asset createAsset(Resource resource)
    {
        final URL url = resource.toURL();
        Asset asset = cache.get(url);
        if (asset == null)
        {
            asset = new UrlAsset(url.toExternalForm(), resource);
            cache.put(url, asset);
        }
View Full Code Here

                        // path was a bit too full of ../ sequences, in which case the expanded path is not valid and we adjust the
                        // error we write.

                        Resource metaResource = findLocalizedResource(null, metaPath, resources.getLocale());

                        Asset result = getComponentAsset(resources, expanded, metaResource);

                        if (result == null)
                        {
                            throw new RuntimeException(String.format("Unable to locate asset '%s' for component %s. It should be located at %s.",
                                    path, resources.getCompleteId(),
                                    metaPath));
                        }

                        // This is the best way to tell if the result is an asset for a Classpath resource.

                        Resource resultResource = result.getResource();

                        if (!resultResource.equals(metaResource))
                        {
                            if (firstWarning.getAndSet(false))
                            {
View Full Code Here

    {
        try
        {
            acquireReadLock();

            Asset result = TapestryInternalUtils.getAndDeref(cache, resource);

            if (result == null)
            {
                result = createAssetFromResource(resource);
                cache.put(resource, new SoftReference(result));
View Full Code Here

        {
            upgradeReadLockToWriteLock();

            // Check for competing thread beat us to it (not very likely!):

            Asset result = TapestryInternalUtils.getAndDeref(cache, resource);

            if (result != null)
            {
                return result;
            }
View Full Code Here

                // considered a real change, since all such variations are valid.
                appendReplacement(matcher, output, url);
                continue;
            }

            Asset asset = assetSource.getAsset(baseResource, url, null);

            if (asset != null)
            {
                String assetURL = asset.toClientURL();

                String queryParameters = matcher.group(3);
                if (queryParameters != null)
                {
                    assetURL += queryParameters;
View Full Code Here

        if (providedChecksum.length() > 0 && !providedChecksum.equals(actualChecksum))
        {
           
            // TAP5-2185: Trying to find the wrongly-checksummed resource in the classpath and context,
            // so we can create an Asset with the correct checksum and redirect to it.
            Asset asset = null;
            if (resource != null)
            {
                asset = findAssetInsideWebapp(resource);
            }
            if (asset != null)
            {
                response.sendRedirect(asset.toClientURL());
                return true;
            }
            return false;
        }
View Full Code Here

        return true;
    }

    private Asset findAssetInsideWebapp(Resource resource)
    {
        Asset asset;
        asset = findAssetFromClasspath(resource);
        if (asset == null)
        {
            asset = findAssetFromContext(resource);
        }
View Full Code Here

        return asset;
    }

    private Asset findAssetFromContext(Resource resource)
    {
        Asset asset = null;
        try
        {
            asset = contextAssetFactory.createAsset(resource);
        }
        catch (RuntimeException e)
View Full Code Here

TOP

Related Classes of com.volantis.mcs.runtime.packagers.PackageResources$Asset

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.