> -----Original Message----- > From: Karr, David [mailto:[EMAIL PROTECTED] > Sent: 28 November 2003 20:11 > To: [EMAIL PROTECTED] > Subject: Clean way to analyze returned redirect URL from servlet > > I'm using Cactus 1.4.1, Tomcat 4.1.24, and JDK 1.4.2. > > I have a servlet whose main purpose is to return a redirection URL which > contains several query parameters. In my test, I'd like to verify that > the query string contains certain request parameters, with certain > values. However, I don't think it's a good idea to assume the order of > those parameters, because they wouldn't affect the operation of the > servlet. > > Currently, in my "end" method, I pull the URL out of the "location" > header, and get the query string from that. What is a reasonable > strategy for post-processing the returned redirection URL so I can > robustly parse it and verify the values? I could easily make some > guesses, like a StringTokenizer for "&", but I'm wondering if that's the > correct way to do this.
Yes, that's the correct way. 2 string tokenizers, one for "&" and one for "=" and put the extracted values in a Map. Then you can perform easy assertions. -Vincent --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
