Lessons which load JavaScript etc now works
This commit is contained in:
@ -1,18 +1,17 @@
|
||||
package org.owasp.webgoat;
|
||||
|
||||
import org.owasp.webgoat.session.LabelDebugger;
|
||||
import org.owasp.webgoat.session.WebgoatContext;
|
||||
import org.owasp.webgoat.session.WebSession;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.context.embedded.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -20,10 +19,15 @@ import java.io.IOException;
|
||||
@Configuration
|
||||
public class MvcConfiguration extends WebMvcConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("pluginTargetDirectory")
|
||||
private File pluginTargetDirectory;
|
||||
|
||||
@Override
|
||||
public void addViewControllers(ViewControllerRegistry registry) {
|
||||
registry.addViewController("/login").setViewName("login");
|
||||
registry.addViewController("/lesson_content").setViewName("lesson_content");
|
||||
registry.addViewController("/start.mvc").setViewName("main_new");
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ -33,23 +37,15 @@ public class MvcConfiguration extends WebMvcConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
Resource resource = new ClassPathResource("/plugin_lessons/plugin_lessons_marker.txt");
|
||||
try {
|
||||
File pluginsDir = resource.getFile().getParentFile();
|
||||
registry.addResourceHandler("/plugin_lessons/**").addResourceLocations("file:///" + pluginsDir.toString() + "/");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
registry.addResourceHandler("/plugin_lessons/**").addResourceLocations("file:///" + pluginTargetDirectory.toString() + "/");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HammerHead hammerHead(WebgoatContext context) {
|
||||
return new HammerHead(context);
|
||||
public HammerHead hammerHead(WebSession webSession) {
|
||||
return new HammerHead(webSession);
|
||||
}
|
||||
|
||||
@Bean
|
||||
//@Scope(value= WebApplicationContext.SCOPE_SESSION)
|
||||
public LabelDebugger labelDebugger() {
|
||||
return new LabelDebugger();
|
||||
}
|
||||
|
Reference in New Issue
Block a user