incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r653738 - /incubator/sling/trunk/api/src/main/java/org/apache/sling/api/servlets/HtmlResponse.java
Date Tue, 06 May 2008 10:27:02 GMT
Author: fmeschbe
Date: Tue May  6 03:27:01 2008
New Revision: 653738

URL: http://svn.apache.org/viewvc?rev=653738&view=rev
Log:
SLING-422 Add Location header in case the status code to be returned
to the client is 201/CREATED

Modified:
    incubator/sling/trunk/api/src/main/java/org/apache/sling/api/servlets/HtmlResponse.java

Modified: incubator/sling/trunk/api/src/main/java/org/apache/sling/api/servlets/HtmlResponse.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/api/src/main/java/org/apache/sling/api/servlets/HtmlResponse.java?rev=653738&r1=653737&r2=653738&view=diff
==============================================================================
--- incubator/sling/trunk/api/src/main/java/org/apache/sling/api/servlets/HtmlResponse.java
(original)
+++ incubator/sling/trunk/api/src/main/java/org/apache/sling/api/servlets/HtmlResponse.java
Tue May  6 03:27:01 2008
@@ -346,7 +346,13 @@
         if (setStatus) {
             Object status = getProperty(PN_STATUS_CODE);
             if (status instanceof Number) {
-                response.setStatus(((Number) status).intValue());
+                int statusCode = ((Number) status).intValue();
+                response.setStatus(statusCode);
+                
+                // special treatment of 201/CREATED: Requires Location
+                if (statusCode == HttpServletResponse.SC_CREATED) {
+                    response.setHeader("Location", getLocation());
+                }
             }
         }
 



Mime
View raw message