Examples of ByteArrayRequestEntity


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

   */
  public Response post(Cluster cluster, String path, Header[] headers,
      byte[] content) throws IOException {
    PostMethod method = new PostMethod();
    try {
      method.setRequestEntity(new ByteArrayRequestEntity(content));
      int code = execute(cluster, method, headers, path);
      headers = method.getResponseHeaders();
      content = method.getResponseBody();
      return new Response(code, headers, content);
    } finally {
View Full Code Here

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

         * Called after this stream is closed.
         */
        @Override
        protected void onClose() throws IOException
        {
            RequestEntity entity = new ByteArrayRequestEntity(((ByteArrayOutputStream) out).toByteArray());
            URLFileName fileName = (URLFileName) getName();
            String urlStr = urlString(fileName);
            if (builder.isVersioning(getFileSystem().getFileSystemOptions()))
            {
                DavPropertySet set = null;
View Full Code Here

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

        final RequestEntity entity;
        try
        {
            final Object payload = payloadProxy.getPayload(message);
            if (payload instanceof byte[])
                entity = new ByteArrayRequestEntity((byte[])payload, _contentType);
            else
                entity = new StringRequestEntity(String.valueOf(payload), _contentType, _charset);
        }
        catch (final MessageDeliverException e)
        {
View Full Code Here

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

   * @throws IOException
   */
  public Response put(Cluster cluster, String path, Header[] headers,
      byte[] content) throws IOException {
    PutMethod method = new PutMethod();
    method.setRequestEntity(new ByteArrayRequestEntity(content));
    int code = execute(cluster, method, headers, path);
    headers = method.getResponseHeaders();
    content = method.getResponseBody();
    method.releaseConnection();
    return new Response(code, headers, content);
View Full Code Here

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

   * @throws IOException
   */
  public Response post(Cluster cluster, String path, Header[] headers,
      byte[] content) throws IOException {
    PostMethod method = new PostMethod();
    method.setRequestEntity(new ByteArrayRequestEntity(content));
    int code = execute(cluster, method, headers, path);
    headers = method.getResponseHeaders();
    content = method.getResponseBody();
    method.releaseConnection();
    return new Response(code, headers, content);
View Full Code Here

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

            ByteArrayOutputStream originalContent = new ByteArrayOutputStream();
            for (int c = 0; c < 5000000; ++c) {
                originalContent.write(c);
            }
            byte[] entity = originalContent.toByteArray();
            postMethod.setRequestEntity(new ByteArrayRequestEntity(entity, "text/xml"));
            client.executeMethod(postMethod);
            assertEquals(277, postMethod.getStatusCode());

            InputStream respStream = postMethod.getResponseBodyAsStream();
            for (int c = 0; c < entity.length; ++c) {
View Full Code Here

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

            ByteArrayOutputStream originalContent = new ByteArrayOutputStream();
            for (int c = 0; c < 5000000; ++c) {
                originalContent.write(c);
            }
            byte[] entity = originalContent.toByteArray();
            postMethod.setRequestEntity(new ByteArrayRequestEntity(entity, "text/xml"));
            client.executeMethod(postMethod);
            assertEquals(277, postMethod.getStatusCode());

            InputStream respStream = postMethod.getResponseBodyAsStream();
            for (int c = 0; c < entity.length; ++c) {
View Full Code Here

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

                        // serialized java object
                        Serializable obj = in.getMandatoryBody(Serializable.class);
                        // write object to output stream
                        ByteArrayOutputStream bos = new ByteArrayOutputStream();
                        HttpHelper.writeObjectToStream(bos, obj);
                        answer = new ByteArrayRequestEntity(bos.toByteArray(), HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT);
                        IOHelper.close(bos);
                    } else if (data instanceof File || data instanceof GenericFile) {
                        // file based (could potentially also be a FTP file etc)
                        File file = in.getBody(File.class);
                        if (file != null) {
View Full Code Here

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

            ByteArrayOutputStream originalContent = new ByteArrayOutputStream();
            for (int c = 0; c < 5000000; ++c) {
                originalContent.write(c);
            }
            byte[] entity = originalContent.toByteArray();
            postMethod.setRequestEntity(new ByteArrayRequestEntity(entity, "text/xml"));
            client.executeMethod(postMethod);
            assertEquals(277, postMethod.getStatusCode());

            InputStream respStream = postMethod.getResponseBodyAsStream();
            for (int c = 0; c < entity.length; ++c) {
View Full Code Here

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

            ByteArrayOutputStream originalContent = new ByteArrayOutputStream();
            for (int c = 0; c < 5000000; ++c) {
                originalContent.write(c);
            }
            byte[] entity = originalContent.toByteArray();
            postMethod.setRequestEntity(new ByteArrayRequestEntity(entity, "text/xml"));
            client.executeMethod(postMethod);
            assertEquals(277, postMethod.getStatusCode());

            InputStream respStream = postMethod.getResponseBodyAsStream();
            for (int c = 0; c < entity.length; ++c) {
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.