[ http://issues.apache.org/jira/browse/CACTUS-131?page=history ]
Vincent Massol updated CACTUS-131:
----------------------------------
Component: Framework
> Unable to pass both parameters and content in a POST request
> ------------------------------------------------------------
>
> Key: CACTUS-131
> URL: http://issues.apache.org/jira/browse/CACTUS-131
> Project: Cactus
> Type: Bug
> Components: Framework
> Versions: 1.6.1
> Reporter: Maxwell Grender-Jones
>
> I have a servlet which operates using POST, taking parameters off the URL
> (GET style), and the processes the body of the request (POST style).
> i.e. my users post to the URL /foo?foo=bar with a bunch of data as the body
> of the post.
> it seems impossible to do this using cactus (and therefore impossible to test
> my servlet). Note that the servlet does not rely on the parameter being in
> the URL, simply that the parameter is set in the received request. To
> demonstrate the behaviour, I have written a test case, one of which I would
> like to pass (or both!), so that I use the functionality provided.
> import java.io.ByteArrayInputStream;
> import java.io.IOException;
> import org.apache.cactus.ServletTestCase;
> import org.apache.cactus.WebRequest;
> public class CactusTest extends ServletTestCase
> {
> public void beginTest(WebRequest webRequest)
> {
> webRequest.addParameter("foo", "bar", "GET");
> webRequest.setUserData(new ByteArrayInputStream(new
> byte[]{'C'}));
> }
>
> public void testTest() throws IOException
> {
> assertEquals("Parameter not set", "bar",
> request.getParameter("foo"));
> assertEquals("Should be able to read data", 'C',
> request.getInputStream().read());
> }
>
> public void beginPostTest(WebRequest webRequest)
> {
> webRequest.addParameter("foo", "bar", "POST");
> webRequest.setUserData(new ByteArrayInputStream(new byte[]{1}));
> }
>
> public void testPostTest() throws IOException
> {
> assertEquals("Parameter not set", "bar",
> request.getParameter("foo"));
> assertEquals("Should be able to read data", 1,
> request.getInputStream().read());
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]