Search in sources :

Example 1 with ContentEncoder

use of org.glassfish.jersey.spi.ContentEncoder in project jersey by jersey.

the class EncodingFilter method getSupportedEncodings.

/**
     * Returns a (lexically) sorted set of supported encodings.
     * @return sorted set of supported encodings.
     */
SortedSet<String> getSupportedEncodings() {
    // may be set twice, but it does not break anything
    if (supportedEncodings == null) {
        SortedSet<String> se = new TreeSet<>();
        List<ContentEncoder> encoders = injectionManager.getAllInstances(ContentEncoder.class);
        for (ContentEncoder encoder : encoders) {
            se.addAll(encoder.getSupportedEncodings());
        }
        se.add(IDENTITY_ENCODING);
        supportedEncodings = se;
    }
    return supportedEncodings;
}
Also used : TreeSet(java.util.TreeSet) ContentEncoder(org.glassfish.jersey.spi.ContentEncoder)

Example 2 with ContentEncoder

use of org.glassfish.jersey.spi.ContentEncoder in project jersey by jersey.

the class EncodingFilter method getSupportedEncodings.

List<Object> getSupportedEncodings() {
    // may be set twice, but it does not break anything
    if (supportedEncodings == null) {
        SortedSet<String> se = new TreeSet<>();
        List<ContentEncoder> encoders = injectionManager.getAllInstances(ContentEncoder.class);
        for (ContentEncoder encoder : encoders) {
            se.addAll(encoder.getSupportedEncodings());
        }
        supportedEncodings = new ArrayList<Object>(se);
    }
    return supportedEncodings;
}
Also used : TreeSet(java.util.TreeSet) ContentEncoder(org.glassfish.jersey.spi.ContentEncoder)

Aggregations

TreeSet (java.util.TreeSet)2 ContentEncoder (org.glassfish.jersey.spi.ContentEncoder)2