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])
Attributes
- See also
- Companion
- object
- Graph
-
- Supertypes
Members list
Type members
Types
Specifies start line type.
Specifies start line type.
Attributes
Value members
Concrete methods
Tests for CONNECT method.
Tests for CONNECT method.
Attributes
Tests for DELETE method.
Tests for DELETE method.
Attributes
Tests for GET method.
Tests for GET method.
Attributes
Tests for HEAD method.
Tests for HEAD method.
Attributes
Tests for OPTIONS method.
Tests for OPTIONS method.
Attributes
Tests for PATCH method.
Tests for PATCH method.
Attributes
Tests for POST method.
Tests for POST method.
Attributes
Tests for PUT method.
Tests for PUT method.
Attributes
Tests for TRACE method.
Tests for TRACE method.
Attributes
Gets request method.
Gets request method.
Attributes
Gets target path.
Gets target path.
Attributes
Gets query string.
Gets query string.
Attributes
Creates request with new method.
Creates request with new method.
Attributes
- Returns
-
new request
Creates request with new target path.
Creates request with new target path.
Attributes
- Returns
-
new request
Creates request with new query.
Creates request with new query.
Attributes
- Returns
-
new request
Creates request with new query using supplied parameters.
Creates request with new query using supplied parameters.
Attributes
- Returns
-
new request
Creates request with new query using supplied parameters.
Creates request with new query using supplied parameters.
Attributes
- Returns
-
new request
Creates request with new query using supplied parameters.
Creates request with new query using supplied parameters.
Attributes
- Returns
-
new request
Creates request with new target.
Creates request with new target.
Attributes
- Returns
-
new request
Creates request with new HTTP version.
Creates request with new HTTP version.
Attributes
- Returns
-
new request
Inherited methods
Creates message with additional headers.
Creates message with additional headers.
Value parameters
- more
-
additional message headers
- one
-
message header
Attributes
- Returns
-
new message
- Inherited from:
- MessageBuilder
Creates message with additional headers.
Creates message with additional headers.
Value parameters
- headers
-
message headers
Attributes
- Returns
-
new message
- Inherited from:
- MessageBuilder
Gets message body as instance of T
.
Gets message body as instance of T
.
Value parameters
- parser
-
body parser
Attributes
- Inherited from:
- HttpMessage
Gets message attributes.
Gets message attributes.
Attributes
- Note
-
Attributes are arbitrary values associated with message and are not part of transmitted message.
- Inherited from:
- HttpMessage
Gets message body.
Drains decoded message body to supplied sink.
Drains decoded message body to supplied sink.
Value parameters
- maxLength
-
maximum number of bytes
- sink
-
sink to which message body is written
Attributes
- Returns
-
number of bytes written
- Throws
-
ReadLimitExceeded
if body exceeds
maxLength
- Inherited from:
- HttpMessage
Drains decoded message body.
Drains decoded message body.
Value parameters
- maxLength
-
maximum number of bytes
Attributes
- Returns
-
this message
- Throws
-
ReadLimitExceeded
if body exceeds
maxLength
- Inherited from:
- HttpMessage
Gets attribute value with given name.
Gets attribute value with given name.
Value parameters
- name
-
attribute name
Attributes
- 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 parameters
- default
-
default value
- name
-
attribute name
Attributes
- Inherited from:
- HttpMessage
Gets first header with given name.
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.
Attributes
- Inherited from:
- HttpMessage
Gets first header value with given name.
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.
Attributes
- Inherited from:
- HttpMessage
Gets header values with given name.
Gets headers with given name.
Tests for header with given name.
Gets message headers.
Creates message with supplied attributes.
Creates message with supplied attributes.
Value parameters
- more
-
additional attribute
- one
-
attribute
Attributes
- 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 parameters
- attributes
-
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 parameters
- more
-
additional headers
- one
-
header
Attributes
- 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 parameters
- headers
-
message headers
Attributes
- 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 parameters
- more
-
additional attribute names
- one
-
attribute name
Attributes
- Returns
-
new message
- Inherited from:
- MessageBuilder
Creates message excluding attributes with given names.
Creates message excluding attributes with given names.
Value parameters
- names
-
attribute names
Attributes
- Returns
-
new message
- Inherited from:
- MessageBuilder
Creates message excluding headers with given names.
Creates message excluding headers with given names.
Value parameters
- more
-
additional header names
- one
-
header name
Attributes
- Returns
-
new message
- Inherited from:
- MessageBuilder
Creates message excluding headers with given names.
Creates message excluding headers with given names.
Value parameters
- names
-
header names
Attributes
- Returns
-
new message
- Inherited from:
- MessageBuilder
Creates message with supplied attributes.
Creates message with supplied attributes.
Value parameters
- more
-
additional message attributes
- one
-
message attribute
Attributes
- Returns
-
new message
- Note
-
All previous attributes are removed.
- Inherited from:
- MessageBuilder
Creates message with supplied attributes.
Creates message with supplied attributes.
Value parameters
- attributes
-
message attributes
Attributes
- Returns
-
new message
- Note
-
All previous attributes are removed.
- Inherited from:
- MessageBuilder
Creates message with supplied body.
Creates message with supplied body.
Value parameters
- body
-
message body
Attributes
- Returns
-
new message
- Inherited from:
- MessageBuilder
Creates message with supplied body.
Creates message with supplied body.
Value parameters
- body
-
message body
Attributes
- Returns
-
new message
- Inherited from:
- MessageBuilder
Creates message with supplied body.
Creates message with supplied body.
Value parameters
- body
-
message body
Attributes
- Returns
-
new message
- Inherited from:
- MessageBuilder
Creates message with supplied body.
Creates message with supplied body.
Value parameters
- body
-
message body
Attributes
- Returns
-
new message
- Inherited from:
- MessageBuilder
Creates message with supplied headers.
Creates message with supplied headers.
Value parameters
- more
-
additional message headers
- one
-
message header
Attributes
- Returns
-
new message
- Note
-
All previous headers are removed.
- Inherited from:
- MessageBuilder
Creates message with supplied headers.
Creates message with supplied headers.
Value parameters
- headers
-
message headers
Attributes
- 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 parameters
- startLine
-
message start line
Attributes
- Returns
-
new message
- Inherited from:
- MessageBuilder
Gets message start line.
Gets HTTP version.