Examples of InputStreamRequestEntity


Examples of com.dotcms.repackage.org.apache.commons.httpclient.methods.InputStreamRequestEntity

        try {
            notifyingIn = new NotifyingFileInputStream(content, contentLength, s, listener);
            RequestEntity requestEntity;
            if (contentLength == null) {
                log.trace("no content length");
                requestEntity = new InputStreamRequestEntity(notifyingIn, contentType);
            } else {
                requestEntity = new InputStreamRequestEntity(notifyingIn, contentLength, contentType);
            }
            p.setRequestEntity(requestEntity);
            int result = client.executeMethod(p);
            return result;
        } catch (IOException ex) {
View Full Code Here

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

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

      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

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

    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

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

            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

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

            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

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

     
      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

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

    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

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

   
    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

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

   
    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
TOP
Copyright © 2018 www.massapi.com. 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.