All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.spincast.plugins.httpclient.builders.IEntitySenderRequestBuilderBase Maven / Gradle / Ivy

The newest version!
package org.spincast.plugins.httpclient.builders;

import java.util.List;
import java.util.Map;

import org.spincast.plugins.httpclient.IHttpRequestBuilder;
import org.spincast.shaded.org.apache.http.HttpEntity;

/**
 * Builders that can send an entity, or upload files.
 */
public interface IEntitySenderRequestBuilderBase>
                                                extends IHttpRequestBuilder {

    /**
     * Sets the Form datas entity.
     * A form data can contain more than one value.
     * 
     * Overwrites any existing Form datas.
     * 
     * Only one type of entity can be set amongs:
     * - Form datas entity
     * - String entity
     * - File upload
     * - Custom HttpEntity
     * 
     * When you set or add an entity of a new type, the
     * existing entity is overwritten.
     * 
     */
    public T setEntityFormDatas(Map> params);

    /**
     * Sets a Form data entity.
     * A form data can contain more than one value.
     * 
     * Overwrites the existing Form data of the same
     * name, but keeps the other ones.
     * 
     * Only one type of entity can be set amongs:
     * - Form datas entity
     * - String entity
     * - File upload
     * - Custom HttpEntity
     * 
     * When you set or add an entity of a new type, the
     * existing entity is overwritten.
     * 
     */
    public T setEntityFormData(String name, List values);

    /**
     * Adds a value to a Form data.
     * 
     * Keeps the existing values.
     * 
     * Only one type of entity can be set amongs:
     * - Form datas entity
     * - String entity
     * - File upload
     * - Custom HttpEntity
     * 
     * When you set or add an entity of a new type, the
     * existing entity is overwritten.
     * 
     */
    public T addEntityFormDataValue(String name, String value);

    /**
     * Sets a String entity.
     * 
     * Only one type of entity can be set amongs:
     * - Form datas entity
     * - String entity
     * - File upload
     * - Custom HttpEntity
     * 
     * When you set or add an entity of a new type, the
     * existing entity is overwritten.
     */
    public T setEntityString(String entity, String contentType);

    /**
     * Sets an custom HttpEntity entity to be sent.
     * 
     * Only one type of entity can be set amongs:
     * - Form datas entity
     * - String entity
     * - File upload
     * - custom HttpEntity
     * 
     * When you set or add an entity of a new type, the
     * existing entity is overwritten.
     */
    public T setEntity(HttpEntity entity);

    /**
     * Sets a Json entity to be sent.
     * The object will be converted to a Json's
     * String representation and sent using the application/json
     * Content-Type.
     * 
     * Only one type of entity can be set amongs:
     * - Form datas entity
     * - String entity
     * - File upload
     * - Custom HttpEntity
     * 
     * When you set or add an entity of a new type, the
     * existing entity is overwritten.
     */
    public T setEntityJson(Object object);

    /**
     * Sets a XML entity to be sent.
     * The object will be converted to a XML
     * and sent using the application/xml
     * Content-Type.
     * 
     * Only one type of entity can be set amongs:
     * - Form datas entity
     * - String entity
     * - File upload
     * - Custom HttpEntity
     * 
     * When you set or add an entity of a new type, the
     * existing entity is overwritten.
     */
    public T setEntityXml(Object object);

    /**
     * Adds a file to upload. More than one file
     * can be uploaded at one time. The specified file
     * is added to the existing ones.
     * 
     * Only one type of entity can be set amongs:
     * - Form datas entity
     * - String entity
     * - File upload
     * - Custom HttpEntity
     * 
     * @param path the path to the file to upload,
     * on the file system
     * 
     * @param name the name to use for the uploaded file.
     */
    public T addEntityFileUpload(String path, String name);

    /**
     * Adds a file to upload. More than one file
     * can be uploaded at one time. The specified file
     * is added to the existing ones.
     * 
     * 
     * Only one type of entity can be set amongs:
     * - Form datas entity
     * - String entity
     * - File upload
     * - Custom HttpEntity
     * 
     * @param path the path to the file to upload
     * 
     * @param isClasspathPath if true, the path to the file to upload is
     * on the classpath, otherwise, it's on the file system.
     * 
     * @param name the name to use for the uploaded file.
     * 
     */
    public T addEntityFileUpload(String path, boolean isClasspathPath, String name);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy