|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wisc.ssec.mcidasv.util.BackgroundTask<String>
edu.wisc.ssec.mcidasv.supportform.Submitter
public class Submitter
Abstraction of a background thread that is used to submit support requests to the McIDAS-V Help Desk Team.
Field Summary | |
---|---|
private SupportForm |
form
Used to gather user input and system information. |
private static org.slf4j.Logger |
logger
Logging object. |
private org.apache.commons.httpclient.methods.PostMethod |
method
Handy reference to the status code (and more) of our POST . |
private static int |
POST_ATTEMPTS
We'll follow up to this many redirects for requestUrl . |
static String |
POST_ERROR
Error message to display if the server had problems. |
private String |
requestUrl
URL that we'll attempt to POST our requests at. |
private int |
tryCount
Number of redirects we've tried since starting. |
private String |
validFormUrl
Keeps track of the most recent redirect for requestUrl . |
Constructor Summary | |
---|---|
Submitter(SupportForm form)
Prepare a support request to be sent (off of the event dispatch thread). |
Method Summary | |
---|---|
private static org.apache.commons.httpclient.methods.multipart.FilePart |
buildFakeFilePart(String id,
String file,
byte[] data)
Creates a file attachment that isn't based upon an actual file. |
private static org.apache.commons.httpclient.methods.PostMethod |
buildPostMethod(String url,
SupportForm form)
Attempts to POST to url using the information from
form . |
private static org.apache.commons.httpclient.methods.multipart.FilePart |
buildRealFilePart(String id,
String file)
Creates a file attachment that's based upon a real file. |
protected String |
compute()
Attempt to POST contents of support request form to requestUrl . |
protected void |
onCompletion(String result,
Throwable exception,
boolean cancelled)
Handles completion of a support request. |
Methods inherited from class edu.wisc.ssec.mcidasv.util.BackgroundTask |
---|
cancel, get, get, isCancelled, isDone, onProgress, run, setProgress |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String POST_ERROR
private static final org.slf4j.Logger logger
private static final int POST_ATTEMPTS
requestUrl
.
private final SupportForm form
private final String requestUrl
POST
our requests at.
private String validFormUrl
requestUrl
.
private int tryCount
private org.apache.commons.httpclient.methods.PostMethod method
POST
.
Constructor Detail |
---|
public Submitter(SupportForm form)
form
- Support request form to send. Cannot be null
.Method Detail |
---|
private static org.apache.commons.httpclient.methods.multipart.FilePart buildRealFilePart(String id, String file)
id
- The parameter ID. Usually something like
"form_data[att_two]".file
- Path to the file that's going to be attached.
POST
-able file attachment using the name and contents of
file
.private static org.apache.commons.httpclient.methods.multipart.FilePart buildFakeFilePart(String id, String file, byte[] data)
id
- Parameter ID. Typically something like
"form_data[att_extra]".file
- Fake name of the file. Can be whatever you like.data
- The actual data to place inside the attachment.
POST
-able file attachment using a spoofed filename!private static org.apache.commons.httpclient.methods.PostMethod buildPostMethod(String url, SupportForm form)
POST
to url
using the information from
form
.
url
- URL that'll accept the POST
. Typically
requestUrl
.form
- The SupportForm
that contains the data to use in the
support request.
protected String compute()
requestUrl
.
compute
in class BackgroundTask<String>
WrapperException
- if there was a problem on the server.protected void onCompletion(String result, Throwable exception, boolean cancelled)
onCompletion
in class BackgroundTask<String>
result
- Result of compute()
.exception
- Exception thrown from compute()
, if any.cancelled
- Whether or not the user opted to cancel.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |