index.jsp 2.68 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<%@ page info="index" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>

<%
String contextRoot = request.getContextPath();
String host = "http://" + request.getServerName() + ":" + request.getServerPort();
String encoded = "";
String umltext = "";
String imgurl = "";
Object encodedAttribute = request.getAttribute("net.sourceforge.plantuml.servlet.encoded");
if (encodedAttribute != null) {
    encoded = encodedAttribute.toString();
    if (!encoded.isEmpty()) {
	    imgurl = host + contextRoot + "/img/" + encoded;
	}
}
Object decodedAttribute = request.getAttribute("net.sourceforge.plantuml.servlet.decoded");
17
/*if (decodedAttribute == null) {
Arnaud Roques's avatar
Arnaud Roques committed
18
19
	umltext = "Bob -> Alice : hello";
    imgurl = host + contextRoot + "/img/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000";
20
21
22
} else {    */

if (decodedAttribute != null) {
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	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>PlantUMLServer</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 --%>
Arnaud Roques's avatar
Arnaud Roques committed
47
    <form method="post" accept-charset="UTF-8"  action="<%=contextRoot %>/form">
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
        <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/>
    <p>You can use the following URL:
        <br/>
        <a href="<%=imgurl %>"><code>&lt;img src="<%=imgurl %>" /&gt;</code></a>
        <br/><br/>
        <img id="diagram" src="<%=imgurl %>" alt="PlantUML diagram"/>
    </p>
    <% } //endif %>
</div>

<%-- FOOTER 
<%@ include file="util/footer.jspf" %> --%>
</body>
</html>