update and fix checkstyle and javadoc plugins

This commit is contained in:
Florian 2021-10-11 16:40:15 +02:00 committed by arnaudroques
parent 8d5be87f03
commit 098e630a28
27 changed files with 376 additions and 299 deletions

19
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
"java.configuration.updateBuildConfiguration": "automatic",
"cSpell.words": [
"Arnaud",
"ditaa",
"endditaa",
"enduml",
"epstext",
"etag",
"Lalloni",
"plantuml",
"Roques",
"servlet",
"servlets",
"startditaa",
"startuml"
],
"cSpell.allowCompoundWords": true
}

View File

@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007 Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail. Also add information on how to contact you by electronic and paper mail.
@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school, You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary. if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>. <https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>. <https://www.gnu.org/licenses/why-not-lgpl.html>.

109
README.md
View File

@ -1,60 +1,59 @@
PlantUML Server # PlantUML Server
===============
[![Build Status](https://travis-ci.org/plantuml/plantuml-server.png?branch=master)](https://travis-ci.org/plantuml/plantuml-server) ![workflow status](https://github.com/plantuml/plantuml-server/actions/workflows/main.yml/badge.svg)
[![](https://images.microbadger.com/badges/image/plantuml/plantuml-server.svg)](https://microbadger.com/images/plantuml/plantuml-server "Get your own image badge on microbadger.com") [![docker pulls](https://img.shields.io/docker/pulls/plantuml/plantuml-server.svg)](https://hub.docker.com/r/plantuml/plantuml-server)
[![Docker Pull](https://img.shields.io/docker/pulls/plantuml/plantuml-server.svg)](https://hub.docker.com/r/plantuml/plantuml-server/)
PlantUML Server is a web application to generate UML diagrams on-the-fly. PlantUML Server is a web application to generate UML diagrams on-the-fly.
![](https://raw.githubusercontent.com/ftomassetti/plantuml-server/readme/screenshots/screenshot.png) ![PlantUML Server](https://raw.githubusercontent.com/plantuml/plantuml-server/master/screenshots/screenshot.png)
To know more about PlantUML, please visit http://plantuml.com/. To know more about PlantUML, please visit https://plantuml.com.
Requirements ## Requirements
============
* jre/jdk 1.6.0 or above - jre/jdk 1.6.0 or above
* apache maven 3.0.2 or above - apache maven 3.0.2 or above
How to run the server
===================== ## How to run the server
Just run: Just run:
``` ```sh
mvn jetty:run mvn jetty:run
``` ```
The server is now listing to [http://localhost:8080/plantuml](http://localhost:8080/plantuml). The server is now listening to [http://localhost:8080/plantuml](http://localhost:8080/plantuml).
In this way the server is run on an embedded jetty server. In this way the server is run on an embedded jetty server.
You can specify the port at which it runs: You can specify the port at which it runs:
``` ```sh
mvn jetty:run -Djetty.port=9999 mvn jetty:run -Djetty.port=9999
``` ```
How to run the server with Docker
================================= ## How to run the server with Docker
You can run Plantuml with jetty or tomcat container You can run Plantuml with jetty or tomcat container
``` ```sh
docker run -d -p 8080:8080 plantuml/plantuml-server:jetty docker run -d -p 8080:8080 plantuml/plantuml-server:jetty
docker run -d -p 8080:8080 plantuml/plantuml-server:tomcat docker run -d -p 8080:8080 plantuml/plantuml-server:tomcat
``` ```
The server is now listing to [http://localhost:8080](http://localhost:8080). The server is now listening to [http://localhost:8080](http://localhost:8080).
## Read-only container ### Read-only container
The jetty container supports read-only files system, you can run the read-only mode with: The jetty container supports read-only files system, you can run the read-only mode with:
``` ```sh
docker run -d -p 8080:8080 --read-only -v /tmp/jetty plantuml/plantuml-server:jetty-readonly docker run -d -p 8080:8080 --read-only -v /tmp/jetty plantuml/plantuml-server:jetty
``` ```
This makes the container compatible with more restricted environment such as OpenShift, just make sure you mount a volume (can be ephemeral) on `/tmp/jetty`. This makes the container compatible with more restricted environment such as OpenShift, just make sure you mount a volume (can be ephemeral) on `/tmp/jetty`.
## Change base URL ### Change base URL
To run plantuml using different base url, change the `docker-compose.yml` file: To run plantuml using different base url, change the `docker-compose.yml` file:
```yaml ```yaml
@ -62,69 +61,67 @@ environment:
- BASE_URL=plantuml - BASE_URL=plantuml
``` ```
And run `docker-compose up`. This will start a modified version of the image using And run `docker-compose up`. This will start a modified version of the image using the base url `/plantuml`, e.g. http://localhost:8080/plantuml
the base url `/plantuml`, e.g. http://localhost/plantuml
How to set PlantUML options
=================================
You can apply some option to your PlantUML server with environement variable. ## How to set PlantUML options
You can apply some option to your PlantUML server with environment variable.
If you run the directly the jar, you can pass the option with `-D` flag If you run the directly the jar, you can pass the option with `-D` flag
``` ```sh
java -D THE_ENV_VARIABLE=THE_ENV_VALUE -Djetty.contextpath=/ -jar target/dependency/jetty-runner.jar target/plantuml.war java -D THE_ENV_VARIABLE=THE_ENV_VALUE -Djetty.contextpath=/ -jar target/dependency/jetty-runner.jar target/plantuml.war
``` ```
or or
``` ```sh
mvn jetty:run -D THE_ENV_VARIABLE=THE_ENV_VALUE -Djetty.port=9999 mvn jetty:run -D THE_ENV_VARIABLE=THE_ENV_VALUE -Djetty.port=9999
``` ```
If you use docker, you can use the `-e` flag: If you use docker, you can use the `-e` flag:
``` ```sh
docker run -d -p 8080:8080 -e THE_ENV_VARIABLE=THE_ENV_VALUE plantuml/plantuml-server:jetty docker run -d -p 8080:8080 -e THE_ENV_VARIABLE=THE_ENV_VALUE plantuml/plantuml-server:jetty
``` ```
You can set all the following variables: You can set all the following variables:
- `BASE_URL` * `PLANTUML_LIMIT_SIZE`
* PlantUML base url * Limits image width and height
* Default value: `ROOT` * Default value: `4096`
- `PLANTUML_LIMIT_SIZE` * `GRAPHVIZ_DOT`
* Limits image width and height * Link to 'dot' executable
* Default value: `4096` * Default value: `/usr/local/bin/dot` or `/usr/bin/dot`
- `PLANTUML_STATS` * `PLANTUML_STATS`
* Set it to `on` to enable [statistics report](http://plantuml.com/statistics-report) * Set it to `on` to enable [statistics report](https://plantuml.com/statistics-report)
* Default value: `off` * Default value: `off`
- `HTTP_AUTHORIZATION` * `HTTP_AUTHORIZATION`
* when calling the `proxy` endpoint, the value of `HTTP_AUTHORIZATION` will be used to set the HTTP Authorization header * when calling the `proxy` endpoint, the value of `HTTP_AUTHORIZATION` will be used to set the HTTP Authorization header
* Default value: `null` * Default value: `null`
- `ALLOW_PLANTUML_INCLUDE` * `ALLOW_PLANTUML_INCLUDE`
* Enables `!include` processing which can read files from the server into diagrams. Files are read relative to the current working directory. * Enables `!include` processing which can read files from the server into diagrams. Files are read relative to the current working directory.
* Default value: `false` * Default value: `false`
Alternate: How to build your docker image
====================================================== ## Alternate: How to build your docker image
This method uses maven to run the application. That requires internet connectivity. This method uses maven to run the application. That requires internet connectivity.
So, you can use following command to create a self-contained docker image that will "just-work". So, you can use following command to create a self-contained docker image that will "just-work".
*Note: Generate the WAR (instructions further below) prior to running "docker build"* *Note: Generate the WAR (instructions further below) prior to running "docker build"*
```sh
docker image build -t plantuml-server:local .
docker run -d -p 8080:8080 plantuml-server:local
``` ```
docker image build -t plantuml-server . The server is now listening to [http://localhost:8080/plantuml](http://localhost:8080/plantuml).
docker run -d -p 8080:8080 plantuml-server
```
The server is now listing to [http://localhost:8080/plantuml](http://localhost:8080/plantuml).
You may specify the port in `-p` Docker command line argument. You may specify the port in `-p` Docker command line argument.
How to generate the war ## How to generate the war
=======================
To build the war, just run: To build the war, just run:
``` ```sh
mvn package mvn package
``` ```

51
pom.xml
View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -8,6 +9,28 @@
<packaging>war</packaging> <packaging>war</packaging>
<build> <build>
<finalName>plantuml</finalName> <finalName>plantuml</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>9.0.1</version>
</dependency>
</dependencies>
<configuration>
<configLocation>${basedir}/src/main/config/checkstyle.xml</configLocation>
<linkXRef>false</linkXRef>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-eclipse-plugin</artifactId> <artifactId>maven-eclipse-plugin</artifactId>
@ -95,24 +118,17 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId> <artifactId>maven-checkstyle-plugin</artifactId>
<version>2.11</version> <version>3.1.2</version>
<executions> <executions>
<execution> <execution>
<id>validate</id> <?m2e execute onConfiguration,onIncremental?>
<phase>validate</phase> <phase>validate</phase>
<configuration>
<configLocation>${basedir}/src/main/config/checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
<goals> <goals>
<goal>check</goal> <goal>check</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<reporting> <reporting>
@ -129,11 +145,11 @@
</reports> </reports>
</reportSet> </reportSet>
</reportSets> </reportSets>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version> <version>3.3.1</version>
<configuration> <configuration>
<show>private</show> <show>private</show>
<nohelp>true</nohelp> <nohelp>true</nohelp>
@ -150,24 +166,21 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId> <artifactId>maven-checkstyle-plugin</artifactId>
<version>2.11</version> <version>3.1.2</version>
<configuration>
<configLocation>${basedir}/src/main/config/checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<linkXRef>false</linkXRef>
</configuration>
<reportSets> <reportSets>
<reportSet> <reportSet>
<reports> <reports>
<report>checkstyle</report> <report>checkstyle</report>
<report>checkstyle-aggregate</report>
</reports> </reports>
</reportSet> </reportSet>
</reportSets> </reportSets>
</plugin> </plugin>
</plugins> </plugins>
</reporting> </reporting>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<jetty.version>8.0.4.v20111024</jetty.version> <jetty.version>8.0.4.v20111024</jetty.version>
<jetty.port>8080</jetty.port> <jetty.port>8080</jetty.port>
<jetty.contextpath>/plantuml</jetty.contextpath> <jetty.contextpath>/plantuml</jetty.contextpath>

View File

@ -1,126 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> <!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
This configuration file was written by the eclipse-cs plugin configuration editor
-->
<!--
Checkstyle-Configuration: checkstyle
Description: none
-->
<module name="Checker"> <module name="Checker">
<property name="severity" value="error"/> <property name="charset" value="UTF-8" />
<property name="charset" value="UTF-8"/> <property name="severity" value="error" />
<module name="TreeWalker"> <module name="FileLength" />
<module name="JavadocMethod"> <module name="FileTabCharacter">
<property name="severity" value="ignore"/> <property name="eachLine" value="true" />
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="JavadocType">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="JavadocVariable">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="JavadocStyle">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<module name="LineLength">
<property name="max" value="120"/>
<property name="tabWidth" value="4"/>
</module>
<module name="MethodLength"/>
<module name="ParameterNumber"/>
<module name="EmptyForIteratorPad"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
<module name="ModifierOrder">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="RedundantModifier"/>
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<module name="AvoidInlineConditionals">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField"/>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="MissingSwitchDefault"/>
<module name="RedundantThrows"/>
<module name="SimplifyBooleanExpression">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="SimplifyBooleanReturn"/>
<module name="DesignForExtension">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier"/>
<module name="ArrayTypeStyle"/>
<module name="FinalParameters">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="TodoComment"/>
<module name="UpperEll"/>
</module> </module>
<module name="JavadocPackage"> <module name="JavadocPackage">
<property name="severity" value="ignore"/> <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
<property name="allowLegacy" value="true"/> <property name="allowLegacy" value="true" />
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/> <property name="severity" value="ignore" />
</module>
<module name="LineLength">
<property name="max" value="120" />
<property name="tabWidth" value="4" />
</module> </module>
<module name="NewlineAtEndOfFile"> <module name="NewlineAtEndOfFile">
<property name="severity" value="ignore"/> <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/> <property name="severity" value="ignore" />
</module>
<module name="Translation"/>
<module name="FileLength"/>
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module> </module>
<module name="RegexpSingleline"> <module name="RegexpSingleline">
<property name="format" value="\s+$"/> <property name="format" value="\s+$" />
<property name="message" value="Line has trailing spaces."/> <property name="message" value="Line has trailing spaces." />
</module>
<module name="Translation" />
<module name="TreeWalker">
<module name="ArrayTypeStyle" />
<module name="AvoidInlineConditionals">
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
<property name="severity" value="ignore" />
</module>
<module name="AvoidNestedBlocks" />
<module name="AvoidStarImport" />
<module name="ConstantName" />
<module name="DesignForExtension">
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
<property name="severity" value="ignore" />
</module>
<module name="EmptyBlock">
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
<property name="severity" value="ignore" />
</module>
<module name="EmptyForIteratorPad" />
<module name="EmptyStatement" />
<module name="EqualsHashCode" />
<module name="FinalClass" />
<module name="FinalParameters">
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
<property name="severity" value="ignore" />
</module>
<module name="HiddenField" />
<module name="HideUtilityClassConstructor" />
<module name="IllegalImport" />
<module name="IllegalInstantiation" />
<module name="InnerAssignment" />
<module name="InterfaceIsType" />
<module name="JavadocMethod">
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
<property name="severity" value="ignore" />
</module>
<module name="JavadocStyle">
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
<property name="severity" value="ignore" />
</module>
<module name="JavadocType">
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
<property name="severity" value="ignore" />
</module>
<module name="JavadocVariable">
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
<property name="severity" value="ignore" />
</module>
<module name="LeftCurly" />
<module name="LocalFinalVariableName" />
<module name="LocalVariableName" />
<module name="MagicNumber">
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
<property name="severity" value="ignore" />
</module>
<module name="MemberName" />
<module name="MethodLength" />
<module name="MethodName" />
<module name="MethodParamPad" />
<module name="MissingSwitchDefault" />
<module name="ModifierOrder">
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
<property name="severity" value="ignore" />
</module>
<module name="NeedBraces" />
<module name="NoWhitespaceAfter" />
<module name="NoWhitespaceBefore" />
<module name="OperatorWrap" />
<module name="PackageName" />
<module name="ParameterName" />
<module name="ParameterNumber" />
<module name="ParenPad" />
<module name="RedundantImport" />
<module name="RedundantModifier" />
<module name="RightCurly" />
<module name="SimplifyBooleanExpression">
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
<property name="severity" value="ignore" />
</module>
<module name="SimplifyBooleanReturn" />
<module name="StaticVariableName" />
<module name="TodoComment" />
<module name="TypecastParenPad" />
<module name="TypeName" />
<module name="UnusedImports" />
<module name="UpperEll" />
<module name="VisibilityModifier" />
<module name="WhitespaceAfter" />
<module name="WhitespaceAround" />
</module> </module>
</module> </module>

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *
@ -25,13 +25,19 @@ package net.sourceforge.plantuml.servlet;
import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormat;
/* /**
* ASCII servlet of the webapp. * ASCII servlet of the webapp.
* This servlet produces the UML sequence diagram in text format. * This servlet produces the UML sequence diagram in text format.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("SERIAL")
public class AsciiServlet extends UmlDiagramService { public class AsciiServlet extends UmlDiagramService {
/**
* Gives the wished output format of the diagram.
* This value is used by the DiagramResponse class.
*
* @return the format for ASCII responses
*/
@Override @Override
public FileFormat getOutputFormat() { public FileFormat getOutputFormat() {
return FileFormat.UTXT; return FileFormat.UTXT;

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *
@ -25,13 +25,19 @@ package net.sourceforge.plantuml.servlet;
import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormat;
/* /**
* Base64 servlet of the webapp. * Base64 servlet of the webapp.
* This servlet produces the UML diagram in Base64 format. * This servlet produces the UML diagram in Base64 format.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("SERIAL")
public class Base64Servlet extends UmlDiagramService { public class Base64Servlet extends UmlDiagramService {
/**
* Gives the wished output format of the diagram.
* This value is used by the DiagramResponse class.
*
* @return the format for Base64 responses
*/
@Override @Override
public FileFormat getOutputFormat() { public FileFormat getOutputFormat() {
return FileFormat.BASE64; return FileFormat.BASE64;

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *
@ -32,14 +32,13 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.servlet.utility.UmlExtractor; import net.sourceforge.plantuml.servlet.utility.UmlExtractor;
/* /**
* Check servlet of the webapp. * Check servlet of the webapp.
* This servlet checks the syntax of the diagram and send a report in TEXT format. * This servlet checks the syntax of the diagram and send a report in TEXT format.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("SERIAL")
public class CheckSyntaxServlet extends HttpServlet { public class CheckSyntaxServlet extends HttpServlet {
@Override @Override
@ -52,12 +51,19 @@ public class CheckSyntaxServlet extends HttpServlet {
DiagramResponse dr = new DiagramResponse(response, getOutputFormat(), request); DiagramResponse dr = new DiagramResponse(response, getOutputFormat(), request);
try { try {
dr.sendCheck(uml); dr.sendCheck(uml);
} catch (IIOException iioe) { } catch (IIOException e) {
// Browser has closed the connection, do nothing // Browser has closed the connection, do nothing
} }
dr = null; dr = null;
} }
/**
* Extract UML source from URI.
*
* @param uri the complete URI as returned by `request.getRequestURI()`
*
* @return the encoded UML text
*/
public String getSource(String uri) { public String getSource(String uri) {
String[] result = uri.split("/check/", 2); String[] result = uri.split("/check/", 2);
if (result.length != 2) { if (result.length != 2) {
@ -67,6 +73,12 @@ public class CheckSyntaxServlet extends HttpServlet {
} }
} }
/**
* Gives the wished output format of the diagram.
* This value is used by the DiagramResponse class.
*
* @return the format for check responses
*/
public FileFormat getOutputFormat() { public FileFormat getOutputFormat() {
return FileFormat.UTXT; return FileFormat.UTXT;
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *
@ -53,7 +53,7 @@ import net.sourceforge.plantuml.ErrorUml;
* Delegates the diagram generation from the UML source and the filling of the HTTP response with the diagram in the * 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. * right format. Its own responsibility is to produce the right HTTP headers.
*/ */
class DiagramResponse { public class DiagramResponse {
private static final String POWERED_BY = "PlantUML Version " + Version.versionString(); private static final String POWERED_BY = "PlantUML Version " + Version.versionString();
@ -77,22 +77,24 @@ class DiagramResponse {
} }
} }
DiagramResponse(HttpServletResponse r, FileFormat f, HttpServletRequest rq) { public DiagramResponse(HttpServletResponse r, FileFormat f, HttpServletRequest rq) {
response = r; response = r;
format = f; format = f;
request = rq; request = rq;
} }
void sendDiagram(String uml, int idx) throws IOException { public void sendDiagram(String uml, int idx) throws IOException {
response.addHeader("Access-Control-Allow-Origin", "*"); response.addHeader("Access-Control-Allow-Origin", "*");
response.setContentType(getContentType()); response.setContentType(getContentType());
SourceStringReader reader = new SourceStringReader(uml); SourceStringReader reader = new SourceStringReader(uml);
if (format == FileFormat.BASE64) { if (format == FileFormat.BASE64) {
final ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] imageBytes;
final DiagramDescription result = reader.outputImage(baos, idx, new FileFormatOption(FileFormat.PNG)); try (ByteArrayOutputStream outstream = new ByteArrayOutputStream()) {
baos.close(); reader.outputImage(outstream, idx, new FileFormatOption(FileFormat.PNG));
final String encodedBytes = "data:image/png;base64," imageBytes = outstream.toByteArray();
+ Base64Coder.encodeLines(baos.toByteArray()).replaceAll("\\s", ""); }
final String base64 = Base64Coder.encodeLines(imageBytes).replaceAll("\\s", "");
final String encodedBytes = "data:image/png;base64," + base64;
response.getOutputStream().write(encodedBytes.getBytes()); response.getOutputStream().write(encodedBytes.getBytes());
return; return;
} }
@ -109,7 +111,7 @@ class DiagramResponse {
if (diagram instanceof PSystemError) { if (diagram instanceof PSystemError) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST); response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
} }
final ImageData result = diagram.exportDiagram(response.getOutputStream(), idx, new FileFormatOption(format)); diagram.exportDiagram(response.getOutputStream(), idx, new FileFormatOption(format));
} }
private boolean notModified(BlockUml blockUml) { private boolean notModified(BlockUml blockUml) {
@ -126,7 +128,7 @@ class DiagramResponse {
} }
void sendMap(String uml) throws IOException { public void sendMap(String uml) throws IOException {
response.setContentType(getContentType()); response.setContentType(getContentType());
SourceStringReader reader = new SourceStringReader(uml); SourceStringReader reader = new SourceStringReader(uml);
final BlockUml blockUml = reader.getBlocks().get(0); final BlockUml blockUml = reader.getBlocks().get(0);
@ -141,16 +143,17 @@ class DiagramResponse {
final String cmap = map.getCMapData("plantuml"); final String cmap = map.getCMapData("plantuml");
httpOut.print(cmap); httpOut.print(cmap);
} }
} }
void sendCheck(String uml) throws IOException { public void sendCheck(String uml) throws IOException {
response.setContentType(getContentType()); response.setContentType(getContentType());
SourceStringReader reader = new SourceStringReader(uml); SourceStringReader reader = new SourceStringReader(uml);
DiagramDescription desc = reader.outputImage( DiagramDescription desc = reader.outputImage(
new NullOutputStream(), new FileFormatOption(FileFormat.PNG, false)); new NullOutputStream(), new FileFormatOption(FileFormat.PNG, false));
PrintWriter httpOut = response.getWriter(); PrintWriter httpOut = response.getWriter();
httpOut.print(desc.getDescription()); httpOut.print(desc.getDescription());
} }
private void addHeaderForCache(BlockUml blockUml) { private void addHeaderForCache(BlockUml blockUml) {
long today = System.currentTimeMillis(); long today = System.currentTimeMillis();
// Add http headers to force the browser to cache the image // Add http headers to force the browser to cache the image
@ -176,11 +179,10 @@ class DiagramResponse {
public static void addHeaders(HttpServletResponse response) { public static void addHeaders(HttpServletResponse response) {
response.addHeader("X-Powered-By", POWERED_BY); response.addHeader("X-Powered-By", POWERED_BY);
response.addHeader("X-Patreon", "Support us on http://plantuml.com/patreon"); response.addHeader("X-Patreon", "Support us on https://plantuml.com/patreon");
response.addHeader("X-Donate", "http://plantuml.com/paypal"); response.addHeader("X-Donate", "https://plantuml.com/paypal");
} }
private String getContentType() { private String getContentType() {
return CONTENT_TYPE.get(format); return CONTENT_TYPE.get(format);
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *
@ -25,13 +25,19 @@ package net.sourceforge.plantuml.servlet;
import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormat;
/* /**
* EPS servlet of the webapp. * EPS servlet of the webapp.
* This servlet produces the UML diagram in EPS format. * This servlet produces the UML diagram in EPS format.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("SERIAL")
public class EpsServlet extends UmlDiagramService { public class EpsServlet extends UmlDiagramService {
/**
* Gives the wished output format of the diagram.
* This value is used by the DiagramResponse class.
*
* @return the format for EPS responses
*/
@Override @Override
public FileFormat getOutputFormat() { public FileFormat getOutputFormat() {
return FileFormat.EPS; return FileFormat.EPS;

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *
@ -25,13 +25,19 @@ package net.sourceforge.plantuml.servlet;
import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormat;
/* /**
* EPS servlet of the webapp. * EPS Text servlet of the webapp.
* This servlet produces the UML diagram in EPS format. * This servlet produces the UML diagram in EPS Text format.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("SERIAL")
public class EpsTextServlet extends UmlDiagramService { public class EpsTextServlet extends UmlDiagramService {
/**
* Gives the wished output format of the diagram.
* This value is used by the DiagramResponse class.
*
* @return the format for EPS Text responses
*/
@Override @Override
public FileFormat getOutputFormat() { public FileFormat getOutputFormat() {
return FileFormat.EPS_TEXT; return FileFormat.EPS_TEXT;

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *
@ -25,13 +25,19 @@ package net.sourceforge.plantuml.servlet;
import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormat;
/* /**
* Image servlet of the webapp. * Image servlet of the webapp.
* This servlet produces the UML diagram in PNG format. * This servlet produces the UML diagram in PNG format.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("SERIAL")
public class ImgServlet extends UmlDiagramService { public class ImgServlet extends UmlDiagramService {
/**
* Gives the wished output format of the diagram.
* This value is used by the DiagramResponse class.
*
* @return the format for image responses
*/
@Override @Override
public FileFormat getOutputFormat() { public FileFormat getOutputFormat() {
return FileFormat.PNG; return FileFormat.PNG;

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *
@ -35,11 +35,11 @@ import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.servlet.utility.UmlExtractor; import net.sourceforge.plantuml.servlet.utility.UmlExtractor;
/* /**
* MAP servlet of the webapp. * MAP servlet of the webapp.
* This servlet produces the image map of the diagram in HTML format. * This servlet produces the image map of the diagram in HTML format.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("SERIAL")
public class MapServlet extends HttpServlet { public class MapServlet extends HttpServlet {
@Override @Override
@ -52,7 +52,7 @@ public class MapServlet extends HttpServlet {
DiagramResponse dr = new DiagramResponse(response, getOutputFormat(), request); DiagramResponse dr = new DiagramResponse(response, getOutputFormat(), request);
try { try {
dr.sendMap(uml); dr.sendMap(uml);
} catch (IIOException iioe) { } catch (IIOException e) {
// Browser has closed the connection, do nothing // Browser has closed the connection, do nothing
} }
dr = null; dr = null;
@ -67,6 +67,12 @@ public class MapServlet extends HttpServlet {
} }
} }
/**
* Gives the wished output format of the diagram.
* This value is used by the DiagramResponse class.
*
* @return the format for map responses
*/
public FileFormat getOutputFormat() { public FileFormat getOutputFormat() {
return FileFormat.UTXT; return FileFormat.UTXT;
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *
@ -40,12 +40,12 @@ import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.SourceStringReader; import net.sourceforge.plantuml.SourceStringReader;
/* /**
* Proxy servlet of the webapp. * Proxy servlet of the webapp.
* This servlet retrieves the diagram source of a web resource (web html page) * This servlet retrieves the diagram source of a web resource (web html page)
* and renders it. * and renders it.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("SERIAL")
public class OldProxyServlet extends HttpServlet { public class OldProxyServlet extends HttpServlet {
private static final Pattern PROXY_PATTERN = Pattern.compile("/\\w+/proxy/((\\d+)/)?((\\w+)/)?(https?://.*)"); private static final Pattern PROXY_PATTERN = Pattern.compile("/\\w+/proxy/((\\d+)/)?((\\w+)/)?(https?://.*)");

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *
@ -43,9 +43,8 @@ import net.sourceforge.plantuml.code.Transcoder;
import net.sourceforge.plantuml.code.TranscoderUtil; import net.sourceforge.plantuml.code.TranscoderUtil;
import net.sourceforge.plantuml.png.MetadataTag; import net.sourceforge.plantuml.png.MetadataTag;
/* /**
* Original idea from Achim Abeling for Confluence macro * Original idea from Achim Abeling for Confluence macro
* See http://www.banapple.de/display/BANAPPLE/plantuml+user+macro
* *
* This class is the old all-in-one historic implementation of the PlantUml server. * This class is the old all-in-one historic implementation of the PlantUml server.
* See package.html for the new design. It's a work in progress. * See package.html for the new design. It's a work in progress.
@ -53,17 +52,16 @@ import net.sourceforge.plantuml.png.MetadataTag;
* Modified by Arnaud Roques * Modified by Arnaud Roques
* Modified by Pablo Lalloni * Modified by Pablo Lalloni
* Modified by Maxime Sinclair * Modified by Maxime Sinclair
*
*/ */
@SuppressWarnings("serial") @SuppressWarnings("SERIAL")
public class PlantUmlServlet extends HttpServlet { public class PlantUmlServlet extends HttpServlet {
private static final String DEFAULT_ENCODED_TEXT = "SyfFKj2rKt3CoKnELR1Io4ZDoSa70000"; private static final String DEFAULT_ENCODED_TEXT = "SyfFKj2rKt3CoKnELR1Io4ZDoSa70000";
// Last part of the URL // Last part of the URL
public static final Pattern URL_PATTERN = Pattern.compile("^.*[^a-zA-Z0-9\\-\\_]([a-zA-Z0-9\\-\\_]+)"); public static final Pattern URL_PATTERN = Pattern.compile("^.*[^a-zA-Z0-9\\-\\_]([a-zA-Z0-9\\-\\_]+)");
private static final Pattern RECOVER_UML_PATTERN = Pattern.compile("/uml/(.*)"); private static final Pattern RECOVER_UML_PATTERN = Pattern.compile("/uml/(.*)");
static { static {
OptionFlags.ALLOW_INCLUDE = false; OptionFlags.ALLOW_INCLUDE = false;
if ("true".equalsIgnoreCase(System.getenv("ALLOW_PLANTUML_INCLUDE"))) { if ("true".equalsIgnoreCase(System.getenv("ALLOW_PLANTUML_INCLUDE"))) {
@ -112,10 +110,10 @@ public class PlantUmlServlet extends HttpServlet {
if (text != null && PlantumlUtils.hasCMapData(text)) { if (text != null && PlantumlUtils.hasCMapData(text)) {
request.setAttribute("mapneeded", Boolean.TRUE); request.setAttribute("mapneeded", Boolean.TRUE);
} }
// forward to index.jsp // forward to index.jsp
final RequestDispatcher dispatcher = request.getRequestDispatcher("/index.jsp"); final RequestDispatcher dispatcher = request.getRequestDispatcher("/index.jsp");
dispatcher.forward(request, response); dispatcher.forward(request, response);
} }
@Override @Override
@ -189,6 +187,4 @@ public class PlantUmlServlet extends HttpServlet {
return is; return is;
} }
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *
@ -49,12 +49,12 @@ import javax.imageio.IIOException;
import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLPeerUnverifiedException;
/* /**
* Proxy servlet of the webapp. * Proxy servlet of the webapp.
* This servlet retrieves the diagram source of a web resource (web html page) * This servlet retrieves the diagram source of a web resource (web html page)
* and renders it. * and renders it.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("SERIAL")
public class ProxyServlet extends HttpServlet { public class ProxyServlet extends HttpServlet {
static { static {
@ -95,7 +95,7 @@ public class ProxyServlet extends HttpServlet {
DiagramResponse dr = new DiagramResponse(response, getOutputFormat(fmt), request); DiagramResponse dr = new DiagramResponse(response, getOutputFormat(fmt), request);
try { try {
dr.sendDiagram(uml, 0); dr.sendDiagram(uml, 0);
} catch (IIOException iioe) { } catch (IIOException e) {
// Browser has closed the connection, so the HTTP OutputStream is closed // Browser has closed the connection, so the HTTP OutputStream is closed
// Silently catch the exception to avoid annoying log // Silently catch the exception to avoid annoying log
} }
@ -145,9 +145,9 @@ public class ProxyServlet extends HttpServlet {
private HttpURLConnection getConnection(final URL url) throws IOException { private HttpURLConnection getConnection(final URL url) throws IOException {
final HttpURLConnection con = (HttpURLConnection) url.openConnection(); final HttpURLConnection con = (HttpURLConnection) url.openConnection();
if (con instanceof HttpsURLConnection) { //if (con instanceof HttpsURLConnection) {
// printHttpsCert((HttpsURLConnection) con); // printHttpsCert((HttpsURLConnection) con);
} //}
con.setRequestMethod("GET"); con.setRequestMethod("GET");
String token = System.getenv("HTTP_AUTHORIZATION"); String token = System.getenv("HTTP_AUTHORIZATION");
if (token != null) { if (token != null) {

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *
@ -25,13 +25,19 @@ package net.sourceforge.plantuml.servlet;
import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormat;
/* /**
* SVG servlet of the webapp. * SVG servlet of the webapp.
* This servlet produces the UML diagram in SVG format. * This servlet produces the UML diagram in SVG format.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("SERIAL")
public class SvgServlet extends UmlDiagramService { public class SvgServlet extends UmlDiagramService {
/**
* Gives the wished output format of the diagram.
* This value is used by the DiagramResponse class.
*
* @return the format for svg responses
*/
@Override @Override
public FileFormat getOutputFormat() { public FileFormat getOutputFormat() {
return FileFormat.SVG; return FileFormat.SVG;

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *
@ -40,7 +40,7 @@ import java.util.regex.Pattern;
/** /**
* Common service servlet to produce diagram from compressed UML source contained in the end part of the requested URI. * Common service servlet to produce diagram from compressed UML source contained in the end part of the requested URI.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("SERIAL")
public abstract class UmlDiagramService extends HttpServlet { public abstract class UmlDiagramService extends HttpServlet {
static { static {
@ -99,7 +99,7 @@ public abstract class UmlDiagramService extends HttpServlet {
DiagramResponse dr = new DiagramResponse(response, getOutputFormat(), request); DiagramResponse dr = new DiagramResponse(response, getOutputFormat(), request);
try { try {
dr.sendDiagram(uml, idx); dr.sendDiagram(uml, idx);
} catch (IIOException iioe) { } catch (IIOException e) {
// Browser has closed the connection, so the HTTP OutputStream is closed // Browser has closed the connection, so the HTTP OutputStream is closed
// Silently catch the exception to avoid annoying log // Silently catch the exception to avoid annoying log
} }
@ -109,11 +109,11 @@ public abstract class UmlDiagramService extends HttpServlet {
private static final Pattern RECOVER_UML_PATTERN = Pattern.compile("/\\w+/(\\d+/)?(.*)"); private static final Pattern RECOVER_UML_PATTERN = Pattern.compile("/\\w+/(\\d+/)?(.*)");
/** /**
* Extracts the compressed UML source from the HTTP URI. * Extracts the UML source text and its index from the HTTP request.
* *
* @param uri * @param request http request
* the complete URI as returned by request.getRequestURI() *
* @return the compressed UML source * @return the UML source text and its index
*/ */
public final String[] getSourceAndIdx(HttpServletRequest request) { public final String[] getSourceAndIdx(HttpServletRequest request) {
final Matcher recoverUml = RECOVER_UML_PATTERN.matcher( final Matcher recoverUml = RECOVER_UML_PATTERN.matcher(

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *
@ -31,11 +31,11 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
/* /**
* Welcome servlet of the webapp. * Welcome servlet of the webapp.
* Displays the sample Bob and Alice sequence diagram. * Displays the sample Bob and Alice sequence diagram.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("SERIAL")
public class Welcome extends HttpServlet { public class Welcome extends HttpServlet {
@Override @Override

View File

@ -1,15 +1,21 @@
<html> <html>
<body> <body>
<p>This package is in charge of the JEE PlantUml Server.</p> <p>This package is in charge of the JEE PlantUml Server.</p>
<p>there are 2 kind of servlets in this package :<br> <p>There are 2 kind of servlets in this package:<br>
- Interactive servlets : Welcome, PlantUmlServlet that are in charge of the web pages dedicated to human users.<br> - Interactive servlets: Welcome, PlantUmlServlet that are in charge of the web pages dedicated to human users.<br>
- Service servlets : ImgServlet, SvgServlet, EpsServlet, EpsTextServlet, AsciiServlet, ProxyServlet that only produce a diagram as output.<br> - Service servlets: ImgServlet, SvgServlet, EpsServlet, EpsTextServlet, AsciiServlet, ProxyServlet that only produce a diagram as output.<br>
<br> <br>
Structure of the service part of the PlantUmlServer: <br> Structure of the service part of the PlantUmlServer: <br>
<img src="http://www.plantuml.com/plantuml/img/XP51ReCm44Ntd6AMH0etwAPIbNPJjIhg0OoPm4WsTiPZrAZDtGk5913IP3b_dlx_7jTK8g3riWUBja0EIJsLf7RbJDeIcavHHH1MMa0R5G9yMlD4gc9bS-IMDC9t0k1ZOKX3wwY4qZsZf2yYlYSCoWVk8WO1tgrX9WVlce30mQywZrFGQ9OBKrD1XPAxo1hJenAPPlo636uSMoKz_1R5HndcT9KSag7tMFeKshU-qDBhxTRJW6sV_FVCW4qv6foRMJFRloe_tntEvvnamSDFbYqlUuFjZCVv1lJExcj_n9R_DZ1DTOV8stl4Oz14_pCkkpnqSgxVRPVhQV5hm2y0" /> <img
</p> alt="Class diagram of the service part of the PlantUmlServer"
<p> src="https://www.plantuml.com/plantuml/svg/XP31Ri8m44Jl_eez1Wd-e0SgLRGNrAfHFy3OIx1ansQzHaKj_zv4mKfCYZXwvcbclEl8aZWvAmv68w0BV0Q7ReSKIuaFNXVItg3j5BcBJ58nl3676kbaaKTHMHaZV3dxOcH3qlM0KGW_0Y2adJKAJjveqFuLkPf4VE8nOMIWun8AEGRVHWIAOI40Sb4EgvbCsq23NFj42gki9385lp4MDvwSv1v-JnmI3-zg8IvYs7qTdKlxrRTQzV-wvRHWtpKFtupOwcl0kCpPmj_AK7eNCQc0fz_L2hOol-VU1_dlStRdbn-Ojdb0rAT7n7DKnjnd_EhsL69StRbpEm-_2wonrSdPFm00"
<img src="http://www.plantuml.com/plantuml/img/XP1DZi8m38NtdCA23RFe0OfGLr24n4y5uW2cU2fBQL8vBeBRup8ZHEc2LPJtNhuNMraTmOey2Ie73-4N48hT2hZ6Ye2TQwEQHvTHuQiZoTMHGfB1ssq65Uanj5BIzESZTghTycQ0KeFy1KrvPNjkqgD-gTktshIQ1wbH1wKBnagmFb1iWezaB-RpKiYcoBAlqKZ-ygyQk45HBhb1hp0kd1sdxGOSdmNbFWQCiE4pJD8qpzDqz4cpWixkVlpSCAsxhHgsKvDX_H3G6_q1" /> >
</p> </p>
<p>
<img
alt="Generation of a PNG image illustrated"
src="https://www.plantuml.com/plantuml/svg/XP1DZi8m38NtdCA23RFe0OfGLr24n4y5uW2cU2fBQL8vBeBRup8ZHEc2LPJtNhuNMraTmOey2Ie73-4N48hT2hZ6Ye2TQwEQHvTHuQiZoTMHGfB1ssq65Uanj5BIzESZTghTycQ0KeFy1KrvPNjkqgD-gTktshIQ1wbH1wKBnagmFb1iWezaB-RpKiYcoBAlqKZ-ygyQk45HBhb1hp0kd1sdxGOSdmNbFWQCiE4pJD8qpzDqz4cpWixkVlpSCAsxhHgsKvDX_H3G6_q1"
>
</p>
</body> </body>
</html> </html>

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: https://plantuml.com
* *
* This file is part of PlantUML. * This file is part of PlantUML.
* *
@ -45,14 +45,13 @@ public class UmlExtractor {
} }
/** /**
* Build the complete UML source from the compressed source extracted from the HTTP URI. * Build the complete UML source from the compressed source extracted from the
* HTTP URI.
* *
* @param source * @param source the last part of the URI containing the compressed UML
* the last part of the URI containing the compressed UML
* @return the textual UML source * @return the textual UML source
*/ */
static public String getUmlSource(String source) { static public String getUmlSource(String source) {
// build the UML source from the compressed part of the URL // build the UML source from the compressed part of the URL
String text; String text;
try { try {
@ -89,4 +88,4 @@ public class UmlExtractor {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
} }

View File

@ -1,9 +1,9 @@
<html> <html>
<body> <body>
<p>This package contains utility classes of the JEE PlantUml Server.</p> <p>This package contains utility classes of the JEE PlantUml Server.</p>
<ul> <ul>
<li>NullOutputStream is used by the Map feature.</li> <li>NullOutputStream is used by the Map feature.</li>
<li>UmlExtractor encapsulates the PlantUML library to decode the UML compressed source.</li> <li>UmlExtractor encapsulates the PlantUML library to decode the UML compressed source.</li>
</ul> </ul>
</body> </body>
</html> </html>

View File

@ -51,7 +51,7 @@
<c:if test="${cfg['SHOW_GITHUB_RIBBON'] eq 'on' }"> <c:if test="${cfg['SHOW_GITHUB_RIBBON'] eq 'on' }">
<%@ include file="resource/githubribbon.html" %> <%@ include file="resource/githubribbon.html" %>
</c:if> </c:if>
<p>Create your <a href="http://plantuml.com">PlantUML</a> diagrams directly in your browser !</p> <p>Create your <a href="https://plantuml.com">PlantUML</a> diagrams directly in your browser !</p>
</div> </div>
<div id="content"> <div id="content">
<%-- CONTENT --%> <%-- CONTENT --%>

View File

@ -6,4 +6,4 @@ Bob -> Alice : hello
@startuml @startuml
version version
@enduml @enduml