1 Reply Latest reply on Apr 16, 2013 9:40 PM by Magesh Bojan

    rest-binding quickstart - how to set http response codes?

    Ross Stockman Newbie

      I have a question regarding setting specific http codes in a rest response. Using the switchyard rest-binding quickstart as an example, what would I need to modify so that the @GET methods on the WareHouseResource class would return a 404 http status code (or any http code I want to specify) if no results are found?

       

      for example, If a call PUT localhost/rest-binding/1/testing I would be adding an item to the warehouse,

      If I then call GET localhost/rest-binding/1 I would get the item back with a 200 OK response code.

      If I then call GET localhost/rest-binding/2 I want to get a 404 back because I never added a second item. I don't want to return the default 200 or 500 in this case.