You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2002/06/04 23:48:01 UTC

cvs commit: jakarta-cactus/documentation/docs/xdocs contributors.xml faq.xml

vmassol     2002/06/04 14:48:01

  Modified:    documentation/docs/xdocs Tag: CACTUS_13_BRANCH
                        contributors.xml faq.xml
  Log:
  added FAQ entry for sending multipart/form-data> Submitted by Alan Perfect.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +3 -0      jakarta-cactus/documentation/docs/xdocs/contributors.xml
  
  Index: contributors.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/documentation/docs/xdocs/contributors.xml,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- contributors.xml	21 May 2002 21:28:37 -0000	1.2.2.1
  +++ contributors.xml	4 Jun 2002 21:48:00 -0000	1.2.2.2
  @@ -103,6 +103,9 @@
           <li>
             <link href="mailto:matt.sullivan@bea.com">Matt Sullivan</link>
           </li>
  +        <li>
  +          <link href="mailto:alan@digitalmonkey.co.uk">Alan Perfect</link>
  +        </li>
         </ul>
   
       </s1>
  
  
  
  1.4.2.2   +46 -0     jakarta-cactus/documentation/docs/xdocs/faq.xml
  
  Index: faq.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/documentation/docs/xdocs/faq.xml,v
  retrieving revision 1.4.2.1
  retrieving revision 1.4.2.2
  diff -u -r1.4.2.1 -r1.4.2.2
  --- faq.xml	23 May 2002 09:31:56 -0000	1.4.2.1
  +++ faq.xml	4 Jun 2002 21:48:00 -0000	1.4.2.2
  @@ -41,6 +41,9 @@
             "<code>not a valid response</code> error message. What does it
             mean ?</jump>
           </li>
  +        <li>
  +          <jump anchor="faq7">How to send multipart/form-data ?</jump>
  +        </li>
         </ul>
       </s1>
   
  @@ -307,6 +310,49 @@
           </p>
         </s2>
   
  +    </s1>
  +
  +    <anchor id="faq7"/>
  +    <s1 title="How to send multipart/form-data ?">
  +
  +        <s2 title="Question">
  +          <p>
  +           How to send multipart/form-data to my servlet under test ?
  +          </p>
  +        </s2>
  +        <s2 title="Solution">
  +          <p>
  +            One solution is to use the
  +            <link href="http://www.innovation.ch/java/HTTPClient/">HTTPClient</link>
  +            classes from Ronald Tschalar, as demonstrated in the following
  +            example :
  +          </p>
  +
  +<source><![CDATA[
  +import HTTPClient.Codecs;
  +import HTTPClient.NVPair;
  +.
  +.
  +.
  +NVPair[] hdrs = new NVPair[1];
  +
  +public void beginUpload(WebRequest theRequest)
  +{
  +  NVPair[] opts = { new NVPair("option", "myoption") };
  +  NVPair[] file = { new NVPair("comment", "/home/alan/src.zip") };
  +  try {
  +    byte[] data = Codecs.mpFormDataEncode(opts, file, hdrs);
  +    InputStream i = new ByteArrayInputStream(data);
  +    theRequest.setUserData(i);
  +    theRequest.setContentType(hdrs[0].getValue());
  +    i.close();
  +  } catch (IOException e) {
  +    System.out.println("Error Building Multipart");
  +  }
  +}
  +]]></source>
  +
  +      </s2>
       </s1>
   
     </body>
  
  
  

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