json - Scala Spray Templated Custom Routing Directive -


okay so.... have this:

  def convertpost  = extract {     _.request.entity.asstring.parsejson.convertto[customclass]   }    private def myroute: route =     (post & terminalpath("routeness")) {       convertpost { req =>         detach() {            thinghandler.getmyresults( req )         }       }     } 

but want template it, this:

  def convertpost[t] = extract {     _.request.entity.asstring.parsejson.convertto[t]   }    private def myroute: route =     (post & terminalpath("routeness")) {       convertpost[customclass] { req =>         detach() {            thinghandler.getmyresults( req )         }       }     } 

but doesn't work. using spray-json-shapeless. error

error:(28, 50) cannot find jsonreader or jsonformat type class t     _.request.entity.asstring.parsejson.convertto[t]                                                  ^ 

when try:

  def getstuff[t] = extract {     _.request.entity.asinstanceof[t] // .convertto[t]   } 

it gives:

spray.http.httpentity$nonempty cannot cast com.stuff.customclass 


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo