org.mashupbots.socko.rest

RestConfig

case class RestConfig(apiVersion: String, rootApiUrl: String, swaggerVersion: String = "1.1", swaggerApiGroupingPathSegment: Int = 1, requestTimeoutSeconds: Int = 60, sockoEventCacheTimeoutSeconds: Int = 5, maxWorkerCount: Int = 100, maxWorkerRescheduleMilliSeconds: Int = 500, reportRuntimeException: ReportRuntimeException.Value = ReportRuntimeException.Never, overrides: Map[String, SwaggerModel] = Map.empty) extends Extension with Product with Serializable

Configuration for REST handler

This can also be loaded from an externalized AKKA configuration file. For example:

rest-config {
# The version of your API. Required.
api-version="1.0"

# Root path to your API with the scheme, domain and port. Required.
# This is the path as seen by the end user and not from on the local server.
root-api-url=http://yourdomain.com/api

# Swagger definition version. Defaults to `1.1` if setting is omitted.
swagger-version="1.1"

# Path segments to group your APIs into Swagger resources. For exmaple, `/pet` is one resource
# while `/user` is another. Default is `1` which refers to the first relative path segment.
swagger-api-grouping-path-segment=1

# Number of seconds before a request is timed out.
# Defaults to `60` seconds if setting is omitted.
request-timeout-seconds=60

# Number of seconds before a SockoEvent is removed from the cache and cannot be accessed by
# your actor. Defaults to `5` if setting is omitted.
socko-event-cache-timeout-seconds=5

# Maximum number of workers per RestHandler
# Defaults to 100 if setting is omitted.
max-worker-count=100

# Reschedule a message for processing again using this delay when max worker count has been reached.
# Defaults to 500 if setting is omitted
max-worker-reschedule-milliseconds=500

# Determines if the message from runtime exceptions caught during handing of a REST request is returned
# to the caller in addition to the HTTP status code. Values are: `Never`, `BadRequestsOnly`,
# `InternalServerErrorOnly or `All`.
# Defaults to `Never` if setting is omitted
report-runtime-exception=Never

# Swagger details overriding the details loaded via reflection
overrides {
  classes = [{
    name = TestOverrideClass
    description = Test Override Description
    properties = [{
      name = Property1
      type = Int
      description = Description of Property 1
      required = true
    }]
  }]
}

}

can be loaded as follows:

object MyRestHandlerConfig extends ExtensionId[RestConfig] with ExtensionIdProvider {
  override def lookup = MyRestHandlerConfig
  override def createExtension(system: ExtendedActorSystem) =
    new RestConfig(system.settings.config, "rest-config")
}

val myRestConfig = MyRestHandlerConfig(actorSystem)
apiVersion

the version of your API

rootApiUrl

Root path to your API with the scheme, domain and port. For example, http://yourdomain.com/api. This is the path as seen by the end user and not from on the local server.

swaggerVersion

Swagger definition version

swaggerApiGroupingPathSegment

Path segments to group APIs by. Default is 1 which refers to the first relative path segment.

For example, the following will be grouped under the /pets because the the share pets in the 1st path segment.

/pets
/pets/{petId}
/pets/findById
requestTimeoutSeconds

Number of seconds before a request is timed out. Make sure that your processor actor responds within this number of seconds or throws an exception. Defaults to 60 seconds.

sockoEventCacheTimeoutSeconds

Number of seconds before a org.mashupbots.socko.events.SockoEvent is removed from the cache and cannot be accessed by the REST processor. Once the REST processor has access to the org.mashupbots.socko.events.SockoEvent, its expiry from the cache does not affect usability. The cache is just used as a means to pass the event. Defaults to 5 seconds.

maxWorkerCount

Maximum number of workers per org.mashupbots.socko.rest.RestHandler.

maxWorkerRescheduleMilliSeconds

Reschedule a message for processing again using this delay when max worker count has been reached.

reportRuntimeException

Determines if the message from runtime exceptions caught during handing of a REST request is returned to the caller in addition to the HTTP status code.

Two types of exceptions are raised: 400 Bad Requests and 500 Internal Server Error. If turned on, the message will be return in the response and the content type set to text/plain; charset=UTF-8.

overrides

Used to override the documentation associated with one or more classes, which will otherwise be created via reflection. The format of the override within application.conf is as follows:

overrides {
classes = [{
  name = <class name>
  description = <description>
  properties = [{
    name = <property name>
    type = <property type>
    description = <property description>
    required = <true or false>
    range {min=<min>, max=<max>} or list = [<value1>, <value2>, ... <valueN>] (optional)
  }]
}]
}

where class name = name of class without package (e.g. String instead of java.lang.String) description = brief text description of class property name = name of property within class property type = type of property (int, String, CustomClassName, etc) property description = brief text description of property required = true if property is required, else false if it is optional range or list = allowed values, or disregard if no allowable values are to be documented

