@Override
    public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
        final RequestHeaders headers = req.headers();
        final String contentEncoding = headers.get(HttpHeaderNames.CONTENT_ENCODING);
        if (contentEncoding == null) {
            // If the request does not contain [Content-Encoding] header,
            // pass the request to the next service.
            return unwrap().serve(ctx, req);
        }

        final StreamDecoderFactory decoderFactory = decoderFactories.get(Ascii.toLowerCase(contentEncoding));
        if (decoderFactory == null) {
            // The request contain [Content-Encoding] but not exist appropriate decoder,
            // pass the request to the next service.
            return unwrap().serve(ctx, req);
        }

        // As the compressed content should be decoded, Content-Encoding and Content-Length header
        // are no longer valid.
        final RequestHeaders newHeaders = headers.toBuilder()
                                                 .removeAndThen(HttpHeaderNames.CONTENT_ENCODING)
                                                 .removeAndThen(HttpHeaderNames.CONTENT_LENGTH)
                                                 .build();
        final HttpRequest newReq = req.withHeaders(newHeaders);
        final HttpDecodedRequest decodedRequest = new HttpDecodedRequest(
                newReq, decoderFactory, ctx.alloc(), Ints.saturatedCast(ctx.maxRequestLength()));
        ctx.updateRequest(decodedRequest);
        return unwrap().serve(ctx, decodedRequest);
    }
Creates a new instance that decorates the specified {@link HttpService} with the provided decoders.
core/src/main/java/com/linecorp/armeria/server/encoding/DecodingService.java