Package org.springdoc.scalar
Class AbstractScalarController
java.lang.Object
org.springdoc.scalar.AbstractScalarController
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 Summary
FieldsModifier and TypeFieldDescriptionprotected final String
The Original scalar url.protected final com.scalar.maven.webjar.ScalarProperties
The Scalar properties. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractScalarController
(com.scalar.maven.webjar.ScalarProperties scalarProperties) Instantiates a new Abstract scalar controller. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract String
buildApiDocsUrl
(String requestUrl) Gets api docs url.protected String
buildApiDocsUrl
(String requestUrl, String apiDocsPath) Gets api docs url.protected abstract String
buildJsBundleUrl
(String requestUrl) Build js bundle url string.protected String
buildJsBundleUrl
(String requestUrl, String scalarPath) Build js bundle url string.protected String
Decode string.protected org.springframework.http.ResponseEntity
<String> Serves the main API reference interface.protected org.springframework.http.ResponseEntity
<byte[]> Serves the JavaScript bundle for the Scalar API Reference.
-
Field Details
-
scalarProperties
protected final com.scalar.maven.webjar.ScalarProperties scalarPropertiesThe Scalar properties. -
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
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
Decode string.- Parameters:
requestURI
- the request uri- Returns:
- the string
-
buildApiDocsUrl
Gets api docs url.- Parameters:
requestUrl
- the request urlapiDocsPath
- the api docs path- Returns:
- the api docs url
-
buildJsBundleUrl
Build js bundle url string.- Parameters:
requestUrl
- the request urlscalarPath
- the scalar path- Returns:
- the string
-
buildApiDocsUrl
Gets api docs url.- Parameters:
requestUrl
- the request url- Returns:
- the api docs url
-
buildJsBundleUrl
Build js bundle url string.- Parameters:
requestUrl
- the request url- Returns:
- the string
-