1
0
mirror of https://github.com/octoleo/plantuml-server.git synced 2024-06-26 11:42:37 +00:00

Transcoder.class will now add @startuml, to we have to check if it is

present before adding it
This commit is contained in:
Arnaud Roques 2011-04-19 18:22:56 +02:00
parent e9fbf4b0e4
commit e71536f634

View File

@ -167,14 +167,19 @@ public class PlantUmlServlet extends HttpServlet {
private void sendImage(HttpServletResponse response, String text, String uri)
throws IOException {
StringBuilder plantUmlSource = new StringBuilder();
plantUmlSource.append("@startuml\n");
plantUmlSource.append(text);
if (text.endsWith("\n") == false) {
plantUmlSource.append("\n");
}
plantUmlSource.append("@enduml");
final String uml = plantUmlSource.toString();
final String uml;
if (text.startsWith("@startuml")) {
uml = text;
} else {
StringBuilder plantUmlSource = new StringBuilder();
plantUmlSource.append("@startuml\n");
plantUmlSource.append(text);
if (text.endsWith("\n") == false) {
plantUmlSource.append("\n");
}
plantUmlSource.append("@enduml");
uml = plantUmlSource.toString();
}
// Write the first image to "os"
long today = System.currentTimeMillis();
if ( StringUtils.isDiagramCacheable( uml)) {