Package org.apache.commons.httpclient.methods

Examples of org.apache.commons.httpclient.methods.InputStreamRequestEntity


  public Object execute(String function, Object callData) throws XException
  {
    PostMethod method = initialize(function, null);

    InputStream inStream = (InputStream) callData;
    method.setRequestEntity(new InputStreamRequestEntity(inStream));
    sendMessage(method);

    try
    {
      inStream.close();
View Full Code Here


      Resource... contexts)
    throws RDFParseException, StoreException
  {
    // Set Content-Length to -1 as we don't know it and we also don't want to
    // cache
    RequestEntity entity = new InputStreamRequestEntity(contents, -1, dataFormat.getDefaultMIMEType());
    upload(entity, baseURI, overwrite, contexts);
  }
View Full Code Here

    protected HttpMethod put(String url, String content, int expect)
    {
        PutMethod putMethod = new PutMethod();
        putMethod.setDoAuthentication(true);
        putMethod.setPath(url);
        putMethod.setRequestEntity(new InputStreamRequestEntity(new ByteArrayInputStream(content.getBytes())));
        testMethod(putMethod, expect);
        return putMethod;
    }
View Full Code Here

            mkColMethod.setPath(spaceUrl);
            assertEquals(DavServletResponse.SC_CREATED, getHttpClient().executeMethod(mkColMethod));
            mkColMethod.setPath(pageUrl);
            assertEquals(DavServletResponse.SC_CREATED, getHttpClient().executeMethod(mkColMethod));
            putMethod.setPath(wikiTextFileUrl);
            putMethod.setRequestEntity(new InputStreamRequestEntity(new ByteArrayInputStream(newContent.getBytes())));
            // Already existing resource, in which case SC_NO_CONTENT will be the return status.
            assertEquals(DavServletResponse.SC_NO_CONTENT, getHttpClient().executeMethod(putMethod));
            getMethod.setPath(wikiTextFileUrl);
            assertEquals(DavServletResponse.SC_OK, getHttpClient().executeMethod(getMethod));
            assertEquals(newContent, getMethod.getResponseBodyAsString());
            putMethod.setPath(wikiXMLFileUrl);
            putMethod.setRequestEntity(new InputStreamRequestEntity(new ByteArrayInputStream(newContent.getBytes())));
            // XML saving was disabled recently. See http://jira.xwiki.org/jira/browse/XWIKI-2910
            assertEquals(DavServletResponse.SC_METHOD_NOT_ALLOWED, getHttpClient().executeMethod(putMethod));
            deleteMethod.setPath(pageUrl);
            assertEquals(DavServletResponse.SC_NO_CONTENT, getHttpClient().executeMethod(deleteMethod));
            deleteMethod.setPath(spaceUrl);
View Full Code Here

            mkColMethod.setPath(pageUrl);
            assertEquals(DavServletResponse.SC_CREATED, getHttpClient().executeMethod(mkColMethod));
            getMethod.setPath(attachmentUrl);
            assertEquals(DavServletResponse.SC_NOT_FOUND, getHttpClient().executeMethod(getMethod));
            putMethod.setPath(attachmentUrl);
            putMethod.setRequestEntity(new InputStreamRequestEntity(new ByteArrayInputStream(attachmentContent
                .getBytes())));
            assertEquals(DavServletResponse.SC_CREATED, getHttpClient().executeMethod(putMethod));
            getMethod.setPath(attachmentUrl);
            assertEquals(DavServletResponse.SC_OK, getHttpClient().executeMethod(getMethod));
            assertEquals(attachmentContent, getMethod.getResponseBodyAsString());
View Full Code Here

     
      if ( contentType==null ) contentType = "text/plain";
     
      PostMethod post = new PostMethod(this.targetURL);
     
      post.setRequestEntity(new InputStreamRequestEntity(new FileInputStream(inputFile), inputFile.length()));
      post.setRequestHeader("Content-Type", contentType);
      //post.setFollowRedirects(true);
     
      HttpClient httpClient = new HttpClient();
     
View Full Code Here

    try {

      spooler_log_debug3("... Send request:" + url);
      PostMethod post = new PostMethod(url);
      post.setRequestEntity(new InputStreamRequestEntity(new ByteArrayInputStream (contentType.getBytes())));
      post.setRequestHeader("Content-type", "xml");

      HttpClient httpClient = new HttpClient();
      if (!http_proxy.equals("")) {
          httpClient.getHostConfiguration().setProxy(http_proxy, http_proxy_port);
View Full Code Here

   
    HttpClient httpClient = new HttpClient();
    PutMethod put = new PutMethod(getHttpXcapUri() + BOB_PRES_RULES_URI); // 11
   
    InputStream is = WatcherInfoTest.class.getResourceAsStream("/xcap-root/pres-rules/users/put/elementPoliteBlock.xml");
    RequestEntity entity = new InputStreamRequestEntity(is, "application/xcap-el+xml");
    put.setRequestEntity(entity);
   
    int result = httpClient.executeMethod(put);
    assertEquals(200, result); // 12
    put.releaseConnection();
View Full Code Here

   
    HttpClient httpClient = new HttpClient();
    PutMethod put = new PutMethod(getHttpXcapUri() + ALICE_PRES_RULES_URI); // 11
   
    InputStream is = WatcherInfoTest.class.getResourceAsStream("/xcap-root/pres-rules/users/put/elementCondAliceBob.xml");
    RequestEntity entity = new InputStreamRequestEntity(is, "application/xcap-el+xml");
    put.setRequestEntity(entity);
   
    int result = httpClient.executeMethod(put);
    assertEquals(200, result); // 12
    put.releaseConnection();
View Full Code Here

        // TODO: improve. currently random name is built instead of retrieving name of new resource from top-level xml element within stream
        Name nodeName = getNameFactory().create(Name.NS_DEFAULT_URI, UUID.randomUUID().toString());
        String uri = getItemUri(parentId, nodeName, sessionInfo);
        MkColMethod method = new MkColMethod(uri);
        method.addRequestHeader(JcrRemotingConstants.IMPORT_UUID_BEHAVIOR, Integer.toString(uuidBehaviour));
        method.setRequestEntity(new InputStreamRequestEntity(xmlStream, "text/xml"));
        execute(method, sessionInfo);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.methods.InputStreamRequestEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.