Apply HTTP/2 rules while translating status code to {@link HttpResponseStatus}

@param status The status from an HTTP/2 frame
@return The HTTP/1.x status
@throws Http2Exception If there is a problem translating from HTTP/2 to HTTP/1.x
160191
public static HttpResponseStatus parseStatus(CharSequence status) throws Http2Exception {
        HttpResponseStatus result;
        try {
            result = parseLine(status);
            if (result == HttpResponseStatus.SWITCHING_PROTOCOLS) {
                throw connectionError(PROTOCOL_ERROR, "Invalid HTTP/2 status code '%d'", result.code());
            }
        } catch (Http2Exception e) {
            throw e;
        } catch (Throwable t) {
            throw connectionError(PROTOCOL_ERROR, t,
                            "Unrecognized HTTP status code '%s' encountered in translation to HTTP/1.x", status);
        }
        return result;
    }
1279674
public ResponseWrapper updateSensitiveWordStatus(int status) throws APIConnectionException, APIRequestException {
        Preconditions.checkArgument(status == 0 || status == 1, "status should be 0 or 1");
        return _httpClient.sendPut(_baseUrl + sensitiveWordPath + "/status?status=" + status, null);
    }
1346071
public static AlluxioStatusException from(Status status) {
    Preconditions.checkNotNull(status, "status");
    Preconditions.checkArgument(status != Status.OK, "OK is not an error status");
    String message = status.getDescription();
    Throwable cause = status.getCause();
    switch (status.getCode()) {
      case CANCELLED:
        return new CancelledException(message, cause);
      case INVALID_ARGUMENT:
        return new InvalidArgumentException(message, cause);
      case DEADLINE_EXCEEDED:
        return new DeadlineExceededException(message, cause);
      case NOT_FOUND:
        return new NotFoundException(message, cause);
      case ALREADY_EXISTS:
        return new AlreadyExistsException(message, cause);
      case PERMISSION_DENIED:
        return new PermissionDeniedException(message, cause);
      case UNAUTHENTICATED:
        return new UnauthenticatedException(message, cause);
      case RESOURCE_EXHAUSTED:
        return new ResourceExhaustedException(message, cause);
      case FAILED_PRECONDITION:
        return new FailedPreconditionException(message, cause);
      case ABORTED:
        return new AbortedException(message, cause);
      case OUT_OF_RANGE:
        return new OutOfRangeException(message, cause);
      case UNIMPLEMENTED:
        return new UnimplementedException(message, cause);
      case INTERNAL:
        return new InternalException(message, cause);
      case UNAVAILABLE:
        return new UnavailableException(message, cause);
      case DATA_LOSS:
        return new DataLossException(message, cause);
      default:
        return new UnknownException(message, cause);
    }
  }
236626
public ListSessionsResponse listSessions(String status) {
        ListSessionsRequest request = new ListSessionsRequest().withStatus(status);
        return listSessions(request);
    }
