diff --git a/pom.xml b/pom.xml
index c58f20590..5b726b17c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
net.sourceforge.plantuml
plantuml
- 1.2020.19-SNAPSHOT
+ 1.2020.20-SNAPSHOT
jar
PlantUML
diff --git a/src/net/sourceforge/plantuml/Option.java b/src/net/sourceforge/plantuml/Option.java
index 7104fada8..ad463f7ee 100644
--- a/src/net/sourceforge/plantuml/Option.java
+++ b/src/net/sourceforge/plantuml/Option.java
@@ -79,6 +79,7 @@ public class Option {
private boolean textProgressBar = false;
private int nbThreads = 0;
private int ftpPort = -1;
+ private int picowebPort = -1;
private boolean hideMetadata = false;
private boolean checkMetadata = false;
private int stdrpt = 0;
@@ -368,6 +369,13 @@ public class Option {
} else {
this.ftpPort = Integer.parseInt(s.substring(x + 1));
}
+ } else if (StringUtils.goLowerCase(s).startsWith("-picoweb")) {
+ final int x = s.indexOf(':');
+ if (x == -1) {
+ this.picowebPort = 8080;
+ } else {
+ this.picowebPort = Integer.parseInt(s.substring(x + 1));
+ }
} else if (s.startsWith("-c")) {
s = s.substring(2);
config.add(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(s));
@@ -395,6 +403,10 @@ public class Option {
return ftpPort;
}
+ public int getPicowebPort() {
+ return picowebPort;
+ }
+
private void addInConfig(BufferedReader br) throws IOException {
if (br == null) {
return;
diff --git a/src/net/sourceforge/plantuml/OptionPrint.java b/src/net/sourceforge/plantuml/OptionPrint.java
index bc8cedb06..9588a1713 100644
--- a/src/net/sourceforge/plantuml/OptionPrint.java
+++ b/src/net/sourceforge/plantuml/OptionPrint.java
@@ -156,6 +156,7 @@ public class OptionPrint {
System.out.println(" -filename \"example.puml\"\tTo override %filename% variable");
System.out.println(" -preproc\t\tTo output preprocessor text of diagrams");
System.out.println(" -cypher\t\tTo cypher texts of diagrams so that you can share them");
+ System.out.println(" -picoweb\t\tTo start internal HTTP Server. See https://plantuml.com/picoweb");
System.out.println();
System.out.println("If needed, you can setup the environment variable GRAPHVIZ_DOT.");
exit(0);
diff --git a/src/net/sourceforge/plantuml/Run.java b/src/net/sourceforge/plantuml/Run.java
index 8a903e1db..a6465e758 100644
--- a/src/net/sourceforge/plantuml/Run.java
+++ b/src/net/sourceforge/plantuml/Run.java
@@ -62,6 +62,7 @@ import net.sourceforge.plantuml.code.TranscoderUtil;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.descdiagram.DescriptionDiagramFactory;
import net.sourceforge.plantuml.ftp.FtpServer;
+import net.sourceforge.plantuml.picoweb.PicoWebServer;
import net.sourceforge.plantuml.png.MetadataTag;
import net.sourceforge.plantuml.preproc.Stdlib;
import net.sourceforge.plantuml.security.ImageIO;
@@ -144,6 +145,11 @@ public class Run {
return;
}
+ if (option.getPicowebPort() != -1) {
+ goPicoweb(option);
+ return;
+ }
+
forceOpenJdkResourceLoad();
if (option.getPreprocessorOutputMode() == OptionPreprocOutputMode.CYPHER) {
cypher = new LanguageDescriptor().getCypher();
@@ -327,6 +333,12 @@ public class Run {
ftpServer.go();
}
+ private static void goPicoweb(Option option) throws IOException {
+ final int picoWebport = option.getPicowebPort();
+ System.err.println("webPort=" + picoWebport);
+ PicoWebServer.startServer(picoWebport);
+ }
+
public static void printFonts() {
final Font fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
for (Font f : fonts) {
diff --git a/src/net/sourceforge/plantuml/SvgString.java b/src/net/sourceforge/plantuml/SvgString.java
index 8baa9af37..1baca4f4d 100644
--- a/src/net/sourceforge/plantuml/SvgString.java
+++ b/src/net/sourceforge/plantuml/SvgString.java
@@ -68,12 +68,37 @@ public class SvgString {
final int idx = result.indexOf(">");
result = "