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 class
HTTPFormBuilder.Field
protected static class
HTTPFormBuilder.Sort
-
Field Summary
Fields Modifier and Type Field Description protected Charset
charset
static Charset
DFALTCHARSET
protected Map<String,HTTPFormBuilder.Field>
parts
protected boolean
usemultipart
-
Constructor Summary
Constructors Constructor Description HTTPFormBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HTTPFormBuilder
add(String fieldname, byte[] content, String filename)
HTTPFormBuilder
add(String fieldname, File content)
HTTPFormBuilder
add(String fieldname, InputStream content, String filename)
HTTPFormBuilder
add(String fieldname, String text)
org.apache.http.HttpEntity
build()
protected org.apache.http.HttpEntity
buildmultipart()
protected org.apache.http.HttpEntity
buildsimple()
String
getCharset()
protected boolean
isempty(String x)
HTTPFormBuilder
setCharset(String charset)
HTTPFormBuilder
setCharset(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)
-
-