fix missing sources, pom was not copying source into WEB-INF/classes
some cleanup and better logging while I was in there
This commit is contained in:
parent
3aa6cb044b
commit
243d88b6d1
8
pom.xml
8
pom.xml
@ -22,6 +22,14 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>${basedir}/src/main/java</directory>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>${basedir}/src/main/resources</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
@ -30,6 +30,8 @@ import org.owasp.webgoat.session.Screen;
|
|||||||
import org.owasp.webgoat.session.WebSession;
|
import org.owasp.webgoat.session.WebSession;
|
||||||
import org.owasp.webgoat.session.WebgoatContext;
|
import org.owasp.webgoat.session.WebgoatContext;
|
||||||
import org.owasp.webgoat.session.WebgoatProperties;
|
import org.owasp.webgoat.session.WebgoatProperties;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* *************************************************************************************************
|
* *************************************************************************************************
|
||||||
@ -66,6 +68,8 @@ import org.owasp.webgoat.session.WebgoatProperties;
|
|||||||
*/
|
*/
|
||||||
public abstract class AbstractLesson extends Screen implements Comparable<Object> {
|
public abstract class AbstractLesson extends Screen implements Comparable<Object> {
|
||||||
|
|
||||||
|
final Logger logger = LoggerFactory.getLogger(AbstractLesson.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of the Field
|
* Description of the Field
|
||||||
*/
|
*/
|
||||||
@ -496,8 +500,7 @@ public abstract class AbstractLesson extends Screen implements Comparable<Object
|
|||||||
String src;
|
String src;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// System.out.println("Loading source file: " +
|
logger.debug("Loading source file: " + getSourceFileName());
|
||||||
// getSourceFileName());
|
|
||||||
src = readFromFile(new BufferedReader(new FileReader(s.getWebResource(getSourceFileName()))), true);
|
src = readFromFile(new BufferedReader(new FileReader(s.getWebResource(getSourceFileName()))), true);
|
||||||
|
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
@ -782,8 +785,7 @@ public abstract class AbstractLesson extends Screen implements Comparable<Object
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setSourceFileName(String sourceFileName) {
|
public void setSourceFileName(String sourceFileName) {
|
||||||
// System.out.println("Setting source file of lesson " + this + " to: "
|
logger.debug("Setting source file of lesson " + this + " to: " + sourceFileName);
|
||||||
// + sourceFileName);
|
|
||||||
this.sourceFileName = sourceFileName;
|
this.sourceFileName = sourceFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,32 +346,35 @@ public class Course {
|
|||||||
*/
|
*/
|
||||||
private void loadResources() {
|
private void loadResources() {
|
||||||
for (AbstractLesson lesson : lessons) {
|
for (AbstractLesson lesson : lessons) {
|
||||||
|
logger.info("Loading resources for lesson -> " + lesson.getName());
|
||||||
String className = lesson.getClass().getName();
|
String className = lesson.getClass().getName();
|
||||||
String classFile = getSourceFile(className);
|
String classFile = getSourceFile(className);
|
||||||
|
logger.info("Lesson classname: " + className);
|
||||||
|
logger.info("Lesson java file: " + classFile);
|
||||||
|
|
||||||
for (String absoluteFile : files) {
|
for (String absoluteFile : files) {
|
||||||
String fileName = getFileName(absoluteFile);
|
String fileName = getFileName(absoluteFile);
|
||||||
logger.debug("Course: looking at file: " + absoluteFile);
|
//logger.debug("Course: looking at file: " + absoluteFile);
|
||||||
|
|
||||||
if (absoluteFile.endsWith(classFile)) {
|
if (absoluteFile.endsWith(classFile)) {
|
||||||
// System.out.println("Set source file for " + classFile);
|
logger.info("Set source file for " + classFile);
|
||||||
lesson.setSourceFileName(absoluteFile);
|
lesson.setSourceFileName(absoluteFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (absoluteFile.startsWith("/lesson_plans") && absoluteFile.endsWith(".html")
|
if (absoluteFile.startsWith("/lesson_plans") && absoluteFile.endsWith(".html")
|
||||||
&& className.endsWith(fileName)) {
|
&& className.endsWith(fileName)) {
|
||||||
logger.debug("DEBUG: setting lesson plan file " + absoluteFile + " for lesson "
|
logger.info("setting lesson plan file " + absoluteFile + " for lesson "
|
||||||
+ lesson.getClass().getName());
|
+ lesson.getClass().getName());
|
||||||
logger.debug("fileName: " + fileName + " == className: " + className);
|
logger.info("fileName: " + fileName + " == className: " + className);
|
||||||
String language = getLanguageFromFileName("/lesson_plans", absoluteFile);
|
String language = getLanguageFromFileName("/lesson_plans", absoluteFile);
|
||||||
lesson.setLessonPlanFileName(language, absoluteFile);
|
lesson.setLessonPlanFileName(language, absoluteFile);
|
||||||
WebGoatI18N.loadLanguage(language);
|
WebGoatI18N.loadLanguage(language);
|
||||||
}
|
}
|
||||||
if (absoluteFile.startsWith("/lesson_solutions") && absoluteFile.endsWith(".html")
|
if (absoluteFile.startsWith("/lesson_solutions") && absoluteFile.endsWith(".html")
|
||||||
&& className.endsWith(fileName)) {
|
&& className.endsWith(fileName)) {
|
||||||
logger.debug("DEBUG: setting lesson solution file " + absoluteFile + " for lesson "
|
logger.info("setting lesson solution file " + absoluteFile + " for lesson "
|
||||||
+ lesson.getClass().getName());
|
+ lesson.getClass().getName());
|
||||||
logger.debug("fileName: " + fileName + " == className: " + className);
|
logger.info("fileName: " + fileName + " == className: " + className);
|
||||||
lesson.setLessonSolutionFileName(absoluteFile);
|
lesson.setLessonSolutionFileName(absoluteFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ public class WebSession {
|
|||||||
/**
|
/**
|
||||||
* Constructor for the WebSession object
|
* Constructor for the WebSession object
|
||||||
*
|
*
|
||||||
* @param servlet Description of the Parameter
|
* @param webgoatContext
|
||||||
* @param context Description of the Parameter
|
* @param context Description of the Parameter
|
||||||
*/
|
*/
|
||||||
public WebSession(WebgoatContext webgoatContext, ServletContext context) {
|
public WebSession(WebgoatContext webgoatContext, ServletContext context) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user