diff --git a/pom.xml b/pom.xml
index 7aee33a..c5b2510 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,6 +75,11 @@
plantuml
LATEST
+
+ javax.servlet
+ jstl
+ 1.2
+
HTTPClient
HTTPClient
diff --git a/src/main/java/net/sourceforge/plantuml/servlet/PlantUmlServlet.java b/src/main/java/net/sourceforge/plantuml/servlet/PlantUmlServlet.java
index 0539838..88da8b8 100644
--- a/src/main/java/net/sourceforge/plantuml/servlet/PlantUmlServlet.java
+++ b/src/main/java/net/sourceforge/plantuml/servlet/PlantUmlServlet.java
@@ -42,6 +42,7 @@ import net.sourceforge.plantuml.SourceStringReader;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.code.Transcoder;
import net.sourceforge.plantuml.code.TranscoderUtil;
+import net.sourceforge.plantuml.servlet.utility.SourceInformation;
import HTTPClient.CookieModule;
import HTTPClient.HTTPConnection;
import HTTPClient.HTTPResponse;
@@ -141,6 +142,11 @@ public class PlantUmlServlet extends HttpServlet {
request.setAttribute("net.sourceforge.plantuml.servlet.decoded", text);
request.setAttribute("net.sourceforge.plantuml.servlet.encoded", encoded);
+
+ // check if an image map is necessary
+ if (text != null && SourceInformation.containsLink(text)) {
+ request.setAttribute("net.sourceforge.plantuml.servlet.mapneeded", Boolean.TRUE);
+ }
// forward to index.jsp
RequestDispatcher dispatcher = request.getRequestDispatcher("/index.jsp");
diff --git a/src/main/java/net/sourceforge/plantuml/servlet/utility/SourceInformation.java b/src/main/java/net/sourceforge/plantuml/servlet/utility/SourceInformation.java
new file mode 100644
index 0000000..7565fb6
--- /dev/null
+++ b/src/main/java/net/sourceforge/plantuml/servlet/utility/SourceInformation.java
@@ -0,0 +1,40 @@
+/* ========================================================================
+ * 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.utility;
+
+/**
+ * Utility class giving information about a diagram based on its source description.
+ */
+public class SourceInformation {
+ /*
+ * Check if there is a link ([[url]]) in the source of the diagram.
+ * @param source the full textual representation of a diagram
+ * @return true if there is at least one link
+ */
+ public static boolean containsLink(String source) {
+ // TODO build a better implementation
+ return source.contains("[[");
+ }
+
+}
diff --git a/src/main/java/net/sourceforge/plantuml/servlet/utility/package.html b/src/main/java/net/sourceforge/plantuml/servlet/utility/package.html
index 570e7b4..0ce2b66 100644
--- a/src/main/java/net/sourceforge/plantuml/servlet/utility/package.html
+++ b/src/main/java/net/sourceforge/plantuml/servlet/utility/package.html
@@ -4,6 +4,7 @@
- NullOutputStream is used by the Map feature.
- UmlExtractor encapsulates the PlantUML library to decode the UML compressed source.
+- SourceInformation extracts useful information from the full textual source.