Examples of StreamableResource


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

    private void streamLibraryContent(Asset library, OutputStream outputStream) throws IOException
    {
        Resource resource = library.getResource();

        StreamableResource streamable = resourceCache.getStreamableResource(resource);

        InputStream inputStream = streamable.getStream(false);

        TapestryInternalUtils.copy(inputStream, outputStream);
    }
View Full Code Here

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

    private void streamLibraryContent(Asset library, OutputStream outputStream) throws IOException
    {
        Resource resource = library.getResource();

        StreamableResource streamable = resourceCache.getStreamableResource(resource);

        InputStream inputStream = streamable.getStream(false);

        TapestryInternalUtils.copy(inputStream, outputStream);
    }
View Full Code Here

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

        writer.close();

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

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

        if (logger.isInfoEnabled())
        {
            long elapsedNanos = System.nanoTime() - startNanos;

            int inputSize = input.getSize();
            int outputSize = output.getSize();

            double elapsedMillis = ((double) elapsedNanos) * NANOS_TO_MILLIS;
            // e.g., reducing 100 bytes to 25 would be a (100-25)/100 reduction, or 75%
            double reduction = 100d * ((double) (inputSize - outputSize)) / ((double) inputSize);

View Full Code Here

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

        if (!enableCache(processing))
        {
            return delegate.getStreamableResource(baseResource, processing, dependencies);
        }

        StreamableResource result = TapestryInternalUtils.getAndDeref(cache, baseResource);

        if (result == null)
        {
            result = delegate.getStreamableResource(baseResource, processing, dependencies);
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, resourceChangeTracker);

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

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

        writer.close();

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

        StreamableResource output = new StreamableResourceImpl("minimized " + input.getDescription(),
                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 %s (%,d input bytes of %s to %,d output bytes in %.2f ms)",
                    input.getDescription(), input.getSize(), resourceType, output.getSize(), elapsedMillis));
        }

        return output;
    }
View Full Code Here

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

        if (processing == StreamableResourceProcessing.FOR_AGGREGATION)
        {
            return delegate.getStreamableResource(baseResource, processing, dependencies);
        }

        StreamableResource result = TapestryInternalUtils.getAndDeref(cache, baseResource);

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

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

            }
        });

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

        StreamableResource output = new StreamableResourceImpl("minimized " + input.getDescription(),
                input.getContentType(), CompressionStatus.COMPRESSABLE,
                input.getLastModified(), new BytestreamCache(bos), checksumGenerator, input.getResponseCustomizer());

        if (logger.isInfoEnabled())
        {
            long elapsedNanos = System.nanoTime() - startNanos;

            int inputSize = input.getSize();
            int outputSize = output.getSize();

            double elapsedMillis = ((double) elapsedNanos) * NANOS_TO_MILLIS;
            // e.g., reducing 100 bytes to 25 would be a (100-25)/100 reduction, or 75%
            double reduction = 100d * ((double) (inputSize - outputSize)) / ((double) inputSize);

View Full Code Here

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

    private List<String> combinedStackURL(String stackName, JavaScriptStack stack)
    {
        try
        {
            StreamableResource assembled = assembler.assembleJavaScriptResourceForStack(stackName, compressionAnalyzer.isGZipSupported(),
                    stack.getJavaScriptAggregationStrategy());

            String path = String.format("%s/%s.js",
                    threadLocale.getLocale(),
                    stackName);
View Full Code Here

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

    }

    @Override
    public StreamableResource getStreamableResource(Resource baseResource, StreamableResourceProcessing processing, ResourceDependencies dependencies) throws IOException
    {
        StreamableResource resource = delegate.getStreamableResource(baseResource, processing, dependencies);

        ContentType contentType = resource.getContentType();

        if (contentType.getBaseType().equals("text")
                && ! contentType.hasParameters()
                && processing != StreamableResourceProcessing.FOR_AGGREGATION)
        {
            return resource.withContentType(contentType.withCharset("utf-8"));
        }

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