summaryrefslogtreecommitdiff
path: root/cask/src/cask/endpoints/FormEndpoint.scala
diff options
context:
space:
mode:
Diffstat (limited to 'cask/src/cask/endpoints/FormEndpoint.scala')
-rw-r--r--cask/src/cask/endpoints/FormEndpoint.scala18
1 files changed, 9 insertions, 9 deletions
diff --git a/cask/src/cask/endpoints/FormEndpoint.scala b/cask/src/cask/endpoints/FormEndpoint.scala
index a952a2a..cc74093 100644
--- a/cask/src/cask/endpoints/FormEndpoint.scala
+++ b/cask/src/cask/endpoints/FormEndpoint.scala
@@ -7,40 +7,40 @@ import io.undertow.server.handlers.form.FormParserFactory
import collection.JavaConverters._
-sealed trait FormReader[T] extends Router.ArgReader[Seq[FormEntry], T, ParamContext]
+sealed trait FormReader[T] extends Router.ArgReader[Seq[FormEntry], T, Request]
object FormReader{
implicit def paramFormReader[T: QueryParamReader] = new FormReader[T]{
def arity = implicitly[QueryParamReader[T]].arity
- def read(ctx: ParamContext, label: String, input: Seq[FormEntry]) = {
+ def read(ctx: Request, label: String, input: Seq[FormEntry]) = {
implicitly[QueryParamReader[T]].read(ctx, label, if (input == null) null else input.map(_.valueOrFileName))
}
}
implicit def formEntryReader = new FormReader[FormEntry]{
def arity = 1
- def read(ctx: ParamContext, label: String, input: Seq[FormEntry]) = input.head
+ def read(ctx: Request, label: String, input: Seq[FormEntry]) = input.head
}
implicit def formEntriesReader = new FormReader[Seq[FormEntry]]{
def arity = 1
- def read(ctx: ParamContext, label: String, input: Seq[FormEntry]) = input
+ def read(ctx: Request, label: String, input: Seq[FormEntry]) = input
}
implicit def formValueReader = new FormReader[FormValue]{
def arity = 1
- def read(ctx: ParamContext, label: String, input: Seq[FormEntry]) = input.head.asInstanceOf[FormValue]
+ def read(ctx: Request, label: String, input: Seq[FormEntry]) = input.head.asInstanceOf[FormValue]
}
implicit def formValuesReader = new FormReader[Seq[FormValue]]{
def arity = 1
- def read(ctx: ParamContext, label: String, input: Seq[FormEntry]) = input.map(_.asInstanceOf[FormValue])
+ def read(ctx: Request, label: String, input: Seq[FormEntry]) = input.map(_.asInstanceOf[FormValue])
}
implicit def formFileReader = new FormReader[FormFile]{
def arity = 1
- def read(ctx: ParamContext, label: String, input: Seq[FormEntry]) = input.head.asInstanceOf[FormFile]
+ def read(ctx: Request, label: String, input: Seq[FormEntry]) = input.head.asInstanceOf[FormFile]
}
implicit def formFilesReader = new FormReader[Seq[FormFile]]{
def arity = 1
- def read(ctx: ParamContext, label: String, input: Seq[FormEntry]) = input.map(_.asInstanceOf[FormFile])
+ def read(ctx: Request, label: String, input: Seq[FormEntry]) = input.map(_.asInstanceOf[FormFile])
}
}
class postForm(val path: String, override val subpath: Boolean = false) extends Endpoint {
@@ -49,7 +49,7 @@ class postForm(val path: String, override val subpath: Boolean = false) extends
val methods = Seq("post")
type Input = Seq[FormEntry]
type InputParser[T] = FormReader[T]
- def wrapFunction(ctx: ParamContext,
+ def wrapFunction(ctx: Request,
delegate: Map[String, Input] => Router.Result[Output]): Router.Result[Response] = {
try {
val formData = FormParserFactory.builder().build().createParser(ctx.exchange).parseBlocking()