com.paypal.cascade.http.util

HttpUtil

object HttpUtil

Convenience methods for interacting with URLs and other parts of an HTTP request.

Methods found within spray.http objects should be preferred over these, wherever Spray objects are already in use. For example, if working with a spray.http.Uri, prefer to access its query string pairs using [spray.http.Uri.Query$.toMap] instead of using parseQueryStringToMap found here

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. HttpUtil
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. val CONTENT_LANGUAGE: String

  5. val CONTENT_LANGUAGE_LC: String

  6. val UTF_8: String

    Convenience value for utf-8

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  11. def errorResponse(e: Exception): HttpResponse

    Convenience method to return an exception as a 500 Internal Error with the body being the message of the exception

  12. val errorResponseType: ContentType

  13. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  17. def jsonOKResponse[T](t: T)(implicit arg0: Manifest[T]): HttpResponse

    Utility method to return HttpResponse with status OK and a serialized json body via Jackson.

    Utility method to return HttpResponse with status OK and a serialized json body via Jackson. If the JSON processing is CPU intensive, it should be done in a background thread, dedicated actor, etc... into an http body with the content type set

    T

    the type to serialize from

    t

    the object to serialize

    returns

    an HttpResponse containing an OK StatusCode and the serialized object

  18. def mergeParameters(m1: Map[String, List[String]], m2: Map[String, List[String]]): Map[String, List[String]]

    Merge two parameter maps into one

    Merge two parameter maps into one

    m1

    the first map

    m2

    the second map

    returns

    a merged map containing members from both maps

  19. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  20. final def notify(): Unit

    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  22. def parseQueryStringToMap(queryString: String): Map[String, List[String]]

    Parse a query string into a Map of key-value String pairs.

    Parse a query string into a Map of key-value String pairs. Ignores invalid key-value pairs in the query string

    queryString

    the query string to parse, without the leading '?'

    returns

    key/value pairs mapping to the items in the query string

  23. def parseQueryStringToPairs(queryString: String): List[StrPair]

    Parse a query string into a List of key-value String pairs

    Parse a query string into a List of key-value String pairs

    queryString

    the query string to parse (without the '?')

    returns

    a list of (String, String), representing each key-value pair in the query string

  24. def parseType[T](r: HttpRequest, data: Array[Byte])(implicit arg0: Manifest[T]): Try[T]

  25. def parseType[T](r: HttpRequest, data: String)(implicit arg0: Manifest[T]): Try[T]

    Attempt to parse the incoming request.

    Attempt to parse the incoming request.

    r

    the full request

    data

    the piece of data that should be converted to the suggested type

    returns

    the parsed request, or a Failure response

  26. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  27. def toJsonBody[T](t: T)(implicit arg0: Manifest[T]): HttpEntity

    Utility method to serialize a json body via jackson.

    Utility method to serialize a json body via jackson. If the JSON processing is CPU intensive, it should be done in a background thread, dedicated actor, etc... into an http body with the content type set Enforces the return of application/json as a content type, since this always serializes to json

    T

    the type to serialize from

    t

    the object to serialize

    returns

    an HttpResponse containing either the desired HttpEntity, or an error entity

  28. def toJsonErrors[T](body: T)(implicit arg0: Manifest[T]): HttpEntity

    Used to convert error objects into JSON format.

    Used to convert error objects into JSON format.

    T

    type of object

    body

    object to convert

    returns

    JSONified body

  29. def toJsonErrorsMap(body: String): HttpEntity

    Used under the covers to force simple error strings into a JSON format

    Used under the covers to force simple error strings into a JSON format

    body

    the body

    returns

    an HttpEntity containing an error JSON body

  30. def toString(): String

    Definition Classes
    AnyRef → Any
  31. def unauthorizedChallenge(req: HttpRequest): List[HttpChallenge]

    The message to be sent back with the WWW-Authenticate header when the request is unauthorized.

    The message to be sent back with the WWW-Authenticate header when the request is unauthorized. This particular form works around a known Android quirk.

    See discussion at http://stackoverflow.com/questions/6114455/

    returns

    the message

  32. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped