Package

play.api

http

Permalink

package http

Contains standard HTTP constants. For example:

val text = ContentTypes.TEXT
val ok = Status.OK
val accept = HeaderNames.ACCEPT
Source
package.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. http
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait AcceptEncoding extends AnyRef

    Permalink

    A representation of the Accept-Encoding header

  2. case class ActionCompositionConfiguration(controllerAnnotationsFirst: Boolean = false, executeActionCreatorActionFirst: Boolean = false) extends Product with Serializable

    Permalink

    Configuration for action composition.

    Configuration for action composition.

    controllerAnnotationsFirst

    If annotations put on controllers should be executed before the ones put on actions.

    executeActionCreatorActionFirst

    If the action returned by the action creator should be executed before the action composition ones.

  3. case class ContentTypeOf[-A](mimeType: Option[String]) extends Product with Serializable

    Permalink

    Defines the default content type for type A.

    Defines the default content type for type A.

    A

    the content type

    mimeType

    the default content type for A, if any

    Annotations
    @implicitNotFound( ... )
  4. trait ContentTypes extends AnyRef

    Permalink

    Defines common HTTP Content-Type header values, according to the current available Codec.

  5. case class CookiesConfiguration(strict: Boolean = true) extends Product with Serializable

    Permalink

    The cookies configuration

    The cookies configuration

    strict

    Whether strict cookie parsing should be used. If true, will cause the entire cookie header to be discarded if a single cookie is found to be invalid.

  6. trait DefaultContentTypeOfs extends AnyRef

    Permalink

    Contains typeclasses for ContentTypeOf.

  7. class DefaultFileMimeTypes extends FileMimeTypes

    Permalink

    Default implementation of FileMimeTypes.

  8. class DefaultFileMimeTypesProvider extends Provider[FileMimeTypes]

    Permalink
    Annotations
    @Singleton()
  9. class DefaultHttpErrorHandler extends HttpErrorHandler

    Permalink

    The default HTTP error handler.

    The default HTTP error handler.

    This class is intended to be extended, allowing users to reuse some of the functionality provided here.

    Annotations
    @Singleton()
  10. class DefaultHttpFilters extends HttpFilters

    Permalink

    A default implementation of HttpFilters that accepts filters as a varargs constructor and exposes them as a filters sequence.

    A default implementation of HttpFilters that accepts filters as a varargs constructor and exposes them as a filters sequence. This is available for runtime DI users who don't want to do things in configuration using play.filters.enabled, because they need more fine grained control over the injected components.

    For example:

    class Filters @Inject()(defaultFilters: EnabledFilters, corsFilter: CORSFilter)
      extends DefaultHttpFilters(defaultFilters.filters :+ corsFilter: _*)
  11. class DefaultHttpRequestHandler extends HttpRequestHandler

    Permalink

    A base implementation of the HttpRequestHandler that handles Scala actions.

    A base implementation of the HttpRequestHandler that handles Scala actions. If you use Java actions in your application, you should override JavaCompatibleHttpRequestHandler; otherwise you can override this for your custom handler.

    Technically, this is not the default request handler that Play uses, rather, the JavaCompatibleHttpRequestHandler is the default one, in order to provide support for Java actions.

  12. trait DefaultWriteables extends LowPriorityWriteables

    Permalink

    Default Writeable.

  13. class EnabledFilters extends HttpFilters

    Permalink

    This class provides filters that are "automatically" enabled through play.filters.enabled.

    This class provides filters that are "automatically" enabled through play.filters.enabled. A list of default filters are defined in reference.conf.

    See https://www.playframework.com/documentation/latest/Filters for more information.

    Annotations
    @Singleton()
  14. case class EncodingPreference(name: String = "*", qValue: Option[BigDecimal] = None) extends Product with Serializable

    Permalink

    A representation of an encoding preference as specified in the Accept-Encoding header.

    A representation of an encoding preference as specified in the Accept-Encoding header. This contains an encoding name (or *), and an optional q-value.

  15. trait FileMimeTypes extends AnyRef

    Permalink

    Defines behavior for file type mappings.

    Defines behavior for file type mappings.

    This trait is primarily used with results and assets that send files, for users who want to send a file without having to specify an explicit content type. For example, a user can send a file with ".json":

    implicit val fileMimeTypes = ...
    val file = new File("test.json")
    Ok.sendFile(file) // <-- uses implicit fileMimeTypes

    and have a "json" -> "application/json" mapping done implicitly based off the file extension. The Assets controller handles this mapping automatically.

    In a controller, an implicit FileMimeTypes object can either be defined explicitly:

    class MyController @Inject()(implicit val fileMimeTypes: FileMimeTypes) extends BaseController {
       def sendFile() = ...
    }

    or, if play.api.mvc.BaseController is extended, then an implicit fileMimeTypes instance is already made available from play.api.mvc.ControllerComponents, meaning that no explicit import is required:

    class MyController @Inject()(val controllerComponents: ControllerComponents) extends BaseController {
      def sendFile() = ...
    }
    Annotations
    @implicitNotFound( ... )
  16. case class FileMimeTypesConfiguration(mimeTypes: Map[String, String] = Map.empty) extends Product with Serializable

    Permalink

    Configuration for file MIME types, mapping from extension to content type.

    Configuration for file MIME types, mapping from extension to content type.

    mimeTypes

    the extension to mime type mapping.

  17. case class FlashConfiguration(cookieName: String = "PLAY_FLASH", secure: Boolean = false, httpOnly: Boolean = true, domain: Option[String] = None, path: String = "/", sameSite: Option[SameSite] = Some(SameSite.Lax), jwt: JWTConfiguration = JWTConfiguration()) extends Product with Serializable

    Permalink

    The flash configuration

    The flash configuration

    cookieName

    The name of the cookie used to store the session

    secure

    Whether the flash cookie should set the secure flag or not

    httpOnly

    Whether the HTTP only attribute of the cookie should be set

    domain

    The domain to set for the session cookie, if defined

    path

    The path for which this cookie is valid

    sameSite

    The cookie's SameSite attribute

    jwt

    The JWT specific information

  18. trait HeaderNames extends AnyRef

    Permalink

    Defines all standard HTTP headers.

  19. sealed trait HttpChunk extends AnyRef

    Permalink

    An HTTP chunk.

    An HTTP chunk.

    May either be a HttpChunk.Chunk containing data, or a HttpChunk.LastChunk, signifying the last chunk in a stream, optionally with trailing headers.

  20. case class HttpConfiguration(context: String = "/", parser: ParserConfiguration = ParserConfiguration(), actionComposition: ActionCompositionConfiguration = ActionCompositionConfiguration(), cookies: CookiesConfiguration = CookiesConfiguration(), session: SessionConfiguration = SessionConfiguration(), flash: FlashConfiguration = FlashConfiguration(), fileMimeTypes: FileMimeTypesConfiguration = FileMimeTypesConfiguration(), secret: SecretConfiguration = SecretConfiguration()) extends Product with Serializable

    Permalink

    HTTP related configuration of a Play application

    HTTP related configuration of a Play application

    context

    The HTTP context

    parser

    The parser configuration

    session

    The session configuration

    flash

    The flash configuration

    fileMimeTypes

    The fileMimeTypes configuration

  21. sealed trait HttpEntity extends AnyRef

    Permalink

    An HTTP entity.

    An HTTP entity.

    HTTP entities come in three flavors, HttpEntity.Strict, HttpEntity.Streamed and HttpEntity.Chunked.

  22. case class HttpErrorConfig(showDevErrors: Boolean, playEditor: Option[String]) extends Product with Serializable

    Permalink
  23. trait HttpErrorHandler extends AnyRef

    Permalink

    Component for handling HTTP errors in Play.

    Component for handling HTTP errors in Play.

    Since

    2.4.0

  24. trait HttpFilters extends AnyRef

    Permalink

    Provides filters to the play.api.http.HttpRequestHandler.

  25. trait HttpProtocol extends AnyRef

    Permalink

    Defines HTTP protocol constants

  26. trait HttpRequestHandler extends AnyRef

    Permalink

    Primary entry point for all HTTP requests on Play applications.

  27. trait HttpVerbs extends AnyRef

    Permalink

    Standard HTTP Verbs

  28. case class JWTConfiguration(signatureAlgorithm: String = "HS256", expiresAfter: Option[FiniteDuration] = None, clockSkew: FiniteDuration = 30.seconds, dataClaim: String = "data") extends Product with Serializable

    Permalink

    The JSON Web Token configuration

    The JSON Web Token configuration

    signatureAlgorithm

    The signature algorithm used to sign the JWT

    expiresAfter

    The period of time after which the JWT expires, if any.

    clockSkew

    The amount of clock skew to permit for expiration / not before checks

    dataClaim

    The claim key corresponding to the data map passed in by the user

  29. class JavaCompatibleHttpRequestHandler extends DefaultHttpRequestHandler

    Permalink

    A Java compatible HTTP request handler.

    A Java compatible HTTP request handler.

    If a router routes to Java actions, it will return instances of play.core.j.JavaHandler. This takes an instance of play.core.j.JavaHandlerComponents to supply the necessary infrastructure to invoke a Java action, and returns a new play.api.mvc.Handler that the core of Play knows how to handle.

    If your application routes to Java actions, then you must use this request handler as the base class as is or as the base class for your custom HttpRequestHandler.

  30. class JavaHttpFiltersAdapter extends DefaultHttpFilters

    Permalink

    Adapter from the Java HttpFilters to the Scala HttpFilters interface.

  31. class JavaHttpFiltersDelegate extends http.DefaultHttpFilters

    Permalink
  32. trait LowPriorityWriteables extends AnyRef

    Permalink

    Default Writeable with lowwe priority.

  33. class MediaRange extends MediaType

    Permalink

    A media range as defined by RFC 2616 14.1

  34. case class MediaType(mediaType: String, mediaSubType: String, parameters: Seq[(String, Option[String])]) extends Product with Serializable

    Permalink

    A media type as defined by RFC 2616 3.7.

    A media type as defined by RFC 2616 3.7.

    mediaType

    The media type

    mediaSubType

    The media sub type

    parameters

    The parameters

  35. trait MimeTypes extends AnyRef

    Permalink

    Common HTTP MIME types

  36. class NoHttpFilters extends HttpFilters

    Permalink

    A filters provider that provides no filters.

  37. case class ParserConfiguration(maxMemoryBuffer: Int = 102400, maxDiskBuffer: Long = 10485760) extends Product with Serializable

    Permalink

    Configuration for body parsers.

    Configuration for body parsers.

    maxMemoryBuffer

    The maximum size that a request body that should be buffered in memory.

    maxDiskBuffer

    The maximum size that a request body should be buffered on disk.

  38. final class Port extends AnyVal

    Permalink

    A port.

    A port. This class is defined so that ports can be passed around implicitly.

  39. case class SecretConfiguration(secret: String = "changeme", provider: Option[String] = None) extends Product with Serializable

    Permalink

    The application secret.

    The application secret. Must be set. A value of "changeme" will cause the application to fail to start in production.

    With the Play secret we want to:

    1) Encourage the practice of *not* using the same secret in dev and prod. 2) Make it obvious that the secret should be changed. 3) Ensure that in dev mode, the secret stays stable across restarts. 4) Ensure that in dev mode, sessions do not interfere with other applications that may be or have been running on localhost. Eg, if I start Play app 1, and it stores a PLAY_SESSION cookie for localhost:9000, then I stop it, and start Play app 2, when it reads the PLAY_SESSION cookie for localhost:9000, it should not see the session set by Play app 1. This can be achieved by using different secrets for the two, since if they are different, they will simply ignore the session cookie set by the other.

    To achieve 1 and 2, we will, in Activator templates, set the default secret to be "changeme". This should make it obvious that the secret needs to be changed and discourage using the same secret in dev and prod.

    For safety, if the secret is not set, or if it's changeme, and we are in prod mode, then we will fail fatally. This will further enforce both 1 and 2.

    To achieve 3, if in dev or test mode, if the secret is either changeme or not set, we will generate a secret based on the location of application.conf. This should be stable across restarts for a given application.

    To achieve 4, using the location of application.conf to generate the secret should ensure this.

    secret

    the application secret

    provider

    the JCE provider to use. If null, uses the platform default

  40. case class SessionConfiguration(cookieName: String = "PLAY_SESSION", secure: Boolean = false, maxAge: Option[FiniteDuration] = None, httpOnly: Boolean = true, domain: Option[String] = None, path: String = "/", sameSite: Option[SameSite] = Some(SameSite.Lax), jwt: JWTConfiguration = JWTConfiguration()) extends Product with Serializable

    Permalink

    The session configuration

    The session configuration

    cookieName

    The name of the cookie used to store the session

    secure

    Whether the session cookie should set the secure flag or not

    maxAge

    The max age of the session, none, use "session" sessions

    httpOnly

    Whether the HTTP only attribute of the cookie should be set

    domain

    The domain to set for the session cookie, if defined

    path

    The path for which this cookie is valid

    sameSite

    The cookie's SameSite attribute

    jwt

    The JWT specific information

  41. trait Status extends AnyRef

    Permalink

    Defines all standard HTTP status codes.

  42. class Writeable[-A] extends AnyRef

    Permalink

    Transform a value of type A to a Byte Array.

    Transform a value of type A to a Byte Array.

    A

    the content type

    Annotations
    @implicitNotFound( ... )

