scala - Spray.io directive not registering? -



scala - Spray.io directive not registering? -

i want access path users/{id}/permission via spray route using post method. reason (and i've tried different configurations) doesn't register route , 405 method not allowed.

the code below part of pathprefix "users". works, post not.

path(rest / "permission") { id => /** * save permissions object user */ post { entity(as[string]) { body => seek { val uperm = parse[userpermission](body) userpermission.store(uperm) respondwithmediatype(`application/json`) { finish { generate(uperm) } } } grab { case e: com.codahale.jerkson.parsingexception => finish { httpresponse(badrequest, "submitted malformed data.") } } } } ~ /** * grab permissions single user */ { seek { val uperm = userpermission.fetch(id) respondwithmediatype(`application/json`) { finish { generate(uperm) } } } grab { case e: java.lang.nullpointerexception => finish { httpresponse(notfound, "object not found.") } } } } ~

am missing here?

you should't utilize "rest" way, seek "pathelement" instead:

path(pathelement / "permission") { id => ... }

if it's int utilize intnumber, rest if want match "rest" of url end... doesn't create sense way used, should set @ end.

scala spray

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -