Class OpenApiUiBase

  • All Implemented Interfaces:
    OpenApiUi, Service

    public abstract class OpenApiUiBase
    extends Object
    implements OpenApiUi
    Common base class for implementations of @link OpenApiUi}.
    • Constructor Detail

      • OpenApiUiBase

        protected OpenApiUiBase​(OpenApiUiBase.Builder<?,​?> builder,
                                Function<MediaType,​String> documentPreparer,
                                String openAPIWebContext)
        Creates a new UI implementation from the specified builder and document preparer.
        Parameters:
        builder - the builder containing relevant settings
        documentPreparer - function returning an OpenAPI document represented as a specified MediaType
        openAPIWebContext - final web context for the OpenAPISupport service
    • Method Detail

      • isEnabled

        protected boolean isEnabled()
        Returns:
        whether the UI is enabled
      • prepareDocument

        protected String prepareDocument​(MediaType mediaType)
        Prepares a representation of the OpenAPI document in the specified media type.
        Parameters:
        mediaType - media type in which to express the document
        Returns:
        representation of the OpenAPI document
      • webContext

        protected String webContext()
        Returns:
        web context this UI implementation responds at
      • options

        protected Map<String,​String> options()
        Returns:
        options set for this UI implementation (unmodifiable)
      • sendStaticText

        protected boolean sendStaticText​(ServerRequest request,
                                         ServerResponse response,
                                         MediaType mediaType)
        Sends a static text response of the given media type.
        Parameters:
        request - the request to respond to
        response - the response
        mediaType - the MediaType with which to respond, if possible
        Returns:
        whether the implementation responded with a static text response