chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1231731 - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/...
Date Sun, 15 Jan 2012 19:14:38 GMT
Author: fmui
Date: Sun Jan 15 19:14:37 2012
New Revision: 1231731

URL: http://svn.apache.org/viewvc?rev=1231731&view=rev
Log:
- more Browser Binding code
- small Workbench fixes

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.java   (with props)
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/VersioningServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeHelper.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/UrlBuilder.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/POSTHttpServletRequestWrapper.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/InfoDialog.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RandomInputStream.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java?rev=1231731&r1=1231730&r2=1231731&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java Sun Jan 15 19:14:37 2012
@@ -188,5 +188,7 @@ public class AtomEntryWriter {
                 writer.writeCharacters(new String(buffer, 0, b, "US-ASCII"));
             }
         }
+        
+        b64stream.close();
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java?rev=1231731&r1=1231730&r2=1231731&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java Sun Jan 15 19:14:37 2012
@@ -117,6 +117,21 @@ public abstract class AbstractBrowserBin
         return result;
     }
 
+    protected UrlBuilder getRepositoryUrl(String repositoryId) {
+        UrlBuilder result = getRepositoryUrlCache().getRepositoryUrl(repositoryId);
+
+        if (result == null) {
+            getRepositoriesInternal(repositoryId);
+            result = getRepositoryUrlCache().getRepositoryUrl(repositoryId);
+        }
+
+        if (result == null) {
+            throw new CmisObjectNotFoundException("Unknown repository!");
+        }
+
+        return result;
+    }
+
     protected UrlBuilder getObjectUrl(String repositoryId, String objectId, String selector) {
         UrlBuilder result = getRepositoryUrlCache().getObjectUrl(repositoryId, objectId, selector);
 
@@ -132,6 +147,21 @@ public abstract class AbstractBrowserBin
         return result;
     }
 
