Search in sources :

Example 1 with RequestHeaderAttribute

use of io.undertow.attribute.RequestHeaderAttribute in project spring-boot by spring-projects.

the class UndertowServletWebServer method getCompressionPredicates.

private Predicate[] getCompressionPredicates(Compression compression) {
    List<Predicate> predicates = new ArrayList<>();
    predicates.add(new MaxSizePredicate(compression.getMinResponseSize()));
    predicates.add(new CompressibleMimeTypePredicate(compression.getMimeTypes()));
    if (compression.getExcludedUserAgents() != null) {
        for (String agent : compression.getExcludedUserAgents()) {
            RequestHeaderAttribute agentHeader = new RequestHeaderAttribute(new HttpString(HttpHeaders.USER_AGENT));
            predicates.add(Predicates.not(Predicates.regex(agentHeader, agent)));
        }
    }
    return predicates.toArray(new Predicate[predicates.size()]);
}
Also used : ArrayList(java.util.ArrayList) HttpString(io.undertow.util.HttpString) RequestHeaderAttribute(io.undertow.attribute.RequestHeaderAttribute) Predicate(io.undertow.predicate.Predicate) HttpString(io.undertow.util.HttpString)

Aggregations

RequestHeaderAttribute (io.undertow.attribute.RequestHeaderAttribute)1 Predicate (io.undertow.predicate.Predicate)1 HttpString (io.undertow.util.HttpString)1 ArrayList (java.util.ArrayList)1