Examples of StreamableResource


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.COMPRESSION_ENABLED) { return compress(streamable); }

        return streamable;
    }
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);

        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

                try
                {
                    // Get the uncompressed version, so that we can identify its content type (and remember, the extension is not enough,
                    // as some types get translated to new content types by the SRS).

                    StreamableResource uncompressed = streamableResourceSource.getStreamableResource(resource, StreamableResourceProcessing.COMPRESSION_DISABLED, resourceChangeTracker);

                    StreamableResource forRequest = isCompressable(uncompressed)
                            ? streamableResourceSource.getStreamableResource(resource, StreamableResourceProcessing.COMPRESSION_ENABLED, resourceChangeTracker)
                            : uncompressed;

                    return assetPathConstructor.constructAssetPath(folder, resourcePath, forRequest);
                } catch (IOException ex)
View Full Code Here

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

        tracker.clearOnInvalidation(cache);
    }

    public String generateChecksum(Resource resource) throws IOException
    {
        StreamableResource streamable = streamableResourceSource.getStreamableResource(resource, StreamableResourceProcessing.COMPRESSION_DISABLED,
                tracker);

        return generateChecksum(streamable);
    }
View Full Code Here

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

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

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

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

            {
                StreamableResourceProcessing processing = compress
                        ? StreamableResourceProcessing.COMPRESSION_ENABLED
                        : StreamableResourceProcessing.COMPRESSION_DISABLED;

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

                return streamResource(streamable, compress ? providedChecksum.substring(1) : providedChecksum, options);
            }
        });
    }
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

            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
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.