|
uncarved-helpers
|
|
class
BasicClient
extends RichClient with CanLog
import com.uncarved.helpers.http._
val helper = new BasicClient()
//Get a webpage as a string (if you look at the apache http log4j messages you can see it
//does conditional get and has transparent gzip support)
val str = helper.get("http://www.theflautadors.org/")
//Get some XML (with request parameters supplied)
val params = List(("tag"->""), ("limit"->"5"))
val xml = helper.getXML(Request(RequestType.GET, "http://www.uncarved.com/index.py/rss1.1.xml", params))
val items = xml \\ "item"
| Value Summary | |
protected val
|
client
: ConfiguredHttpClient
derived classes must define how they create and configure the client
|
| Values and Variables inherited from CanLog | |
| loggerName, logger |
| Values and Variables inherited from Client | |
| userAgent, connectionTimeout, soTimeout, cache |
| Method Summary | |
def
|
fetch
[T](req : Request)(thunk : (Response) => T) : T
Execute a request and run some code with the results.
|
def
|
fetchOk
[T](req : Request)(thunk : (Response) => T) : T
Execute a request and run some code with the results if the response
code is "OK" (200 to 204).
|
| Methods inherited from RichClient | |
| fetchOk, getString, getString, get, get, post, getContent, getContent, getContent, getSource, getSource, getSource, getXML, getXML, getXML, getXML |
| Methods inherited from Client | |
| entityString, shutdown |
| Methods inherited from AnyRef | |
| getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
| Methods inherited from Any | |
| ==, !=, isInstanceOf, asInstanceOf |
| Class Summary | |
class
|
ConfiguredHttpClient
extends org.apache.http.impl.client.DefaultHttpClient with CanLog
This class exends the HttpClient defaults by setting various parameters
to more useful settings.
|
class
|
RequestInterceptor
extends org.apache.http.HttpRequestInterceptor with CanLog
This class is used to intercept outgoing Http requests and modify
them. This enables us to do conditional get and transparent gzip
encoding so we are slightly more polite web citizens.
|
class
|
ResponseInterceptor
extends org.apache.http.HttpResponseInterceptor with CanLog
This class is used to intercept incoming Http responses and modify
them. This enables us to do conditional get and transparent gzip
encoding so we are slightly more polite web citizens.
|
| Value Details |
protected
val
client : ConfiguredHttpClient
| Method Details |
req - The http request (in the form of a Request)thunk - A code snippet that takes a response code, the response and an entity option that will be None if the response didn't result
in an entityreq - The http request (in the form of a Request)thunk - A code snippet that takes a response code, the response and an entity option that will be None if the response didn't result
in an entity|
uncarved-helpers
|
|