|
|
|
@ -53,11 +53,11 @@ import com.fr.third.org.apache.http.entity.StringEntity;
|
|
|
|
|
* <ul> |
|
|
|
|
* <li>{@link #setText(String)}</li> |
|
|
|
|
* <li>{@link #setBinary(byte[])}</li> |
|
|
|
|
* <li>{@link #setStream(java.io.InputStream)}</li> |
|
|
|
|
* <li>{@link #setSerializable(java.io.Serializable)}</li> |
|
|
|
|
* <li>{@link #setParameters(java.util.List)}</li> |
|
|
|
|
* <li>{@link #setParameters(NameValuePair...)}</li> |
|
|
|
|
* <li>{@link #setFile(java.io.File)}</li> |
|
|
|
|
* <li>{@link #setStream(InputStream)}</li> |
|
|
|
|
* <li>{@link #setSerializable(Serializable)}</li> |
|
|
|
|
* <li>{@link #setParameters(List)}</li> |
|
|
|
|
* <li>{@link #setParameters(org.apache.http.NameValuePair...)}</li> |
|
|
|
|
* <li>{@link #setFile(File)}</li> |
|
|
|
|
* </ul> |
|
|
|
|
* |
|
|
|
|
* @since 4.3 |
|
|
|
@ -100,13 +100,15 @@ public class EntityBuilder {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Sets entity content as a string. This method is mutually exclusive with |
|
|
|
|
* {@link #setBinary(byte[])}, |
|
|
|
|
* {@link #setStream(java.io.InputStream)} , |
|
|
|
|
* {@link #setSerializable(java.io.Serializable)} , |
|
|
|
|
* {@link #setParameters(java.util.List)}, |
|
|
|
|
* {@link #setParameters(NameValuePair...)} |
|
|
|
|
* {@link #setFile(java.io.File)} methods. |
|
|
|
|
* Sets entity content as a string. This method is mutually exclusive with: |
|
|
|
|
* <ul> |
|
|
|
|
* <li>{@link #setBinary(byte[])}</li> |
|
|
|
|
* <li>{@link #setStream(InputStream)}</li> |
|
|
|
|
* <li>{@link #setSerializable(Serializable)}</li> |
|
|
|
|
* <li>{@link #setParameters(List)}</li> |
|
|
|
|
* <li>{@link #setParameters(org.apache.http.NameValuePair...)}</li> |
|
|
|
|
* <li>{@link #setFile(File)}</li> |
|
|
|
|
* </ul> |
|
|
|
|
*/ |
|
|
|
|
public EntityBuilder setText(final String text) { |
|
|
|
|
clearContent(); |
|
|
|
@ -123,13 +125,16 @@ public class EntityBuilder {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Sets entity content as a byte array. This method is mutually exclusive with |
|
|
|
|
* {@link #setText(String)}, |
|
|
|
|
* {@link #setStream(java.io.InputStream)} , |
|
|
|
|
* {@link #setSerializable(java.io.Serializable)} , |
|
|
|
|
* {@link #setParameters(java.util.List)}, |
|
|
|
|
* {@link #setParameters(NameValuePair...)} |
|
|
|
|
* {@link #setFile(java.io.File)} methods. |
|
|
|
|
* Sets entity content as a byte array. This method is mutually exclusive |
|
|
|
|
* with: |
|
|
|
|
* <ul> |
|
|
|
|
* <li>{@link #setText(String)}</li> |
|
|
|
|
* <li>{@link #setStream(InputStream)}</li> |
|
|
|
|
* <li>{@link #setSerializable(Serializable)}</li> |
|
|
|
|
* <li>{@link #setParameters(List)}</li> |
|
|
|
|
* <li>{@link #setParameters(org.apache.http.NameValuePair...)}</li> |
|
|
|
|
* <li>{@link #setFile(File)}</li> |
|
|
|
|
* </ul> |
|
|
|
|
*/ |
|
|
|
|
public EntityBuilder setBinary(final byte[] binary) { |
|
|
|
|
clearContent(); |
|
|
|
@ -139,20 +144,23 @@ public class EntityBuilder {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns entity content as a {@link InputStream} if set using |
|
|
|
|
* {@link #setStream(java.io.InputStream)} method. |
|
|
|
|
* {@link #setStream(InputStream)} method. |
|
|
|
|
*/ |
|
|
|
|
public InputStream getStream() { |
|
|
|
|
return stream; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Sets entity content as a {@link InputStream}. This method is mutually exclusive with |
|
|
|
|
* {@link #setText(String)}, |
|
|
|
|
* {@link #setBinary(byte[])}, |
|
|
|
|
* {@link #setSerializable(java.io.Serializable)} , |
|
|
|
|
* {@link #setParameters(java.util.List)}, |
|
|
|
|
* {@link #setParameters(NameValuePair...)} |
|
|
|
|
* {@link #setFile(java.io.File)} methods. |
|
|
|
|
* Sets entity content as a {@link InputStream}. This method is mutually |
|
|
|
|
* exclusive with: |
|
|
|
|
* <ul> |
|
|
|
|
* <li>{@link #setText(String)}</li> |
|
|
|
|
* <li>{@link #setBinary(byte[])}</li> |
|
|
|
|
* <li>{@link #setSerializable(Serializable)}</li> |
|
|
|
|
* <li>{@link #setParameters(List)}</li> |
|
|
|
|
* <li>{@link #setParameters(org.apache.http.NameValuePair...)}</li> |
|
|
|
|
* <li>{@link #setFile(File)}</li> |
|
|
|
|
* </ul> |
|
|
|
|
*/ |
|
|
|
|
public EntityBuilder setStream(final InputStream stream) { |
|
|
|
|
clearContent(); |
|
|
|
@ -162,20 +170,23 @@ public class EntityBuilder {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns entity content as a parameter list if set using |
|
|
|
|
* {@link #setParameters(java.util.List)} or |
|
|
|
|
* {@link #setParameters(NameValuePair...)} methods. |
|
|
|
|
* {@link #setParameters(List)} or |
|
|
|
|
* {@link #setParameters(org.apache.http.NameValuePair...)} methods. |
|
|
|
|
*/ |
|
|
|
|
public List<NameValuePair> getParameters() { |
|
|
|
|
return parameters; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Sets entity content as a parameter list. This method is mutually exclusive with |
|
|
|
|
* {@link #setText(String)}, |
|
|
|
|
* {@link #setBinary(byte[])}, |
|
|
|
|
* {@link #setStream(java.io.InputStream)} , |
|
|
|
|
* {@link #setSerializable(java.io.Serializable)} , |
|
|
|
|
* {@link #setFile(java.io.File)} methods. |
|
|
|
|
* Sets entity content as a parameter list. This method is mutually |
|
|
|
|
* exclusive with: |
|
|
|
|
* <ul> |
|
|
|
|
* <li>{@link #setText(String)}</li> |
|
|
|
|
* <li>{@link #setBinary(byte[])}</li> |
|
|
|
|
* <li>{@link #setStream(InputStream)}</li> |
|
|
|
|
* <li>{@link #setSerializable(Serializable)}</li> |
|
|
|
|
* <li>{@link #setFile(File)}</li> |
|
|
|
|
* </ul> |
|
|
|
|
*/ |
|
|
|
|
public EntityBuilder setParameters(final List<NameValuePair> parameters) { |
|
|
|
|
clearContent(); |
|
|
|
@ -184,12 +195,14 @@ public class EntityBuilder {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Sets entity content as a parameter list. This method is mutually exclusive with |
|
|
|
|
* {@link #setText(String)}, |
|
|
|
|
* {@link #setBinary(byte[])}, |
|
|
|
|
* {@link #setStream(java.io.InputStream)} , |
|
|
|
|
* {@link #setSerializable(java.io.Serializable)} , |
|
|
|
|
* {@link #setFile(java.io.File)} methods. |
|
|
|
|
* Sets entity content as a parameter list. This method is mutually exclusive with: |
|
|
|
|
* <ul> |
|
|
|
|
* <li>{@link #setText(String)}</li> |
|
|
|
|
* <li>{@link #setBinary(byte[])}</li> |
|
|
|
|
* <li>{@link #setStream(InputStream)}</li> |
|
|
|
|
* <li>{@link #setSerializable(Serializable)}</li> |
|
|
|
|
* <li>{@link #setFile(File)}</li> |
|
|
|
|
* </ul> |
|
|
|
|
*/ |
|
|
|
|
public EntityBuilder setParameters(final NameValuePair... parameters) { |
|
|
|
|
return setParameters(Arrays.asList(parameters)); |
|
|
|
@ -197,20 +210,22 @@ public class EntityBuilder {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns entity content as a {@link Serializable} if set using |
|
|
|
|
* {@link #setSerializable(java.io.Serializable)} method. |
|
|
|
|
* {@link #setSerializable(Serializable)} method. |
|
|
|
|
*/ |
|
|
|
|
public Serializable getSerializable() { |
|
|
|
|
return serializable; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Sets entity content as a {@link Serializable}. This method is mutually exclusive with |
|
|
|
|
* {@link #setText(String)}, |
|
|
|
|
* {@link #setBinary(byte[])}, |
|
|
|
|
* {@link #setStream(java.io.InputStream)} , |
|
|
|
|
* {@link #setParameters(java.util.List)}, |
|
|
|
|
* {@link #setParameters(NameValuePair...)} |
|
|
|
|
* {@link #setFile(java.io.File)} methods. |
|
|
|
|
* Sets entity content as a {@link Serializable}. This method is mutually exclusive with: |
|
|
|
|
* <ul> |
|
|
|
|
* <li>{@link #setText(String)}</li> |
|
|
|
|
* <li>{@link #setBinary(byte[])}</li> |
|
|
|
|
* <li>{@link #setStream(InputStream)}</li> |
|
|
|
|
* <li>{@link #setParameters(List)}</li> |
|
|
|
|
* <li>{@link #setParameters(org.apache.http.NameValuePair...)}</li> |
|
|
|
|
* <li>{@link #setFile(File)}</li> |
|
|
|
|
* </ul> |
|
|
|
|
*/ |
|
|
|
|
public EntityBuilder setSerializable(final Serializable serializable) { |
|
|
|
|
clearContent(); |
|
|
|
@ -220,20 +235,22 @@ public class EntityBuilder {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns entity content as a {@link File} if set using |
|
|
|
|
* {@link #setFile(java.io.File)} method. |
|
|
|
|
* {@link #setFile(File)} method. |
|
|
|
|
*/ |
|
|
|
|
public File getFile() { |
|
|
|
|
return file; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Sets entity content as a {@link File}. This method is mutually exclusive with |
|
|
|
|
* {@link #setText(String)}, |
|
|
|
|
* {@link #setBinary(byte[])}, |
|
|
|
|
* {@link #setStream(java.io.InputStream)} , |
|
|
|
|
* {@link #setParameters(java.util.List)}, |
|
|
|
|
* {@link #setParameters(NameValuePair...)} |
|
|
|
|
* {@link #setSerializable(java.io.Serializable)} methods. |
|
|
|
|
* Sets entity content as a {@link File}. This method is mutually exclusive with: |
|
|
|
|
* <ul> |
|
|
|
|
* <li>{@link #setText(String)}</li> |
|
|
|
|
* <li>{@link #setBinary(byte[])}</li> |
|
|
|
|
* <li>{@link #setStream(InputStream)}</li> |
|
|
|
|
* <li>{@link #setParameters(List)}</li> |
|
|
|
|
* <li>{@link #setParameters(org.apache.http.NameValuePair...)}</li> |
|
|
|
|
* <li>{@link #setSerializable(Serializable)}</li> |
|
|
|
|
* </ul> |
|
|
|
|
*/ |
|
|
|
|
public EntityBuilder setFile(final File file) { |
|
|
|
|
clearContent(); |
|
|
|
|