Example usage for io.netty.util.internal StringUtil unescapeCsvFields

List of usage examples for io.netty.util.internal StringUtil unescapeCsvFields

Introduction

In this page you can find the example usage for io.netty.util.internal StringUtil unescapeCsvFields.

Prototype

public static List<CharSequence> unescapeCsvFields(CharSequence value) 

Source Link

Document

Unescapes the specified escaped CSV fields according to <a href="https://tools.ietf.org/html/rfc4180#section-2">RFC-4180</a>.

Usage

From source file:com.linecorp.armeria.internal.ArmeriaHttpUtil.java

License:Apache License

/**
 * Filter the {@link HttpHeaderNames#TE} header according to the
 * <a href="https://tools.ietf.org/html/rfc7540#section-8.1.2.2">special rules in the HTTP/2 RFC</a>.
 * @param entry An entry whose name is {@link HttpHeaderNames#TE}.
 * @param out the resulting HTTP/2 headers.
 *//*from   w w  w  . ja va 2 s.  c  om*/
private static void toHttp2HeadersFilterTE(Entry<CharSequence, CharSequence> entry, HttpHeaders out) {
    if (AsciiString.indexOf(entry.getValue(), ',', 0) == -1) {
        if (AsciiString.contentEqualsIgnoreCase(AsciiString.trim(entry.getValue()),
                HttpHeaderValues.TRAILERS)) {
            out.add(HttpHeaderNames.TE, HttpHeaderValues.TRAILERS.toString());
        }
    } else {
        final List<CharSequence> teValues = StringUtil.unescapeCsvFields(entry.getValue());
        for (CharSequence teValue : teValues) {
            if (AsciiString.contentEqualsIgnoreCase(AsciiString.trim(teValue), HttpHeaderValues.TRAILERS)) {
                out.add(HttpHeaderNames.TE, HttpHeaderValues.TRAILERS.toString());
                break;
            }
        }
    }
}