[snip]
 > 
 > > I think parsing the query string is the only realistic solution (without
 > > looking at the code). If I pass data as a serialized object, the
 > redirector
 > > has to use get[InputStream|Reader] to get the data, this will interfere
 > with
 > > my servlet calling getParameter. If the re-director calls getParameter
 > this
 > > will interfere with my servlet calling get[InputStream|Reader].
 > >
 > 
 > You're right. Let's do it in the URL. I'll modify Cactus to behave this way
 > first ...
 > 
Passing the parameters in the URL will help alot.

 > > If this works then would the idea be to add support for add beginXXX
 > methods
 > > that take a WebRequest object that we could 'write' the input data to?
 > 
 > ... then I propose to modify WebRequest :
 > * add a addParameter(String name, String value, String method) method where
 > method = {"POST" | "GET"}
 > * modify the behaviour of the existing addParameter(String name, String
 > value) so that it defaults to addParameter(String name, String value, "GET")
 > * add a setData(InputStream bodyData) method to pass data to write in the
 > HTTP request body. If setData() is used, then all added POST parameters will
 > be ignored
 > * force the method to POST if any POST parameters have been added
 > * add a setContentType(String contentType) method. Content type is
 > "application/x-www-form-urlencoded" by default. Question: is this needed ? I
 > have not looked at multi-part MIME yet.
 > 

I think leaving the addParameter methods alone will work.

Reason: Cactus will shortly pass all Cactus related information in the
query string.  All calls to 'addParameter', 'addHeader' should be
related to the servlet being tested.

Will there be a case where a servlet uses a combination of
'getParameter' and 'getHeader' OR use 'getInputStream' OR use
'getReader'?

The test writer should know which call to make.


I looked at:

HTTP:
http://www.w3.org/Protocols/HTTP/Body.html

MIME and HTML:
http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4

The HTTP request content format/encoding is specified by the object
header fields (covered by 'addHeader'?)

The object termination is determined by 
'Content-Length' field
OR
"boundary" attribute with same syntax as MIME multipart message
OR
by closing the connection


The 'MIME and HTML' link suggests the content sent on the output
stream is plain text with parameters of the form 'name=value' and
'boundary=string' string <data> string.

If the user formats the output data stream, this could go through
'setData'.

Where is a good division of labour?  Does Cactus (or HttpClient)
format the MIME multi-part data or does the user?

 > What do you think ?
 > Thanks
 > 
 > >
 > > Kevin Jones
 > > Developmentor
 > > www.develop.com
 > >
 > 
 > -Vincent
 > 
[snip]


My attempt at adding a 'setData' type method did not work due to
Cactus passing info using 'addParameter'.  I tried passing the Cactus
info using 'setHeader' which did not work cleanly.

Once Cactus is updated to pass its parameters through the query
string, I can try to add 'setData' again.

Hope this helps.

Alvin.

Reply via email to