Examples of StreamableResource


Examples of org.apache.tapestry5.services.assets.StreamableResource

        // Yes, I have a big regret that the JavaScript stack stuff relies on this global, rather than
        // having it passed around properly.

        localizationSetter.setNonPersistentLocaleFromLocaleName(localeName);

        StreamableResource resource =
                tracker.perform(String.format("Assembling JavaScript asset stack '%s' (%s)",
                                stackName, localeName),
                        new IOOperation<StreamableResource>()
                        {
                            public StreamableResource perform() throws IOException
View Full Code Here

Examples of org.apache.tapestry5.services.assets.StreamableResource

            public void perform() throws IOException
            {
                StreamableResourceProcessing processing = analyzer.isGZipSupported() ? StreamableResourceProcessing.COMPRESSION_ENABLED
                        : StreamableResourceProcessing.COMPRESSION_DISABLED;

                StreamableResource streamable = streamableResourceSource.getStreamableResource(resource, processing);

                streamResource(streamable);
            }
        });
    }
View Full Code Here

Examples of org.apache.tapestry5.services.assets.StreamableResource

            throws IOException
    {
        if (processing == StreamableResourceProcessing.FOR_AGGREGATION)
            return delegate.getStreamableResource(baseResource, processing);

        StreamableResource result = cache.get(baseResource);

        if (result == null)
        {
            result = delegate.getStreamableResource(baseResource, processing);
View Full Code Here

Examples of org.apache.tapestry5.services.assets.StreamableResource

                {
                    public void perform() throws IOException
                    {
                        boolean compress = compressionAnalyzer.isGZipSupported();

                        StreamableResource resource = getResource(extraPath, compress);

                        resourceStreamer.streamResource(resource);
                    }
                });
View Full Code Here

Examples of org.apache.tapestry5.services.assets.StreamableResource

        return compressed ? getCompressedResource(extraPath) : getUncompressedResource(extraPath);
    }

    private synchronized StreamableResource getCompressedResource(String extraPath) throws IOException
    {
        StreamableResource result = compressedCache.get(extraPath);

        if (result == null)
        {
            StreamableResource uncompressed = getUncompressedResource(extraPath);
            result = compressStream(uncompressed);
            compressedCache.put(extraPath, result);
        }

        return result;
View Full Code Here

Examples of org.apache.tapestry5.services.assets.StreamableResource

        return result;
    }

    private synchronized StreamableResource getUncompressedResource(String extraPath) throws IOException
    {
        StreamableResource result = uncompressedCache.get(extraPath);

        if (result == null)
        {
            result = assembleStackContent(extraPath);
            uncompressedCache.put(extraPath, result);
View Full Code Here

Examples of org.apache.tapestry5.services.assets.StreamableResource

        localizationSetter.setNonPeristentLocaleFromLocaleName(localeName);

        JavaScriptStack stack = javascriptStackSource.getStack(stackName);
        List<Asset> libraries = stack.getJavaScriptLibraries();

        StreamableResource stackContent = assembleStackContent(libraries);

        return minificationEnabled ? resourceMinimizer.minimize(stackContent) : stackContent;
    }
View Full Code Here

Examples of org.apache.tapestry5.services.assets.StreamableResource

            writer.format("\n/* %s */;\n", path);

            Resource resource = library.getResource();

            StreamableResource streamable = streamableResourceSource.getStreamableResource(resource,
                    StreamableResourceProcessing.FOR_AGGREGATION);

            streamable.streamTo(stream);

            lastModified = Math.max(lastModified, streamable.getLastModified());
        }

        writer.close();

        return new StreamableResourceImpl(JAVASCRIPT_CONTENT_TYPE, CompressionStatus.COMPRESSABLE, lastModified,
View Full Code Here

Examples of org.apache.tapestry5.services.assets.StreamableResource

    }

    public StreamableResource getStreamableResource(Resource baseResource, StreamableResourceProcessing processing)
            throws IOException
    {
        StreamableResource streamable = delegate.getStreamableResource(baseResource, processing);

        if (processing != StreamableResourceProcessing.FOR_AGGREGATION)
            return minimizer.minimize(streamable);

        return streamable;
View Full Code Here

Examples of org.apache.tapestry5.services.assets.StreamableResource

        inputStream.close();
        writer.close();

        // The content is minimized, but can still be (GZip) compressed.

        StreamableResource output = new StreamableResourceImpl(input.getContentType(), CompressionStatus.COMPRESSABLE,
                input.getLastModified(), new BytestreamCache(bos));

        long elapsedNanos = System.nanoTime() - startNanos;

        if (logger.isDebugEnabled())
        {
            double elapsedMillis = ((double) elapsedNanos) * NANOS_TO_MILLIS;

            logger.debug(String.format("Minimized %,d input bytes of %s to %,d output bytes in %.2f ms",
                    input.getSize(), resourceType, output.getSize(), elapsedMillis));
        }

        return output;
    }
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.