diff --git a/content/WEB-INF/web.xml b/content/WEB-INF/web.xml
index fa2c97b..e24540f 100644
--- a/content/WEB-INF/web.xml
+++ b/content/WEB-INF/web.xml
@@ -5,7 +5,15 @@
plantumlservlet
net.sourceforge.plantuml.servlet.PlantUmlServlet
+
+ welcome
+ net.sourceforge.plantuml.servlet.Welcome
+
+
+ welcome
+ /welcome
+
plantumlservlet
/uml/*
@@ -27,7 +35,7 @@
/proxy/*
- index.jsp
+ welcome
java.lang.Throwable
diff --git a/content/index.jsp b/content/index.jsp
index fea6937..cf8fe7a 100644
--- a/content/index.jsp
+++ b/content/index.jsp
@@ -14,10 +14,12 @@ if (encodedAttribute != null) {
}
}
Object decodedAttribute = request.getAttribute("net.sourceforge.plantuml.servlet.decoded");
-if (decodedAttribute == null) {
+/*if (decodedAttribute == null) {
umltext = "Bob -> Alice : hello";
imgurl = host + contextRoot + "/img/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000";
-} else {
+} else { */
+
+if (decodedAttribute != null) {
umltext = decodedAttribute.toString();
}
%>
diff --git a/src/net/sourceforge/plantuml/servlet/Welcome.java b/src/net/sourceforge/plantuml/servlet/Welcome.java
new file mode 100644
index 0000000..0b1cc84
--- /dev/null
+++ b/src/net/sourceforge/plantuml/servlet/Welcome.java
@@ -0,0 +1,30 @@
+package net.sourceforge.plantuml.servlet;
+
+import java.io.IOException;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+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.
+ */
+public class Welcome extends HttpServlet {
+
+ @Override
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException {
+
+ // set the sample
+ request.setAttribute("net.sourceforge.plantuml.servlet.decoded", "Bob -> Alice : hello");
+ request.setAttribute("net.sourceforge.plantuml.servlet.encoded", "SyfFKj2rKt3CoKnELR1Io4ZDoSa70000");
+
+ // forward to index.jsp
+ RequestDispatcher dispatcher = request.getRequestDispatcher("/index.jsp");
+ dispatcher.forward(request, response);
+ }
+
+}
diff --git a/test/src/net/sourceforge/plantuml/servlet/TestForm.java b/test/src/net/sourceforge/plantuml/servlet/TestForm.java
index 5953eb6..d8811dd 100644
--- a/test/src/net/sourceforge/plantuml/servlet/TestForm.java
+++ b/test/src/net/sourceforge/plantuml/servlet/TestForm.java
@@ -73,7 +73,7 @@ public class TestForm extends TestCase {
public void testEmptyUrl() throws Exception {
WebConversation conversation = new WebConversation();
// Fill the form and submit it
- WebRequest request = new GetMethodWebRequest( "http://localhost/plantuml/" );
+ WebRequest request = new GetMethodWebRequest( TestUtils.getServerUrl() );
WebResponse response = TestUtils.tryGetResponse(conversation, request );
WebForm formUrl = response.getForms()[1];
formUrl.setParameter("url", "");
@@ -82,11 +82,11 @@ public class TestForm extends TestCase {
WebForm forms[] = response.getForms();
assertEquals( 2, forms.length );
// Ensure the Text field is empty
- assertTrue( forms[0].getParameterValue("text").startsWith("Bob"));
- // Ensure the URL field is correct
- assertTrue( forms[1].getParameterValue("url").endsWith("/img/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000"));
- // Ensure the image is present
- assertEquals( 1, response.getImages().length);
+ assertNull( forms[0].getParameterValue("text"));
+ // Ensure the URL field is empty
+ assertTrue( forms[1].getParameterValue("url").isEmpty());
+ // Ensure there is no image
+ assertEquals( 0, response.getImages().length);
}
}