Packages

  • package root

    Provided herein is API documentation for Scamper, the HTTP library for Scala.

    Provided herein is API documentation for Scamper, the HTTP library for Scala.

    Definition Classes
    root
  • package scamper

    Defines core types.

    Defines core types.

    HTTP Messages

    At the core of Scamper is HttpMessage, which is a trait that defines the fundamental characteristics of an HTTP message. HttpRequest and HttpResponse extend the specification to define characteristics specific to their respective message types.

    An HttpRequest is created using a factory method defined in its companion object. Or you can start with a RequestMethod and use builder methods to further define the request.

    import scamper.Header
    import scamper.Implicits.stringToUri
    import scamper.RequestMethod.Registry.Get
    
    val request = Get("/motd").setHeaders(
      Header("Host: localhost:8080"),
      Header("Accept: text/plain")
    )
    
    printf("Request Method: %s%n", request.method)
    printf("Target URI: %s%n", request.target)
    
    request.headers.foreach(println)
    
    val host: Option[String] = request.getHeaderValue("Host")

    An HttpResponse is created using a factory method defined in its companion object. Or you can start with a ResponseStatus and use builder methods to further define the response.

    import scamper.{ BodyParser, Header }
    import scamper.Implicits.stringToEntity
    import scamper.ResponseStatus.Registry.Ok
    
    val response = Ok("There is an answer.").setHeaders(
      Header("Content-Type: text/plain"),
      Header("Connection: close")
    )
    
    printf("Status Code: %s%n", response.statusCode)
    printf("Reason Phrase: %s%n", response.reasonPhrase)
    
    response.headers.foreach(println)
    
    val contentType: Option[String] = response.getHeaderValue("Content-Type")
    
    implicit val parser = BodyParser.text()
    
    printf("Body: %s%n", response.as[String])
    Definition Classes
    root
  • package logging

    Provides logging facilities.

    Provides logging facilities.

    Definition Classes
    scamper
  • ConsoleLogger
  • LogWriter
  • Logger
  • NullLogger

trait Logger extends AnyRef

Defines logger interface.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Logger
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def debug(message: String, cause: Throwable): Unit

    Logs debug message and stack trace of given cause.

    Logs debug message and stack trace of given cause.

    message

    log message

    cause

    Throwable whose stack trace to log

  2. abstract def debug(format: String, args: Any*): Unit

    Logs formatted debug message.

    Logs formatted debug message.

    format

    message format

    args

    message arguments

  3. abstract def debug(message: String): Unit

    Logs debug message.

    Logs debug message.

    message

    log message

  4. abstract def error(message: String, cause: Throwable): Unit

    Logs error message and stack trace of given cause.

    Logs error message and stack trace of given cause.

    message

    log message

    cause

    Throwable whose stack trace to log

  5. abstract def error(format: String, args: Any*): Unit

    Logs formatted error message.

    Logs formatted error message.

    format

    message format

    args

    message arguments

  6. abstract def error(message: String): Unit

    Logs error message.

    Logs error message.

    message

    log message

  7. abstract def info(message: String, cause: Throwable): Unit

    Logs information message and stack trace of given cause.

    Logs information message and stack trace of given cause.

    message

    log message

    cause

    Throwable whose stack trace to log

  8. abstract def info(format: String, args: Any*): Unit

    Logs formatted information message.

    Logs formatted information message.

    format

    message format

    args

    message arguments

  9. abstract def info(message: String): Unit

    Logs information message.

    Logs information message.

    message

    log message

  10. abstract def trace(message: String, cause: Throwable): Unit

    Logs trace message and stack trace of given cause.

    Logs trace message and stack trace of given cause.

    message

    log message

    cause

    Throwable whose stack trace to log

  11. abstract def trace(format: String, args: Any*): Unit

    Logs formatted trace message.

    Logs formatted trace message.

    format

    message format

    args

    message arguments

  12. abstract def trace(message: String): Unit

    Logs trace message.

    Logs trace message.

    message

    log message

  13. abstract def warn(message: String, cause: Throwable): Unit

    Logs warning message and stack trace of given cause.

    Logs warning message and stack trace of given cause.

    message

    log message

    cause

    Throwable whose stack trace to log

  14. abstract def warn(format: String, args: Any*): Unit

    Logs formatted warning message.

    Logs formatted warning message.

    format

    message format

    args

    message arguments

  15. abstract def warn(message: String): Unit

    Logs warning message.

    Logs warning message.

    message

    log message

Concrete 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. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped