larryi 2003/02/16 15:18:50 Modified: src/share/org/apache/tomcat/util/test HttpClient.java src/share/org/apache/tomcat/util/test/matchers SessionMatch.java Log: Add some session handling ability. Revision Changes Path 1.11 +3 -0 jakarta-tomcat/src/share/org/apache/tomcat/util/test/HttpClient.java Index: HttpClient.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/test/HttpClient.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- HttpClient.java 22 Sep 2001 21:10:50 -0000 1.10 +++ HttpClient.java 16 Feb 2003 23:18:50 -0000 1.11 @@ -188,6 +188,9 @@ public void addResponseMatchFile( ResponseMatchFile m ) { addMatcher( m ); } + public void addSessionMatch( SessionMatch m ) { + addMatcher( m ); + } // -------------------- Access to the actions -------------------- 1.3 +24 -2 jakarta-tomcat/src/share/org/apache/tomcat/util/test/matchers/SessionMatch.java Index: SessionMatch.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/test/matchers/SessionMatch.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SessionMatch.java 22 Sep 2001 21:10:50 -0000 1.2 +++ SessionMatch.java 16 Feb 2003 23:18:50 -0000 1.3 @@ -69,6 +69,7 @@ public class SessionMatch extends Matcher { String id; String cookieName="JSESSIONID"; + String property; public SessionMatch() { } @@ -83,6 +84,10 @@ id=v; } + public void setProperty(String prop) { + property = prop; + } + public String getTestDescription() { return "Session extract"; } @@ -105,7 +110,24 @@ { Hashtable headers=response.getHeaders(); - Header resH=(Header)headers.get("Cookie"); + Header resH=(Header)headers.get("Set-Cookie"); + if (null != resH) { + String temp = resH.getValue(); + if (null != temp) { + int begin = temp.indexOf("JSESSIONID"); + if (begin >= 0) { + if (null != property) { + int end = temp.indexOf(";",begin); + if (end >= 0) { + temp = temp.substring(begin,end); + } else { + temp = temp.substring(begin); + } + client.getProject().setUserProperty(property,temp); + } + result = true; + } + } + } } - }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]