public class DefaultHttpService extends AbstractContexed implements AppContextService<HttpService>, HttpService
HttpService
This uses the most basic functionality provided in the base java classes and requires no new dependencies.
More advanced implementations using dedicated client libraries can be substituted if these are not sufficientconn| Constructor and Description |
|---|
DefaultHttpService(AppContext conn) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanup()
AppContext is being closed. |
protected java.net.HttpURLConnection |
connect(java.net.URL url)
extension point to allow mock insertion
|
MimeStreamData |
fetch(java.net.URL url,
java.util.Map<java.lang.String,java.lang.String> props)
fetch data from a URL
|
MimeStreamData |
post(java.net.URL url,
java.util.Map<java.lang.String,java.lang.String> props,
MimeStreamData input)
post data to a URL
This is intended to post a single object rather than encoded form data.
|
getContext, getLogger, resetLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddBasicAuth, getTypepublic DefaultHttpService(AppContext conn)
public void cleanup()
AppContextCleanupAppContext is being closed.
Only use this for cleanup that can't be handled by
normal garbage collection or for state which is never returned by reference.cleanup in interface AppContextCleanuppublic MimeStreamData fetch(java.net.URL url, java.util.Map<java.lang.String,java.lang.String> props) throws HttpException
HttpServicefetch in interface HttpServiceurl - URL to fetch fromprops - additional request headers to setMimeStreamDataHttpExceptionprotected java.net.HttpURLConnection connect(java.net.URL url)
throws java.io.IOException
url - java.io.IOExceptionpublic MimeStreamData post(java.net.URL url, java.util.Map<java.lang.String,java.lang.String> props, MimeStreamData input) throws HttpException
HttpServicepost in interface HttpServiceurl - URL to post toprops - additional request headers to setinput - MimeStreamData to postMimeStreamDataHttpException