Example usage for io.netty.util AsciiString toLowerCase

List of usage examples for io.netty.util AsciiString toLowerCase

Introduction

In this page you can find the example usage for io.netty.util AsciiString toLowerCase.

Prototype

public AsciiString toLowerCase() 

Source Link

Document

Converts the characters in this string to lowercase, using the default Locale.

Usage

From source file:com.linecorp.armeria.common.DefaultHttpHeaders.java

License:Apache License

@Override
protected HeaderEntry<AsciiString, String> newHeaderEntry(int h, AsciiString name, String value,
        HeaderEntry<AsciiString, String> next) {

    return super.newHeaderEntry(h, name.toLowerCase(), value, next);
}

From source file:com.linecorp.armeria.server.http.tomcat.TomcatService.java

License:Apache License

private static HttpHeaders convertResponse(Response coyoteRes) {
    final HttpHeaders headers = HttpHeaders.of(HttpStatus.valueOf(coyoteRes.getStatus()));

    final String contentType = coyoteRes.getContentType();
    if (contentType != null && !contentType.isEmpty()) {
        headers.set(HttpHeaderNames.CONTENT_TYPE, contentType);
    }//from  ww w  .  j a v  a2  s  .co m

    final MimeHeaders cHeaders = coyoteRes.getMimeHeaders();
    final int numHeaders = cHeaders.size();
    for (int i = 0; i < numHeaders; i++) {
        final AsciiString name = toHeaderName(cHeaders.getName(i));
        if (name == null) {
            continue;
        }

        final String value = toHeaderValue(cHeaders.getValue(i));
        if (value == null) {
            continue;
        }

        headers.add(name.toLowerCase(), value);
    }

    return headers;
}

From source file:com.linecorp.armeria.server.tomcat.TomcatService.java

License:Apache License

private static HttpHeaders convertResponse(Response coyoteRes) {
    final HttpHeaders headers = HttpHeaders.of(HttpStatus.valueOf(coyoteRes.getStatus()));

    final String contentType = coyoteRes.getContentType();
    if (contentType != null && !contentType.isEmpty()) {
        headers.set(HttpHeaderNames.CONTENT_TYPE, contentType);
    }//from ww w. j  a v a 2  s.  co m

    final long contentLength = coyoteRes.getBytesWritten(true); // 'true' will trigger flush.
    final String method = coyoteRes.getRequest().method().toString();
    if (!"HEAD".equals(method)) {
        headers.setLong(HttpHeaderNames.CONTENT_LENGTH, contentLength);
    }

    final MimeHeaders cHeaders = coyoteRes.getMimeHeaders();
    final int numHeaders = cHeaders.size();
    for (int i = 0; i < numHeaders; i++) {
        final AsciiString name = toHeaderName(cHeaders.getName(i));
        if (name == null) {
            continue;
        }

        final String value = toHeaderValue(cHeaders.getValue(i));
        if (value == null) {
            continue;
        }

        headers.add(name.toLowerCase(), value);
    }

    return headers;
}