add new service to view source
This commit is contained in:
parent
05dc945d95
commit
f6437cf28c
31
java/org/owasp/webgoat/lessons/model/SourceListing.java
Normal file
31
java/org/owasp/webgoat/lessons/model/SourceListing.java
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.owasp.webgoat.lessons.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author rlawson
|
||||||
|
*/
|
||||||
|
public class SourceListing {
|
||||||
|
|
||||||
|
private String source;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the source
|
||||||
|
*/
|
||||||
|
public String getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param source the source to set
|
||||||
|
*/
|
||||||
|
public void setSource(String source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -34,6 +34,7 @@ import javax.servlet.http.HttpSession;
|
|||||||
import static org.owasp.webgoat.LessonSource.END_SOURCE_SKIP;
|
import static org.owasp.webgoat.LessonSource.END_SOURCE_SKIP;
|
||||||
import static org.owasp.webgoat.LessonSource.START_SOURCE_SKIP;
|
import static org.owasp.webgoat.LessonSource.START_SOURCE_SKIP;
|
||||||
import org.owasp.webgoat.lessons.AbstractLesson;
|
import org.owasp.webgoat.lessons.AbstractLesson;
|
||||||
|
import org.owasp.webgoat.lessons.model.SourceListing;
|
||||||
import org.owasp.webgoat.session.Course;
|
import org.owasp.webgoat.session.Course;
|
||||||
import org.owasp.webgoat.session.WebSession;
|
import org.owasp.webgoat.session.WebSession;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@ -55,10 +56,12 @@ public class SourceService extends BaseService {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/source.mvc", produces = "application/json")
|
@RequestMapping(value = "/source.mvc", produces = "application/json")
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
String showSource(HttpSession session) {
|
SourceListing showSource(HttpSession session) {
|
||||||
WebSession ws = getWebSesion(session);
|
WebSession ws = getWebSesion(session);
|
||||||
String source = getSource(ws);
|
String source = getSource(ws);
|
||||||
return source;
|
SourceListing sl = new SourceListing();
|
||||||
|
sl.setSource(source);
|
||||||
|
return sl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user