Thursday, 15 September 2011

playframework - Json As Writeable Scala Play Framework -



playframework - Json As Writeable Scala Play Framework -

i trying take http request , send service. want utilize json sent first post , send on next service. problem having turning post info json , set new post not play's type writeable.

here code:

def postproxyparse(proxyurl: string) = action.async { request => var url = buildurl(request.uri) val info = request.body.asjson if(url ==""){ badrequest(null, "url not matching proxy possibilities") } ws.url(url).post(data).map { response => ok(response.body) } }

the error getting cannot write instance of option[play.api.libs.json.jsvalue] http response. seek define writeable[option[play.api.libs.json.jsvalue]]

hi point of create proxy service redirect post requests specific url. reply problem is:

def postproxyparse(proxyurl: string) = action.async { request => val url = buildurl(request.uri) var info = json.parse(request.body.astext.get); if(url ==""){ badrequest(null, "url not matching proxy possibilities") } ws.url(url).withheaders( "accept" -> "application/json", "cookie" -> ("sessionid=" + request.cookies.apply("sessionid").value)).post(data).map { response => ok(data) } }

the total code scala proxy service here

scala playframework

No comments:

Post a Comment