scalamachine.core

Resource

trait Resource extends AnyRef

Resources represent HTTP resources in an application's API.

Applications should subclass this trait and implement the functions necessary for its resources' logic.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Resource
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def allowMissingPost(data: ReqRespData): (ReqRespData, Res[Boolean])

    returns

    true if this resource allows POST requests to be serviced when the resource does not exist, false otherwise

    Note

    default - false

  7. def allowedMethods(data: ReqRespData): (ReqRespData, Res[List[HTTPMethod]])

    returns

    list of scalamachine.core.HTTPMethods allowed by this resource

    Note

    default - List(GET)

  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. def charsetsProvided(data: ReqRespData): (ReqRespData, Res[CharsetsProvided])

    this functions determines the charset of the response body and influences whether or not the request can be serviced by this resource based on the Accept-Charset.

    this functions determines the charset of the response body and influences whether or not the request can be serviced by this resource based on the Accept-Charset. If the charset is acceptable, the charsetting function will be run. See information about the return value for more.

    The charsetting function is of type Array[Byte] => Array[Byte]

    returns

    An optional list of provided charsets. If None, charset short-circuiting is used and no charsetting is performed. However, if Some containing a list of 2-tuples of charsets and charsetting functions, the chosen charsetting function will be applied the response body.

    Note

    default - None

  10. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  11. def contentHeadersValid(data: ReqRespData): (ReqRespData, Res[Boolean])

    returns

    true if Content-* headers are valid, false otherwise

    Note

    default - true

  12. def contentTypesAccepted(data: ReqRespData): (ReqRespData, Res[ContentTypesAccepted])

    Used during PUT requests and POST requests if postIsCreate returns true.

    Used during PUT requests and POST requests if postIsCreate returns true. Returns a list of accepted Content-Types and their associated handler functions. The handler functions have the signature ReqRespData => (Res[Boolean],ReqRespData). If the handler returns true it is considered successful, otherwise it is considered to have failed and to be an error.

    If the Content-Type of the request is not acceptable a response with code 415 is returned

    returns

    a list of 2-tuples containing the accepted content types and their associated handlers

    Note

    default - Nil

    See also

    scalamachine.core.Resource.ContentTypesAccepted

  13. def contentTypesProvided(data: ReqRespData): (ReqRespData, Res[ContentTypesProvided])

    This function determines the body of GET/HEAD requests.

    This function determines the body of GET/HEAD requests. If your resource responds to them, make sure to implement it because the default most likely will not do. It should return a list of 2-tuples containing the content type and its associated body rendering function. The body rendering function has signature ReqRespData => (Res[Array[Byte],ReqRespData)

    returns

    list of 2-tuples from the scalamachine.core.ContentType to the rendering function.

    Note

    default - by default resources provice the text/html content type, rendering a simple HTML response

    See also

    scalamachine.core.Resource.ContentTypesProvided

  14. def createPath(data: ReqRespData): (ReqRespData, Res[Option[String]])

    Use for POST requests that represent creation of data.

    Use for POST requests that represent creation of data. Makes handling somewhat similar to a PUT request ultimately

    returns

    if this function is called it must return Some containing the created path, returning None is considered an error

    To do

    need to elaborate more on what happens with the returned path and what exactly the string should be

    Note

    default - None

  15. def deleteCompleted(data: ReqRespData): (ReqRespData, Res[Boolean])

    returns

    true if the deletion is complete at the time this function is called, false otherwise

    Note

    default - true

  16. def deleteResource(data: ReqRespData): (ReqRespData, Res[Boolean])

    Perform the deletion of the resource during a DELETE request

    Perform the deletion of the resource during a DELETE request

    returns

    true if the deletion succeed (does not necessarily have to complete), false otherwise

    Note

    default - false

  17. def encodingsProvided(data: ReqRespData): (ReqRespData, Res[CharsetsProvided])

    returns

    similar to scalamachine.core.Resource.charsetsProvided except for response encoding

    Note

    default - supports the "identity" encoding

  18. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  19. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  20. def expires(data: ReqRespData): (ReqRespData, Res[Option[Date]])

    returns

    if Some the date will be set as the value of the Expires header in the response

    Note

    default - None

  21. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  22. def generateEtag(data: ReqRespData): (ReqRespData, Res[Option[String]])

    returns

    the _etag_, if any, for the resource to be included in the response or to determine if the cached response is fresh

    Note

    default - None

  23. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  24. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  25. def isAuthorized(data: ReqRespData): (ReqRespData, Res[AuthResult])

    returns

    scalamachine.core.AuthSuccess if request is authorized scalamachine.core.AuthFailure otherwise

    Note

    default - AuthSuccess

  26. def isConflict(data: ReqRespData): (ReqRespData, Res[Boolean])

    returns

    true if the PUT request cannot be handled due to conflict, false otherwise

    Note

    default - false

  27. def isForbidden(data: ReqRespData): (ReqRespData, Res[Boolean])

    returns

    true if request is forbidden, false otherwise

    Note

    default - false

  28. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  29. def isKnownContentType(data: ReqRespData): (ReqRespData, Res[Boolean])

    returns

    true if content type is known, false otherwise

    Note

    default - true

  30. def isLanguageAvailable(data: ReqRespData): (ReqRespData, Res[Boolean])

    returns

    true if the accepted language is available

    To do

    change to real content negotiation like ruby port

    Note

    default - true

  31. def isMalformed(data: ReqRespData): (ReqRespData, Res[Boolean])

    returns

    true if the request is malformed, false otherwise

    Note

    default - false

  32. def isValidEntityLength(data: ReqRespData): (ReqRespData, Res[Boolean])

    returns

    true if request body length is valid, false otherwise

    Note

    default - true

  33. def knownMethods(data: ReqRespData): (ReqRespData, Res[List[HTTPMethod]])

    returns

    list of scalamachine.core.HTTPMethods known by this resource

    Note

    default - List(OPTIONS, TRACE, CONNECT, HEAD, GET, POST, PUT, DELETE)

  34. def lastModified(data: ReqRespData): (ReqRespData, Res[Option[Date]])

    returns

    the last modified date of the resource being requested, if any, included in response or to determine if cached response is fresh

    Note

    default - None

  35. def movedPermanently(data: ReqRespData): (ReqRespData, Res[Option[String]])

    returns

    None if the resource has not been moved, Some, contain the URI of its new location otherwise

    Note

    default - None

  36. def movedTemporarily(data: ReqRespData): (ReqRespData, Res[Option[String]])

    returns

    None if the resource is not moved temporarily, Some containing its temporary URI otherwise

    Note

    default - None

  37. def multipleChoices(data: ReqRespData): (ReqRespData, Res[Boolean])

  38. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  39. final def notify(): Unit

    Definition Classes
    AnyRef
  40. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  41. def options(data: ReqRespData): (ReqRespData, Res[Map[HTTPHeader, String]])

    returns

    additional headers to include in the reponse to an OPTIONS request

    Note

    default - no additional headers

  42. def postIsCreate(data: ReqRespData): (ReqRespData, Res[Boolean])

    Determines whether or not createPath or processPost is called during a POST request

    Determines whether or not createPath or processPost is called during a POST request

    returns

    true will cause the resource to follow a path that calls createPath, false will result in the flow calling processPost

    Note

    default - false

  43. def previouslyExisted(data: ReqRespData): (ReqRespData, Res[Boolean])

    returns

    true if the resource existed before, although it does not now, false otherwise

    Note

    default - false

  44. def processPost(data: ReqRespData): (ReqRespData, Res[Boolean])

    Used for POST requests that represent generic processing on a resource, instead of creation

    Used for POST requests that represent generic processing on a resource, instead of creation

    returns

    true of the processing succeeded, false otherwise

    Note

    default - false

  45. def resourceExists(data: ReqRespData): (ReqRespData, Res[Boolean])

    for most resources that access a datasource this is where that access should most likely be performed and placed into a variable in the resource (or the resource's context -- coming soon)

    for most resources that access a datasource this is where that access should most likely be performed and placed into a variable in the resource (or the resource's context -- coming soon)

    returns

    true if the resource exists, false otherwise

    Note

    default - true

  46. def serviceAvailable(data: ReqRespData): (ReqRespData, Res[Boolean])

    returns

    true if the service(s) necessary to service this resource are available, false otherwise

    Note

    default - true

  47. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  48. def toString(): String

    Definition Classes
    AnyRef → Any
  49. def uriTooLong(data: ReqRespData): (ReqRespData, Res[Boolean])

    returns

    true if the request URI is too long, otherwise false

    Note

    default - false

  50. def variances(data: ReqRespData): (ReqRespData, Res[Seq[String]])

    returns

    headers to be included in the Vary response header. Accept, Accept-Encoding, Accept-Charset will always be included and do not need to be in the returned list

    Note

    default - Nil

  51. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  52. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  53. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from AnyRef

Inherited from Any

Ungrouped