Search in sources :

Example 36 with PutMethod

use of org.apache.commons.httpclient.methods.PutMethod in project sling by apache.

the class SlingIntegrationTestClient method upload.

/** Upload a file to the Sling repository
     *  @return the HTTP status code
     */
public int upload(String toUrl, InputStream is) throws IOException {
    final PutMethod put = new PutMethod(toUrl);
    put.setRequestEntity(new InputStreamRequestEntity(is));
    return httpClient.executeMethod(put);
}
Also used : InputStreamRequestEntity(org.apache.commons.httpclient.methods.InputStreamRequestEntity) PutMethod(org.apache.commons.httpclient.methods.PutMethod)

Example 37 with PutMethod

use of org.apache.commons.httpclient.methods.PutMethod in project sling by apache.

the class PutMethodServletTest method testPutMethodServletSpecificRT.

public void testPutMethodServletSpecificRT() throws Exception {
    final PutMethod put = new PutMethod(testNodeRT.nodeUrl);
    final int status = httpClient.executeMethod(put);
    assertEquals("PUT to testNodeRT should return 200", 200, status);
    final String content = put.getResponseBodyAsString();
    assertServlet(content, PUT_SERVLET_SUFFIX);
}
Also used : PutMethod(org.apache.commons.httpclient.methods.PutMethod)

Aggregations

PutMethod (org.apache.commons.httpclient.methods.PutMethod)37 Test (org.junit.Test)13 HttpClient (org.apache.commons.httpclient.HttpClient)12 Header (org.apache.commons.httpclient.Header)8 ByteArrayRequestEntity (org.apache.commons.httpclient.methods.ByteArrayRequestEntity)8 GetMethod (org.apache.commons.httpclient.methods.GetMethod)8 IOException (java.io.IOException)7 HttpMethod (org.apache.commons.httpclient.HttpMethod)6 Map (java.util.Map)5 Note (org.apache.zeppelin.notebook.Note)5 Pair (com.zimbra.common.util.Pair)4 Account (com.zimbra.cs.account.Account)4 HttpException (org.apache.commons.httpclient.HttpException)4 DeleteMethod (org.apache.commons.httpclient.methods.DeleteMethod)4 PostMethod (org.apache.commons.httpclient.methods.PostMethod)4 StringRequestEntity (org.apache.commons.httpclient.methods.StringRequestEntity)4 InputStreamRequestEntity (org.apache.commons.httpclient.methods.InputStreamRequestEntity)3 RequestEntity (org.apache.commons.httpclient.methods.RequestEntity)3 Paragraph (org.apache.zeppelin.notebook.Paragraph)3 TypeToken (com.google.gson.reflect.TypeToken)2