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
Type members
Types
Value members
Abstract methods
Concrete methods
Creates request with new query using supplied parameters.
Creates request with new query using supplied parameters.
- Returns
new request
Creates request with new query using supplied parameters.
Creates request with new query using supplied parameters.
- Returns
new request
Creates request with new query using supplied parameters.
Creates request with new query using supplied parameters.
- Returns
new request
Inherited methods
Creates message with additional headers.
Creates message with additional headers.
- Value Params
- more
additional message headers
- one
message header
- Returns
new message
- Inherited from
- MessageBuilder
Creates message with additional headers.
Creates message with additional headers.
- Value Params
- headers
message headers
- Returns
new message
- Inherited from
- MessageBuilder
Gets message body as instance of T
.
Gets message body as instance of T
.
- Value Params
- parser
body parser
- Inherited from
- HttpMessage
Gets message attributes.
Gets message attributes.
- Note
Attributes are arbitrary values associated with message and are not part of transmitted message.
- Inherited from
- HttpMessage
Gets attribute value with given name.
Gets attribute value with given name.
- Value Params
- name
attribute name
- Inherited from
- HttpMessage
Gets attribute value with given name, or returns default if attribute not present.
Gets attribute value with given name, or returns default if attribute not present.
- Value Params
- default
default value
- name
attribute name
- Inherited from
- HttpMessage
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.
- Inherited from
- HttpMessage
Gets first header value with given name.
Gets first header value with given name.
- Inherited from
- HttpMessage
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.
- Inherited from
- HttpMessage
Creates message with supplied attributes.
Creates message with supplied attributes.
- Value Params
- more
additional attribute
- one
attribute
- Returns
new message
- Note
If attribute already exists, its value is replaced.
- Inherited from
- MessageBuilder
Creates message with supplied attribute.
Creates message with supplied attribute.
- Value Params
- attributes
attributes
- Returns
new message
- Note
If attribute already exists, its value is replaced.
- Inherited from
- MessageBuilder
Creates message with supplied headers.
Creates message with supplied headers.
- Value Params
- more
additional headers
- one
header
- Returns
new message
- Note
All previous headers with same name are removed.
- Inherited from
- MessageBuilder
Creates message with supplied headers.
Creates message with supplied headers.
- Value Params
- headers
message headers
- Returns
new message
- Note
All previous headers with same name are removed.
- Inherited from
- MessageBuilder
Creates message excluding attributes with given names.
Creates message excluding attributes with given names.
- Value Params
- more
additional attribute names
- one
attribute name
- Returns
new message
- Inherited from
- MessageBuilder
Creates message excluding attributes with given names.
Creates message excluding attributes with given names.
- Value Params
- names
attribute names
- Returns
new message
- Inherited from
- MessageBuilder
Creates message excluding headers with given names.
Creates message excluding headers with given names.
- Value Params
- more
additional header names
- one
header name
- Returns
new message
- Inherited from
- MessageBuilder
Creates message excluding headers with given names.
Creates message excluding headers with given names.
- Value Params
- names
header names
- Returns
new message
- Inherited from
- MessageBuilder
Creates message with supplied attributes.
Creates message with supplied attributes.
- Value Params
- more
additional message attributes
- one
message attribute
- Returns
new message
- Note
All previous attributes are removed.
- Inherited from
- MessageBuilder
Creates message with supplied attributes.
Creates message with supplied attributes.
- Value Params
- attributes
message attributes
- Returns
new message
- Note
All previous attributes are removed.
- Inherited from
- MessageBuilder
Creates message with supplied body.
Creates message with supplied body.
- Value Params
- body
message body
- Returns
new message
- Inherited from
- MessageBuilder
Creates message with supplied body.
Creates message with supplied body.
- Value Params
- body
message body
- Returns
new message
- Inherited from
- MessageBuilder
Creates message with supplied body.
Creates message with supplied body.
- Value Params
- body
message body
- Returns
new message
- Inherited from
- MessageBuilder
Creates message with supplied body.
Creates message with supplied body.
- Value Params
- body
message body
- Returns
new message
- Inherited from
- MessageBuilder
Creates message with supplied body.
Creates message with supplied body.
- Value Params
- body
message body
- Returns
new message
- Inherited from
- MessageBuilder
Creates message with supplied headers.
Creates message with supplied headers.
- Value Params
- more
additional message headers
- one
message header
- Returns
new message
- Note
All previous headers are removed.
- Inherited from
- MessageBuilder
Creates message with supplied headers.
Creates message with supplied headers.
- Value Params
- headers
message headers
- Returns
new message
- Note
All previous headers are removed.
- Inherited from
- MessageBuilder
Creates message with supplied start line.
Creates message with supplied start line.
- Value Params
- startLine
message start line
- Returns
new message
- Inherited from
- MessageBuilder