+    protected UrlBuilder getObjectUrl(String repositoryId, String objectId) {
+        UrlBuilder result = getRepositoryUrlCache().getObjectUrl(repositoryId, objectId);
+
+        if (result == null) {
+            getRepositoriesInternal(repositoryId);
+            result = getRepositoryUrlCache().getObjectUrl(repositoryId, objectId);
+        }
+
+        if (result == null) {
+            throw new CmisObjectNotFoundException("Unknown repository!");
+        }
+
+        return result;
+    }
+
     protected UrlBuilder getPathUrl(String repositoryId, String objectId, String selector) {
         UrlBuilder result = getRepositoryUrlCache().getPathUrl(repositoryId, objectId, selector);
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java?rev=1231731&r1=1231730&r2=1231731&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java Sun Jan 15 19:14:37 2012
@@ -18,10 +18,16 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.browser;
 
+import java.util.Map;
+
 import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
+import org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils;
 import org.apache.chemistry.opencmis.commons.data.Acl;
 import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
 import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
+import org.apache.chemistry.opencmis.commons.impl.Constants;
+import org.apache.chemistry.opencmis.commons.impl.JSONConverter;
+import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
 import org.apache.chemistry.opencmis.commons.spi.AclService;
 
 /**
@@ -37,8 +43,15 @@ public class AclServiceImpl extends Abst
     }
     
     public Acl getAcl(String repositoryId, String objectId, Boolean onlyBasicPermissions, ExtensionsData extension) {
-        // TODO Auto-generated method stub
-        return null;
+        // build URL
+        UrlBuilder url = getObjectUrl(repositoryId, objectId, Constants.SELECTOR_ACL);
+        url.addParameter(Constants.PARAM_ONLY_BASIC_PERMISSIONS, onlyBasicPermissions);
+
+        // read and parse
+        HttpUtils.Response resp = read(url);
+        Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset());
+
+        return JSONConverter.convertAcl(json, null);
     }
 
     public Acl applyAcl(String repositoryId, String objectId, Acl addAces, Acl removeAces,

Added: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.java?rev=1231731&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.java Sun Jan 15 19:14:37 2012
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.client.bindings.spi.browser;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URLEncoder;
+import java.util.GregorianCalendar;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.commons.data.Ace;
+import org.apache.chemistry.opencmis.commons.data.Acl;
+import org.apache.chemistry.opencmis.commons.data.ContentStream;
+import org.apache.chemistry.opencmis.commons.data.Properties;
+import org.apache.chemistry.opencmis.commons.data.PropertyData;
+import org.apache.chemistry.opencmis.commons.impl.Constants;
+import org.apache.chemistry.opencmis.commons.impl.MimeHelper;
+import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
+
+public class FormDataWriter {
+
+    private static final String CONTENT_TYPE_URLENCODED = "application/x-www-form-urlencoded;charset=utf-8";
+    private static final String CONTENT_TYPE_FORMDATA = "multipart/form-data; boundary=";
+    private static final String CRLF = "\r\n";
+    private static final int BUFFER_SIZE = 64 * 1024;
+
+    private final String boundary = "opencmis" + Long.toHexString(System.currentTimeMillis())
+            + Long.toHexString(this.hashCode());
+    private final Map<String, String> parameters = new LinkedHashMap<String, String>();
+    private ContentStream contentStream;
+
+    public FormDataWriter(String action) {
+        this(action, null);
+    }
+
+    public FormDataWriter(String action, ContentStream contentStream) {
+        addParameter(Constants.CONTROL_CMISACTION, action);
+        this.contentStream = contentStream;
+    }
+
+    public void addParameter(String name, Object value) {
+        if (name == null || value == null) {
+            return;
+        }
+
+        parameters.put(name, UrlBuilder.normalizeParameter(value));
+    }
+
+    public void addPropertiesParameters(Properties properties) {
+        if (properties == null) {
+            return;
+        }
+
+        int idx = 0;
+        for (PropertyData<?> prop : properties.getPropertyList()) {
+            if (prop == null) {
+                continue;
+            }
+
+            String idxStr = "[" + idx + "]";
+            addParameter(Constants.CONTROL_PROP_ID + idxStr, prop.getId());
+
+            if (prop.getValues() != null && prop.getValues().size() > 0) {
+                if (prop.getValues().size() == 1) {
+                    addParameter(Constants.CONTROL_PROP_VALUE + idxStr, convertPropertyValue(prop.getFirstValue()));
+                } else {
+                    int vidx = 0;
+                    for (Object obj : prop.getValues()) {
+                        String vidxStr = "[" + vidx + "]";
+                        addParameter(Constants.CONTROL_PROP_VALUE + idxStr + vidxStr, convertPropertyValue(obj));
+                        vidx++;
+                    }
+                }
+            }
+
+            idx++;
+        }
+    }
+
+    public void addPoliciesParameters(List<String> policies) {
+        if (policies == null) {
+            return;
+        }
+
+        int idx = 0;
+        for (String policy : policies) {
+            if (policy != null) {
+                String idxStr = "[" + idx + "]";
+                addParameter(Constants.CONTROL_POLICY + idxStr, policy);
+                idx++;
+            }
+        }
+    }
+
+    public void addAddAcesParameters(Acl acl) {
+        addAcesParameters(acl, Constants.CONTROL_ADD_ACE_PRINCIPAL, Constants.CONTROL_ADD_ACE_PERMISSION);
+    }
+
+    public void addRemoveAcesParameters(Acl acl) {
+        addAcesParameters(acl, Constants.CONTROL_REMOVE_ACE_PRINCIPAL, Constants.CONTROL_REMOVE_ACE_PERMISSION);
+    }
+
+    private void addAcesParameters(Acl acl, String principalControl, String permissionControl) {
+        if (acl == null || acl.getAces() != null) {
+            return;
+        }
+
+        int idx = 0;
+        for (Ace ace : acl.getAces()) {
+            if (ace.getPrincipalId() != null && ace.getPermissions() != null && !ace.getPermissions().isEmpty()) {
+                String idxStr = "[" + idx + "]";
+                addParameter(principalControl + idxStr, ace.getPrincipalId());
+
+                int permIdx = 0;
+                for (String perm : ace.getPermissions()) {
+                    if (perm != null) {
+                        String permIdxStr = "[" + permIdx + "]";
+                        addParameter(permissionControl + idxStr + permIdxStr, perm);
+                        permIdx++;
+                    }
+                }
+                idx++;
+            }
+        }
+    }
+
+    private String convertPropertyValue(Object value) {
+        if (value == null) {
+            return null;
+        }
+
+        if (value instanceof GregorianCalendar) {
+            return "" + ((GregorianCalendar) value).getTimeInMillis();
+        }
+
+        return value.toString();
+    }
+
+    public String getContentType() {
+        return (contentStream == null ? CONTENT_TYPE_URLENCODED : CONTENT_TYPE_FORMDATA + boundary);
+    }
+
+    public void write(OutputStream out) throws Exception {
+        if (contentStream == null || contentStream.getStream() == null) {
+            boolean first = true;
+            byte[] amp = "&".getBytes("UTF-8");
+
+            for (Map.Entry<String, String> param : parameters.entrySet()) {
+                if (first) {
+                    first = false;
+                } else {
+                    out.write(amp);
+                }
+
+                out.write((param.getKey() + "=" + URLEncoder.encode(param.getValue(), "UTF-8")).getBytes("UTF-8"));
+            }
+        } else {
+            // parameters
+            for (Map.Entry<String, String> param : parameters.entrySet()) {
+                writeLine(out, "--" + boundary);
+                writeLine(out, "Content-Disposition: form-data; name=\"" + param.getKey() + "\"");
+                writeLine(out, "Content-Type: text/plain; charset=utf-8");
+                writeLine(out);
+                writeLine(out, param.getValue());
+            }
+
+            // content
+            String filename = contentStream.getFileName();
+            if (filename == null || filename.length() == 0) {
+                filename = "content";
+            }
+
+            String mediaType = contentStream.getMimeType();
+            if (mediaType == null || mediaType.length() == 0) {
+                mediaType = Constants.MEDIATYPE_OCTETSTREAM;
+            }
+
+            writeLine(out, "--" + boundary);
+            writeLine(
+                    out,
+                    "Content-Disposition: "
+                            + MimeHelper.encodeContentDisposition(MimeHelper.DISPOSITION_FORM_DATA_CONTENT, filename));
+            writeLine(out, "Content-Type: " + mediaType);
+            writeLine(out, "Content-Transfer-Encoding: binary");
+            writeLine(out);
+
+            InputStream stream = contentStream.getStream();
+            if (!(stream instanceof BufferedInputStream) && !(stream instanceof ByteArrayInputStream)) {
+                // avoid double buffering
+                stream = new BufferedInputStream(stream, BUFFER_SIZE);
+            }
+
+            byte[] buffer = new byte[BUFFER_SIZE];
+            int b;
+            while ((b = stream.read(buffer)) > -1) {
+                if (b > 0) {
+                    out.write(buffer, 0, b);
+                }
+            }
+
+            writeLine(out);
+            writeLine(out, "--" + boundary + "--");
+
+            stream.close();
+        }
+    }
+
+    private void writeLine(OutputStream out) throws Exception {
+        writeLine(out, null);
+    }
+
+    private void writeLine(OutputStream out, String s) throws Exception {
+        s = (s == null ? CRLF : s + CRLF);
+        out.write(s.getBytes("UTF-8"));
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.java?rev=1231731&r1=1231730&r2=1231731&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.java Sun Jan 15 19:14:37 2012
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.browser;
 
+import java.io.OutputStream;
 import java.math.BigInteger;
 import java.util.List;
 import java.util.Map;
@@ -57,33 +58,131 @@ public class ObjectServiceImpl extends A
     public String createDocument(String repositoryId, Properties properties, String folderId,
             ContentStream contentStream, VersioningState versioningState, List<String> policies, Acl addAces,
             Acl removeAces, ExtensionsData extension) {
-        // TODO Auto-generated method stub
-        return null;
+        // build URL
+        UrlBuilder url = (folderId != null ? getObjectUrl(repositoryId, folderId) : getRepositoryUrl(repositoryId));
+
+        // prepare form data
+        final FormDataWriter formData = new FormDataWriter(Constants.CMISACTION_CREATE_DOCUMENT, contentStream);
+        formData.addPropertiesParameters(properties);
+        formData.addParameter(Constants.PARAM_VERSIONIG_STATE, versioningState);
+        formData.addPoliciesParameters(policies);
+        formData.addAddAcesParameters(addAces);
+        formData.addRemoveAcesParameters(removeAces);
+
+        // send and parse
+        HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() {
+            public void write(OutputStream out) throws Exception {
+                formData.write(out);
+            }
+        });
+
+        Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset());
+        ObjectData newObj = JSONConverter.convertObject(json);
+
+        return (newObj == null ? null : newObj.getId());
     }
 
     public String createDocumentFromSource(String repositoryId, String sourceId, Properties properties,
             String folderId, VersioningState versioningState, List<String> policies, Acl addAces, Acl removeAces,
             ExtensionsData extension) {
-        // TODO Auto-generated method stub
-        return null;
+        // build URL
+        UrlBuilder url = (folderId != null ? getObjectUrl(repositoryId, folderId) : getRepositoryUrl(repositoryId));
+
+        // prepare form data
+        final FormDataWriter formData = new FormDataWriter(Constants.CMISACTION_CREATE_DOCUMENT_FROM_SOURCE);
+        formData.addParameter(Constants.PARAM_SOURCE_ID, sourceId);
+        formData.addPropertiesParameters(properties);
+        formData.addParameter(Constants.PARAM_VERSIONIG_STATE, versioningState);
+        formData.addPoliciesParameters(policies);
+        formData.addAddAcesParameters(addAces);
+        formData.addRemoveAcesParameters(removeAces);
+
+        // send and parse
+        HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() {
+            public void write(OutputStream out) throws Exception {
+                formData.write(out);
+            }
+        });
+
+        Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset());
+        ObjectData newObj = JSONConverter.convertObject(json);
+
+        return (newObj == null ? null : newObj.getId());
     }
 
     public String createFolder(String repositoryId, Properties properties, String folderId, List<String> policies,
             Acl addAces, Acl removeAces, ExtensionsData extension) {
-        // TODO Auto-generated method stub
-        return null;
+        // build URL
+        UrlBuilder url = getObjectUrl(repositoryId, folderId);
+
+        // prepare form data
+        final FormDataWriter formData = new FormDataWriter(Constants.CMISACTION_CREATE_FOLDER);
+        formData.addPropertiesParameters(properties);
+        formData.addPoliciesParameters(policies);
+        formData.addAddAcesParameters(addAces);
+        formData.addRemoveAcesParameters(removeAces);
+
+        // send and parse
+        HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() {
+            public void write(OutputStream out) throws Exception {
+                formData.write(out);
+            }
+        });
+
+        Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset());
+        ObjectData newObj = JSONConverter.convertObject(json);
+
+        return (newObj == null ? null : newObj.getId());
     }
 
     public String createRelationship(String repositoryId, Properties properties, List<String> policies, Acl addAces,
             Acl removeAces, ExtensionsData extension) {
-        // TODO Auto-generated method stub
-        return null;
+        // build URL
+        UrlBuilder url = getRepositoryUrl(repositoryId);
+
+        // prepare form data
+        final FormDataWriter formData = new FormDataWriter(Constants.CMISACTION_CREATE_RELATIONSHIP);
+        formData.addPropertiesParameters(properties);
+        formData.addPoliciesParameters(policies);
+        formData.addAddAcesParameters(addAces);
+        formData.addRemoveAcesParameters(removeAces);
+
+        // send and parse
+        HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() {
+            public void write(OutputStream out) throws Exception {
+                formData.write(out);
+            }
+        });
+
+        Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset());
+        ObjectData newObj = JSONConverter.convertObject(json);
+
+        return (newObj == null ? null : newObj.getId());
     }
 
     public String createPolicy(String repositoryId, Properties properties, String folderId, List<String> policies,
             Acl addAces, Acl removeAces, ExtensionsData extension) {
-        // TODO Auto-generated method stub
-        return null;
+        // build URL
+        UrlBuilder url = (folderId != null ? getObjectUrl(repositoryId, folderId) : getRepositoryUrl(repositoryId));
+
+        // prepare form data
+        final FormDataWriter formData = new FormDataWriter(Constants.CMISACTION_CREATE_POLICY);
+        formData.addPropertiesParameters(properties);
+        formData.addPoliciesParameters(policies);
+        formData.addAddAcesParameters(addAces);
+        formData.addRemoveAcesParameters(removeAces);
+
+        // send and parse
+        HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() {
+            public void write(OutputStream out) throws Exception {
+                formData.write(out);
+            }
+        });
+
+        Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset());
+        ObjectData newObj = JSONConverter.convertObject(json);
+
+        return (newObj == null ? null : newObj.getId());
     }
 
     public AllowableActions getAllowableActions(String repositoryId, String objectId, ExtensionsData extension) {
@@ -136,14 +235,30 @@ public class ObjectServiceImpl extends A
     }
 
     public Properties getProperties(String repositoryId, String objectId, String filter, ExtensionsData extension) {
-        // TODO Auto-generated method stub
-        return null;
+        // build URL
+        UrlBuilder url = getObjectUrl(repositoryId, objectId, Constants.SELECTOR_PROPERTIES);
+        url.addParameter(Constants.PARAM_FILTER, filter);
+
+        // read and parse
+        HttpUtils.Response resp = read(url);
+        Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset());
+
+        return JSONConverter.convertProperties(json);
     }
 
     public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
             BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
-        // TODO Auto-generated method stub
-        return null;
+        // build URL
+        UrlBuilder url = getObjectUrl(repositoryId, objectId, Constants.SELECTOR_RENDITIONS);
+        url.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
+        url.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
+        url.addParameter(Constants.PARAM_SKIP_COUNT, skipCount);
+
+        // read and parse
+        HttpUtils.Response resp = read(url);
+        List<Object> json = parseArray(resp.getStream(), resp.getCharset());
+
+        return JSONConverter.convertRenditions(json);
     }
 
     public ContentStream getContentStream(String repositoryId, String objectId, String streamId, BigInteger offset,
@@ -183,8 +298,19 @@ public class ObjectServiceImpl extends A
     }
 
     public void deleteObject(String repositoryId, String objectId, Boolean allVersions, ExtensionsData extension) {
-        // TODO Auto-generated method stub
+        // build URL
+        UrlBuilder url = getObjectUrl(repositoryId, objectId);
 
+        // prepare form data
+        final FormDataWriter formData = new FormDataWriter(Constants.CMISACTION_DELETE);
+        formData.addParameter(Constants.PARAM_ALL_VERSIONS, allVersions);
+
+        // send
+        post(url, formData.getContentType(), new HttpUtils.Output() {
+            public void write(OutputStream out) throws Exception {
+                formData.write(out);
+            }
+        });
     }
 
     public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions,

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/VersioningServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/VersioningServiceImpl.java?rev=1231731&r1=1231730&r2=1231731&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/VersioningServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/VersioningServiceImpl.java Sun Jan 15 19:14:37 2012
@@ -19,14 +19,20 @@
 package org.apache.chemistry.opencmis.client.bindings.spi.browser;
 
 import java.util.List;
+import java.util.Map;
 
 import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
+import org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils;
 import org.apache.chemistry.opencmis.commons.data.Acl;
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
 import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
 import org.apache.chemistry.opencmis.commons.data.Properties;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
+import org.apache.chemistry.opencmis.commons.impl.Constants;
+import org.apache.chemistry.opencmis.commons.impl.JSONConverter;
+import org.apache.chemistry.opencmis.commons.impl.ReturnVersion;
+import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
 import org.apache.chemistry.opencmis.commons.spi.Holder;
 import org.apache.chemistry.opencmis.commons.spi.VersioningService;
 
@@ -63,20 +69,51 @@ public class VersioningServiceImpl exten
     public ObjectData getObjectOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
             Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
             String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) {
-        // TODO Auto-generated method stub
-        return null;
+        // build URL
+        UrlBuilder url = getObjectUrl(repositoryId, objectId, Constants.SELECTOR_OBJECT);
+        url.addParameter(Constants.PARAM_FILTER, filter);
+        url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
+        url.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
+        url.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
+        url.addParameter(Constants.PARAM_POLICY_IDS, includePolicyIds);
+        url.addParameter(Constants.PARAM_ACL, includeAcl);
+        url.addParameter(Constants.PARAM_RETURN_VERSION,
+                (major == null || Boolean.FALSE.equals(major) ? ReturnVersion.LATEST : ReturnVersion.LASTESTMAJOR));
+
+        // read and parse
+        HttpUtils.Response resp = read(url);
+        Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset());
+
+        return JSONConverter.convertObject(json);
     }
 
     public Properties getPropertiesOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
             Boolean major, String filter, ExtensionsData extension) {
-        // TODO Auto-generated method stub
-        return null;
+        // build URL
+        UrlBuilder url = getObjectUrl(repositoryId, objectId, Constants.SELECTOR_PROPERTIES);
+        url.addParameter(Constants.PARAM_FILTER, filter);
+        url.addParameter(Constants.PARAM_RETURN_VERSION,
+                (major == null || Boolean.FALSE.equals(major) ? ReturnVersion.LATEST : ReturnVersion.LASTESTMAJOR));
+
+        // read and parse
+        HttpUtils.Response resp = read(url);
+        Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset());
+
+        return JSONConverter.convertProperties(json);
     }
 
     public List<ObjectData> getAllVersions(String repositoryId, String objectId, String versionSeriesId, String filter,
             Boolean includeAllowableActions, ExtensionsData extension) {
-        // TODO Auto-generated method stub
-        return null;
+        // build URL
+        UrlBuilder url = getObjectUrl(repositoryId, objectId, Constants.SELECTOR_VERSIONS);
+        url.addParameter(Constants.PARAM_FILTER, filter);
+        url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
+
+        // read and parse
+        HttpUtils.Response resp = read(url);
+        List<Object> json = parseArray(resp.getStream(), resp.getCharset());
+
+        return JSONConverter.convertObjects(json);
     }
 
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.java?rev=1231731&r1=1231730&r2=1231731&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.java Sun Jan 15 19:14:37 2012
@@ -138,6 +138,20 @@ public final class Constants {
     public static final String CMISACTION_REMOVE_POLICY = "removePolicy";
     public static final String CMISACTION_APPLY_ACL = "applyACL";
 
+    // browser binding control
+    public static final String CONTROL_CMISACTION = "cmisaction";
+    public static final String CONTROL_TRANSACTION = "transaction";
+    public static final String CONTROL_OBJECT_ID = "objectId";
+    public static final String CONTROL_PROP_ID = "propertyId";
+    public static final String CONTROL_PROP_VALUE = "propertyValue";
+    public static final String CONTROL_POLICY = "policy";
+    public static final String CONTROL_ADD_ACE_PRINCIPAL = "addACEPrincipal";
+    public static final String CONTROL_ADD_ACE_PERMISSION = "addACEPermission";
+    public static final String CONTROL_REMOVE_ACE_PRINCIPAL = "removeACEPrincipal";
+    public static final String CONTROL_REMOVE_ACE_PERMISSION = "removeACEPermission";
+    public static final String CONTROL_CONTENT_TYPE = "contenttype";
+    public static final String CONTROL_FILENAME = "filename";
+
     // parameter
     public static final String PARAM_ACL = "includeACL";
     public static final String PARAM_ALLOWABLE_ACTIONS = "includeAllowableActions";

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java?rev=1231731&r1=1231730&r2=1231731&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java Sun Jan 15 19:14:37 2012
@@ -1516,25 +1516,11 @@ public class JSONConverter {
         result.setProperties(convertProperties(getMap(json.get(JSON_OBJECT_PROPERTIES))));
         List<Object> jsonRelationships = getList(json.get(JSON_OBJECT_RELATIONSHIPS));
         if (jsonRelationships != null) {
-            List<ObjectData> relationships = new ArrayList<ObjectData>();
-            for (Object obj : jsonRelationships) {
-                ObjectData relationship = convertObject(getMap(obj));
-                if (relationship != null) {
-                    relationships.add(relationship);
-                }
-            }
-            result.setRelationships(relationships);
+            result.setRelationships(convertObjects(jsonRelationships));
         }
         List<Object> jsonRenditions = getList(json.get(JSON_OBJECT_RENDITIONS));
         if (jsonRenditions != null) {
-            List<RenditionData> renditions = new ArrayList<RenditionData>();
-            for (Object obj : jsonRenditions) {
-                RenditionData rendition = convertRendition(getMap(obj));
-                if (rendition != null) {
-                    renditions.add(rendition);
-                }
-            }
-            result.setRenditions(renditions);
+            result.setRenditions(convertRenditions(jsonRenditions));
         }
 
         // TODO
@@ -1545,6 +1531,25 @@ public class JSONConverter {
     }
 
     /**
+     * Converts an object.
+     */
+    public static List<ObjectData> convertObjects(List<Object> json) {
+        if (json == null) {
+            return null;
+        }
+
+        List<ObjectData> result = new ArrayList<ObjectData>();
+        for (Object obj : json) {
+            ObjectData relationship = convertObject(getMap(obj));
+            if (relationship != null) {
+                result.add(relationship);
+            }
+        }
+
+        return result;
+    }
+
+    /**
      * Converts an ACL.
      */
     public static Acl convertAcl(Map<String, Object> json, Boolean isExact) {
@@ -1870,6 +1875,26 @@ public class JSONConverter {
     }
 
     /**
+     * Converts a list of renditions.
+     */
+    public static List<RenditionData> convertRenditions(List<Object> json) {
+        if (json == null) {
+            return null;
+        }
+
+        List<RenditionData> result = new ArrayList<RenditionData>();
+
+        for (Object obj : json) {
+            RenditionData rendition = convertRendition(getMap(obj));
+            if (rendition != null) {
+                result.add(rendition);
+            }
+        }
+
+        return result;
+    }
+
+    /**
      * Converts a object list.
      */
     public static ObjectInFolderList convertObjectInFolderList(Map<String, Object> json) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeHelper.java?rev=1231731&r1=1231730&r2=1231731&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeHelper.java Sun Jan 15 19:14:37 2012
@@ -36,6 +36,8 @@ public class MimeHelper {
 
     public static final String DISPOSITION_ATTACHMENT = "attachment";
 
+    public static final String DISPOSITION_FORM_DATA_CONTENT = "form-data; name=\"content\"";
+    
     public static final String DISPOSITION_FILENAME = "filename";
 
     // RFC 2045
@@ -108,7 +110,7 @@ public class MimeHelper {
      * @param value the string to encode
      * @return the encoded string
      */
-    protected static String encodeRFC2231(String key, String value) {
+     protected static String encodeRFC2231(String key, String value) {
         StringBuilder buf = new StringBuilder();
         boolean encoded = encodeRFC2231value(value, buf);
         if (encoded) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/UrlBuilder.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/UrlBuilder.java?rev=1231731&r1=1231730&r2=1231731&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/UrlBuilder.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/UrlBuilder.java Sun Jan 15 19:14:37 2012
@@ -123,7 +123,7 @@ public class UrlBuilder {
             queryPart.append('&');
         }
         queryPart.append(name);
-        queryPart.append("=");
+        queryPart.append('=');
         try {
             queryPart.append(URLEncoder.encode(valueStr, "UTF-8"));
         } catch (UnsupportedEncodingException e) {

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=1231731&r1=1231730&r2=1231731&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 Sun Jan 15 19:14:37 2012
@@ -74,19 +74,6 @@ public class BrowserBindingUtils {
 
     public static final String ROOT_PATH_FRAGMENT = "root";
 
-    public static final String CONTROL_CMISACTION = "cmisaction";
-    public static final String CONTROL_TRANSACTION = "transaction";
-    public static final String CONTROL_OBJECT_ID = "objectid";
-    public static final String CONTROL_PROP_ID = "propertyid";
-    public static final String CONTROL_PROP_VALUE = "propertyvalue";
-    public static final String CONTROL_POLICY = "policy";
-    public static final String CONTROL_ADD_ACE_PRINCIPAL = "addACEPrincipal";
-    public static final String CONTROL_ADD_ACE_PERMISSION = "addACEPermission";
-    public static final String CONTROL_REMOVE_ACE_PRINCIPAL = "removeACEPrincipal";
-    public static final String CONTROL_REMOVE_ACE_PERMISSION = "removeACEPermission";
-    public static final String CONTROL_CONTENT_TYPE = "contenttype";
-    public static final String CONTROL_FILENAME = "filename";
-
     public static final String CONTEXT_OBJECT_ID = "org.apache.chemistry.opencmis.browserbinding.objectId";
     public static final String CONTEXT_OBJECT_TYPE_ID = "org.apache.chemistry.opencmis.browserbinding.objectTypeId";
     public static final String CONTEXT_BASETYPE_ID = "org.apache.chemistry.opencmis.browserbinding.basetypeId";
@@ -211,13 +198,14 @@ public class BrowserBindingUtils {
     }
 
     public static Properties createProperties(ControlParser controlParser, String typeId, TypeCache typeCache) {
-        List<String> propertyIds = controlParser.getValues(CONTROL_PROP_ID);
+        List<String> propertyIds = controlParser.getValues(Constants.CONTROL_PROP_ID);
         if (propertyIds == null) {
             return null;
         }
 
-        Map<Integer, String> singleValuePropertyMap = controlParser.getOneDimMap(CONTROL_PROP_VALUE);
-        Map<Integer, Map<Integer, String>> multiValuePropertyMap = controlParser.getTwoDimMap(CONTROL_PROP_VALUE);
+        Map<Integer, String> singleValuePropertyMap = controlParser.getOneDimMap(Constants.CONTROL_PROP_VALUE);
+        Map<Integer, Map<Integer, String>> multiValuePropertyMap = controlParser
+                .getTwoDimMap(Constants.CONTROL_PROP_VALUE);
 
         if (typeId == null) {
             // it's a create call -> find type id in properties
@@ -255,7 +243,7 @@ public class BrowserBindingUtils {
             if (singleValuePropertyMap.containsKey(i)) {
                 propertyData = createPropertyData(propDef, singleValuePropertyMap.get(i));
             } else if (multiValuePropertyMap.containsKey(i)) {
-                propertyData = createPropertyData(propDef, controlParser.getValues(CONTROL_PROP_VALUE, i));
+                propertyData = createPropertyData(propDef, controlParser.getValues(Constants.CONTROL_PROP_VALUE, i));
             } else {
                 propertyData = createPropertyData(propDef, null);
             }
@@ -347,11 +335,11 @@ public class BrowserBindingUtils {
     }
 
     public static List<String> createPolicies(ControlParser controlParser) {
-        return controlParser.getValues(CONTROL_POLICY);
+        return controlParser.getValues(Constants.CONTROL_POLICY);
     }
 
     public static Acl createAddAcl(ControlParser controlParser) {
-        List<String> principals = controlParser.getValues(CONTROL_ADD_ACE_PRINCIPAL);
+        List<String> principals = controlParser.getValues(Constants.CONTROL_ADD_ACE_PRINCIPAL);
         if (principals == null) {
             return null;
         }
@@ -361,7 +349,7 @@ public class BrowserBindingUtils {
         int i = 0;
         for (String principalId : principals) {
             aces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(principalId), controlParser
-                    .getValues(CONTROL_ADD_ACE_PERMISSION, i)));
+                    .getValues(Constants.CONTROL_ADD_ACE_PERMISSION, i)));
             i++;
         }
 
@@ -369,7 +357,7 @@ public class BrowserBindingUtils {
     }
 
     public static Acl createRemoveAcl(ControlParser controlParser) {
-        List<String> principals = controlParser.getValues(CONTROL_REMOVE_ACE_PRINCIPAL);
+        List<String> principals = controlParser.getValues(Constants.CONTROL_REMOVE_ACE_PRINCIPAL);
         if (principals == null) {
             return null;
         }
@@ -379,7 +367,7 @@ public class BrowserBindingUtils {
         int i = 0;
         for (String principalId : principals) {
             aces.add(new AccessControlEntryImpl(new AccessControlPrincipalDataImpl(principalId), controlParser
-                    .getValues(CONTROL_REMOVE_ACE_PERMISSION, i)));
+                    .getValues(Constants.CONTROL_REMOVE_ACE_PERMISSION, i)));
             i++;
         }
 
@@ -477,7 +465,7 @@ public class BrowserBindingUtils {
         if (clientToken != null) {
             response.getWriter().print(");");
         }
-        
+
         response.getWriter().flush();
     }
 

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=1231731&r1=1231730&r2=1231731&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 Sun Jan 15 19:14:37 2012
@@ -65,9 +65,6 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.ERROR_STACKTRACE;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CONTEXT_BASETYPE_ID;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CONTEXT_TRANSACTION;
-import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CONTROL_CMISACTION;
-import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CONTROL_OBJECT_ID;
-import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.CONTROL_TRANSACTION;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.JSON_MIME_TYPE;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.createCookieValue;
 import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.prepareContext;
@@ -336,9 +333,9 @@ public class CmisBrowserBindingServlet e
             } else if (METHOD_POST.equals(method)) {
                 POSTHttpServletRequestWrapper postRequest = new POSTHttpServletRequestWrapper(request);
 
-                String cmisaction = getStringParameter(postRequest, CONTROL_CMISACTION);
-                String objectId = getStringParameter(postRequest, CONTROL_OBJECT_ID);
-                String transaction = getStringParameter(postRequest, CONTROL_TRANSACTION);
+                String cmisaction = getStringParameter(postRequest, Constants.CONTROL_CMISACTION);
+                String objectId = getStringParameter(postRequest, Constants.CONTROL_OBJECT_ID);
+                String transaction = getStringParameter(postRequest, Constants.CONTROL_TRANSACTION);
 
                 if (cmisaction == null || cmisaction.length() == 0) {
                     throw new CmisNotSupportedException("Unknown action");

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=1231731&r1=1231730&r2=1231731&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 Sun Jan 15 19:14:37 2012
@@ -54,6 +54,22 @@ public class POSTHttpServletRequestWrapp
         if (isMultipart) {
             parameters = new HashMap<String, String[]>();
 
+            String query = request.getQueryString();
+            if (query != null) {
+                String[] nameValuePairs = query.split("&");
+                for (String nameValuePair : nameValuePairs) {
+                    if (nameValuePair.length() > Constants.PARAM_OBJECT_ID.length()
+                            && nameValuePair.toLowerCase().startsWith(Constants.PARAM_OBJECT_ID.toLowerCase())) {
+                        int x = nameValuePair.indexOf('=');
+                        if (x > -1 && x < nameValuePair.length() - 1) {
+                            String objectId = nameValuePair.substring(x + 1);
+                            parameters.put(Constants.PARAM_OBJECT_ID, new String[] { objectId });
+                            break;
+                        }
+                    }
+                }
+            }
+
             DiskFileItemFactory itemFactory = new DiskFileItemFactory();
             itemFactory.setSizeThreshold(memoryThreshold);
 
@@ -82,12 +98,12 @@ public class POSTHttpServletRequestWrapp
                 }
             }
 
-            String filenameControl = HttpUtils.getStringParameter(this, BrowserBindingUtils.CONTROL_FILENAME);
+            String filenameControl = HttpUtils.getStringParameter(this, Constants.CONTROL_FILENAME);
             if ((filenameControl) != null && (filenameControl.trim().length() > 0)) {
                 filename = filenameControl;
             }
 
-            String contentTypeControl = HttpUtils.getStringParameter(this, BrowserBindingUtils.CONTROL_CONTENT_TYPE);
+            String contentTypeControl = HttpUtils.getStringParameter(this, Constants.CONTROL_CONTENT_TYPE);
             if ((contentTypeControl != null) && (contentTypeControl.trim().length() > 0)) {
                 contentType = contentTypeControl;
             }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/InfoDialog.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/InfoDialog.java?rev=1231731&r1=1231730&r2=1231731&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/InfoDialog.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/InfoDialog.java Sun Jan 15 19:14:37 2012
@@ -25,6 +25,8 @@ import java.awt.Frame;
 import java.io.BufferedReader;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.util.Properties;
+import java.util.TreeSet;
 
 import javax.swing.BorderFactory;
 import javax.swing.BoxLayout;
@@ -69,6 +71,15 @@ public class InfoDialog extends JDialog 
 
         readme.append(loadText("/META-INF/README", "CMIS Workbench"));
         readme.append("\n---------------------------------------------------------\n");
+
+        readme.append("\nCurrent System Properties:\n\n");
+
+        Properties sysProps = System.getProperties();
+        for (Object key : new TreeSet<Object>(sysProps.keySet())) {
+            readme.append(key).append(" = ").append(sysProps.get(key)).append("\n");
+        }
+
+        readme.append("\n---------------------------------------------------------\n");
         readme.append(loadText("/META-INF/build-timestamp.txt", ""));
 
         JTextArea ta = new JTextArea(readme.toString());

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RandomInputStream.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RandomInputStream.java?rev=1231731&r1=1231730&r2=1231731&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RandomInputStream.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RandomInputStream.java Sun Jan 15 19:14:37 2012
@@ -85,7 +85,7 @@ public class RandomInputStream extends I
         for (int i = 0; i < len; i++) {
             int r = read();
             if (r == -1) {
-                return i;
+                return (i == 0 ? -1 : i);
             }
             b[off + i] = (byte) r;
         }



Mime
View raw message