You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Will Sargent <wi...@yahoo.com> on 2002/01/14 07:36:05 UTC

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Javadoc generation (WAS RE: Writing to HttpServletRequest)

Posted by Vincent Massol <vm...@octo.com>.
I have corrected the problem of javadoc generation :

"corrected problem with javadoc failing because of Aspect. Now using
ajdoc Ant task which understands Aspects. However, the result is not as
nice as javadoc (but it should be !) and I have submitted a bug report
to the AspectJ.org team."

So next time a valid nightly build happens, you'll get the javadoc ... I
have noticed that the Cactus build has been failing for 2 days now and
am trying to fix that ASAP.

Thanks
-Vincent

> -----Original Message-----
> From: Will Sargent [mailto:will_sargent@yahoo.com]
> Sent: 16 January 2002 05:21
> To: Cactus Users List
> Subject: RE: Writing to HttpServletRequest
> 
> Okay, I've upgraded to 1.3.
> 
> There's no javadoc for 1.3.
> 
> Making the javadoc for 1.3 requires that I download the source, setup
> classes to servlet-api, and have AspectJ installed.  This is starting
to
> get
> really messy.
> 
> Can you e-mail me the cactus javadocs for 1.3?  I really hate
interpreting
> build systems by hand...
> 
> Will.
> 
> > upgrade to 1.3 (nightly build) ... ;-)
> 
> 
> 
> _________________________________________________________
> 
> Do You Yahoo!?
> 
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Writing to HttpServletRequest

Posted by Vincent Massol <vm...@octo.com>.

> -----Original Message-----
> From: Will Sargent [mailto:will_sargent@yahoo.com]
> Sent: 16 January 2002 05:21
> To: Cactus Users List
> Subject: RE: Writing to HttpServletRequest
> 
> Okay, I've upgraded to 1.3.
> 
> There's no javadoc for 1.3.
> 

that's a bug ! I'll check this. Thanks.
-Vincent

> Making the javadoc for 1.3 requires that I download the source, setup
> classes to servlet-api, and have AspectJ installed.  This is starting
to
> get
> really messy.
> 
> Can you e-mail me the cactus javadocs for 1.3?  I really hate
interpreting
> build systems by hand...
> 
> Will.
> 
> > upgrade to 1.3 (nightly build) ... ;-)
> 
> 
> 
> _________________________________________________________
> 
> Do You Yahoo!?
> 
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Writing to HttpServletRequest

Posted by Nicholas Lesiecki <ni...@eblox.com>.
Hmmm, we should probably build the javadocs along with the new version.

In the meantime Will, have a look at the actual source. the javadocs are
there too, and plus the source documents itself even more thoroughly than
any external doc. I don't mean this in an arrogant way--rather I love Open
Source and I think code makes great docs.


Cheers,

Nick

P.S. It's worth checking out AspectJ too, I only say that because it's
really cool.

Nicholas Lesiecki
Technical Team Lead
eBlox, Inc.
(520) 615-9345 x104
Check out my new book!:
Java Tools for Extreme Programming: Mastering Open Source Tools, including
Ant, JUnit, and Cactus

http://www.amazon.com/exec/obidos/ASIN/047120708X/


-----Original Message-----
From: Will Sargent [mailto:will_sargent@yahoo.com]
Sent: Tuesday, January 15, 2002 10:21 PM
To: Cactus Users List
Subject: RE: Writing to HttpServletRequest


Okay, I've upgraded to 1.3.

There's no javadoc for 1.3.

Making the javadoc for 1.3 requires that I download the source, setup
classes to servlet-api, and have AspectJ installed.  This is starting to get
really messy.

Can you e-mail me the cactus javadocs for 1.3?  I really hate interpreting
build systems by hand...

Will.

> upgrade to 1.3 (nightly build) ... ;-)


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Writing to HttpServletRequest

Posted by Will Sargent <wi...@yahoo.com>.
Okay, I've upgraded to 1.3.

There's no javadoc for 1.3.

Making the javadoc for 1.3 requires that I download the source, setup
classes to servlet-api, and have AspectJ installed.  This is starting to get
really messy.

Can you e-mail me the cactus javadocs for 1.3?  I really hate interpreting
build systems by hand...

Will.

> upgrade to 1.3 (nightly build) ... ;-)


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Writing to HttpServletRequest

Posted by Vincent Massol <vm...@octo.com>.

> -----Original Message-----
> From: Will Sargent [mailto:will_sargent@yahoo.com]
> Sent: 14 January 2002 17:20
> To: Cactus Users List
> Subject: RE: Writing to HttpServletRequest
> 
> I'm using 23-1.2... I did a find through the sample source code and
> couldn't
> find UserData anywhere...
> 
> What are my options?
> 

upgrade to 1.3 (nightly build) ... ;-)

-Vincent

> Will.
> 
> > -----Original Message-----
> > From: Vincent Massol [mailto:vmassol@octo.com]
> > Sent: Sunday, January 13, 2002 11:32 PM
> > To: 'Cactus Users List'
> > Subject: RE: Writing to HttpServletRequest
> >
> >
> > Err .... just for clarification, this is in Cactus 1.3 only.
> > -Vincent
> >
> > > -----Original Message-----
> > > From: Vincent Massol [mailto:vmassol@octo.com]
> > > 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:will_sargent@yahoo.com]
> > > > 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-
> > > > unsubscribe@jakarta.apache.org>
> > > > For additional commands, e-mail: <mailto:cactus-user-
> > > > help@jakarta.apache.org>
> > > >
> > >
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:   <mailto:cactus-user-
> > > unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail: <mailto:cactus-user-
> > > help@jakarta.apache.org>
> > >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> 
> 
> 
> _________________________________________________________
> 
> Do You Yahoo!?
> 
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Writing to HttpServletRequest

Posted by Will Sargent <wi...@yahoo.com>.
I'm using 23-1.2... I did a find through the sample source code and couldn't
find UserData anywhere...

What are my options?

Will.

> -----Original Message-----
> From: Vincent Massol [mailto:vmassol@octo.com]
> Sent: Sunday, January 13, 2002 11:32 PM
> To: 'Cactus Users List'
> Subject: RE: Writing to HttpServletRequest
>
>
> Err .... just for clarification, this is in Cactus 1.3 only.
> -Vincent
>
> > -----Original Message-----
> > From: Vincent Massol [mailto:vmassol@octo.com]
> > 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:will_sargent@yahoo.com]
> > > 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-
> > > unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail: <mailto:cactus-user-
> > > help@jakarta.apache.org>
> > >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:   <mailto:cactus-user-
> > unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: <mailto:cactus-user-
> > help@jakarta.apache.org>
> >
>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Writing to HttpServletRequest

Posted by Vincent Massol <vm...@octo.com>.
Err .... just for clarification, this is in Cactus 1.3 only.
-Vincent

> -----Original Message-----
> From: Vincent Massol [mailto:vmassol@octo.com]
> 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:will_sargent@yahoo.com]
> > 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-
> > unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: <mailto:cactus-user-
> > help@jakarta.apache.org>
> >
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Writing to HttpServletRequest

Posted by Vincent Massol <vm...@octo.com>.
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:will_sargent@yahoo.com]
> 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-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>