Revision: 1902
Author: [email protected]
Date: Fri Jun 11 10:52:00 2010
Log: Return HTTP status 201 when addProject has been successful (fixes issue 287)
http://code.google.com/p/simal/source/detail?r=1902

Modified:
/trunk/uk.ac.osswatch.simal.rest/src/main/java/uk/ac/osswatch/simal/rest/RESTServlet.java

=======================================
--- /trunk/uk.ac.osswatch.simal.rest/src/main/java/uk/ac/osswatch/simal/rest/RESTServlet.java Sun Apr 18 05:24:22 2010 +++ /trunk/uk.ac.osswatch.simal.rest/src/main/java/uk/ac/osswatch/simal/rest/RESTServlet.java Fri Jun 11 10:52:00 2010
@@ -26,6 +26,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;

+import org.apache.commons.httpclient.HttpStatus;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

@@ -90,6 +91,7 @@
     }
   }

+  @SuppressWarnings("unchecked")
   public void doPost(HttpServletRequest req, HttpServletResponse res)
       throws ServletException, IOException {
     if (logger.isTraceEnabled()) {
@@ -119,6 +121,9 @@
       HandlerFactory handlerFactory = new HandlerFactory(repo);
       IAPIHandler handler = handlerFactory.get(cmd);
       response = handler.execute();
+      if(cmd.isAddProject()) {
+        res.setStatus(HttpStatus.SC_CREATED);
+      }
     } catch (SimalAPIException e) {
       response = errorResponse(e);
     } catch (SimalRepositoryException e) {

--
You received this message because you are subscribed to the Google Groups "Simal 
Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/simal-commits?hl=en.

Reply via email to