Open amnaredo opened 3 years ago
I got it to work by pulling the implicit Reader for A into scope by declaring the function as:
def pickled[A : Reader](maxLength: Int): BodyParser[A] = BodyParser("pickled, maxLength=" + maxLength) { request =>
..i also changed c.toString to new String(c) so that the byte array would correctly be converted to a string..
So, now it works :)
Original Author: jn73
I'm trying to create a body parser in play framework that will read/unpickle the request body. This code will not compile and I can't see why:
The error is:
[error] scala.ScalaReflectionException: type A is not a class [error] at scala.reflect.api.Symbols$SymbolApi$class.asClass(Symbols.scala:275) [error] at scala.reflect.internal.Symbols$SymbolContextApiImpl.asClass(Symbols.scala:84) [error] at upickle.Macros$.picklerFor(Macros.scala:75) [error] at upickle.Macros$.macroRImpl(Macros.scala:35) [error] .transform(Iteratee.consume[Array[Byte]]().map(c => readA)) [error] ^ [error] /Users/janne/projects/private/gb/play/app/controllers/ProfileController.scala:16: missing arguments for method apply in trait EofOrElse; [error] follow this method with `_' if you want to treat it as a partially applied function [error] .flatMap(Iteratee.eofOrElse(Results.EntityTooLarge)) [error] ^ [error] two errors found error Compilation failed
ID: 85 Original Author: jn73