mirror of
https://github.com/octoleo/plantuml-server.git
synced 2025-02-04 03:28:25 +00:00
Documentation and polishing
This commit is contained in:
parent
237907b410
commit
0f34349037
@ -43,7 +43,7 @@ public class ImgServlet extends UmlDiagramService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
FileFormat getOutputFormat() {
|
public FileFormat getOutputFormat() {
|
||||||
return FileFormat.PNG;
|
return FileFormat.PNG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,6 @@ import HTTPClient.ParseException;
|
|||||||
public class PlantUmlServlet extends HttpServlet {
|
public class PlantUmlServlet extends HttpServlet {
|
||||||
|
|
||||||
private static final Pattern startumlPattern = Pattern.compile("/\\w+/start/(.*)");
|
private static final Pattern startumlPattern = Pattern.compile("/\\w+/start/(.*)");
|
||||||
private static final Pattern imagePattern = Pattern.compile("/\\w+/img/(.*)");
|
|
||||||
private static final Pattern proxyPattern = Pattern.compile("/\\w+/proxy/((\\d+)/)?(http://.*)");
|
private static final Pattern proxyPattern = Pattern.compile("/\\w+/proxy/((\\d+)/)?(http://.*)");
|
||||||
private static final Pattern oldStartumlPattern = Pattern.compile("/\\w+/uml/startuml/(.*)");
|
private static final Pattern oldStartumlPattern = Pattern.compile("/\\w+/uml/startuml/(.*)");
|
||||||
private static final Pattern oldImagePattern = Pattern.compile("/\\w+/uml/image/(.*)");
|
private static final Pattern oldImagePattern = Pattern.compile("/\\w+/uml/image/(.*)");
|
||||||
@ -72,7 +71,6 @@ public class PlantUmlServlet extends HttpServlet {
|
|||||||
|
|
||||||
final String uri = request.getRequestURI();
|
final String uri = request.getRequestURI();
|
||||||
Matcher startumlMatcher = startumlPattern.matcher(uri);
|
Matcher startumlMatcher = startumlPattern.matcher(uri);
|
||||||
Matcher imageMatcher = imagePattern.matcher(uri);
|
|
||||||
Matcher proxyMatcher = proxyPattern.matcher(uri);
|
Matcher proxyMatcher = proxyPattern.matcher(uri);
|
||||||
Matcher oldStartumlMatcher = oldStartumlPattern.matcher(uri);
|
Matcher oldStartumlMatcher = oldStartumlPattern.matcher(uri);
|
||||||
Matcher oldImageMatcher = oldImagePattern.matcher(uri);
|
Matcher oldImageMatcher = oldImagePattern.matcher(uri);
|
||||||
@ -80,9 +78,6 @@ public class PlantUmlServlet extends HttpServlet {
|
|||||||
if (startumlMatcher.matches()) {
|
if (startumlMatcher.matches()) {
|
||||||
String source = startumlMatcher.group(1);
|
String source = startumlMatcher.group(1);
|
||||||
handleImage(response, source, uri);
|
handleImage(response, source, uri);
|
||||||
} else if (imageMatcher.matches()) {
|
|
||||||
String source = imageMatcher.group(1);
|
|
||||||
handleImageDecompress(response, source, uri);
|
|
||||||
} else if (proxyMatcher.matches()) {
|
} else if (proxyMatcher.matches()) {
|
||||||
String num = proxyMatcher.group(2);
|
String num = proxyMatcher.group(2);
|
||||||
String source = proxyMatcher.group(3);
|
String source = proxyMatcher.group(3);
|
||||||
|
@ -27,7 +27,7 @@ import net.sourceforge.plantuml.FileFormat;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* SVG servlet of the webapp.
|
* SVG servlet of the webapp.
|
||||||
* TODO.
|
* This servlet produces the UML diagram in SVG format.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class SvgServlet extends UmlDiagramService {
|
public class SvgServlet extends UmlDiagramService {
|
||||||
@ -43,7 +43,7 @@ public class SvgServlet extends UmlDiagramService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
FileFormat getOutputFormat() {
|
public FileFormat getOutputFormat() {
|
||||||
return FileFormat.SVG;
|
return FileFormat.SVG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,8 @@ import net.sourceforge.plantuml.code.Transcoder;
|
|||||||
import net.sourceforge.plantuml.code.TranscoderUtil;
|
import net.sourceforge.plantuml.code.TranscoderUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common service servlet to produce diagram from compressed UML source.
|
* 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 {
|
||||||
@ -45,7 +46,7 @@ public abstract class UmlDiagramService extends HttpServlet {
|
|||||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws IOException, ServletException {
|
throws IOException, ServletException {
|
||||||
|
|
||||||
// build the uml source from the compressed request parameter
|
// build the UML source from the compressed request parameter
|
||||||
String text = URLDecoder.decode( getSource( request.getRequestURI()), "UTF-8");
|
String text = URLDecoder.decode( getSource( request.getRequestURI()), "UTF-8");
|
||||||
Transcoder transcoder = getTranscoder();
|
Transcoder transcoder = getTranscoder();
|
||||||
text = transcoder.decode(text);
|
text = transcoder.decode(text);
|
||||||
@ -76,7 +77,7 @@ public abstract class UmlDiagramService extends HttpServlet {
|
|||||||
* This value is used by the DiagramResponse class.
|
* This value is used by the DiagramResponse class.
|
||||||
* @return the format
|
* @return the format
|
||||||
*/
|
*/
|
||||||
abstract FileFormat getOutputFormat();
|
abstract public FileFormat getOutputFormat();
|
||||||
|
|
||||||
private Transcoder getTranscoder() {
|
private Transcoder getTranscoder() {
|
||||||
return TranscoderUtil.getDefaultTranscoder();
|
return TranscoderUtil.getDefaultTranscoder();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user