update and fix checkstyle and javadoc plugins
This commit is contained in:
@@ -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">
|
||||
|
||||
<!--
|
||||
This configuration file was written by the eclipse-cs plugin configuration editor
|
||||
-->
|
||||
<!--
|
||||
Checkstyle-Configuration: checkstyle
|
||||
Description: none
|
||||
-->
|
||||
<module name="Checker">
|
||||
<property name="severity" value="error"/>
|
||||
<property name="charset" value="UTF-8"/>
|
||||
<module name="TreeWalker">
|
||||
<module name="JavadocMethod">
|
||||
<property name="severity" value="ignore"/>
|
||||
<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"/>
|
||||
<property name="charset" value="UTF-8" />
|
||||
<property name="severity" value="error" />
|
||||
<module name="FileLength" />
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true" />
|
||||
</module>
|
||||
<module name="JavadocPackage">
|
||||
<property name="severity" value="ignore"/>
|
||||
<property name="allowLegacy" value="true"/>
|
||||
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
|
||||
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
|
||||
<property name="allowLegacy" value="true" />
|
||||
<property name="severity" value="ignore" />
|
||||
</module>
|
||||
<module name="LineLength">
|
||||
<property name="max" value="120" />
|
||||
<property name="tabWidth" value="4" />
|
||||
</module>
|
||||
<module name="NewlineAtEndOfFile">
|
||||
<property name="severity" value="ignore"/>
|
||||
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
|
||||
</module>
|
||||
<module name="Translation"/>
|
||||
<module name="FileLength"/>
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
|
||||
<property name="severity" value="ignore" />
|
||||
</module>
|
||||
<module name="RegexpSingleline">
|
||||
<property name="format" value="\s+$"/>
|
||||
<property name="message" value="Line has trailing spaces."/>
|
||||
<property name="format" value="\s+$" />
|
||||
<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>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
@@ -25,13 +25,19 @@ package net.sourceforge.plantuml.servlet;
|
||||
|
||||
import net.sourceforge.plantuml.FileFormat;
|
||||
|
||||
/*
|
||||
/**
|
||||
* ASCII servlet of the webapp.
|
||||
* This servlet produces the UML sequence diagram in text format.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@SuppressWarnings("SERIAL")
|
||||
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
|
||||
public FileFormat getOutputFormat() {
|
||||
return FileFormat.UTXT;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
@@ -25,13 +25,19 @@ package net.sourceforge.plantuml.servlet;
|
||||
|
||||
import net.sourceforge.plantuml.FileFormat;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Base64 servlet of the webapp.
|
||||
* This servlet produces the UML diagram in Base64 format.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@SuppressWarnings("SERIAL")
|
||||
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
|
||||
public FileFormat getOutputFormat() {
|
||||
return FileFormat.BASE64;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
@@ -32,14 +32,13 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.sourceforge.plantuml.FileFormat;
|
||||
|
||||
import net.sourceforge.plantuml.servlet.utility.UmlExtractor;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Check servlet of the webapp.
|
||||
* This servlet checks the syntax of the diagram and send a report in TEXT format.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@SuppressWarnings("SERIAL")
|
||||
public class CheckSyntaxServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
@@ -52,12 +51,19 @@ public class CheckSyntaxServlet extends HttpServlet {
|
||||
DiagramResponse dr = new DiagramResponse(response, getOutputFormat(), request);
|
||||
try {
|
||||
dr.sendCheck(uml);
|
||||
} catch (IIOException iioe) {
|
||||
} catch (IIOException e) {
|
||||
// Browser has closed the connection, do nothing
|
||||
}
|
||||
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) {
|
||||
String[] result = uri.split("/check/", 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() {
|
||||
return FileFormat.UTXT;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* 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
|
||||
* 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();
|
||||
|
||||
@@ -77,22 +77,24 @@ class DiagramResponse {
|
||||
}
|
||||
}
|
||||
|
||||
DiagramResponse(HttpServletResponse r, FileFormat f, HttpServletRequest rq) {
|
||||
public DiagramResponse(HttpServletResponse r, FileFormat f, HttpServletRequest rq) {
|
||||
response = r;
|
||||
format = f;
|
||||
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.setContentType(getContentType());
|
||||
SourceStringReader reader = new SourceStringReader(uml);
|
||||
if (format == FileFormat.BASE64) {
|
||||
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
final DiagramDescription result = reader.outputImage(baos, idx, new FileFormatOption(FileFormat.PNG));
|
||||
baos.close();
|
||||
final String encodedBytes = "data:image/png;base64,"
|
||||
+ Base64Coder.encodeLines(baos.toByteArray()).replaceAll("\\s", "");
|
||||
byte[] imageBytes;
|
||||
try (ByteArrayOutputStream outstream = new ByteArrayOutputStream()) {
|
||||
reader.outputImage(outstream, idx, new FileFormatOption(FileFormat.PNG));
|
||||
imageBytes = outstream.toByteArray();
|
||||
}
|
||||
final String base64 = Base64Coder.encodeLines(imageBytes).replaceAll("\\s", "");
|
||||
final String encodedBytes = "data:image/png;base64," + base64;
|
||||
response.getOutputStream().write(encodedBytes.getBytes());
|
||||
return;
|
||||
}
|
||||
@@ -109,7 +111,7 @@ class DiagramResponse {
|
||||
if (diagram instanceof PSystemError) {
|
||||
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) {
|
||||
@@ -126,7 +128,7 @@ class DiagramResponse {
|
||||
}
|
||||
|
||||
|
||||
void sendMap(String uml) throws IOException {
|
||||
public void sendMap(String uml) throws IOException {
|
||||
response.setContentType(getContentType());
|
||||
SourceStringReader reader = new SourceStringReader(uml);
|
||||
final BlockUml blockUml = reader.getBlocks().get(0);
|
||||
@@ -141,16 +143,17 @@ class DiagramResponse {
|
||||
final String cmap = map.getCMapData("plantuml");
|
||||
httpOut.print(cmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sendCheck(String uml) throws IOException {
|
||||
public void sendCheck(String uml) throws IOException {
|
||||
response.setContentType(getContentType());
|
||||
SourceStringReader reader = new SourceStringReader(uml);
|
||||
DiagramDescription desc = reader.outputImage(
|
||||
new NullOutputStream(), new FileFormatOption(FileFormat.PNG, false));
|
||||
PrintWriter httpOut = response.getWriter();
|
||||
httpOut.print(desc.getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
private void addHeaderForCache(BlockUml blockUml) {
|
||||
long today = System.currentTimeMillis();
|
||||
// Add http headers to force the browser to cache the image
|
||||
@@ -176,11 +179,10 @@ class DiagramResponse {
|
||||
|
||||
public static void addHeaders(HttpServletResponse response) {
|
||||
response.addHeader("X-Powered-By", POWERED_BY);
|
||||
response.addHeader("X-Patreon", "Support us on http://plantuml.com/patreon");
|
||||
response.addHeader("X-Donate", "http://plantuml.com/paypal");
|
||||
response.addHeader("X-Patreon", "Support us on https://plantuml.com/patreon");
|
||||
response.addHeader("X-Donate", "https://plantuml.com/paypal");
|
||||
}
|
||||
|
||||
|
||||
private String getContentType() {
|
||||
return CONTENT_TYPE.get(format);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
@@ -25,13 +25,19 @@ package net.sourceforge.plantuml.servlet;
|
||||
|
||||
import net.sourceforge.plantuml.FileFormat;
|
||||
|
||||
/*
|
||||
/**
|
||||
* EPS servlet of the webapp.
|
||||
* This servlet produces the UML diagram in EPS format.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@SuppressWarnings("SERIAL")
|
||||
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
|
||||
public FileFormat getOutputFormat() {
|
||||
return FileFormat.EPS;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
@@ -25,13 +25,19 @@ package net.sourceforge.plantuml.servlet;
|
||||
|
||||
import net.sourceforge.plantuml.FileFormat;
|
||||
|
||||
/*
|
||||
* EPS servlet of the webapp.
|
||||
* This servlet produces the UML diagram in EPS format.
|
||||
/**
|
||||
* EPS Text servlet of the webapp.
|
||||
* This servlet produces the UML diagram in EPS Text format.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@SuppressWarnings("SERIAL")
|
||||
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
|
||||
public FileFormat getOutputFormat() {
|
||||
return FileFormat.EPS_TEXT;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
@@ -25,13 +25,19 @@ package net.sourceforge.plantuml.servlet;
|
||||
|
||||
import net.sourceforge.plantuml.FileFormat;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Image servlet of the webapp.
|
||||
* This servlet produces the UML diagram in PNG format.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@SuppressWarnings("SERIAL")
|
||||
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
|
||||
public FileFormat getOutputFormat() {
|
||||
return FileFormat.PNG;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
@@ -35,11 +35,11 @@ import net.sourceforge.plantuml.FileFormat;
|
||||
|
||||
import net.sourceforge.plantuml.servlet.utility.UmlExtractor;
|
||||
|
||||
/*
|
||||
/**
|
||||
* MAP servlet of the webapp.
|
||||
* This servlet produces the image map of the diagram in HTML format.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@SuppressWarnings("SERIAL")
|
||||
public class MapServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
@@ -52,7 +52,7 @@ public class MapServlet extends HttpServlet {
|
||||
DiagramResponse dr = new DiagramResponse(response, getOutputFormat(), request);
|
||||
try {
|
||||
dr.sendMap(uml);
|
||||
} catch (IIOException iioe) {
|
||||
} catch (IIOException e) {
|
||||
// Browser has closed the connection, do nothing
|
||||
}
|
||||
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() {
|
||||
return FileFormat.UTXT;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
@@ -40,12 +40,12 @@ import net.sourceforge.plantuml.FileFormat;
|
||||
import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.SourceStringReader;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Proxy servlet of the webapp.
|
||||
* This servlet retrieves the diagram source of a web resource (web html page)
|
||||
* and renders it.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@SuppressWarnings("SERIAL")
|
||||
public class OldProxyServlet extends HttpServlet {
|
||||
|
||||
private static final Pattern PROXY_PATTERN = Pattern.compile("/\\w+/proxy/((\\d+)/)?((\\w+)/)?(https?://.*)");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* 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.png.MetadataTag;
|
||||
|
||||
/*
|
||||
/**
|
||||
* 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.
|
||||
* 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 Pablo Lalloni
|
||||
* Modified by Maxime Sinclair
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@SuppressWarnings("SERIAL")
|
||||
public class PlantUmlServlet extends HttpServlet {
|
||||
|
||||
private static final String DEFAULT_ENCODED_TEXT = "SyfFKj2rKt3CoKnELR1Io4ZDoSa70000";
|
||||
|
||||
// Last part of the URL
|
||||
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/(.*)");
|
||||
|
||||
static {
|
||||
OptionFlags.ALLOW_INCLUDE = false;
|
||||
if ("true".equalsIgnoreCase(System.getenv("ALLOW_PLANTUML_INCLUDE"))) {
|
||||
@@ -112,10 +110,10 @@ public class PlantUmlServlet extends HttpServlet {
|
||||
if (text != null && PlantumlUtils.hasCMapData(text)) {
|
||||
request.setAttribute("mapneeded", Boolean.TRUE);
|
||||
}
|
||||
|
||||
// forward to index.jsp
|
||||
final RequestDispatcher dispatcher = request.getRequestDispatcher("/index.jsp");
|
||||
dispatcher.forward(request, response);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -189,6 +187,4 @@ public class PlantUmlServlet extends HttpServlet {
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
@@ -49,12 +49,12 @@ import javax.imageio.IIOException;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLPeerUnverifiedException;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Proxy servlet of the webapp.
|
||||
* This servlet retrieves the diagram source of a web resource (web html page)
|
||||
* and renders it.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@SuppressWarnings("SERIAL")
|
||||
public class ProxyServlet extends HttpServlet {
|
||||
|
||||
static {
|
||||
@@ -95,7 +95,7 @@ public class ProxyServlet extends HttpServlet {
|
||||
DiagramResponse dr = new DiagramResponse(response, getOutputFormat(fmt), request);
|
||||
try {
|
||||
dr.sendDiagram(uml, 0);
|
||||
} catch (IIOException iioe) {
|
||||
} catch (IIOException e) {
|
||||
// Browser has closed the connection, so the HTTP OutputStream is closed
|
||||
// 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 {
|
||||
final HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||
if (con instanceof HttpsURLConnection) {
|
||||
// printHttpsCert((HttpsURLConnection) con);
|
||||
}
|
||||
//if (con instanceof HttpsURLConnection) {
|
||||
// printHttpsCert((HttpsURLConnection) con);
|
||||
//}
|
||||
con.setRequestMethod("GET");
|
||||
String token = System.getenv("HTTP_AUTHORIZATION");
|
||||
if (token != null) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
@@ -25,13 +25,19 @@ package net.sourceforge.plantuml.servlet;
|
||||
|
||||
import net.sourceforge.plantuml.FileFormat;
|
||||
|
||||
/*
|
||||
/**
|
||||
* SVG servlet of the webapp.
|
||||
* This servlet produces the UML diagram in SVG format.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@SuppressWarnings("SERIAL")
|
||||
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
|
||||
public FileFormat getOutputFormat() {
|
||||
return FileFormat.SVG;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@SuppressWarnings("SERIAL")
|
||||
public abstract class UmlDiagramService extends HttpServlet {
|
||||
|
||||
static {
|
||||
@@ -99,7 +99,7 @@ public abstract class UmlDiagramService extends HttpServlet {
|
||||
DiagramResponse dr = new DiagramResponse(response, getOutputFormat(), request);
|
||||
try {
|
||||
dr.sendDiagram(uml, idx);
|
||||
} catch (IIOException iioe) {
|
||||
} catch (IIOException e) {
|
||||
// Browser has closed the connection, so the HTTP OutputStream is closed
|
||||
// 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+/)?(.*)");
|
||||
|
||||
/**
|
||||
* Extracts the compressed UML source from the HTTP URI.
|
||||
* Extracts the UML source text and its index from the HTTP request.
|
||||
*
|
||||
* @param uri
|
||||
* the complete URI as returned by request.getRequestURI()
|
||||
* @return the compressed UML source
|
||||
* @param request http request
|
||||
*
|
||||
* @return the UML source text and its index
|
||||
*/
|
||||
public final String[] getSourceAndIdx(HttpServletRequest request) {
|
||||
final Matcher recoverUml = RECOVER_UML_PATTERN.matcher(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
@@ -31,11 +31,11 @@ import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/*
|
||||
/**
|
||||
* Welcome servlet of the webapp.
|
||||
* Displays the sample Bob and Alice sequence diagram.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@SuppressWarnings("SERIAL")
|
||||
public class Welcome extends HttpServlet {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
<html>
|
||||
<body>
|
||||
<p>This package is in charge of the JEE PlantUml Server.</p>
|
||||
<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>
|
||||
- Service servlets : ImgServlet, SvgServlet, EpsServlet, EpsTextServlet, AsciiServlet, ProxyServlet that only produce a diagram as output.<br>
|
||||
<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" />
|
||||
</p>
|
||||
<p>
|
||||
<img src="http://www.plantuml.com/plantuml/img/XP1DZi8m38NtdCA23RFe0OfGLr24n4y5uW2cU2fBQL8vBeBRup8ZHEc2LPJtNhuNMraTmOey2Ie73-4N48hT2hZ6Ye2TQwEQHvTHuQiZoTMHGfB1ssq65Uanj5BIzESZTghTycQ0KeFy1KrvPNjkqgD-gTktshIQ1wbH1wKBnagmFb1iWezaB-RpKiYcoBAlqKZ-ygyQk45HBhb1hp0kd1sdxGOSdmNbFWQCiE4pJD8qpzDqz4cpWixkVlpSCAsxhHgsKvDX_H3G6_q1" />
|
||||
</p>
|
||||
<p>This package is in charge of the JEE PlantUml Server.</p>
|
||||
<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>
|
||||
- Service servlets: ImgServlet, SvgServlet, EpsServlet, EpsTextServlet, AsciiServlet, ProxyServlet that only produce a diagram as output.<br>
|
||||
<br>
|
||||
Structure of the service part of the PlantUmlServer: <br>
|
||||
<img
|
||||
alt="Class diagram of the service part of the PlantUmlServer"
|
||||
src="https://www.plantuml.com/plantuml/svg/XP31Ri8m44Jl_eez1Wd-e0SgLRGNrAfHFy3OIx1ansQzHaKj_zv4mKfCYZXwvcbclEl8aZWvAmv68w0BV0Q7ReSKIuaFNXVItg3j5BcBJ58nl3676kbaaKTHMHaZV3dxOcH3qlM0KGW_0Y2adJKAJjveqFuLkPf4VE8nOMIWun8AEGRVHWIAOI40Sb4EgvbCsq23NFj42gki9385lp4MDvwSv1v-JnmI3-zg8IvYs7qTdKlxrRTQzV-wvRHWtpKFtupOwcl0kCpPmj_AK7eNCQc0fz_L2hOol-VU1_dlStRdbn-Ojdb0rAT7n7DKnjnd_EhsL69StRbpEm-_2wonrSdPFm00"
|
||||
>
|
||||
</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>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
* Project Info: https://plantuml.com
|
||||
*
|
||||
* 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
|
||||
* the last part of the URI containing the compressed UML
|
||||
* @param source the last part of the URI containing the compressed UML
|
||||
* @return the textual UML source
|
||||
*/
|
||||
static public String getUmlSource(String source) {
|
||||
|
||||
// build the UML source from the compressed part of the URL
|
||||
String text;
|
||||
try {
|
||||
@@ -89,4 +88,4 @@ public class UmlExtractor {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<html>
|
||||
<body>
|
||||
<p>This package contains utility classes of the JEE PlantUml Server.</p>
|
||||
<ul>
|
||||
<li>NullOutputStream is used by the Map feature.</li>
|
||||
<li>UmlExtractor encapsulates the PlantUML library to decode the UML compressed source.</li>
|
||||
</ul>
|
||||
<p>This package contains utility classes of the JEE PlantUml Server.</p>
|
||||
<ul>
|
||||
<li>NullOutputStream is used by the Map feature.</li>
|
||||
<li>UmlExtractor encapsulates the PlantUML library to decode the UML compressed source.</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<c:if test="${cfg['SHOW_GITHUB_RIBBON'] eq 'on' }">
|
||||
<%@ include file="resource/githubribbon.html" %>
|
||||
</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 id="content">
|
||||
<%-- CONTENT --%>
|
||||
|
||||
@@ -6,4 +6,4 @@ Bob -> Alice : hello
|
||||
|
||||
@startuml
|
||||
version
|
||||
@enduml
|
||||
@enduml
|
||||
|
||||
Reference in New Issue
Block a user