Note that there are some explanatory texts on larger screens.

plurals
  1. POReturning RESTful response codes in Play
    primarykey
    data
    text
    <p>I'm just getting started with REST and I've been reading <a href="https://stackoverflow.com/questions/847224/restful-http-response-codes">this</a> post and the mentioned <a href="http://rads.stackoverflow.com/amzn/click/0596529260" rel="nofollow noreferrer">book</a> about REST <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" rel="nofollow noreferrer">response codes</a>. When I look at Play's <a href="http://www.playframework.org/documentation/api/1.1/play/mvc/Controller.html" rel="nofollow noreferrer" title="Restful Web Services">Controller</a> class however, it seems to be limited to returning </p> <ul> <li>200 - OK</li> <li>301 - Moved Permanently</li> <li>302 - Found</li> <li>304 - Not Modified</li> <li>400 - Bad Request</li> <li>401 - Not Authorized</li> <li>403 - Forbidden</li> <li>404 - Not Found</li> <li>5xx</li> </ul> <p>That seems to leave out some potentially useful codes that were mentioned:</p> <ul> <li>201 - Created (good response for successful JSON post?)</li> <li>202 - Accepted (for queued requests)</li> <li>204 - No Content (possible response for successful PUT/POST/DELETE)</li> <li>307 - Temporary Redirect</li> <li>405 - Method Not Allowed</li> <li>406 - Not Acceptable</li> <li>409 - Conflict</li> <li>410 - Gone</li> <li>415 - Unsupported Media Type (this seems like the appropriate response for a request for JSON format when no JSON template is defined)</li> </ul> <p>Are those not needed after all? Is Play handling those situations automatically?</p> <p>Also it appears that one controller can't handle REST requests and normal web page requests for the same resource very well since the web pages are always returned with <code>200</code>. Am I missing anything there?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload