[Httpunit-develop] Form-based authentication using HTTPUnit and J2SDKEE 1.2.1
Brought to you by:
russgold
From: Jon I. <jon...@bc...> - 2001-09-26 09:35:19
|
Hi, I'm new to this list, I have had a quick browse through the archived postings, so I hope I'm not raising old issues... I've been loking at using HTTPUnit and JUnit to build a test suite for a J2EE application I'm building. At the moment I'm using the J2SDKEE 1.2.1 J2EE reference implementation from Sun to test the application as it is developed. The headers returned from this app server reveal that Tomcat is being used to provide the web server, servlets, JSP etc. Servlet-Engine: Tomcat Web Server/3.0 (JSP 1.1; Servlet 2.2; Java 1.3.0_02; Windows 2000 5.0 x86; java.vendor=Sun Microsystems Inc.) Using HTTPUnit 1.2.6 form-based authentication fails with an HTTP state of 405. After examining the headers produced by IE 5.5 and by HTTPUnit, I located the problem in the following bit of code... PostMethodWebRequest.java:160 String getContentType() { return "application/x-www-form-urlencoded; charset=" + getReques().getCharacterSet(); } Removing the charset=... part of the header to match what IE 5.5 produces fixes the problem, allowing form-based authentication to work correcly. The modified code is... String getContentType() { return "application/x-www-form-urlencoded"; } I'm not familiar with the HTTP standards so I can't make a judgement on what is and is not correct for this header. Any comments? Cheers! Jon |