Use AbstractLesson.getLink() and getFormAction() more

Rather than constructing URL's manually all the time, rather
make use of existing mechanisms to create the URL, and use
it consistently.


git-svn-id: http://webgoat.googlecode.com/svn/trunk@184 4033779f-a91e-0410-96ef-6bf7bf53c507
This commit is contained in:
rogan.dawes
2007-07-18 13:31:11 +00:00
parent e27aaccb45
commit 9ea97126b8
41 changed files with 61 additions and 109 deletions

View File

@ -360,42 +360,7 @@ public class WebSession
public String getRestartLink()
{
List<String> parameters = new ArrayList<String>();
String screenValue = request.getParameter(SCREEN);
if (screenValue != null)
parameters.add(SCREEN + "=" + screenValue);
String menuValue = request.getParameter(MENU);
if (menuValue != null)
parameters.add(MENU + "=" + menuValue);
parameters.add(RESTART + "=" + currentScreen);
return makeQuery("attack", parameters);
}
private String makeQuery(String resource, List parameters)
{
StringBuffer query = new StringBuffer(resource);
boolean isFirstParameter = true;
Iterator i = parameters.iterator();
while (i.hasNext())
{
String parameter = (String) i.next();
if (isFirstParameter)
{
query.append("?");
isFirstParameter = false;
}
else
query.append("&");
query.append(parameter);
}
return query.toString();
return getCurrentLesson().getLink() + "&" + RESTART + "=" + getCurrentScreen();
}
public String getCurrentLink()