diff --git a/src/main/java/org/owasp/webgoat/lessons/AbstractLesson.java b/src/main/java/org/owasp/webgoat/lessons/AbstractLesson.java index bf435a261..8c80c1d00 100644 --- a/src/main/java/org/owasp/webgoat/lessons/AbstractLesson.java +++ b/src/main/java/org/owasp/webgoat/lessons/AbstractLesson.java @@ -38,32 +38,32 @@ import java.util.Map; /** * ************************************************************************************************* - * - * + *

+ *

* This file is part of WebGoat, an Open Web Application Security Project * utility. For details, please see http://www.owasp.org/ - * + *

* Copyright (c) 2002 - 20014 Bruce Mayhew - * + *

* This program 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 2 of the License, or (at your option) any later * version. - * + *

* This program is 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 General Public License for more * details. - * + *

* You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307, USA. - * + *

* Getting Source ============== - * + *

* Source for this application is maintained at * https://github.com/WebGoat/WebGoat, a repository for free software projects. - * + *

* For details, please see http://webgoat.github.io * * @author Bruce Mayhew WebGoat @@ -163,8 +163,8 @@ public abstract class AbstractLesson extends Screen implements Comparable" + "Send this message to: " + s.getWebgoatContext().getFeedbackAddress() + ""); + + s.getCurrentLesson().getLessonName() + "\">" + s.getWebgoatContext() + .getFeedbackAddress() + ""); } Html html = new Html(); @@ -512,7 +510,8 @@ public abstract class AbstractLesson extends Screen implements Comparable" + "Send this message to: " + s.getWebgoatContext().getFeedbackAddress() + ""); + + s.getCurrentLesson().getLessonName() + "\">" + s.getWebgoatContext() + .getFeedbackAddress() + ""); } return src; @@ -530,7 +529,8 @@ public abstract class AbstractLesson extends Screen implements Comparable" + "Send this message to: " + s.getWebgoatContext().getFeedbackAddress() + ""); + + s.getCurrentLesson().getLessonName() + "\">" + s.getWebgoatContext() + .getFeedbackAddress() + ""); } // Solutions are html files @@ -540,12 +540,12 @@ public abstract class AbstractLesson extends Screen implements Comparable * Returns the default "path" portion of a lesson's URL.

- * + *

*

* Legacy webgoat lesson links are of the form * "attack?Screen=Xmenu=Ystage=Z". This method returns the path portion of * the url, i.e., "attack" in the string above.

- * + *

*

* Newer, Spring-Controller-based classes will override this method to * return "*.do"-styled paths.

@@ -624,7 +624,7 @@ public abstract class AbstractLesson extends Screen implements Comparable + * A reference in include directives are made from within the web application on the server. + * However, img tags (and the like) make references from the client browser. + * In such external references, the context path must be included. + */ protected final String buildImagePath(WebSession w, String imgResourceName) { - return w.getRequest().getContextPath() + "/plugin_extracted/plugin/" + getLessonName() + "/images/" + imgResourceName; + return w.getRequest() + .getContextPath() + "/plugin_extracted/plugin/" + getLessonName() + "/images/" + imgResourceName; } - protected final String buildJspPath(WebSession w, String jspResourceName) { - return w.getRequest().getContextPath() + "/plugin_extracted/plugin/" + getLessonName() + "/jsp/" + jspResourceName; + + protected final String buildJspPath(WebSession w, String jspResourceName, boolean includeContextPath) { + String path = includeContextPath ? w.getContext().getContextPath() : ""; + return path + "/plugin_extracted/plugin/" + getLessonName() + "/jsp/" + jspResourceName; } protected final String buildJsPath(WebSession w, String jsResourceName) { - return w.getRequest().getContextPath() + "/plugin_extracted/plugin/" + getLessonName() + "/js/" + jsResourceName; + return w.getRequest() + .getContextPath() + "/plugin_extracted/plugin/" + getLessonName() + "/js/" + jsResourceName; } protected final File getLessonDirectory(WebSession w) {