missing request parameters in POST request
Lothar Krenzien <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Organization | http://freemail.web.de/ |
| Message-ID | <[email protected]> |
Hello,
I've just started to write a simple testcase with HTTPUnit / ServletUnit and tried to include some parameters in the request. My problem now is when the request is executed my servlet is called correctly but the request paramters are not available anymore. For now that seams only happen if I do a POST request. Here's a sample what I've tried to do :
// TestServlet.testPost
String data = ....
InputStream inStream = new ByteArrayInputStream(data.getBytes());
WebRequest request = new PostMethodWebRequest("http://localhost:8080/myServlet", inStream, "text/xml");
request.setParameter("mod", "stream");
ServletRunner sr = new ServletRunner();
sr.registerServlet("myServlet", MyServletClass.getName());
ServletUnitClient sc = sr.newClient();
WebResponse response = sc.getResponse(request); // here the "mod" parameter is available in the request !!
int responseCode = response.getResponseCode();
//MyServlet.doPost
String paramMode = request.getParameter("mod"); // here the "mod" parameter is null !!
So what I'm doing wrong ?
Thanks, Lothar
_______________________________________________________________________
Viren-Scan für Ihren PC! Jetzt für jeden. Sofort, online und kostenlos.
Gleich testen! http://www.pc-sicherheit.web.de/freescan/?mc=022222
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV