Project fully mavenized with functionality exceeding previous Ant build.xml implemented (except deployment to servlet container, which can be easily added).
Improved unit tests to be independent of externally running servlet container, now every test runs its own embedded jetty server (and stops it afterward). Removed all eclipse artifacts (.project, .classpath, .settings, etc.) and added to .gitignore to be independent of development environment (can be autogenerated by maven, or better yet use m2eclipse). Removed embedded dependency jars since they are handled automatically by maven.
This commit is contained in:
3
src/main/webapp/META-INF/MANIFEST.MF
Normal file
3
src/main/webapp/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
|
||||
65
src/main/webapp/WEB-INF/web.xml
Normal file
65
src/main/webapp/WEB-INF/web.xml
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
|
||||
<display-name>plantuml</display-name>
|
||||
<servlet>
|
||||
<servlet-name>plantumlservlet</servlet-name>
|
||||
<servlet-class>net.sourceforge.plantuml.servlet.PlantUmlServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<servlet-name>welcome</servlet-name>
|
||||
<servlet-class>net.sourceforge.plantuml.servlet.Welcome</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<servlet-name>imgservlet</servlet-name>
|
||||
<servlet-class>net.sourceforge.plantuml.servlet.ImgServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<servlet-name>svgservlet</servlet-name>
|
||||
<servlet-class>net.sourceforge.plantuml.servlet.SvgServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<servlet-name>asciiservlet</servlet-name>
|
||||
<servlet-class>net.sourceforge.plantuml.servlet.AsciiServlet</servlet-class>
|
||||
</servlet>
|
||||
<!-- Patterns of the servlet -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>welcome</servlet-name>
|
||||
<url-pattern>/</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>plantumlservlet</servlet-name>
|
||||
<url-pattern>/uml/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>plantumlservlet</servlet-name>
|
||||
<url-pattern>/form</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>imgservlet</servlet-name>
|
||||
<url-pattern>/img/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>svgservlet</servlet-name>
|
||||
<url-pattern>/svg/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>asciiservlet</servlet-name>
|
||||
<url-pattern>/txt/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>plantumlservlet</servlet-name>
|
||||
<url-pattern>/start/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>plantumlservlet</servlet-name>
|
||||
<url-pattern>/proxy/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<error-page>
|
||||
<exception-type>java.lang.Throwable</exception-type>
|
||||
<location>/error.jsp</location>
|
||||
</error-page>
|
||||
<error-page>
|
||||
<error-code>500</error-code>
|
||||
<location>/error.jsp</location>
|
||||
</error-page>
|
||||
</web-app>
|
||||
32
src/main/webapp/error.jsp
Normal file
32
src/main/webapp/error.jsp
Normal file
@@ -0,0 +1,32 @@
|
||||
<%@ page isErrorPage="true" contentType="text/html; charset=utf-8" pageEncoding="utf-8" session="false" %>
|
||||
<%
|
||||
String contextRoot = request.getContextPath();
|
||||
%>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="expires" content="0" />
|
||||
<meta http-equiv="pragma" content="no-cache" />
|
||||
<meta http-equiv="cache-control" content="no-cache, must-revalidate" />
|
||||
<link rel="stylesheet" href="<%=contextRoot %>/plantuml.css" type="text/css"/>
|
||||
<link rel="icon" href="<%=contextRoot %>/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="shortcut icon" href="<%=contextRoot %>/favicon.ico" type="image/x-icon"/>
|
||||
<title>PlantUMLServer Error</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
Sorry, but things didn't work out as planned.
|
||||
</p>
|
||||
<hr/>
|
||||
<jsp:useBean id="now" class="java.util.Date" />
|
||||
<ul>
|
||||
<li><%=now.toString() %></li>
|
||||
<li>Request that failed: <%=pageContext.getErrorData().getRequestURI() %></li>
|
||||
<li>Status code: <%=pageContext.getErrorData().getStatusCode() %></li>
|
||||
<li>Exception: <%=pageContext.getErrorData().getThrowable() %></li>
|
||||
</ul>
|
||||
<hr/>
|
||||
</body>
|
||||
</html>
|
||||
BIN
src/main/webapp/favicon.ico
Normal file
BIN
src/main/webapp/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
5
src/main/webapp/footer.jspf
Normal file
5
src/main/webapp/footer.jspf
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
<div id="footer">
|
||||
<p>PlantUML Server @timestamp@ / version <%= net.sourceforge.plantuml.version.Version.version() %>
|
||||
</p>
|
||||
</div>
|
||||
79
src/main/webapp/index.jsp
Normal file
79
src/main/webapp/index.jsp
Normal file
@@ -0,0 +1,79 @@
|
||||
<%@ page info="index" contentType="text/html; charset=utf-8" pageEncoding="utf-8" session="false" %>
|
||||
|
||||
<%
|
||||
String contextRoot = request.getContextPath();
|
||||
String host = "http://" + request.getServerName() + ":" + request.getServerPort();
|
||||
String encoded = "";
|
||||
String umltext = "";
|
||||
String imgurl = "";
|
||||
String svgurl = "";
|
||||
String txturl = "";
|
||||
Object encodedAttribute = request.getAttribute("net.sourceforge.plantuml.servlet.encoded");
|
||||
if (encodedAttribute != null) {
|
||||
encoded = encodedAttribute.toString();
|
||||
if (!encoded.isEmpty()) {
|
||||
imgurl = host + contextRoot + "/img/" + encoded;
|
||||
svgurl = host + contextRoot + "/svg/" + encoded;
|
||||
txturl = host + contextRoot + "/txt/" + encoded;
|
||||
}
|
||||
}
|
||||
Object decodedAttribute = request.getAttribute("net.sourceforge.plantuml.servlet.decoded");
|
||||
if (decodedAttribute != null) {
|
||||
umltext = decodedAttribute.toString();
|
||||
}
|
||||
%>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="expires" content="0" />
|
||||
<meta http-equiv="pragma" content="no-cache" />
|
||||
<meta http-equiv="cache-control" content="no-cache, must-revalidate" />
|
||||
<link rel="stylesheet" href="<%=contextRoot %>/plantuml.css" type="text/css"/>
|
||||
<link rel="icon" href="<%=contextRoot %>/favicon.ico" type="image/x-icon"/>
|
||||
<link rel="shortcut icon" href="<%=contextRoot %>/favicon.ico" type="image/x-icon"/>
|
||||
<title>PlantUMLServer</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header">
|
||||
<%-- PAGE TITLE --%>
|
||||
<h1>PlantUML Server</h1>
|
||||
<p>This application provides a servlet which serves images created by <a href="http://plantuml.sourceforge.net">PlantUML</a>.</p>
|
||||
</div>
|
||||
<div id="content">
|
||||
<%-- CONTENT --%>
|
||||
<form method="post" accept-charset="UTF-8" action="<%=contextRoot %>/form">
|
||||
<p>
|
||||
<textarea name="text" cols="120" rows="10"><%=umltext %></textarea>
|
||||
<br/>
|
||||
<input type="submit" />
|
||||
</p>
|
||||
</form>
|
||||
<hr/>
|
||||
You can enter here a previously generated URL:
|
||||
<form method="post" action="<%=contextRoot %>/form">
|
||||
<p>
|
||||
<input name="url" type="text" size="150" value="<%=imgurl %>" />
|
||||
<br/>
|
||||
<input type="submit"/>
|
||||
</p>
|
||||
</form>
|
||||
<% if ( !imgurl.isEmpty()) { %>
|
||||
<hr/>
|
||||
<a href="<%=svgurl%>">View as SVG</a>
|
||||
<a href="<%=txturl%>">View as ASCII Art</a>
|
||||
<p id="diagram">
|
||||
<img src="<%=imgurl %>" alt="PlantUML diagram"/>
|
||||
</p>
|
||||
<% } //endif %>
|
||||
</div>
|
||||
<!-- This comment is used by the TestProxy class
|
||||
@startuml
|
||||
Bob -> Alice : hello
|
||||
@enduml
|
||||
-->
|
||||
<%-- FOOTER --%>
|
||||
<%@ include file="footer.jspf" %>
|
||||
</body>
|
||||
</html>
|
||||
55
src/main/webapp/plantuml.css
Normal file
55
src/main/webapp/plantuml.css
Normal file
@@ -0,0 +1,55 @@
|
||||
/******************************
|
||||
* PlantUMLServlet style sheet *
|
||||
******************************/
|
||||
|
||||
/* Font */
|
||||
* {
|
||||
font-family: arial,helvetica,sans-serif;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
#header {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Content */
|
||||
#content {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
/* Form inputs */
|
||||
#content textarea, #content input[type=text] {
|
||||
background-color: #ffc;
|
||||
font-family: monospace;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* XHTML tag */
|
||||
#content code {
|
||||
font-family: 'courier new',courier,monospace;
|
||||
letter-spacing: -1pt;
|
||||
}
|
||||
|
||||
/* Diagram */
|
||||
#content #diagram {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#content #diagram img {
|
||||
border: medium solid green;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
#footer p {
|
||||
background-color: #eee;
|
||||
color: #666;
|
||||
font-size: 0.7em;
|
||||
padding: 2px;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
Reference in New Issue
Block a user