Class BasicHttpException

All Implemented Interfaces:
Serializable, HttpMessage, HttpResponse
Direct Known Subclasses:
BadRequest, BasicHttpException.Unmodifiable, Conflict, ExpectationFailed, FailedDependency, Forbidden, Gone, HttpVersionNotSupported, InsufficientStorage, InternalServerError, LengthRequired, Locked, LoopDetected, MethodNotAllowed, MisdirectedRequest, NetworkAuthenticationRequired, NotAcceptable, NotExtended, NotFound, NotImplemented, PayloadTooLarge, PreconditionFailed, PreconditionRequired, RangeNotSatisfiable, RequestHeaderFieldsTooLarge, ServiceUnavailable, TooManyRequests, Unauthorized, UnavailableForLegalReasons, UnprocessableEntity, UnsupportedMediaType, UpgradeRequired, UriTooLong, VariantAlsoNegotiates

Basic implementation of the HttpResponse interface for error responses.

Although this class implements the various setters defined on the HttpResponse interface, it's in general going to be more efficient to set the status/headers/content of this bean through the builder.

Immutability is expressed with the "funnel + nested Unmodifiable snapshot" paradigm: every mutator (fluent setter and void interface mutator) routes through the single protected modify(Runnable) choke-point, and each concrete leaf gets a nested X.Unmodifiable whose only behavioral override is a throwing modify(...). A leaf's unmodifiable() factory returns a point-in-time snapshot of type X.Unmodifiable; any attempt to set a property on it throws an UnsupportedOperationException.

This is a Throwable-rooted hierarchy, so (unlike BasicHttpResponse) it cannot be a self-typed (CRTP) root — JLS §8.1.2 forbids a generic Throwable. The funnel therefore returns the base type and each leaf keeps its covariant setter overrides.

Notes:
  • Beans are not thread safe unless they're marked as unmodifiable.
See Also: