Images from solutions are loading again
This commit is contained in:
@ -5,9 +5,15 @@ import org.owasp.webgoat.session.WebgoatContext;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -25,6 +31,18 @@ public class MvcConfiguration extends WebMvcConfigurerAdapter {
|
||||
return new ServletRegistrationBean(hammerHead, "/attack/*");
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HammerHead hammerHead(WebgoatContext context) {
|
||||
return new HammerHead(context);
|
||||
|
Reference in New Issue
Block a user