Scala Play External Redirect -
as i'm working on implementing tinyurl, want redirect users webpage based on input hash.
def gettask(hash: int) = action { val url: option[string] = task.gettask(hash) // redirect show(url) } however, don't know how redirect user external url.
i saw related post, encountered compile-time error when used redirect
not found: value redirect
redirect doesn't exist. redirect, fellow member of play.api.mvc package, does.
here's illustration of action should like:
import play.api.mvc._ def gettask(hash: int) = action { val url: option[string] = task.gettask(hash) url match { case some(url) => redirect(url) case none => notfound("this url leads nowhere. :(") } } scala redirect playframework
No comments:
Post a Comment