scamper.http
Type members
Classlikes
Provides access to decoded message body.
Provides access to decoded message body.
- Companion
- object
Provides factory for BodyDecoder
.
Provides factory for BodyDecoder
.
- Companion
- class
Provides utility for parsing message body.
Provides utility for parsing message body.
- Companion
- object
Provides input stream to HTTP entity.
Provides input stream to HTTP entity.
- Companion
- object
Indicates entity larger than established maximum length.
Indicates entity larger than established maximum length.
EntityTooLarge
is a complement to ReadLimitExceeded
. Whereas
ReadLimitExceeded
applies to raw bytes of an input stream, EntityTooLarge
applies to a constructed entity, which is potentially subject to
decompression.
- See also
Indicates exception in HTTP processing.
Indicates exception in HTTP processing.
- Value Params
- cause
underlying cause
- message
detail message
- Constructor
Constructs HttpException with supplied detail message and cause.
Defines HTTP message.
Defines HTTP message.
HttpMessage
defines fundamental characteristics of an HTTP message.
HttpRequest and HttpResponse extend the specification to define
characteristics specific to their respective message types.
Defines HTTP request.
Defines HTTP request.
A request is created using one of its factory methods, or you can start with a RequestMethod and build from there.
import scala.language.implicitConversions
import scamper.http.{ BodyParser, Header, stringToUri }
import scamper.http.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")
given BodyParser[String] = BodyParser.string()
printf("Body: %s%n", request.as[String])
- See also
- Companion
- object
Provides factory for HttpRequest
.
Provides factory for HttpRequest
.
- Companion
- class
Defines HTTP response.
Defines HTTP response.
A response is created using one of its factory methods, or you can start with a ResponseStatus and build from there.
import scala.language.implicitConversions
import scamper.http.{ BodyParser, Header, stringToEntity }
import scamper.http.ResponseStatus.Registry.Ok
val response = Ok("There is an answer.").setHeaders(
Header("Content-Type: text/plain"),
Header("Connection: close")
)
printf("Status Code: %d%n", response.statusCode)
printf("Reason Phrase: %s%n", response.reasonPhrase)
response.headers.foreach(println)
val contentType: Option[String] = response.getHeaderValue("Content-Type")
given BodyParser[String] = BodyParser.string()
printf("Body: %s%n", response.as[String])
- See also
- Companion
- object
Provides factory for HttpResponse
.
Provides factory for HttpResponse
.
- Companion
- class
Provides factory for HttpVersion
.
Provides factory for HttpVersion
.
- Companion
- class
Represents query string as mapped parameters.
Represents query string as mapped parameters.
- Companion
- object
Provides factory for QueryString
.
Provides factory for QueryString
.
- Companion
- class
Indicates read of input stream exceeds established limit.
Indicates read of input stream exceeds established limit.
ReadLimitExceeded
is a complement to EntityTooLarge
. Whereas
ReadLimitExceeded
applies to raw bytes of an input stream, EntityTooLarge
applies to a constructed entity, which is potentially subject to
decompression.
- See also
Provides factory for RequestLine
.
Provides factory for RequestLine
.
- Companion
- class
Defines HTTP request method.
Defines HTTP request method.
- See also
- Companion
- object
Provides factory for RequestMethod
.
Provides factory for RequestMethod
.
- See also
- Companion
- class
Defines HTTP response status.
Defines HTTP response status.
- See also
- Companion
- object
Provides factory for ResponseStatus
.
Provides factory for ResponseStatus
.
- See also
- Companion
- class
Types
Givens
Givens
Extensions
Extensions
Gets first header with given name, or returns default if header not present.
Gets first header with given name, or returns default if header not present.
Gets first header value with given name, or returns default if header not present.
Gets first header value with given name, or returns default if header not present.
Creates new message with supplied file as message body.
Creates new message with supplied file as message body.
Content-Type is set according to file type; Content-Length is set to length of file.
- Value Params
- file
message body
Creates new message with form data from supplied query string as message body.
Creates new message with form data from supplied query string as message body.
Content-Type is set to application/x-www-form-urlencoded
;
Content-Length is set to length of encoded form data.
- Value Params
- query
message body
- Note
Content-Type and Content-Length headers are set accordingly.
Creates new message with supplied form data as message body.
Creates new message with supplied form data as message body.
Content-Type is set to application/x-www-form-urlencoded
;
Content-Length is set to length of encoded form data.
- Value Params
- data
message body
Creates new message with supplied form data as message body.
Creates new message with supplied form data as message body.
Content-Type is set to application/x-www-form-urlencoded
;
Content-Length is set to length of encoded form data.
- Value Params
- data
message body
Creates new message with supplied form data as message body.
Creates new message with supplied form data as message body.
Content-Type is set to application/x-www-form-urlencoded
;
Content-Length is set to length of encoded form data.
- Value Params
- data
form data
- more
additional form data
Creates new message with supplied bytes as message body.
Creates new message with supplied bytes as message body.
Content-Type is set to application/octet-stream
; Content-Length
is set to length of bytes.
- Value Params
- charset
character set
- text
message body