Package ucar.httpservices
Class HTTPFormBuilder
- java.lang.Object
-
- ucar.httpservices.HTTPFormBuilder
-
public class HTTPFormBuilder extends Object
Class HTTPFormBuilder provides a mechanism for constructing a postable entity for use with Post. This code is derived from IDV HttpFormEntry. The basic idea is that a list of HTTPFormBuilder.Field instances is created to represent the fields and attachments of the form. Then, a post method instance is provided and the content of the post is set from the HTTPForm instance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classHTTPFormBuilder.Fieldprotected static classHTTPFormBuilder.Sort
-
Field Summary
Fields Modifier and Type Field Description protected Charsetcharsetstatic CharsetDFALTCHARSETprotected Map<String,HTTPFormBuilder.Field>partsprotected booleanusemultipart
-
Constructor Summary
Constructors Constructor Description HTTPFormBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HTTPFormBuilderadd(String fieldname, byte[] content, String filename)HTTPFormBuilderadd(String fieldname, File content)HTTPFormBuilderadd(String fieldname, InputStream content, String filename)HTTPFormBuilderadd(String fieldname, String text)org.apache.http.HttpEntitybuild()protected org.apache.http.HttpEntitybuildmultipart()protected org.apache.http.HttpEntitybuildsimple()StringgetCharset()protected booleanisempty(String x)HTTPFormBuildersetCharset(String charset)HTTPFormBuildersetCharset(Charset charset)
-
-
-
Field Detail
-
DFALTCHARSET
public static final Charset DFALTCHARSET
-
parts
protected Map<String,HTTPFormBuilder.Field> parts
-
charset
protected Charset charset
-
usemultipart
protected boolean usemultipart
-
-
Method Detail
-
getCharset
public String getCharset()
-
setCharset
public HTTPFormBuilder setCharset(String charset)
-
setCharset
public HTTPFormBuilder setCharset(Charset charset)
-
add
public HTTPFormBuilder add(String fieldname, String text) throws HTTPException
- Throws:
HTTPException
-
add
public HTTPFormBuilder add(String fieldname, byte[] content, String filename) throws HTTPException
- Throws:
HTTPException
-
add
public HTTPFormBuilder add(String fieldname, InputStream content, String filename) throws HTTPException
- Throws:
HTTPException
-
add
public HTTPFormBuilder add(String fieldname, File content) throws HTTPException
- Throws:
HTTPException
-
build
public org.apache.http.HttpEntity build() throws HTTPException- Throws:
HTTPException
-
buildsimple
protected org.apache.http.HttpEntity buildsimple() throws HTTPException- Throws:
HTTPException
-
buildmultipart
protected org.apache.http.HttpEntity buildmultipart() throws HTTPException- Throws:
HTTPException
-
isempty
protected boolean isempty(String x)
-
-