|
| 1 | +/*************************************************************************************************** |
| 2 | + * |
| 3 | + * |
| 4 | + * This file is part of WebGoat, an Open Web Application Security Project utility. For details, |
| 5 | + * please see http://www.owasp.org/ |
| 6 | + * |
| 7 | + * Copyright (c) 2002 - 20014 Bruce Mayhew |
| 8 | + * |
| 9 | + * This program is free software; you can redistribute it and/or modify it under the terms of the |
| 10 | + * GNU General Public License as published by the Free Software Foundation; either version 2 of the |
| 11 | + * License, or (at your option) any later version. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without |
| 14 | + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | + * General Public License for more details. |
| 16 | + * |
| 17 | + * You should have received a copy of the GNU General Public License along with this program; if |
| 18 | + * not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 19 | + * 02111-1307, USA. |
| 20 | + * |
| 21 | + * Getting Source ============== |
| 22 | + * |
| 23 | + * Source for this application is maintained at https://github.com/WebGoat/WebGoat, a repository for free software |
| 24 | + * projects. |
| 25 | + * |
| 26 | + * For details, please see http://webgoat.github.io |
| 27 | + */ |
| 28 | +package org.owasp.webgoat.service; |
| 29 | + |
| 30 | +import javax.servlet.http.HttpSession; |
| 31 | +import org.owasp.webgoat.session.WebSession; |
| 32 | +import org.springframework.stereotype.Controller; |
| 33 | +import org.springframework.web.bind.annotation.RequestMapping; |
| 34 | +import org.springframework.web.bind.annotation.ResponseBody; |
| 35 | + |
| 36 | +/** |
| 37 | + * |
| 38 | + * @author rlawson |
| 39 | + */ |
| 40 | +@Controller |
| 41 | +public class RestartLessonService extends BaseService { |
| 42 | + |
| 43 | + /** |
| 44 | + * Returns current lesson |
| 45 | + * |
| 46 | + * @param session |
| 47 | + * @return |
| 48 | + */ |
| 49 | + @RequestMapping(value = "/restartlesson.mvc", produces = "text/text") |
| 50 | + public @ResponseBody |
| 51 | + String restartLesson(HttpSession session) { |
| 52 | + WebSession ws = getWebSession(session); |
| 53 | + int currentScreen = ws.getCurrentScreen(); |
| 54 | + if(currentScreen > 0){ |
| 55 | + ws.restartLesson(currentScreen); |
| 56 | + } |
| 57 | + return ws.getCurrentLesson().getLink(); |
| 58 | + } |
| 59 | +} |
0 commit comments