Skip to content

Commit 5dfd1c4

Browse files
committed
Moving lesson utilities to common project instead of AbstractLesson
1 parent 5bd348f commit 5dfd1c4

1 file changed

Lines changed: 1 addition & 52 deletions

File tree

webgoat-container/src/main/java/org/owasp/webgoat/lessons/AbstractLesson.java

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.slf4j.LoggerFactory;
2222

2323
import java.io.BufferedReader;
24-
import java.io.File;
2524
import java.io.FileNotFoundException;
2625
import java.io.FileReader;
2726
import java.io.InputStreamReader;
@@ -399,7 +398,7 @@ public String getHint(WebSession s, int hintNumber) {
399398
*
400399
* @return The lessonPlan value
401400
*/
402-
protected String getLessonName() {
401+
public String getLessonName() {
403402
return this.getClass().getSimpleName();
404403
}
405404

@@ -991,57 +990,7 @@ protected LabelManager getLabelManager() {
991990
return labelManager;
992991
}
993992

994-
/**
995-
* A reference from an image, script and link tag must include the context path.
996-
* <p>
997-
* A reference in include directives are made from within the web application on the server.
998-
* However, img tags (and the like) make references from the client browser.
999-
* In such external references, the context path must be included.
1000-
*
1001-
* @param w a {@link org.owasp.webgoat.session.WebSession} object.
1002-
* @param imgResourceName a {@link java.lang.String} object.
1003-
* @return a {@link java.lang.String} object.
1004-
*/
1005-
protected final String buildImagePath(WebSession w, String imgResourceName) {
1006-
return w.getRequest()
1007-
.getContextPath() + "/plugin_extracted/plugin/" + getLessonName() + "/images/" + imgResourceName;
1008-
}
1009-
1010-
1011-
/**
1012-
* <p>buildJspPath.</p>
1013-
*
1014-
* @param w a {@link org.owasp.webgoat.session.WebSession} object.
1015-
* @param jspResourceName a {@link java.lang.String} object.
1016-
* @param includeContextPath a boolean.
1017-
* @return a {@link java.lang.String} object.
1018-
*/
1019-
protected final String buildJspPath(WebSession w, String jspResourceName, boolean includeContextPath) {
1020-
String path = includeContextPath ? w.getContext().getContextPath() : "";
1021-
return path + "/plugin_extracted/plugin/" + getLessonName() + "/jsp/" + jspResourceName;
1022-
}
1023993

1024-
/**
1025-
* <p>buildJsPath.</p>
1026-
*
1027-
* @param w a {@link org.owasp.webgoat.session.WebSession} object.
1028-
* @param jsResourceName a {@link java.lang.String} object.
1029-
* @return a {@link java.lang.String} object.
1030-
*/
1031-
protected final String buildJsPath(WebSession w, String jsResourceName) {
1032-
return w.getRequest()
1033-
.getContextPath() + "/plugin_extracted/plugin/" + getLessonName() + "/js/" + jsResourceName;
1034-
}
1035-
1036-
/**
1037-
* <p>getLessonDirectory.</p>
1038-
*
1039-
* @param w a {@link org.owasp.webgoat.session.WebSession} object.
1040-
* @return a {@link java.io.File} object.
1041-
*/
1042-
protected final File getLessonDirectory(WebSession w) {
1043-
return new File(w.getContext().getRealPath("/plugin_extracted/plugin/" + getLessonName() + "/"));
1044-
}
1045994

1046995

1047996
}

0 commit comments

Comments
 (0)