Package net.sourceforge.plantuml.servlet
Class DiagramResponse
java.lang.Object
net.sourceforge.plantuml.servlet.DiagramResponse
Delegates the diagram generation from the UML source and the filling of the HTTP response with the diagram in the
right format. Its own responsibility is to produce the right HTTP headers.
-
Constructor Summary
ConstructorsConstructorDescriptionDiagramResponse(jakarta.servlet.http.HttpServletResponse res, net.sourceforge.plantuml.FileFormat fmt, jakarta.servlet.http.HttpServletRequest req) Create new diagram response instance.DiagramResponse(jakarta.servlet.http.HttpServletResponse res, net.sourceforge.plantuml.FileFormat fmt, jakarta.servlet.http.HttpServletRequest req, net.sourceforge.plantuml.klimt.color.ColorMapper cm) Create new diagram response instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic net.sourceforge.plantuml.klimt.color.ColorMappergetColorMapper(jakarta.servlet.http.HttpServletRequest req) Retrieves the color mapper based on the HTTP request.static voidinit()Initialize PlantUML configurations and properties as well as loading the PlantUML config file.voidCheck the syntax of the diagram and send a report in TEXT format.voidsendDiagram(String uml, int idx) Render and send a specific uml diagram.voidProduce and send the image map of the uml diagram in HTML format.
-
Constructor Details
-
DiagramResponse
public DiagramResponse(jakarta.servlet.http.HttpServletResponse res, net.sourceforge.plantuml.FileFormat fmt, jakarta.servlet.http.HttpServletRequest req) Create new diagram response instance.- Parameters:
res- http responsefmt- target file formatreq- http request
-
DiagramResponse
public DiagramResponse(jakarta.servlet.http.HttpServletResponse res, net.sourceforge.plantuml.FileFormat fmt, jakarta.servlet.http.HttpServletRequest req, net.sourceforge.plantuml.klimt.color.ColorMapper cm) Create new diagram response instance.- Parameters:
res- http responsefmt- target file formatreq- http requestcm- color mapper
-
-
Method Details
-
init
public static void init()Initialize PlantUML configurations and properties as well as loading the PlantUML config file. -
getColorMapper
public static net.sourceforge.plantuml.klimt.color.ColorMapper getColorMapper(jakarta.servlet.http.HttpServletRequest req) Retrieves the color mapper based on the HTTP request.The color mapper can be specified in two ways:
- Via the HTTP header
X-Preferred-Color-Mapper, or - Via the URL by prefixing the diagram type with
dfor dark mode, e.g.,/dpng/....
X-Preferred-Color-Mappertakes precedence.- Parameters:
req- the HTTP request containing headers and URL information- Returns:
- the color mapper based on the request, with fallback to
ColorMapper.IDENTITY
- Via the HTTP header
-
sendDiagram
Render and send a specific uml diagram.- Parameters:
uml- textual UML diagram(s) sourceidx- diagram index ofumlto send- Throws:
IOException- if an input or output exception occurred
-
sendMap
Produce and send the image map of the uml diagram in HTML format.- Parameters:
uml- textual UML diagram sourceidx- diagram index ofumlto send- Throws:
IOException- if an input or output exception occurred
-
sendCheck
Check the syntax of the diagram and send a report in TEXT format.- Parameters:
uml- textual UML diagram source- Throws:
IOException- if an input or output exception occurred
-