Class AbstractScalarController

java.lang.Object
org.springdoc.scalar.AbstractScalarController

public abstract class AbstractScalarController extends Object
The type Abstract scalar controller.
Author:
bnasslahsen This is a copy of the class ScalarController from the scalar webjar. It has been slightly modified to fit the springdoc-openapi code base.
  • Field Details

    • scalarProperties

      protected final com.scalar.maven.webjar.ScalarProperties scalarProperties
      The Scalar properties.
    • originalScalarUrl

      protected final String originalScalarUrl
      The Original scalar url.
  • Constructor Details

    • AbstractScalarController

      protected AbstractScalarController(com.scalar.maven.webjar.ScalarProperties scalarProperties)
      Instantiates a new Abstract scalar controller.
      Parameters:
      scalarProperties - the scalar properties
  • Method Details

    • getDocs

      protected org.springframework.http.ResponseEntity<String> getDocs(String requestUrl) throws IOException
      Serves the main API reference interface.

      This endpoint returns an HTML page that displays the Scalar API Reference interface. The page is configured with the OpenAPI specification URL from the properties.

      Parameters:
      requestUrl - the request url
      Returns:
      a ResponseEntity containing the HTML content for the API reference interface
      Throws:
      IOException - if the HTML template cannot be loaded
    • getScalarJs

      protected org.springframework.http.ResponseEntity<byte[]> getScalarJs() throws IOException
      Serves the JavaScript bundle for the Scalar API Reference.

      This endpoint returns the JavaScript file that powers the Scalar API Reference interface. The file is served with the appropriate MIME type.

      Returns:
      a ResponseEntity containing the JavaScript bundle
      Throws:
      IOException - if the JavaScript file cannot be loaded
    • decode

      protected String decode(String requestURI)
      Decode string.
      Parameters:
      requestURI - the request uri
      Returns:
      the string
    • buildApiDocsUrl

      protected String buildApiDocsUrl(String requestUrl, String apiDocsPath)
      Gets api docs url.
      Parameters:
      requestUrl - the request url
      apiDocsPath - the api docs path
      Returns:
      the api docs url
    • buildJsBundleUrl

      protected String buildJsBundleUrl(String requestUrl, String scalarPath)
      Build js bundle url string.
      Parameters:
      requestUrl - the request url
      scalarPath - the scalar path
      Returns:
      the string
    • buildApiDocsUrl

      protected abstract String buildApiDocsUrl(String requestUrl)
      Gets api docs url.
      Parameters:
      requestUrl - the request url
      Returns:
      the api docs url
    • buildJsBundleUrl

      protected abstract String buildJsBundleUrl(String requestUrl)
      Build js bundle url string.
      Parameters:
      requestUrl - the request url
      Returns:
      the string