Value Members

  1. object AcceptEncoding

    Permalink
  2. object ActionCreator

    Permalink
  3. object ContentEncoding

    Permalink
  4. object ContentTypeOf extends DefaultContentTypeOfs with Serializable

    Permalink

    Default Content-Type typeclasses.

  5. object ContentTypes extends ContentTypes

    Permalink

    Defines common HTTP Content-Type header values, according to the current available Codec.

  6. object DefaultHttpErrorHandler extends DefaultHttpErrorHandler

    Permalink

    A default HTTP error handler that can be used when there's no application available

  7. object EncodingPreference extends Serializable

    Permalink
  8. object HeaderNames extends HeaderNames

    Permalink

    Defines all standard HTTP headers.

  9. object HttpChunk

    Permalink
  10. object HttpConfiguration extends Serializable

    Permalink
  11. object HttpEntity

    Permalink
  12. object HttpErrorHandler

    Permalink
  13. object HttpErrorHandlerExceptions

    Permalink

    Extracted so the Java default error handler can reuse this functionality

  14. object HttpFilters

    Permalink
  15. object HttpProtocol extends HttpProtocol

    Permalink

    Defines HTTP protocol constants

  16. object HttpRequestHandler

    Permalink
  17. object HttpVerbs extends HttpVerbs

    Permalink

    Standard HTTP Verbs

  18. object JWTConfigurationParser

    Permalink
  19. object LazyHttpErrorHandler extends HttpErrorHandler

    Permalink

    A lazy HTTP error handler, that looks up the error handler from the current application

  20. object MediaRange extends Serializable

    Permalink
  21. object MediaType extends Serializable

    Permalink
  22. object MimeTypes extends MimeTypes

    Permalink

    Common HTTP MIME types

  23. object NoHttpFilters extends NoHttpFilters

    Permalink
  24. object NotImplementedHttpRequestHandler extends HttpRequestHandler

    Permalink

    Implementation of a [HttpRequestHandler] that always returns NotImplemented results

  25. object Status extends Status

    Permalink

    Defines all standard HTTP status codes, with additional helpers for determining the type of status.

  26. object Writeable extends DefaultWriteables

    Permalink

    Helper utilities for Writeable.

  27. val dateFormat: DateTimeFormatter

    Permalink

    HTTP date formatter, compliant to RFC 1123

  28. package websocket

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped