abstract class Message extends AnyRef
Rich Message
Base class for Request and Response. There are both input and output methods, though only one set of methods should be used.
- Alphabetic
- By Inheritance
- Message
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Message()
Abstract Value Members
-
abstract
def
httpMessage: HttpMessage
- Attributes
- protected[com.twitter.finagle]
- abstract def isRequest: Boolean
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
accept: Seq[String]
Accept header
-
def
acceptMediaTypes: Seq[String]
Accept header media types (normalized, no parameters)
-
def
accept_=(values: Iterable[String]): Unit
Set Accept header with list of values
-
def
accept_=(value: String): Unit
Set Accept header
-
def
addCookie(cookie: Cookie): Unit
Add a cookie
-
def
allow: Option[String]
Allow header
-
def
allow_=(values: Iterable[Method]): Unit
Set Authorization header
-
def
allow_=(value: String): Unit
Set Authorization header
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
authorization: Option[String]
Get Authorization header
-
def
authorization_=(value: String): Unit
Set Authorization header
-
def
cacheControl: Option[String]
Get Cache-Control header
-
def
cacheControl_=(maxAge: Duration): Unit
Set Cache-Control header with a max-age (and must-revalidate).
-
def
cacheControl_=(value: String): Unit
Set Cache-Control header
-
def
charset: Option[String]
Get charset from Content-Type header
-
def
charset_=(value: String): Unit
Set charset in Content-Type header.
Set charset in Content-Type header. This does not change the content.
-
def
clearContent(): Unit
Clear content (set to "").
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
close(): Future[Unit]
End the response stream.
-
final
def
content(content: Buf): Message.this.type
Set the content of this
Message.Set the content of this
Message.Any existing content is discarded. If this
Messageis set to chunked, anIllegalStateExceptionis thrown.- Annotations
- @throws( ... )
- See also
content_=(Buf) for Scala users
-
def
content: Buf
Retrieve the current content of this
Message.Retrieve the current content of this
Message.If this message is chunked, the resulting
Bufwill always be empty. -
def
contentLength: Option[Long]
Get Content-Length header.
Get Content-Length header. Use length to get the length of actual content.
-
def
contentLength_=(value: Long): Unit
Set Content-Length header.
Set Content-Length header. Normally, this is automatically set by the Codec, but this method allows you to override that.
-
def
contentString: String
Get the content as a string.
-
def
contentString_=(value: String): Unit
Set the content as a string.
-
def
contentType: Option[String]
Get Content-Type header
-
def
contentType_=(value: String): Unit
Set Content-Type header
-
def
content_=(content: Buf): Unit
Set the content of this
Message.Set the content of this
Message.Any existing content is discarded. If this
Messageis set to chunked, anIllegalStateExceptionis thrown.- Annotations
- @throws( ... )
- See also
content(Buf) for Java users
-
lazy val
cookies: CookieMap
Cookies.
Cookies. In a request, this uses the Cookie headers. In a response, it uses the Set-Cookie headers.
-
def
date: Option[String]
Get Date header
-
def
date_=(value: Date): Unit
Set Date header by Date
-
def
date_=(value: String): Unit
Set Date header
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
expires: Option[String]
Get Expires header
-
def
expires_=(value: Date): Unit
Set Expires header by Date
-
def
expires_=(value: String): Unit
Set Expires header
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- def getContentString(): String
-
def
getCookies(): Iterator[Cookie]
Get iterator over Cookies
-
def
getInputStream(): InputStream
Get InputStream for content.
Get InputStream for content. Caller must close. (Java interface. Scala users should use withInputStream.)
- def getLength(): Int
-
def
getReader(): Reader
Get Reader for content.
Get Reader for content. (Java interface. Scala users should use withReader.)
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- lazy val headerMap: HeaderMap
-
def
host: Option[String]
Get Host header
-
def
host_=(value: String): Unit
Set Host header
- def isChunked: Boolean
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isResponse: Boolean
-
def
isXmlHttpRequest: Boolean
Check if X-Requested-With contains XMLHttpRequest, usually signalling a request from a JavaScript AJAX libraries.
Check if X-Requested-With contains XMLHttpRequest, usually signalling a request from a JavaScript AJAX libraries. Some servers treat these requests specially. For example, an endpoint might render JSON or XML instead HTML if it's an XmlHttpRequest. (Tip: don't do this - it's gross.)
-
def
lastModified: Option[String]
Get Last-Modified header
-
def
lastModified_=(value: Date): Unit
Set Last-Modified header by Date
-
def
lastModified_=(value: String): Unit
Set Last-Modified header
-
def
length: Int
Get length of content.
-
def
location: Option[String]
Get Location header
-
def
location_=(value: String): Unit
Set Location header
-
def
mediaType: Option[String]
Get media-type from Content-Type header
-
def
mediaType_=(value: String): Unit
Set media-type in Content-Type header.
Set media-type in Content-Type header. Charset and parameter values are preserved, though may not be appropriate for the new media type.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
reader: Reader
A read-only handle to the internal stream of bytes, representing the message body.
A read-only handle to the internal stream of bytes, representing the message body. See com.twitter.io.Reader for more information.
-
def
referer: Option[String]
Get Referer [sic] header
-
def
referer_=(value: String): Unit
Set Referer [sic] header
-
def
removeCookie(name: String): Unit
Remove a cookie
-
def
retryAfter: Option[String]
Get Retry-After header
-
def
retryAfter_=(value: Long): Unit
Set Retry-After header by seconds
-
def
retryAfter_=(value: String): Unit
Set Retry-After header
-
def
server: Option[String]
Get Server header
-
def
server_=(value: String): Unit
Set Server header
-
def
setChunked(chunked: Boolean): Unit
Manipulate the
Messagecontent mode.Manipulate the
Messagecontent mode.If
chunkedistrue, any existing content will be discarded and further attempts to manipulate the synchronous content will result in anIllegalStateException.If
chunkedisfalse, the synchronous content methods will become available and theReader/Writerof the message will be ignored by finagle. - def setContentString(value: String): Unit
-
def
setContentType(mediaType: String, charset: String = "utf-8"): Unit
Set Content-Type header by media-type and charset
-
def
setContentTypeJson(): Unit
Set Content-Type header to application/json;charset=utf-8
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
userAgent: Option[String]
Get User-Agent header
-
def
userAgent_=(value: String): Unit
Set User-Agent header
- def version: Version
- def version_=(version: Version): Unit
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
withInputStream[T](f: (InputStream) ⇒ T): T
Use content as InputStream.
Use content as InputStream. The underlying channel buffer's reader index is advanced. (Scala interface. Java users can use getInputStream().)
-
def
withOutputStream[T](f: (OutputStream) ⇒ T): T
Append content via an OutputStream.
Append content via an OutputStream.
An
IllegalStateExceptionis thrown if this message is chunked.- Annotations
- @throws( classOf[IllegalStateException] )
-
def
withReader[T](f: (Reader) ⇒ T): T
Use content as Reader.
Use content as Reader. (Scala interface. Java usrs can use getReader().)
-
def
withWriter[T](f: (Writer) ⇒ T): T
Append content via a Writer.
Append content via a Writer.
An
IllegalStateExceptionis thrown if this message is chunked.- Annotations
- @throws( classOf[IllegalStateException] )
-
def
write(bytes: Array[Byte]): Unit
Append bytes to content.
Append bytes to content.
This method makes a defensive copy of the provided byte array. This can be avoided by wrapping the byte array via
Buf.ByteArray.Ownedand using thewrite(Buf)method.An
IllegalStateExceptionis thrown if this message is chunked.- Annotations
- @throws( classOf[IllegalStateException] )
-
def
write(buf: Buf): Unit
Append a Buf to content.
Append a Buf to content.
An
IllegalStateExceptionis thrown if this message is chunked.- Annotations
- @throws( classOf[IllegalStateException] )
-
def
write(string: String): Unit
Append string to content.
Append string to content.
An
IllegalStateExceptionis thrown if this message is chunked.- Annotations
- @throws( classOf[IllegalStateException] )
-
def
writer: Writer with Closable
A write-only handle to the internal stream of bytes, representing the message body.
A write-only handle to the internal stream of bytes, representing the message body. See com.twitter.io.Writer for more information.
-
def
wwwAuthenticate: Option[String]
Get WWW-Authenticate header
-
def
wwwAuthenticate_=(value: String): Unit
Set WWW-Authenticate header
-
def
xForwardedFor: Option[String]
Get X-Forwarded-For header
-
def
xForwardedFor_=(value: String): Unit
Set X-Forwarded-For header
Deprecated Value Members
-
def
getContent(): ChannelBuffer
- Attributes
- protected
- Annotations
- @deprecated
- Deprecated
(Since version 2017-01-23) Use content instead
-
def
headers(): HttpHeaders
- Attributes
- protected
- Annotations
- @deprecated
- Deprecated
(Since version 2017-01-24) Use headerMap instead
-
def
setContent(content: ChannelBuffer): Unit
- Attributes
- protected
- Annotations
- @deprecated @throws( ... )
- Deprecated
(Since version 2017-01-23) Use content(Buf) instead