|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jscape.inet.mime.MimeMessage
com.jscape.inet.http.HttpRequest
com.jscape.inet.http.HttpFileUpload
public class HttpFileUpload
Implements methods for emulating a web browser and performing HTTP file upload based on specifications defined in RFC 1867.
Example Usage:
Http http = new Http(); HttpFileUpload request = new HttpFileUpload("http://www.myserver.com/cgi-bin/upload.cgi"); request.addParameter("name", "John Doe"); request.setFile("picture", "joe.gif", new File("/home/joe/joe.gif"); HttpResponse response = http.getResponse(request);
Field Summary | |
---|---|
static java.lang.String |
PLACEHOLDER
Place holder string for file data. |
Fields inherited from interface com.jscape.inet.mime.MimeConstants |
---|
COLON, CRLF, EQUALS, QUESTION_MARK, SEMI_COLON, SPACE, TAB |
Constructor Summary | |
---|---|
HttpFileUpload(java.lang.String url)
Constructs a new HttpFileUpload instance. |
Method Summary | |
---|---|
void |
addParameter(HttpParameter parameter)
Adds a query parameter to HttpFileUpload . |
void |
addParameter(java.lang.String name,
java.lang.String value)
Adds a query parameter to HttpFileUpload . |
boolean |
IsStreamingEnabled()
Streaming. |
void |
setFile(java.lang.String fieldName,
java.lang.String filename,
byte[] data)
Sets the file to upload for this HttpFileUpload . |
void |
setFile(java.lang.String fieldName,
java.lang.String fileName,
java.io.File file)
Sets the file to upload for this HttpFileUpload . |
void |
streamFileToServer(java.lang.String fieldName,
java.lang.String fileName,
java.io.File file)
Stream file to HTTP server instead of reading entire File object in RAM. |
Methods inherited from class com.jscape.inet.http.HttpRequest |
---|
addCookie, addHeader, addHeader, addReplaceHeader, addReplaceHeader, addReplaceParameter, addReplaceParameter, clearCookies, clearParameters, getHttpVersion, getMessage, getMethod, getParameters, getProxyHost, getProxyPort, getProxyUsername, getURL, getUserAgent, isUTF8, setBasicAuthentication, setHttpVersion, setMethod, setProxyHost, setProxyLogin, setProxyPort, setURL, setUserAgent, setUTF8 |
Methods inherited from class com.jscape.inet.mime.MimeMessage |
---|
addPart, getBody, getBodyAsFile, getBodyData, getBoundary, getContentTransferEncoding, getContentType, getHeader, getHeaders, getHeaders, getHeaderValue, getPart, getParts, getRawBodyData, removeHeader, removePart, removeParts, setBody, setBody, setBody, setBody, setBodyAsFile, setContentType |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PLACEHOLDER
Constructor Detail |
---|
public HttpFileUpload(java.lang.String url) throws HttpException
HttpFileUpload
instance.
url
- the URL to post the file upload to
HttpException
- if a MIME related parsing error occursMethod Detail |
---|
public void addParameter(java.lang.String name, java.lang.String value)
HttpFileUpload
. HTTP query
parameters are typically used in submitting form data for processing by
a CGI or servlet resident on the HTTP server. Names of query parameters
need not be unique.
addParameter
in class HttpRequest
name
- the name of the parameter to add.value
- the value of the parameter to add.public void addParameter(HttpParameter parameter)
HttpFileUpload
. HTTP query
parameters are typically used in submitting form data for processing by
a CGI or servlet resident on the HTTP server. Names of query parameters
need not be unique.
addParameter
in class HttpRequest
parameter
- the HttpParameter
to addHttpParameter
public boolean IsStreamingEnabled()
public void streamFileToServer(java.lang.String fieldName, java.lang.String fileName, java.io.File file) throws HttpException
fieldName
- fileName
- file
-
HttpException
public void setFile(java.lang.String fieldName, java.lang.String fileName, java.io.File file) throws HttpException
HttpFileUpload
.
fieldName
- the name of the field, as specified in HTML INPUT
TYPE=FILE tagfileName
- the value to set the MIME filename attribute tofile
- the File object of the file to be added
HttpException
- if file is not foundpublic void setFile(java.lang.String fieldName, java.lang.String filename, byte[] data) throws HttpException
HttpFileUpload
.
fieldName
- the name of the field, as specified in HTML INPUT TYPE=FILE tagfilename
- the value to set the MIME filename attribute todata
- the data representing the file to upload
HttpException
- if file is not found
|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |