Package org.glassfish.grizzly.http

Examples of org.glassfish.grizzly.http.CompressionConfig


        }
    }

    private void configureCompressionForListener(UrsusJerseyApplicationConfiguration.NetworkListener networkListenerConfig, NetworkListener listener) {
        UrsusJerseyApplicationConfiguration.Compression compression = networkListenerConfig.getCompression();
        CompressionConfig compressionConfig = listener.getCompressionConfig();

        compressionConfig.setCompressionMode(CompressionConfig.CompressionMode.fromString(compression.getCompressionMode()));
        compressionConfig.setCompressionMinSize(compression.getCompressionMinSize());
        compressionConfig.setCompressableMimeTypes(new HashSet(compression.getCompressableMimeTypes()));
        compressionConfig.setNoCompressionUserAgents(new HashSet(compression.getNoCompressionUserAgents()));
    }
View Full Code Here


        }
    }

    private void configureCompressionForListener(UrsusJerseyApplicationConfiguration.NetworkListener networkListenerConfig, NetworkListener listener) {
        UrsusJerseyApplicationConfiguration.Compression compression = networkListenerConfig.getCompression();
        CompressionConfig compressionConfig = listener.getCompressionConfig();

        compressionConfig.setCompressionMode(CompressionConfig.CompressionMode.fromString(compression.getCompressionMode()));
        compressionConfig.setCompressionMinSize(compression.getCompressionMinSize());
        compressionConfig.setCompressableMimeTypes(new HashSet<>(compression.getCompressableMimeTypes()));
        compressionConfig.setNoCompressionUserAgents(new HashSet<>(compression.getNoCompressionUserAgents()));
    }
View Full Code Here

        }
    }

    private void configureCompressionForListener(UrsusJerseyApplicationConfiguration.NetworkListener networkListenerConfig, NetworkListener listener) {
        UrsusJerseyApplicationConfiguration.Compression compression = networkListenerConfig.getCompression();
        CompressionConfig compressionConfig = listener.getCompressionConfig();

        compressionConfig.setCompressionMode(CompressionConfig.CompressionMode.fromString(compression.getCompressionMode()));
        compressionConfig.setCompressionMinSize(compression.getCompressionMinSize());
        compressionConfig.setCompressableMimeTypes(new HashSet<>(compression.getCompressableMimeTypes()));
        compressionConfig.setNoCompressionUserAgents(new HashSet<>(compression.getNoCompressionUserAgents()));
    }
View Full Code Here

    }

    protected Set<ContentEncoding> configureCompressionEncodings(
            final NetworkListener listener) {
       
        final CompressionConfig compressionConfig = listener.getCompressionConfig();
       
        if (compressionConfig.getCompressionMode() != CompressionMode.OFF) {
            final ContentEncoding gzipContentEncoding = new GZipContentEncoding(
                GZipContentEncoding.DEFAULT_IN_BUFFER_SIZE,
                GZipContentEncoding.DEFAULT_OUT_BUFFER_SIZE,
                new CompressionEncodingFilter(compressionConfig,
                    GZipContentEncoding.getGzipAliases()));
View Full Code Here

    private final CompressionConfig compressionConfig;
    private final String[] aliases;

    public CompressionEncodingFilter(final CompressionConfig compressionConfig,
            final String[] aliases) {
        this.compressionConfig = new CompressionConfig(compressionConfig);
        this.aliases = Arrays.copyOf(aliases, aliases.length);
    }
View Full Code Here

            // backwards compatibility
            assert (compressionMode instanceof CompressionLevel);
            mode = ((CompressionLevel) compressionMode).normalize();
        }

        compressionConfig = new CompressionConfig(mode, compressionMinSize,
                null, null);
        compressionConfig.setCompressableMimeTypes(compressableMimeTypes);
        compressionConfig.setNoCompressionUserAgents(noCompressionUserAgents);
       
        this.aliases = Arrays.copyOf(aliases, aliases.length);
View Full Code Here

        }
    }

    private void configureCompressionForListener(UrsusJerseyApplicationConfiguration.NetworkListener networkListenerConfig, NetworkListener listener) {
        UrsusJerseyApplicationConfiguration.Compression compression = networkListenerConfig.getCompression();
        CompressionConfig compressionConfig = listener.getCompressionConfig();

        compressionConfig.setCompressionMode(CompressionConfig.CompressionMode.fromString(compression.getCompressionMode()));
        compressionConfig.setCompressionMinSize(compression.getCompressionMinSize());
        compressionConfig.setCompressableMimeTypes(new HashSet(compression.getCompressableMimeTypes()));
        compressionConfig.setNoCompressionUserAgents(new HashSet(compression.getNoCompressionUserAgents()));
    }
View Full Code Here

                        .setNeedClientAuth(false)
        );

        // For both HTTP and HTTPS listeners: enable gzip compression, set thread pool, add listener to httpServer.
        for (NetworkListener listener : new NetworkListener[] {httpListener, httpsListener}) {
            CompressionConfig cc = listener.getCompressionConfig();
            cc.setCompressionMode(CompressionConfig.CompressionMode.ON);
            cc.setCompressionMinSize(50000); // the min number of bytes to compress
            cc.setCompressableMimeTypes("application/json", "text/json"); // the mime types to compress
            listener.getTransport().setWorkerThreadPoolConfig(threadPoolConfig);
            httpServer.addListener(listener);
        }

        /* Add a few handlers (~= servlets) to the Grizzly server. */
 
View Full Code Here

    }

    protected Set<ContentEncoding> configureCompressionEncodings(
            final NetworkListener listener) {
       
        final CompressionConfig compressionConfig = listener.getCompressionConfig();
       
        if (compressionConfig.getCompressionMode() != CompressionMode.OFF) {
            final ContentEncoding gzipContentEncoding = new GZipContentEncoding(
                GZipContentEncoding.DEFAULT_IN_BUFFER_SIZE,
                GZipContentEncoding.DEFAULT_OUT_BUFFER_SIZE,
                new CompressionEncodingFilter(compressionConfig,
                    GZipContentEncoding.getGzipAliases()));
View Full Code Here

        }
    }

    private void configureCompressionForListener(UrsusApplicationConfiguration.NetworkListener networkListenerConfig, NetworkListener listener) {
        UrsusApplicationConfiguration.Compression compression = networkListenerConfig.getCompression();
        CompressionConfig compressionConfig = listener.getCompressionConfig();

        compressionConfig.setCompressionMode(CompressionConfig.CompressionMode.fromString(compression.getCompressionMode()));
        compressionConfig.setCompressionMinSize(compression.getCompressionMinSize());
        compressionConfig.setCompressableMimeTypes(new HashSet(compression.getCompressableMimeTypes()));
        compressionConfig.setNoCompressionUserAgents(new HashSet(compression.getNoCompressionUserAgents()));
    }
View Full Code Here

TOP

Related Classes of org.glassfish.grizzly.http.CompressionConfig

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.