Package org.apache.http.entity

Examples of org.apache.http.entity.FileEntity


        if(!hasArguments() && getSendFileAsPostBody()) {
            hasEntityBody = true;

            // If getSendFileAsPostBody returned true, it's sure that file is not null
            FileEntity fileRequestEntity = new FileEntity(new File(files[0].getPath())); // no need for content-type here
            entity.setEntity(fileRequestEntity);
        }
        // If none of the arguments have a name specified, we
        // just send all the values as the entity body
        else if(getSendParameterValuesAsPostBody()) {
View Full Code Here


                        answer = entity;
                    } 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) {
                            answer = new FileEntity(file, contentType);
                        }
                    } else if (data instanceof String) {
                        // be a bit careful with String as any type can most likely be converted to String
                        // so we only do an instanceof check and accept String if the body is really a String
                        // do not fallback to use the default charset as it can influence the request
View Full Code Here

    }
  }

  @Override
  protected HttpEntity getFileEntity(File file) {
    return new FileEntity(file, getContentType(file));
  }
View Full Code Here

        return body;
  }
 
  @Override
  protected HttpEntity getFileEntity(File file) {
    return new FileEntity(file, getContentType(file));
  }
View Full Code Here

      return null;
    }
  }
 
  protected HttpEntity getFileEntity(File file, String contentType) {
    FileEntity body = new FileEntity(file, contentType);
        return body;
  }
View Full Code Here

        return body;
  }
 
  @Override
  protected HttpEntity getFileEntity(File file) {
    FileEntity body = new FileEntity(file, getContentType(file));
        return body;
  }
View Full Code Here

    }
  }
 
  @Override
  protected HttpEntity getFileEntity(File file) {
    FileEntity body = new FileEntity(file, getContentType(file));
        return body;
  }
View Full Code Here

        return body;
  }
 
  @Override
  protected HttpEntity getFileEntity(File file) {
    FileEntity body = new FileEntity(file, getContentType(file));
        return body;
  }
View Full Code Here

    public Request bodyString(final String s, final ContentType contentType) {
        return body(new StringEntity(s, contentType));
    }

    public Request bodyFile(final File file, final ContentType contentType) {
        return body(new FileEntity(file, contentType));
    }
View Full Code Here

                    else {
                        post.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
                    }
                }

                FileEntity fileRequestEntity = new FileEntity(new File(file.getPath()),(ContentType) null);// TODO is null correct?
                post.setEntity(fileRequestEntity);

                // We just add placeholder text for file content
                postedBody.append("<actual file content, not shown here>");
            } else {
View Full Code Here

TOP

Related Classes of org.apache.http.entity.FileEntity

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.