diff --git a/src/main/java/net/sourceforge/plantuml/servlet/DiagramResponse.java b/src/main/java/net/sourceforge/plantuml/servlet/DiagramResponse.java
index a0e02a0..930b72f 100644
--- a/src/main/java/net/sourceforge/plantuml/servlet/DiagramResponse.java
+++ b/src/main/java/net/sourceforge/plantuml/servlet/DiagramResponse.java
@@ -28,12 +28,14 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.SourceStringReader;
import net.sourceforge.plantuml.StringUtils;
+import net.sourceforge.plantuml.servlet.utility.NullOutputStream;
/**
* Delegates the diagram generation from the UML source and the filling of the HTTP response with the diagram in the
@@ -47,7 +49,7 @@ class DiagramResponse {
Map map = new HashMap();
map.put(FileFormat.PNG, "image/png");
map.put(FileFormat.SVG, "image/svg+xml");
- map.put(FileFormat.ATXT, "text/plain");
+ map.put(FileFormat.ATXT, "text/plain;charset=ISO-8859-1");
contentType = Collections.unmodifiableMap(map);
}
@@ -67,14 +69,18 @@ class DiagramResponse {
}
void sendMap(String uml) throws IOException {
- /* SourceStringReader reader = new SourceStringReader(uml);
- String map = reader.generateImage(response.getOutputStream(), new FileFormatOption(FileFormat.PNG));
- response.flushBuffer();
- System.out.println( "map !!!" + map + "!!!");
+ if (StringUtils.isDiagramCacheable(uml)) {
+ addHeaderForCache();
+ }
+ response.setContentType(getContentType());
+ SourceStringReader reader = new SourceStringReader(uml);
+ String map = reader.generateImage(new NullOutputStream(), new FileFormatOption(FileFormat.PNG));
String[] mapLines = map.split("[\\r\\n]");
- for (int i=2; (i+1) PngServlet : getSource()
+PngServlet -> UmlExtractor : getUmlSource()
+UmlExtractor --> PngServlet
+PngServlet -> PngServlet : getOutputFormat()
+PngServlet -> DiagramResponse : <>
+PngServlet -> DiagramResponse : sendDiagram()
+participant "PlantUML library" as Lib #99FF99
+DiagramResponse -> Lib : generateImage()
+Lib --> DiagramResponse
+DiagramResponse --> PngServlet
@enduml
\ No newline at end of file
diff --git a/src/main/java/net/sourceforge/plantuml/servlet/package.html b/src/main/java/net/sourceforge/plantuml/servlet/package.html
index 91061b9..c3c9bb3 100644
--- a/src/main/java/net/sourceforge/plantuml/servlet/package.html
+++ b/src/main/java/net/sourceforge/plantuml/servlet/package.html
@@ -8,5 +8,8 @@
Structure of the service part of the PlantUmlServer:
+
+
+