How to access attributes set by servlet into request

"Larry Kline" <[email protected]>
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
I am doing servlet testing and my servlet sets parameters into the request in its doPost() method.  In my test however I do not see those parameters.  Here's the test code:

    public void testInsert() throws Exception {
        File webXmlFile = new File("./conf/web.xml");
        ServletRunner sr = new ServletRunner( webXmlFile );
        ServletUnitClient client = sr.newClient();
        GetMethodWebRequest request = new GetMethodWebRequest("http://localhost:8080/servlet");
        request.setParameter("cmd", "rload");
        request.setParameter("text", getInsertBeneficiaryString());
        WebResponse response = client.getResponse(request);

        String responseString = response.getText();
        InvocationContext context = client.newInvocation( request );
        HttpServletRequest httpRequest = context.getRequest();
        ...
    }

And here's the relevant portion of the servlet code:

    doGet(HttpServletRequest req, HttpServletResponse res) {
        ...
	if (statusFlag) {
            req.setAttribute("Status", Boolean.TRUE);
	} else {
	    req.setAttribute("Status", Boolean.FALSE);
	}
	req.setAttribute("Result", db.getResultValue());
	req.setAttribute("ResultVector", db.getResultVector());
        ...
    }

In the test code, if I send the message getAttributeNames() to the httpRequest object I do not see any of the parameters - Status, Result, or ResultVector - that were set in the servlet code.  How can I get at those attributes set by the servlet?

BTW, I also tried getParameterNames() which also gets nothing.  And I traced this code in a debugger and the servlet code that sets the attributes does get executed.

TIA
Larry
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.