public static long getTtlFromRequestHeader(Map<String, Object> args) throws RestServiceException {
    long ttl = Utils.Infinite_Time;
    Long ttlFromHeader = getLongHeader(args, Headers.TTL, false);
    if (ttlFromHeader != null) {
      if (ttlFromHeader < -1) {
        throw new RestServiceException(Headers.TTL + "[" + ttlFromHeader + "] is not valid (has to be >= -1)",
            RestServiceErrorCode.InvalidArgs);
      }
      ttl = ttlFromHeader;
    }
    return ttl;
  }
An util method to get ttl from arguments associated with a request.
@param args the arguments associated with the request. Cannot be {@code null}.
@return the ttl extracted from the arguments.
@throws RestServiceException if required arguments aren't present or if they aren't in the format expected.
ambry-api/src/main/java/com/github/ambry/rest/RestUtils.java