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").withHeaders(
      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.").withHeaders(
      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

class LogWriter extends Logger with Closeable

Provides logger to java.io.PrintWriter.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. LogWriter
  2. Closeable
  3. AutoCloseable
  4. Logger
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new LogWriter(writer: PrintWriter)

    Creates log writer.

    Creates log writer.

    writer

    writer to which logs are written

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(classOf[java.lang.CloneNotSupportedException]) @native()
  6. def close(): Unit

    Closes logger.

    Closes logger.

    Definition Classes
    LogWriter → Closeable → AutoCloseable
  7. 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

    Definition Classes
    LogWriterLogger
  8. def debug(format: String, args: Any*): Unit

    Logs formatted debug message.

    Logs formatted debug message.

    format

    message format

    args

    message arguments

    Definition Classes
    LogWriterLogger
  9. def debug(message: String): Unit

    Logs debug message.

    Logs debug message.

    message

    log message

    Definition Classes
    LogWriterLogger
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. 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

    Definition Classes
    LogWriterLogger
  13. def error(format: String, args: Any*): Unit

    Logs formatted error message.

    Logs formatted error message.

    format

    message format

    args

    message arguments

    Definition Classes
    LogWriterLogger
  14. def error(message: String): Unit

    Logs error message.

    Logs error message.

    message

    log message

    Definition Classes
    LogWriterLogger
  15. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  16. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  17. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. 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

    Definition Classes
    LogWriterLogger
  19. def info(format: String, args: Any*): Unit

    Logs formatted information message.

    Logs formatted information message.

    format

    message format

    args

    message arguments

    Definition Classes
    LogWriterLogger
  20. def info(message: String): Unit

    Logs information message.

    Logs information message.

    message

    log message

    Definition Classes
    LogWriterLogger
  21. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  22. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  25. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  26. def toString(): String
    Definition Classes
    AnyRef → Any
  27. 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

    Definition Classes
    LogWriterLogger
  28. def trace(format: String, args: Any*): Unit

    Logs formatted trace message.

    Logs formatted trace message.

    format

    message format

    args

    message arguments

    Definition Classes
    LogWriterLogger
  29. def trace(message: String): Unit

    Logs trace message.

    Logs trace message.

    message

    log message

    Definition Classes
    LogWriterLogger
  30. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  31. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  32. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  33. 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

    Definition Classes
    LogWriterLogger
  34. def warn(format: String, args: Any*): Unit

    Logs formatted warning message.

    Logs formatted warning message.

    format

    message format

    args

    message arguments

    Definition Classes
    LogWriterLogger
  35. def warn(message: String): Unit

    Logs warning message.

    Logs warning message.

    message

    log message

    Definition Classes
    LogWriterLogger

Inherited from Closeable

Inherited from AutoCloseable

Inherited from Logger

Inherited from AnyRef

Inherited from Any

Ungrouped