Linear Supertypes
Serializable, Serializable, Product, Equals, Extension, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. RestConfig
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Extension
  7. AnyRef
  8. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new RestConfig(config: Config, prefix: String)

    Read configuration from AKKA's application.conf

  2. new RestConfig(apiVersion: String, rootApiUrl: String, swaggerVersion: String = "1.1", swaggerApiGroupingPathSegment: Int = 1, requestTimeoutSeconds: Int = 60, sockoEventCacheTimeoutSeconds: Int = 5, maxWorkerCount: Int = 100, maxWorkerRescheduleMilliSeconds: Int = 500, reportRuntimeException: ReportRuntimeException.Value = ReportRuntimeException.Never, overrides: Map[String, SwaggerModel] = Map.empty)

    apiVersion

    the version of your API

    rootApiUrl

    Root path to your API with the scheme, domain and port. For example, http://yourdomain.com/api. This is the path as seen by the end user and not from on the local server.

    swaggerVersion

    Swagger definition version

    swaggerApiGroupingPathSegment

    Path segments to group APIs by. Default is 1 which refers to the first relative path segment.

    For example, the following will be grouped under the /pets because the the share pets in the 1st path segment.

    /pets
    /pets/{petId}
    /pets/findById
    requestTimeoutSeconds

    Number of seconds before a request is timed out. Make sure that your processor actor responds within this number of seconds or throws an exception. Defaults to 60 seconds.

    sockoEventCacheTimeoutSeconds

    Number of seconds before a org.mashupbots.socko.events.SockoEvent is removed from the cache and cannot be accessed by the REST processor. Once the REST processor has access to the org.mashupbots.socko.events.SockoEvent, its expiry from the cache does not affect usability. The cache is just used as a means to pass the event. Defaults to 5 seconds.

    maxWorkerCount

    Maximum number of workers per org.mashupbots.socko.rest.RestHandler.

    maxWorkerRescheduleMilliSeconds

    Reschedule a message for processing again using this delay when max worker count has been reached.

    reportRuntimeException

    Determines if the message from runtime exceptions caught during handing of a REST request is returned to the caller in addition to the HTTP status code.

    Two types of exceptions are raised: 400 Bad Requests and 500 Internal Server Error. If turned on, the message will be return in the response and the content type set to text/plain; charset=UTF-8.

    overrides

    Used to override the documentation associated with one or more classes, which will otherwise be created via reflection. The format of the override within application.conf is as follows:

    overrides {
    classes = [{
      name = <class name>
      description = <description>
      properties = [{
        name = <property name>
        type = <property type>
        description = <property description>
        required = <true or false>
        range {min=<min>, max=<max>} or list = [<value1>, <value2>, ... <valueN>] (optional)
      }]
    }]
    }

    where class name = name of class without package (e.g. String instead of java.lang.String) description = brief text description of class property name = name of property within class property type = type of property (int, String, CustomClassName, etc) property description = brief text description of property required = true if property is required, else false if it is optional range or list = allowed values, or disregard if no allowable values are to be documented

Value Members

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

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Definition Classes
    AnyRef → Any
  4. val apiVersion: String

    the version of your API

  5. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  6. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  8. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  10. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  11. val maxWorkerCount: Int

    Maximum number of workers per org.mashupbots.socko.rest.RestHandler.

  12. val maxWorkerRescheduleMilliSeconds: Int

    Reschedule a message for processing again using this delay when max worker count has been reached.

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

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

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

    Definition Classes
    AnyRef
  16. val overrides: Map[String, SwaggerModel]

    Used to override the documentation associated with one or more classes, which will otherwise be created via reflection.

    Used to override the documentation associated with one or more classes, which will otherwise be created via reflection. The format of the override within application.conf is as follows:

    overrides {
    classes = [{
      name = <class name>
      description = <description>
      properties = [{
        name = <property name>
        type = <property type>
        description = <property description>
        required = <true or false>
        range {min=<min>, max=<max>} or list = [<value1>, <value2>, ... <valueN>] (optional)
      }]
    }]
    }

    where class name = name of class without package (e.g. String instead of java.lang.String) description = brief text description of class property name = name of property within class property type = type of property (int, String, CustomClassName, etc) property description = brief text description of property required = true if property is required, else false if it is optional range or list = allowed values, or disregard if no allowable values are to be documented

  17. val reportOn400BadRequests: Boolean

  18. val reportOn500InternalServerError: Boolean

  19. val reportRuntimeException: ReportRuntimeException.Value

    Determines if the message from runtime exceptions caught during handing of a REST request is returned to the caller in addition to the HTTP status code.

    Determines if the message from runtime exceptions caught during handing of a REST request is returned to the caller in addition to the HTTP status code.

    Two types of exceptions are raised: 400 Bad Requests and 500 Internal Server Error. If turned on, the message will be return in the response and the content type set to text/plain; charset=UTF-8.

  20. val requestTimeoutSeconds: Int

    Number of seconds before a request is timed out.

    Number of seconds before a request is timed out. Make sure that your processor actor responds within this number of seconds or throws an exception. Defaults to 60 seconds.

  21. val rootApiURI: URI

  22. val rootApiUrl: String

    Root path to your API with the scheme, domain and port.

    Root path to your API with the scheme, domain and port. For example, http://yourdomain.com/api. This is the path as seen by the end user and not from on the local server.

  23. val rootPath: String

  24. val schemeDomainPort: String

  25. val sockoEventCacheTimeoutMilliSeconds: Int

  26. val sockoEventCacheTimeoutSeconds: Int

    Number of seconds before a org.mashupbots.socko.events.SockoEvent is removed from the cache and cannot be accessed by the REST processor.

    Number of seconds before a org.mashupbots.socko.events.SockoEvent is removed from the cache and cannot be accessed by the REST processor. Once the REST processor has access to the org.mashupbots.socko.events.SockoEvent, its expiry from the cache does not affect usability. The cache is just used as a means to pass the event. Defaults to 5 seconds.

  27. val swaggerApiGroupingPathSegment: Int

    Path segments to group APIs by.

    Path segments to group APIs by. Default is 1 which refers to the first relative path segment.

    For example, the following will be grouped under the /pets because the the share pets in the 1st path segment.

    /pets
    /pets/{petId}
    /pets/findById
  28. val swaggerVersion: String

    Swagger definition version

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

    Definition Classes
    AnyRef
  30. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Extension

Inherited from AnyRef

Inherited from Any

Ungrouped