Class UrlDataExtractor
java.lang.Object
net.sourceforge.plantuml.servlet.utility.UrlDataExtractor
Utility class to extract the index and diagram source from an URL, e.g., returned by `request.getRequestURI()`.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetEncodedDiagram(String url) Get encoded diagram source from URL.static StringgetEncodedDiagram(String url, String fallback) Get encoded diagram source from URL.static intGet diagram index from URL.static intGet diagram index from URL.static BooleanisDarkModeUrl(String url) Determines whether the UML diagram should be rendered in dark mode based on the URL.
-
Constructor Details
-
UrlDataExtractor
public UrlDataExtractor()
-
-
Method Details
-
getIndex
Get diagram index from URL.- Parameters:
url- URL to analyse, e.g., returned by `request.getRequestURI()`- Returns:
- if exists diagram index; otherwise -1
-
getIndex
Get diagram index from URL.- Parameters:
url- URL to analyse, e.g., returned by `request.getRequestURI()`fallback- fallback index if no index exists inurl- Returns:
- if exists diagram index; otherwise
fallback
-
getEncodedDiagram
Get encoded diagram source from URL.- Parameters:
url- URL to analyse, e.g., returned by `request.getRequestURI()`- Returns:
- if exists diagram index; otherwise `null`
-
getEncodedDiagram
Get encoded diagram source from URL.- Parameters:
url- URL to analyse, e.g., returned by `request.getRequestURI()`fallback- fallback if no encoded diagram source exists inurl- Returns:
- if exists diagram index; otherwise
fallback
-
isDarkModeUrl
Determines whether the UML diagram should be rendered in dark mode based on the URL.If the URL contains a diagram output type prefixed with
d, the UML diagram will be rendered in dark mode by default.Examples:
/diagram/dsvg-> dark mode/diagram/svg-> light mode
- Parameters:
url- the URL to analyze, e.g., obtained fromrequest.getRequestURI()- Returns:
trueif the UML diagram should be rendered in dark mode,falseif it should not, ornullif the URL could not be analyzed
-