Err .... just for clarification, this is in Cactus 1.3 only.
-Vincent

> -----Original Message-----
> From: Vincent Massol [mailto:[EMAIL PROTECTED]]
> Sent: 14 January 2002 07:25
> To: 'Cactus Users List'
> Subject: RE: Writing to HttpServletRequest
> 
> Will,
> 
> Here is an example (from the sample application unit tests) :
> 
>     /**
>      * Verify that we can send arbitrary data in the request body.
>      *
>      * @param theRequest the request object that serves to initialize
> the
>      *                   HTTP connection to the server redirector.
>      */
>     public void beginSendUserData(WebRequest theRequest)
>     {
>         ByteArrayInputStream bais = new ByteArrayInputStream(
>             "<data>some data to send in the body</data>".getBytes());
> 
>         theRequest.setUserData(bais);
>         theRequest.setContentType("text/xml");
>     }
> 
>     /**
>      * Verify that we can send arbitrary data in the request body.
>      */
>     public void testSendUserData() throws Exception
>     {
>         String buffer;
>         StringBuffer body = new StringBuffer();
> 
>         BufferedReader reader = request.getReader();
>         while ((buffer = reader.readLine()) != null) {
>             body.append(buffer);
>         }
> 
>         assertEquals("<data>some data to send in the body</data>",
>             body.toString());
>         assertEquals("text/xml", request.getContentType());
>     }
> 
> You can replace getReader() by getInputStream().
> 
> Hope it helps
> -Vincent
> 
> 
> > -----Original Message-----
> > From: Will Sargent [mailto:[EMAIL PROTECTED]]
> > Sent: 14 January 2002 06:36
> > To: Cactus Users List
> > Subject: Writing to HttpServletRequest
> >
> > I have kind of a wierd problem and I'd like to know if I'm missing
> > something.
> >
> > I'm trying to get an XML-RPC solution working through a servlet.
The
> way
> > the XML-RPC works is by reading the inputstream of
HttpServletRequest.
> >
> > However, from ServletTestCase I can't see a way to actually WRITE
> stuff to
> > the inputstream.  Read stuff, sure.  Add headers, cookies,
attributes,
> you
> > name it, sure.  But how do I actually stuff real content into the
POST
> > request?
> >
> > Will.
> >
> >
> >
> > _________________________________________________________
> >
> > Do You Yahoo!?
> >
> > Get your free @yahoo.com address at http://mail.yahoo.com
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:   <mailto:cactus-user-
> > [EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:cactus-user-
> > [EMAIL PROTECTED]>
> >
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> [EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:cactus-user-
> [EMAIL PROTECTED]>
> 




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to