1284575
public ApiResponse<CheckPostMigrateStatistic> checkPostMigrateStatisticWithHttpInfo() throws ApiException {
        com.squareup.okhttp.Call call = checkPostMigrateStatisticValidateBeforeCall(null, null);
        Type localVarReturnType = new TypeToken<CheckPostMigrateStatistic>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
306192
public HttpStatus getStatusCode() {
        final Object statusCode = getHeader(HttpMessageHeaders.HTTP_STATUS_CODE);

        if (statusCode != null) {
            if (statusCode instanceof HttpStatus) {
                return (HttpStatus) statusCode;
            } else if (statusCode instanceof Integer) {
                return HttpStatus.valueOf((Integer) statusCode);
            } else {
                return HttpStatus.valueOf(Integer.valueOf(statusCode.toString()));
            }
        }

        return null;
    }
469607
private String getErrorHttpResponseMsg(HttpRequest httpRequest, StatusLine responseStatus) {
		StringBuilder sb = new StringBuilder("HttpRequest:").append(httpRequest.toString());
		sb.append("\nHttpResponse:");
		if (responseStatus.getProtocolVersion() != null) {
			sb.append(" protocol:").append(responseStatus.getProtocolVersion().toString());
		}
		sb.append(", code:").append(responseStatus.getStatusCode());
		if (responseStatus.getReasonPhrase() != null) {
			sb.append(", reasonPhrase:").append(responseStatus.getReasonPhrase());
		}

		LOG.error(sb.toString());
		return sb.toString();
	}
484183
public static String getStatusDescription(int status)
   {
      String description = "";

      Integer statusKey = new Integer(status);
      if (statusDescriptions.containsKey(statusKey))
      {
         description = statusDescriptions.get(statusKey);
      }

      return String.format("%s %d %s", WebDavConst.HTTPVER, status, description);
   }
708491
public Http2HeadersStreamSinkChannel createInitialUpgradeResponseStream() {
        if (lastGoodStreamId != 0) {
            throw new IllegalStateException();
        }
        lastGoodStreamId = 1;
        Http2HeadersStreamSinkChannel stream = new Http2HeadersStreamSinkChannel(this, 1);
        StreamHolder streamHolder = new StreamHolder(stream);
        streamHolder.sourceClosed = true;
        currentStreams.put(1, streamHolder);
        receiveConcurrentStreamsAtomicUpdater.getAndIncrement(this);
        return stream;

    }
1080644
public static Http2Headers toNettyHttp2(HttpHeaders in, boolean server) {
        final Http2Headers out = new DefaultHttp2Headers(false, in.size());

        // Trailing headers if it does not have :status.
        if (server && in.status() == null) {
            for (Entry<AsciiString, String> entry : in) {
                final AsciiString name = entry.getKey();
                final String value = entry.getValue();
                if (name.isEmpty() || HTTP_TRAILER_BLACKLIST.contains(name)) {
                    continue;
                }
                out.add(name, value);
            }
        } else {
            out.set(in);
            out.remove(HttpHeaderNames.CONNECTION);
            out.remove(HttpHeaderNames.TRANSFER_ENCODING);
        }

        if (!out.contains(HttpHeaderNames.COOKIE)) {
            return out;
        }

        // Split up cookies to allow for better compression.
        // https://tools.ietf.org/html/rfc7540#section-8.1.2.5
        final List<CharSequence> cookies = out.getAllAndRemove(HttpHeaderNames.COOKIE);
        for (CharSequence c : cookies) {
            out.add(HttpHeaderNames.COOKIE, COOKIE_SPLITTER.split(c));
        }

        return out;
    }
948058
public static ErrorMessage fromStatus(int status) {
        ErrorMessage errorMessage = new ErrorMessage();
        errorMessage.setStatus(status);
        errorMessage.setMessage(parseMessage(status));
        errorMessage.setDescription(parseDescription(status));
        return errorMessage;
    }
1221507
public static int parseHttpStatus(Throwable exception) {
        int status = 500;
        Exception ex = Requests.getProperty(DefaultExceptionMapper.BEFORE_EXCEPTION_KEY);
        if (ex != null) {
            exception = ex;
        }
        if (exception instanceof InternalServerErrorException) {
            if (exception.getCause() instanceof MessageBodyProviderNotFoundException) {
                MessageBodyProviderNotFoundException e = (MessageBodyProviderNotFoundException) exception.getCause();
                if (e.getMessage().startsWith("MessageBodyReader")) {
                    status = 415;
                } else if (e.getMessage().startsWith("MessageBodyWriter")) {
                    status = 406;
                }
            }
        } else if (exception instanceof WebApplicationException) {
            status = ((WebApplicationException) exception).getResponse().getStatus();
        } else if (exception instanceof FileNotFoundException) {
            status = 404;
        }
        return status;
    }
1110604
private boolean simulateHttpStatusCode(Message replyMessage) throws IOException {
        if (replyMessage == null || CollectionUtils.isEmpty(replyMessage.getHeaders())) {
            return false;
        }
        
        for (Entry<String, Object> headerEntry : replyMessage.getHeaders().entrySet()) {
            if (headerEntry.getKey().equalsIgnoreCase(SoapMessageHeaders.HTTP_STATUS_CODE)) {
                WebServiceConnection connection = TransportContextHolder.getTransportContext().getConnection();
                
                int statusCode = Integer.valueOf(headerEntry.getValue().toString());
                if (connection instanceof HttpServletConnection) {
                    ((HttpServletConnection)connection).setFault(false);
                    ((HttpServletConnection)connection).getHttpServletResponse().setStatus(statusCode);
                    return true;
                } else {
                    log.warn("Unable to set custom Http status code on connection other than HttpServletConnection (" + connection.getClass().getName() + ")");
                }
            }
        }
        
        return false;
    }
48776
public function status($status = null)
    {
        if ($status !== null) {
            if (!isset($this->statusTexts[$status])) {
                throw new ResponseException('Unsupported status code "' . $status . '"');
            }

            $this->status = (int) $status;

            if ($this->content === null) {
                $this->content = $this->statusTexts[$this->status];
            }
        }

        return $this->status;
    }
720503
public static HttpStatus grpcCodeToHttpStatus(Status.Code grpcStatusCode) {
        switch (grpcStatusCode) {
            case OK:
                return HttpStatus.OK;
            case CANCELLED:
                return HttpStatus.CLIENT_CLOSED_REQUEST;
            case UNKNOWN:
            case INTERNAL:
            case DATA_LOSS:
                return HttpStatus.INTERNAL_SERVER_ERROR;
            case INVALID_ARGUMENT:
            case FAILED_PRECONDITION:
            case OUT_OF_RANGE:
                return HttpStatus.BAD_REQUEST;
            case DEADLINE_EXCEEDED:
                return HttpStatus.GATEWAY_TIMEOUT;
            case NOT_FOUND:
                return HttpStatus.NOT_FOUND;
            case ALREADY_EXISTS:
            case ABORTED:
                return HttpStatus.CONFLICT;
            case PERMISSION_DENIED:
                return HttpStatus.FORBIDDEN;
            case UNAUTHENTICATED:
                return HttpStatus.UNAUTHORIZED;
            case RESOURCE_EXHAUSTED:
                return HttpStatus.TOO_MANY_REQUESTS;
            case UNIMPLEMENTED:
                return HttpStatus.NOT_IMPLEMENTED;
            case UNAVAILABLE:
                return HttpStatus.SERVICE_UNAVAILABLE;
            default:
                return HttpStatus.UNKNOWN;
        }
    }
1003970
private String convert(final T status) {
        if (adapter == null) {
            throw new IllegalStateException(
                    "Adapter must be set before usage! Convertion without adapter is not possible!");
        }
        final StatusFontIcon statusProps = adapter.adapt(status);
        // fail fast
        if (statusProps == null) {
            return "";
        }
        final String codePoint = getCodePoint(statusProps);
        final String title = statusProps.getTitle();
        return getStatusLabelDetailsInString(codePoint, statusProps.getStyle(), title, statusProps.getId(),
                statusProps.isDisabled());
    }
1368001
public static <T> GenericResponseBuilder<T> status(Response.StatusType status) {
    if (status == null) {
      throw new NullPointerException("status:null");
    }

    return status(status.getStatusCode());
  }