add new service to view source

This commit is contained in:
lawson89 2014-08-11 16:28:05 -04:00
parent 05dc945d95
commit f6437cf28c
2 changed files with 36 additions and 2 deletions

View 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;
}
}

View File

@ -34,6 +34,7 @@ import javax.servlet.http.HttpSession;
import static org.owasp.webgoat.LessonSource.END_SOURCE_SKIP;
import static org.owasp.webgoat.LessonSource.START_SOURCE_SKIP;
import org.owasp.webgoat.lessons.AbstractLesson;
import org.owasp.webgoat.lessons.model.SourceListing;
import org.owasp.webgoat.session.Course;
import org.owasp.webgoat.session.WebSession;
import org.springframework.stereotype.Controller;
@ -55,10 +56,12 @@ public class SourceService extends BaseService {
*/
@RequestMapping(value = "/source.mvc", produces = "application/json")
public @ResponseBody
String showSource(HttpSession session) {
SourceListing showSource(HttpSession session) {
WebSession ws = getWebSesion(session);
String source = getSource(ws);
return source;
SourceListing sl = new SourceListing();
sl.setSource(source);
return sl;
}
/**