chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1296961 - /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/
Date Mon, 05 Mar 2012 08:40:16 GMT
Author: fmui
Date: Mon Mar  5 08:40:16 2012
New Revision: 1296961

URL: http://svn.apache.org/viewvc?rev=1296961&view=rev
Log:
Browser binding: honor suppressResponseCodes parameter everywhere

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AclService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserBindingUtils.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/MultiFilingService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/POSTHttpServletRequestWrapper.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AclService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AclService.java?rev=1296961&r1=1296960&r2=1296961&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AclService.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AclService.java
Mon Mar  5 08:40:16 2012
@@ -21,6 +21,7 @@ package org.apache.chemistry.opencmis.se
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CONTEXT_OBJECT_ID;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createAddAcl;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createRemoveAcl;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.setStatus;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.writeJSON;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBooleanParameter;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getEnumParameter;
@@ -79,7 +80,7 @@ public class AclService {
         Acl acl = service.applyAcl(repositoryId, objectId, createAddAcl(cp), createRemoveAcl(cp),
aclPropagation, null);
 
         // return ACL
-        response.setStatus(HttpServletResponse.SC_CREATED);
+        setStatus(request, response, HttpServletResponse.SC_CREATED);
 
         JSONObject jsonObject = JSONConverter.convert(acl);
         if (jsonObject == null) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserBindingUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserBindingUtils.java?rev=1296961&r1=1296960&r2=1296961&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserBindingUtils.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserBindingUtils.java
Mon Mar  5 08:40:16 2012
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.server.impl.browser;
 
+import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBooleanParameter;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getStringParameter;
 
 import java.io.IOException;
@@ -380,8 +381,8 @@ public class BrowserBindingUtils {
         if (request instanceof POSTHttpServletRequestWrapper) {
             POSTHttpServletRequestWrapper post = (POSTHttpServletRequestWrapper) request;
             if (post.getStream() != null) {
-                result = new ContentStreamImpl(post.getFilename(), BigInteger.valueOf(post.getSize()),
-                        post.getContentType(), post.getStream());
+                result = new ContentStreamImpl(post.getFilename(), post.getSize(), post.getContentType(),
+                        post.getStream());
             }
         }
 
@@ -394,6 +395,18 @@ public class BrowserBindingUtils {
     }
 
     /**
+     * Sets the given HTTP status code if the surpessResponseCodes parameter is
+     * not set to true; otherwise sets HTTP status code 200 (OK).
+     */
+    public static void setStatus(HttpServletRequest request, HttpServletResponse response,
int statusCode) {
+        if (getBooleanParameter(request, Constants.PARAM_SUPPRESS_RESPONSE_CODES, false))
{
+            statusCode = HttpServletResponse.SC_OK;
+        }
+
+        response.setStatus(statusCode);
+    }
+
+    /**
      * Transforms the transaction into a cookie name.
      */
     public static String getCookieName(String transaction) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java?rev=1296961&r1=1296960&r2=1296961&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
Mon Mar  5 08:40:16 2012
@@ -70,10 +70,10 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createCookieValue;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.prepareContext;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.setCookie;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.setStatus;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.writeJSON;
 import static org.apache.chemistry.opencmis.server.shared.Dispatcher.METHOD_GET;
 import static org.apache.chemistry.opencmis.server.shared.Dispatcher.METHOD_POST;
-import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBooleanParameter;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getStringParameter;
 
 import java.io.IOException;
@@ -420,11 +420,7 @@ public class CmisBrowserBindingServlet e
             LOG.error(ex.getMessage(), ex);
         }
 
-        if (getBooleanParameter(request, Constants.PARAM_SUPPRESS_RESPONSE_CODES, false))
{
-            statusCode = HttpServletResponse.SC_OK;
-        }
-
-        response.setStatus(statusCode);
+        setStatus(request, response, statusCode);
         response.setContentType(JSON_MIME_TYPE);
         if (context != null) {
             setCookie(request, response, context.getRepositoryId(), (String) context.get(CONTEXT_TRANSACTION),

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/MultiFilingService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/MultiFilingService.java?rev=1296961&r1=1296960&r2=1296961&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/MultiFilingService.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/MultiFilingService.java
Mon Mar  5 08:40:16 2012
@@ -24,6 +24,7 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrl;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CONTEXT_OBJECT_ID;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.getSimpleObject;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.setStatus;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.writeJSON;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBooleanParameter;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getStringParameter;
@@ -71,7 +72,7 @@ public class MultiFilingService {
         // set headers
         String location = compileUrl(compileBaseUrl(request, repositoryId), RESOURCE_CONTENT,
newObjectId);
 
-        response.setStatus(HttpServletResponse.SC_CREATED);
+        setStatus(request, response, HttpServletResponse.SC_CREATED);
         response.setHeader("Location", location);
 
         // return object
@@ -104,7 +105,7 @@ public class MultiFilingService {
         // set headers
         String location = compileUrl(compileBaseUrl(request, repositoryId), RESOURCE_CONTENT,
newObjectId);
 
-        response.setStatus(HttpServletResponse.SC_CREATED);
+        setStatus(request, response, HttpServletResponse.SC_CREATED);
         response.setHeader("Location", location);
 
         // return object

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java?rev=1296961&r1=1296960&r2=1296961&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
Mon Mar  5 08:40:16 2012
@@ -45,6 +45,7 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createRemoveAcl;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.getSimpleObject;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.setCookie;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.setStatus;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.writeEmpty;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.writeJSON;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBigIntegerParameter;
@@ -122,7 +123,7 @@ public final class ObjectService {
         // return object
         JSONObject jsonObject = JSONConverter.convert(object, typeCache, false);
 
-        response.setStatus(HttpServletResponse.SC_CREATED);
+        setStatus(request, response, HttpServletResponse.SC_CREATED);
         setCookie(request, response, repositoryId, transaction,
                 createCookieValue(HttpServletResponse.SC_CREATED, object.getId(), null, null));
 
@@ -162,7 +163,7 @@ public final class ObjectService {
         // return object
         JSONObject jsonObject = JSONConverter.convert(object, typeCache, false);
 
-        response.setStatus(HttpServletResponse.SC_CREATED);
+        setStatus(request, response, HttpServletResponse.SC_CREATED);
         setCookie(request, response, repositoryId, transaction,
                 createCookieValue(HttpServletResponse.SC_CREATED, object.getId(), null, null));
 
@@ -193,7 +194,7 @@ public final class ObjectService {
         // return object
         JSONObject jsonObject = JSONConverter.convert(object, typeCache, false);
 
-        response.setStatus(HttpServletResponse.SC_CREATED);
+        setStatus(request, response, HttpServletResponse.SC_CREATED);
         setCookie(request, response, repositoryId, transaction,
                 createCookieValue(HttpServletResponse.SC_CREATED, object.getId(), null, null));
 
@@ -224,7 +225,7 @@ public final class ObjectService {
         // return object
         JSONObject jsonObject = JSONConverter.convert(object, typeCache, false);
 
-        response.setStatus(HttpServletResponse.SC_CREATED);
+        setStatus(request, response, HttpServletResponse.SC_CREATED);
         setCookie(request, response, repositoryId, transaction,
                 createCookieValue(HttpServletResponse.SC_CREATED, object.getId(), null, null));
 
@@ -254,7 +255,7 @@ public final class ObjectService {
         // return object
         JSONObject jsonObject = JSONConverter.convert(object, typeCache, false);
 
-        response.setStatus(HttpServletResponse.SC_CREATED);
+        setStatus(request, response, HttpServletResponse.SC_CREATED);
         setCookie(request, response, repositoryId, transaction,
                 createCookieValue(HttpServletResponse.SC_CREATED, object.getId(), null, null));
 
@@ -296,7 +297,7 @@ public final class ObjectService {
             status = HttpServletResponse.SC_CREATED;
         }
 
-        response.setStatus(status);
+        setStatus(request, response, status);
         setCookie(request, response, repositoryId, transaction, createCookieValue(status,
object.getId(), null, null));
 
         writeJSON(jsonObject, request, response);
@@ -445,7 +446,7 @@ public final class ObjectService {
         if (offset == null && length == null) {
             response.setStatus(HttpServletResponse.SC_OK);
         } else {
-            response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT);
+            setStatus(request, response, HttpServletResponse.SC_PARTIAL_CONTENT);
         }
         response.setContentType(contentType);
         if (content.getFileName() != null) {
@@ -564,7 +565,7 @@ public final class ObjectService {
         // set headers
         String location = compileUrl(compileBaseUrl(request, repositoryId), RESOURCE_CONTENT,
newObjectId);
 
-        response.setStatus(HttpServletResponse.SC_CREATED);
+        setStatus(request, response, HttpServletResponse.SC_CREATED);
         response.setHeader("Location", location);
 
         // return object
@@ -598,7 +599,7 @@ public final class ObjectService {
         // set headers
         String location = compileUrl(compileBaseUrl(request, repositoryId), RESOURCE_CONTENT,
newObjectId);
 
-        response.setStatus(HttpServletResponse.SC_CREATED);
+        setStatus(request, response, HttpServletResponse.SC_CREATED);
         response.setHeader("Location", location);
 
         // return object

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/POSTHttpServletRequestWrapper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/POSTHttpServletRequestWrapper.java?rev=1296961&r1=1296960&r2=1296961&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/POSTHttpServletRequestWrapper.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/POSTHttpServletRequestWrapper.java
Mon Mar  5 08:40:16 2012
@@ -20,6 +20,7 @@ package org.apache.chemistry.opencmis.se
 
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.math.BigInteger;
 import java.net.URLDecoder;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -33,15 +34,18 @@ import javax.servlet.http.HttpServletReq
 import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.server.shared.HttpUtils;
 import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemIterator;
+import org.apache.commons.fileupload.FileItemStream;
 import org.apache.commons.fileupload.disk.DiskFileItemFactory;
 import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.commons.fileupload.util.Streams;
 
 public class POSTHttpServletRequestWrapper extends HttpServletRequestWrapper {
     private final boolean isMultipart;
     private Map<String, String[]> parameters;
     private String filename;
     private String contentType;
-    private long size;
+    private BigInteger size;
     private InputStream stream;
 
     public POSTHttpServletRequestWrapper(HttpServletRequest request) throws Exception {
@@ -60,23 +64,60 @@ public class POSTHttpServletRequestWrapp
         isMultipart = ServletFileUpload.isMultipartContent(request);
 
         if (isMultipart) {
-            // multipart processing
-            DiskFileItemFactory itemFactory = new DiskFileItemFactory();
-            itemFactory.setSizeThreshold(memoryThreshold);
-
-            ServletFileUpload upload = new ServletFileUpload(itemFactory);
-            @SuppressWarnings("unchecked")
-            List<FileItem> fileItems = upload.parseRequest(request);
-
-            for (FileItem item : fileItems) {
-                if (item.isFormField()) {
-                    addParameter(item.getFieldName(), item.getString());
-                } else {
-                    filename = item.getName();
-                    contentType = (item.getContentType() == null ? Constants.MEDIATYPE_OCTETSTREAM
: item
-                            .getContentType());
-                    size = item.getSize();
-                    stream = item.getInputStream();
+            if (true) {
+                // multipart processing - the safe way
+                DiskFileItemFactory itemFactory = new DiskFileItemFactory();
+                itemFactory.setSizeThreshold(memoryThreshold);
+
+                ServletFileUpload upload = new ServletFileUpload(itemFactory);
+                @SuppressWarnings("unchecked")
+                List<FileItem> fileItems = upload.parseRequest(request);
+
+                for (FileItem item : fileItems) {
+                    if (item.isFormField()) {
+                        addParameter(item.getFieldName(), item.getString());
+                    } else {
+                        filename = item.getName();
+                        contentType = (item.getContentType() == null ? Constants.MEDIATYPE_OCTETSTREAM
: item
+                                .getContentType());
+                        size = BigInteger.valueOf(item.getSize());
+                        stream = item.getInputStream();
+                    }
+                }
+            } else {
+                // multipart processing - optimized but unsafe
+                // big content is not buffered on disk but has to be the last
+                // part of the request
+                // code is parked here until we find a way to make it safe
+
+                ServletFileUpload upload = new ServletFileUpload();
+                FileItemIterator iter = upload.getItemIterator(request);
+
+                while (iter.hasNext()) {
+                    FileItemStream item = iter.next();
+                    String name = item.getFieldName();
+                    InputStream itemStream = item.openStream();
+
+                    if (item.isFormField()) {
+                        addParameter(name, Streams.asString(itemStream));
+                    } else {
+                        filename = item.getName();
+                        contentType = (item.getContentType() == null ? Constants.MEDIATYPE_OCTETSTREAM
: item
+                                .getContentType());
+
+                        if (item.getHeaders() != null) {
+                            String lengthStr = item.getHeaders().getHeader("Content-Length");
+                            if (lengthStr != null) {
+                                try {
+                                    size = new BigInteger(lengthStr);
+                                } catch (NumberFormatException e) {
+                                }
+                            }
+                        }
+
+                        stream = itemStream;
+                        break;
+                    }
                 }
             }
 
@@ -167,7 +208,7 @@ public class POSTHttpServletRequestWrapp
         return contentType;
     }
 
-    public long getSize() {
+    public BigInteger getSize() {
         return size;
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java?rev=1296961&r1=1296960&r2=1296961&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java
Mon Mar  5 08:40:16 2012
@@ -35,6 +35,7 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createRemoveAcl;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.getSimpleObject;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.setCookie;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.setStatus;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.writeEmpty;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.writeJSON;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBooleanParameter;
@@ -89,10 +90,9 @@ public class VersioningService {
         // set headers
         String location = compileUrl(compileBaseUrl(request, repositoryId), RESOURCE_CONTENT,
object.getId());
 
-        response.setStatus(HttpServletResponse.SC_CREATED);
+        setStatus(request, response, HttpServletResponse.SC_CREATED);
         response.setHeader("Location", location);
 
-        response.setStatus(HttpServletResponse.SC_CREATED);
         setCookie(request, response, repositoryId, transaction,
                 createCookieValue(HttpServletResponse.SC_CREATED, object.getId(), null, null));
 
@@ -146,7 +146,7 @@ public class VersioningService {
 
         String location = compileUrl(compileBaseUrl(request, repositoryId), RESOURCE_CONTENT,
object.getId());
 
-        response.setStatus(HttpServletResponse.SC_CREATED);
+        setStatus(request, response, HttpServletResponse.SC_CREATED);
         response.setHeader("Location", location);
 
         setCookie(request, response, repositoryId, transaction,



Mime
View raw message