All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ratpack.kotlin.handling.KByContentSpec.kt Maven / Gradle / Ivy

There is a newer version: 1.10.3
Show newest version
package ratpack.kotlin.handling

import ratpack.func.Block
import ratpack.handling.ByContentSpec
import ratpack.handling.Handler

class KByContentSpec(val delegate: ByContentSpec) {

  fun type (mimeType: String, handler: KContext.(KContext) -> Unit) = type(mimeType, Handler { val ctx = KContext(it); ctx.handler(ctx) })
  fun type(mimeType: String, handler: Handler) = delegate.type(mimeType, handler)
  fun type(mimeType: String, block: Block) = delegate.type(mimeType, block)
  fun type(mimeType: String, clazz: Class) = delegate.type(mimeType, clazz)

  fun plainText (handler: KContext.(KContext) -> Unit) = plainText(Handler { val ctx = KContext(it); ctx.handler(ctx) })
  fun plainText(handler: Handler) = delegate.plainText(handler)
  fun plainText(block: Block) = delegate.plainText(block)
  fun plainText(clazz: Class) = delegate.plainText(clazz)

  fun html (handler: KContext.(KContext) -> Unit) = html(Handler { val ctx = KContext(it); ctx.handler(ctx) })
  fun html(handler: Handler) = delegate.html(handler)
  fun html(block: Block) = delegate.html(block)
  fun html(clazz: Class) = delegate.html(clazz)

  fun json (handler: KContext.(KContext) -> Unit) = json(Handler { val ctx = KContext(it); ctx.handler(ctx) })
  fun json(handler: Handler) = delegate.json(handler)
  fun json(block: Block) = delegate.json(block)
  fun json(clazz: Class) = delegate.json(clazz)

  fun xml (handler: KContext.(KContext) -> Unit) = xml(Handler { val ctx = KContext(it); ctx.handler(ctx) })
  fun xml(handler: Handler) = delegate.xml(handler)
  fun xml(block: Block) = delegate.xml(block)
  fun xml(clazz: Class) = delegate.xml(clazz)

  fun noMatch (handler: KContext.(KContext) -> Unit) = noMatch(Handler { val ctx = KContext(it); ctx.handler(ctx) })
  fun noMatch(handler: Handler) = delegate.noMatch(handler)
  fun noMatch(block: Block) = delegate.noMatch(block)
  fun noMatch(clazz: Class) = delegate.noMatch(clazz)

  fun unspecified (handler: KContext.(KContext) -> Unit) = unspecified(Handler { val ctx = KContext(it); ctx.handler(ctx) })
  fun unspecified(handler: Handler) = delegate.unspecified(handler)
  fun unspecified(block: Block) = delegate.unspecified(block)
  fun unspecified(clazz: Class) = delegate.unspecified(clazz)


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy