Class RedocMixin
/redoc for the OpenAPI 3.1 spec.
Sibling of SwaggerMixin (Swagger v2 spec at /api),
SwaggerUiMixin (HTML-first mount at /swagger), and OpenApiMixin
(OpenAPI 3.1 spec at /openapi*). All four classes live in the
org.apache.juneau.rest.server.docs api-docs mixin pack.
Declares @Rest(mixins={OpenApiMixin.class}) so transitive resolution
pulls in OpenApiMixin (and its /openapi* mounts) automatically when this
mixin is composed into a host.
Configurable mount path:
The default mount /redoc/* can be overridden via the SVL variable
${juneau.redoc.path:redoc} — set via system property
(-Djuneau.redoc.path=docs), environment variable
(JUNEAU_REDOC_PATH=docs), or Config key
(juneau.redoc.path = docs) to change the runtime mount without subclassing.
Resolution happens once at RestContext construction time (SVL resolution in @RestOp(path)).
Override accepts bare token (redoc), leading slash (/redoc), trailing slash
(redoc/), or wildcard suffix (/redoc/*) — all resolve to the same mount.
Mixin-only deployment:
This resource is designed for composition via @Rest(mixins=...). The mount path is
pinned at the op level by @RestGet(path="/{juneau.redoc.path:redoc}/*") on
getRedoc(org.apache.juneau.rest.server.RestRequest); a class-level @Rest(paths=...) declaration would be silently
ignored under the mixin pattern (see @Rest(paths) Javadoc).
Composition example:
Content negotiation:
@Rest(defaultAccept="text/html") causes bare browser requests
(no Accept header) to render HTML via the RedocUI swap. Explicit accept headers
(e.g. Accept: application/json) are honored normally.
See Also:
- Since:
- 10.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetRedoc(RestRequest req) [GET /redoc] — render the Redoc HTML view (or the spec, depending onAccept).
-
Constructor Details
-
RedocMixin
public RedocMixin()
-
-
Method Details
-
getRedoc
[GET /redoc] — render the Redoc HTML view (or the spec, depending onAccept).- Parameters:
req- The current REST request.- Returns:
- The OpenAPI document.
- Throws:
NotFound- If no OpenAPI document is available for this resource.
-