1
0
mirror of https://github.com/octoleo/plantuml-server.git synced 2024-06-06 18:30:51 +00:00

Javadoc and source headers.

This commit is contained in:
Maxime Sinclair 2011-03-30 17:53:11 +02:00
parent 0ed28aaea4
commit 237907b410
7 changed files with 174 additions and 3 deletions

View File

@ -1,3 +1,26 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
package net.sourceforge.plantuml.servlet;
import java.io.IOException;
@ -12,7 +35,11 @@ import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.SourceStringReader;
import net.sourceforge.plantuml.StringUtils;
/**
* 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 {
private HttpServletResponse response;
private FileFormat format;

View File

@ -1,10 +1,33 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
package net.sourceforge.plantuml.servlet;
import net.sourceforge.plantuml.FileFormat;
/*
* SVG servlet of the webapp.
* TODO.
* Image servlet of the webapp.
* This servlet produces the UML diagram in PNG format.
*/
@SuppressWarnings("serial")
public class ImgServlet extends UmlDiagramService {

View File

@ -1,3 +1,26 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
package net.sourceforge.plantuml.servlet;
import java.io.IOException;
@ -33,6 +56,7 @@ import HTTPClient.ParseException;
* Packaged by Maxime Sinclair
*
*/
@SuppressWarnings("serial")
public class PlantUmlServlet extends HttpServlet {
private static final Pattern startumlPattern = Pattern.compile("/\\w+/start/(.*)");

View File

@ -1,3 +1,26 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
package net.sourceforge.plantuml.servlet;
import net.sourceforge.plantuml.FileFormat;

View File

@ -1,3 +1,26 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
package net.sourceforge.plantuml.servlet;
import java.io.IOException;
@ -12,6 +35,9 @@ import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.code.Transcoder;
import net.sourceforge.plantuml.code.TranscoderUtil;
/**
* Common service servlet to produce diagram from compressed UML source.
*/
@SuppressWarnings("serial")
public abstract class UmlDiagramService extends HttpServlet {
@ -35,9 +61,21 @@ public abstract class UmlDiagramService extends HttpServlet {
// generate the response
DiagramResponse dr = new DiagramResponse( response, getOutputFormat());
dr.sendDiagram( uml);
dr = null;
}
/**
* Extracts the compressed UML source from the HTTP URI.
* @param uri the complete URI as returned by request.getRequestURI()
* @return the compressed UML source
*/
abstract public String getSource( String uri);
/**
* Gives the wished output format of the diagram.
* This value is used by the DiagramResponse class.
* @return the format
*/
abstract FileFormat getOutputFormat();
private Transcoder getTranscoder() {

View File

@ -1,3 +1,26 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
package net.sourceforge.plantuml.servlet;
import java.io.IOException;
@ -12,6 +35,7 @@ import javax.servlet.http.HttpServletResponse;
* Welcome servlet of the webapp.
* Displays the sample Bob and Alice sequence diagram.
*/
@SuppressWarnings("serial")
public class Welcome extends HttpServlet {
@Override

View File

@ -0,0 +1,12 @@
<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 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/XP3DJiCm48JlaV8EUmnIymPSAg723KJ40pZsDbd9ZbtlEX8gl3laXv2q_1mz-dPcF2qP17H1Ni6Xgp5odhLhJLfljjgHq0wIgbcYqWBQAcPuSVQEL1ELgp3sf17EUGOGKcr9G-_9WF7tACM3I1WGY_ACfuGi44yxsCWSVCS8aSFDOB94pMwLHEeQQ50gdwB6uaj9aRO71x9uyD4f6UZ79279z2u-mVSycyhFpPVWiVg5MFnSSRVEE8xfusSPEpCxVDTpTafT-gqiuVQjBAzdpBFhPKVogMlcor-HglyNsRCc-WFovUKE7m00" />
</p>
</body>
</html>