Scaladoc: uncarved-helpers

This document is the API specification for uncarved-helpers

Class Summary
class BasicClient extends RichClient with CanLog
Class that allows simple and scalable http requests. It wraps up all of the complexity of HttpClient 4 and HttpCore 4 so you get cookies, redirection, transparent gzip support, and condition get Last Modified and ETag support. Sample usage:
     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"					  
 
abstract class Client extends AnyRef
Interfacte for Http clients. If this interface is implemented, we can enrich it with various convenience functions
class GZIPDecompressingEntity (entity : org.apache.http.HttpEntity) extends org.apache.http.entity.HttpEntityWrapper with AnyRef
Simple wrapper entity type that takes a gzipped entity and unzips it. Translated to scala from the Apache HttpClient 4 example code.
case class Request (val reqType : scala.Enumeration.Value, val url : java.lang.String, val params : scala.Seq[(java.lang.String, java.lang.String)]) extends scala.Product
Helper class that standardizes how we get request information. This enables us to simplify the calling interfaces for our requester methods and also our request and response interceptors and cacheing.
case class Response (val statusCode : Int, val response : org.apache.http.HttpResponse, val entity : scala.Option[org.apache.http.HttpEntity]) extends scala.Product
Encapsulates an HTTP response.
class ResponseCache extends scala.collection.mutable.HashMap[Request, ResponseCacheInfo]
The type of our http response cache, used to implement conditional get
case class ResponseCacheInfo extends scala.Product
Container for the header and content information that is cached to allow conditional get to work
trait RichClient extends Client
Trait which uses the interface above to provide a rich and convenient http client interface.
case class StatusCode (val code : Int, val reason : java.lang.String, val contents : java.lang.String) extends java.lang.Exception with scala.Product
Exception class thrown when we receive a status code we don't expect.
Object Summary
object Request extends (scala.Enumeration.Value, java.lang.String, scala.Seq[(java.lang.String, java.lang.String)]) => Request
object RequestType extends scala.Enumeration
Enumeration of possible HTTP request types.
object Response extends (Int, org.apache.http.HttpResponse, scala.Option[org.apache.http.HttpEntity]) => Response
object ResponseCacheInfo extends () => ResponseCacheInfo
object StatusCode extends (Int, java.lang.String, java.lang.String) => StatusCode