Java Code Examples for io.netty.handler.codec.http.HttpResponseStatus#REQUESTED_RANGE_NOT_SATISFIABLE
The following examples show how to use
io.netty.handler.codec.http.HttpResponseStatus#REQUESTED_RANGE_NOT_SATISFIABLE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NettyResponseChannel.java From ambry with Apache License 2.0 | 4 votes |
/** * Converts a {@link ResponseStatus} into a {@link HttpResponseStatus}. * @param responseStatus {@link ResponseStatus} that needs to be mapped to a {@link HttpResponseStatus}. * @return the {@link HttpResponseStatus} that maps to the {@link ResponseStatus}. */ private HttpResponseStatus getHttpResponseStatus(ResponseStatus responseStatus) { HttpResponseStatus status; switch (responseStatus) { case Ok: nettyMetrics.okCount.inc(); status = HttpResponseStatus.OK; break; case Created: nettyMetrics.createdCount.inc(); status = HttpResponseStatus.CREATED; break; case Accepted: nettyMetrics.acceptedCount.inc(); status = HttpResponseStatus.ACCEPTED; break; case PartialContent: nettyMetrics.partialContentCount.inc(); status = HttpResponseStatus.PARTIAL_CONTENT; break; case NotModified: nettyMetrics.notModifiedCount.inc(); status = HttpResponseStatus.NOT_MODIFIED; break; case BadRequest: nettyMetrics.badRequestCount.inc(); status = HttpResponseStatus.BAD_REQUEST; break; case Unauthorized: nettyMetrics.unauthorizedCount.inc(); status = HttpResponseStatus.UNAUTHORIZED; break; case NotFound: nettyMetrics.notFoundCount.inc(); status = HttpResponseStatus.NOT_FOUND; break; case Conflict: nettyMetrics.conflictCount.inc(); status = HttpResponseStatus.CONFLICT; break; case Gone: nettyMetrics.goneCount.inc(); status = HttpResponseStatus.GONE; break; case Forbidden: nettyMetrics.forbiddenCount.inc(); status = HttpResponseStatus.FORBIDDEN; break; case ProxyAuthenticationRequired: nettyMetrics.proxyAuthRequiredCount.inc(); status = HttpResponseStatus.PROXY_AUTHENTICATION_REQUIRED; break; case RangeNotSatisfiable: nettyMetrics.rangeNotSatisfiableCount.inc(); status = HttpResponseStatus.REQUESTED_RANGE_NOT_SATISFIABLE; break; case TooManyRequests: nettyMetrics.tooManyRequests.inc(); status = HttpResponseStatus.TOO_MANY_REQUESTS; break; case RequestTooLarge: nettyMetrics.requestTooLargeCount.inc(); status = HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE; break; case InternalServerError: nettyMetrics.internalServerErrorCount.inc(); status = HttpResponseStatus.INTERNAL_SERVER_ERROR; break; case ServiceUnavailable: nettyMetrics.serviceUnavailableErrorCount.inc(); status = HttpResponseStatus.SERVICE_UNAVAILABLE; break; case InsufficientCapacity: nettyMetrics.insufficientCapacityErrorCount.inc(); status = HttpResponseStatus.INSUFFICIENT_STORAGE; break; case PreconditionFailed: nettyMetrics.preconditionFailedErrorCount.inc(); status = HttpResponseStatus.PRECONDITION_FAILED; break; case MethodNotAllowed: nettyMetrics.methodNotAllowedErrorCount.inc(); status = HttpResponseStatus.METHOD_NOT_ALLOWED; break; default: nettyMetrics.unknownResponseStatusCount.inc(); status = HttpResponseStatus.INTERNAL_SERVER_ERROR; break; } return status; }
Example 2
Source File: NettyResponseChannelTest.java From ambry with Apache License 2.0 | 4 votes |
/** * @param code the {@link RestServiceErrorCode} whose {@link HttpResponseStatus} equivalent is required. * @return the {@link HttpResponseStatus} equivalent of {@code code}. */ private HttpResponseStatus getExpectedHttpResponseStatus(RestServiceErrorCode code) { switch (code) { case RequestTooLarge: return HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE; case Conflict: return HttpResponseStatus.CONFLICT; case Deleted: return HttpResponseStatus.GONE; case NotFound: return HttpResponseStatus.NOT_FOUND; case BadRequest: case InvalidArgs: case InvalidAccount: case InvalidContainer: case InvalidRequestState: case MalformedRequest: case MissingArgs: case UnsupportedHttpMethod: return HttpResponseStatus.BAD_REQUEST; case ResourceDirty: case AccessDenied: return HttpResponseStatus.FORBIDDEN; case Unauthorized: return HttpResponseStatus.UNAUTHORIZED; case ResourceScanInProgress: return HttpResponseStatus.PROXY_AUTHENTICATION_REQUIRED; case RangeNotSatisfiable: return HttpResponseStatus.REQUESTED_RANGE_NOT_SATISFIABLE; case ServiceUnavailable: return HttpResponseStatus.SERVICE_UNAVAILABLE; case TooManyRequests: return HttpResponseStatus.TOO_MANY_REQUESTS; case InsufficientCapacity: return HttpResponseStatus.INSUFFICIENT_STORAGE; case IdConverterServiceError: case InternalServerError: case RequestChannelClosed: case RequestResponseQueuingFailure: case UnsupportedRestMethod: return HttpResponseStatus.INTERNAL_SERVER_ERROR; case PreconditionFailed: return HttpResponseStatus.PRECONDITION_FAILED; case NotAllowed: return HttpResponseStatus.METHOD_NOT_ALLOWED; default: throw new IllegalArgumentException("Unrecognized RestServiceErrorCode - " + code); } }