Skip to main content

HTTP Responses

The org.apache.juneau.http.response package contains predefined transport-neutral HttpResponseMessage implementations for most standard HTTP responses. These mirror org.apache.http.HttpResponse semantics without the Apache HttpCore dependency.

Accepted AlreadyReported BadRequest Conflict Continue Created EarlyHints ExpectationFailed FailedDependency Forbidden Found Gone HttpVersionNotSupported IMUsed InsufficientStorage InternalServerError LengthRequired Locked LoopDetected MethodNotAllowed MisdirectedRequest MovedPermanently MultipleChoices MultiStatus NetworkAuthenticationRequired NoContent NonAuthoritativeInformation NotAcceptable NotExtended NotFound NotImplemented NotModified Ok PartialContent PayloadTooLarge PermanentRedirect PreconditionFailed PreconditionRequired Processing RangeNotSatisfiable RequestHeaderFieldsTooLarge ResetContent SeeOther ServiceUnavailable SwitchingProtocols TemporaryRedirect TooManyRequests Unauthorized UnavailableForLegalReasons UnprocessableEntity UnsupportedMediaType UpgradeRequired UriTooLong UseProxy VariantAlsoNegotiates

These are built upon the transport-neutral HttpResponseMessage interface:

HttpResponseMessageBasicHttpResponse - 100-399 response codesBasicHttpException - 400+ response codes

The most common location where these responses are used are in REST operation methods described later.

Example
@RestDelete(path="/{id}")
public Ok doDelete(@Path int id) throws NotFound, Unauthorized {
pojoService.delete(pojoService.find(id).orElseThrow(NotFound::new));
return Ok.OK;
}

The following classes are also provided for constructing your own custom responses:

BasicHttpExceptionBasicHttpResponse