|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjimm.twice.util.HttpTalker
Handles request and request/receive communications with an HTTP server. This class exists so we can replace instances during testing.
| Field Summary | |
protected static java.lang.String |
DEFAULT_LOGGER_PREFIX
|
protected static HttpTalker |
instance
|
protected java.lang.String |
loggerPrefix
|
protected static int |
TEMP_FILE_BUFSIZ
|
protected static java.lang.String |
TEMP_FILE_PREFIX
|
protected static java.lang.String |
TEMP_FILE_SUFFIX
|
| Constructor Summary | |
HttpTalker()
|
|
| Method Summary | |
static HttpTalker |
getInstance()
Returns an instance of instanceClassNameK, which is HttpTalker by default. |
java.io.File |
getURL(java.net.URL url)
Retrieves the contents of a URL, stores it in a temp file, and returns the file. |
protected java.io.File |
readIntoTempFile(java.io.InputStream source)
|
java.io.File |
sendPayload(SoapEnvelope payload,
java.net.URL url)
Sends a payload, saves the XML response to a temp file, and returns the temp file. |
static void |
setInstance(HttpTalker talker)
Sets class name for getInstance() to return. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final java.lang.String TEMP_FILE_PREFIX
protected static final java.lang.String TEMP_FILE_SUFFIX
protected static final java.lang.String DEFAULT_LOGGER_PREFIX
protected static final int TEMP_FILE_BUFSIZ
protected static HttpTalker instance
protected java.lang.String loggerPrefix
| Constructor Detail |
public HttpTalker()
| Method Detail |
public static HttpTalker getInstance()
public static void setInstance(HttpTalker talker)
getInstance() to return.
public java.io.File sendPayload(SoapEnvelope payload,
java.net.URL url)
throws java.io.IOException
Tech note: the order of the HTTP I/O fault (get output, write output,
get input, read input) is used by the HttpURLConnection class
to decide that a POST is appropriate instead of a GET.
If an IOException exception is caught, it is logged and
rethrown.
payload - the payload we want to send
java.io.IOException
public java.io.File getURL(java.net.URL url)
throws java.io.IOException
The file returned is a temp file, marked for deletion upon exit. It is still a good idea to delete the file when you are done with it.
If an IOException exception is caught, it is logged and
rethrown.
url - the URL to GET
java.io.IOException
protected java.io.File readIntoTempFile(java.io.InputStream source)
throws java.io.IOException
java.io.IOException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||