@Override
    public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
        final DecodedRequest decodedRequest = ctx.attr(DECODED_REQUEST);
        if (decodedRequest != null) {
            final CompletableFuture<HttpResponse> responseFuture = new CompletableFuture<>();
            invoke(ctx, decodedRequest.serializationFormat, decodedRequest.seqId,
                   decodedRequest.thriftFunction, decodedRequest.decodedReq, responseFuture);
            return HttpResponse.of(responseFuture);
        }

        if (req.method() != HttpMethod.POST) {
            return HttpResponse.of(HttpStatus.METHOD_NOT_ALLOWED);
        }

        final SerializationFormat serializationFormat = determineSerializationFormat(req);
        if (serializationFormat == null) {
            return HttpResponse.of(HttpStatus.UNSUPPORTED_MEDIA_TYPE,
                                   MediaType.PLAIN_TEXT_UTF_8, PROTOCOL_NOT_SUPPORTED);
        }

        if (!validateAcceptHeaders(req, serializationFormat)) {
            return HttpResponse.of(HttpStatus.NOT_ACCEPTABLE,
                                   MediaType.PLAIN_TEXT_UTF_8, ACCEPT_THRIFT_PROTOCOL_MUST_MATCH_CONTENT_TYPE);
        }

        final CompletableFuture<HttpResponse> responseFuture = new CompletableFuture<>();
        final HttpResponse res = HttpResponse.of(responseFuture);
        ctx.logBuilder().serializationFormat(serializationFormat);
        ctx.logBuilder().defer(RequestLogProperty.REQUEST_CONTENT);
        req.aggregate(AggregationOptions.usePooledObjects(ctx.alloc(), ctx.eventLoop()))
           .handle((aReq, cause) -> {
               if (cause != null) {
                   cause = Exceptions.peel(cause);
                   if (cause instanceof HttpStatusException || cause instanceof HttpResponseException) {
                       return HttpResponse.ofFailure(cause);
                   }
                   final HttpResponse errorRes;
                   if (ctx.config().verboseResponses()) {
                       errorRes = HttpResponse.of(HttpStatus.INTERNAL_SERVER_ERROR,
                                                  MediaType.PLAIN_TEXT_UTF_8,
                                                  Exceptions.traceText(cause));
                   } else {
                       errorRes = HttpResponse.of(HttpStatus.INTERNAL_SERVER_ERROR);
                   }
                   responseFuture.complete(errorRes);
                   return null;
               }
               decodeAndInvoke(ctx, aReq, serializationFormat, responseFuture);
               return null;
           }).exceptionally(CompletionActions::log);
        return res;
    }
Returns the default {@link SerializationFormat} of this service.
thrift/thrift0.13/src/main/java/com/linecorp/armeria/server/thrift/THttpService.java