Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/MultiFilingServiceImpl.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/MultiFilingServiceImpl.java?rev=1423147&r1=1423146&r2=1423147&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/MultiFilingServiceImpl.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/MultiFilingServiceImpl.java Mon Dec 17 21:12:52 2012 @@ -21,7 +21,7 @@ package org.apache.chemistry.opencmis.cl import java.io.OutputStream; import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession; -import org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils; +import org.apache.chemistry.opencmis.client.bindings.spi.http.Output; import org.apache.chemistry.opencmis.commons.data.ExtensionsData; import org.apache.chemistry.opencmis.commons.impl.Constants; import org.apache.chemistry.opencmis.commons.impl.UrlBuilder; @@ -50,7 +50,7 @@ public class MultiFilingServiceImpl exte formData.addParameter(Constants.PARAM_ALL_VERSIONS, allVersions); // send and parse - postAndConsume(url, formData.getContentType(), new HttpUtils.Output() { + postAndConsume(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -66,7 +66,7 @@ public class MultiFilingServiceImpl exte formData.addParameter(Constants.PARAM_FOLDER_ID, folderId); // send and parse - postAndConsume(url, formData.getContentType(), new HttpUtils.Output() { + postAndConsume(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); }
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/NavigationServiceImpl.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/NavigationServiceImpl.java?rev=1423147&r1=1423146&r2=1423147&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/NavigationServiceImpl.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/NavigationServiceImpl.java Mon Dec 17 21:12:52 2012 @@ -23,7 +23,7 @@ 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.client.bindings.spi.http.Response; import org.apache.chemistry.opencmis.commons.data.ExtensionsData; import org.apache.chemistry.opencmis.commons.data.ObjectData; import org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer; @@ -65,7 +65,7 @@ public class NavigationServiceImpl exten url.addParameter(Constants.PARAM_SUCCINCT, getSuccinctParameter()); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset()); TypeCache typeCache = new ClientTypeCacheImpl(repositoryId, this); @@ -87,7 +87,7 @@ public class NavigationServiceImpl exten url.addParameter(Constants.PARAM_SUCCINCT, getSuccinctParameter()); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); List<Object> json = parseArray(resp.getStream(), resp.getCharset()); TypeCache typeCache = new ClientTypeCacheImpl(repositoryId, this); @@ -109,7 +109,7 @@ public class NavigationServiceImpl exten url.addParameter(Constants.PARAM_SUCCINCT, getSuccinctParameter()); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); List<Object> json = parseArray(resp.getStream(), resp.getCharset()); TypeCache typeCache = new ClientTypeCacheImpl(repositoryId, this); @@ -130,7 +130,7 @@ public class NavigationServiceImpl exten url.addParameter(Constants.PARAM_SUCCINCT, getSuccinctParameter()); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); List<Object> json = parseArray(resp.getStream(), resp.getCharset()); TypeCache typeCache = new ClientTypeCacheImpl(repositoryId, this); @@ -145,7 +145,7 @@ public class NavigationServiceImpl exten url.addParameter(Constants.PARAM_SUCCINCT, getSuccinctParameter()); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset()); TypeCache typeCache = new ClientTypeCacheImpl(repositoryId, this); @@ -169,7 +169,7 @@ public class NavigationServiceImpl exten url.addParameter(Constants.PARAM_SUCCINCT, getSuccinctParameter()); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset()); TypeCache typeCache = new ClientTypeCacheImpl(repositoryId, this); 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=1423147&r1=1423146&r2=1423147&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 Mon Dec 17 21:12:52 2012 @@ -24,7 +24,8 @@ 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.client.bindings.spi.http.Output; +import org.apache.chemistry.opencmis.client.bindings.spi.http.Response; import org.apache.chemistry.opencmis.commons.PropertyIds; import org.apache.chemistry.opencmis.commons.data.Acl; import org.apache.chemistry.opencmis.commons.data.AllowableActions; @@ -76,7 +77,7 @@ public class ObjectServiceImpl extends A formData.addSuccinctFlag(getSuccinct()); // send and parse - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -108,7 +109,7 @@ public class ObjectServiceImpl extends A formData.addSuccinctFlag(getSuccinct()); // send and parse - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -137,7 +138,7 @@ public class ObjectServiceImpl extends A formData.addSuccinctFlag(getSuccinct()); // send and parse - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -166,7 +167,7 @@ public class ObjectServiceImpl extends A formData.addSuccinctFlag(getSuccinct()); // send and parse - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -195,7 +196,7 @@ public class ObjectServiceImpl extends A formData.addSuccinctFlag(getSuccinct()); // send and parse - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -224,7 +225,7 @@ public class ObjectServiceImpl extends A formData.addSuccinctFlag(getSuccinct()); // send and parse - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -244,7 +245,7 @@ public class ObjectServiceImpl extends A UrlBuilder url = getObjectUrl(repositoryId, objectId, Constants.SELECTOR_ALLOWABLEACTIONS); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset()); return JSONConverter.convertAllowableActions(json); @@ -264,7 +265,7 @@ public class ObjectServiceImpl extends A url.addParameter(Constants.PARAM_SUCCINCT, getSuccinctParameter()); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset()); TypeCache typeCache = new ClientTypeCacheImpl(repositoryId, this); @@ -286,7 +287,7 @@ public class ObjectServiceImpl extends A url.addParameter(Constants.PARAM_SUCCINCT, getSuccinctParameter()); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset()); TypeCache typeCache = new ClientTypeCacheImpl(repositoryId, this); @@ -301,7 +302,7 @@ public class ObjectServiceImpl extends A url.addParameter(Constants.PARAM_SUCCINCT, getSuccinctParameter()); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset()); if (getSuccinct()) { @@ -321,7 +322,7 @@ public class ObjectServiceImpl extends A url.addParameter(Constants.PARAM_SKIP_COUNT, skipCount); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); List<Object> json = parseArray(resp.getStream(), resp.getCharset()); return JSONConverter.convertRenditions(json); @@ -336,7 +337,7 @@ public class ObjectServiceImpl extends A url.addParameter(Constants.PARAM_STREAM_ID, streamId); // get the content - HttpUtils.Response resp = HttpUtils.invokeGET(url, getSession(), offset, length); + Response resp = getHttpInvoker().invokeGET(url, getSession(), offset, length); // check response code if ((resp.getResponseCode() != 200) && (resp.getResponseCode() != 206)) { @@ -368,7 +369,7 @@ public class ObjectServiceImpl extends A formData.addSuccinctFlag(getSuccinct()); // send and parse - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -407,7 +408,7 @@ public class ObjectServiceImpl extends A formData.removeSecondaryTypeIds(removeSecondaryTypeIds); // send and parse - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -435,7 +436,7 @@ public class ObjectServiceImpl extends A formData.addSuccinctFlag(getSuccinct()); // send and parse - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -459,7 +460,7 @@ public class ObjectServiceImpl extends A formData.addParameter(Constants.PARAM_ALL_VERSIONS, allVersions); // send - postAndConsume(url, formData.getContentType(), new HttpUtils.Output() { + postAndConsume(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -478,7 +479,7 @@ public class ObjectServiceImpl extends A formData.addParameter(Constants.PARAM_CONTINUE_ON_FAILURE, continueOnFailure); // send - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -509,7 +510,7 @@ public class ObjectServiceImpl extends A formData.addSuccinctFlag(getSuccinct()); // send and parse - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -546,7 +547,7 @@ public class ObjectServiceImpl extends A formData.addSuccinctFlag(getSuccinct()); // send and parse - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -582,7 +583,7 @@ public class ObjectServiceImpl extends A formData.addSuccinctFlag(getSuccinct()); // send and parse - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/PolicyServiceImpl.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/PolicyServiceImpl.java?rev=1423147&r1=1423146&r2=1423147&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/PolicyServiceImpl.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/PolicyServiceImpl.java Mon Dec 17 21:12:52 2012 @@ -23,7 +23,8 @@ import java.util.Collections; import java.util.List; import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession; -import org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils; +import org.apache.chemistry.opencmis.client.bindings.spi.http.Output; +import org.apache.chemistry.opencmis.client.bindings.spi.http.Response; import org.apache.chemistry.opencmis.commons.data.ExtensionsData; import org.apache.chemistry.opencmis.commons.data.ObjectData; import org.apache.chemistry.opencmis.commons.impl.Constants; @@ -53,7 +54,7 @@ public class PolicyServiceImpl extends A formData.addPoliciesParameters(Collections.singletonList(policyId)); // send - postAndConsume(url, formData.getContentType(), new HttpUtils.Output() { + postAndConsume(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -69,7 +70,7 @@ public class PolicyServiceImpl extends A formData.addPoliciesParameters(Collections.singletonList(policyId)); // send - postAndConsume(url, formData.getContentType(), new HttpUtils.Output() { + postAndConsume(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -84,7 +85,7 @@ public class PolicyServiceImpl extends A url.addParameter(Constants.PARAM_SUCCINCT, getSuccinctParameter()); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); List<Object> json = parseArray(resp.getStream(), resp.getCharset()); TypeCache typeCache = new ClientTypeCacheImpl(repositoryId, this); Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RelationshipServiceImpl.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/RelationshipServiceImpl.java?rev=1423147&r1=1423146&r2=1423147&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RelationshipServiceImpl.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RelationshipServiceImpl.java Mon Dec 17 21:12:52 2012 @@ -22,7 +22,7 @@ import java.math.BigInteger; 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.client.bindings.spi.http.Response; import org.apache.chemistry.opencmis.commons.data.ExtensionsData; import org.apache.chemistry.opencmis.commons.data.ObjectList; import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection; @@ -59,7 +59,7 @@ public class RelationshipServiceImpl ext url.addParameter(Constants.PARAM_SUCCINCT, getSuccinctParameter()); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset()); TypeCache typeCache = new ClientTypeCacheImpl(repositoryId, this); Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RepositoryServiceImpl.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/RepositoryServiceImpl.java?rev=1423147&r1=1423146&r2=1423147&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RepositoryServiceImpl.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RepositoryServiceImpl.java Mon Dec 17 21:12:52 2012 @@ -24,7 +24,8 @@ 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.client.bindings.spi.http.Output; +import org.apache.chemistry.opencmis.client.bindings.spi.http.Response; import org.apache.chemistry.opencmis.commons.data.ExtensionsData; import org.apache.chemistry.opencmis.commons.data.RepositoryInfo; import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition; @@ -91,7 +92,7 @@ public class RepositoryServiceImpl exten url.addParameter(Constants.PARAM_SKIP_COUNT, skipCount); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset()); return JSONConverter.convertTypeChildren(json); @@ -106,7 +107,7 @@ public class RepositoryServiceImpl exten url.addParameter(Constants.PARAM_PROPERTY_DEFINITIONS, includePropertyDefinitions); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); List<Object> json = parseArray(resp.getStream(), resp.getCharset()); return JSONConverter.convertTypeDescendants(json); @@ -123,7 +124,7 @@ public class RepositoryServiceImpl exten } // send - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -145,7 +146,7 @@ public class RepositoryServiceImpl exten } // send - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -165,7 +166,7 @@ public class RepositoryServiceImpl exten formData.addParameter(Constants.CONTROL_TYPE_ID, typeId); // send - postAndConsume(url, formData.getContentType(), new HttpUtils.Output() { + postAndConsume(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } 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=1423147&r1=1423146&r2=1423147&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 Mon Dec 17 21:12:52 2012 @@ -23,7 +23,8 @@ 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.client.bindings.spi.http.Output; +import org.apache.chemistry.opencmis.client.bindings.spi.http.Response; import org.apache.chemistry.opencmis.commons.data.Acl; import org.apache.chemistry.opencmis.commons.data.ContentStream; import org.apache.chemistry.opencmis.commons.data.ExtensionsData; @@ -66,7 +67,7 @@ public class VersioningServiceImpl exten formData.addSuccinctFlag(getSuccinct()); // send and parse - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -89,7 +90,7 @@ public class VersioningServiceImpl exten final FormDataWriter formData = new FormDataWriter(Constants.CMISACTION_CANCEL_CHECK_OUT); // send - postAndConsume(url, formData.getContentType(), new HttpUtils.Output() { + postAndConsume(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -118,7 +119,7 @@ public class VersioningServiceImpl exten formData.addSuccinctFlag(getSuccinct()); // send and parse - HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() { + Response resp = post(url, formData.getContentType(), new Output() { public void write(OutputStream out) throws Exception { formData.write(out); } @@ -149,7 +150,7 @@ public class VersioningServiceImpl exten url.addParameter(Constants.PARAM_SUCCINCT, getSuccinctParameter()); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset()); TypeCache typeCache = new ClientTypeCacheImpl(repositoryId, this); @@ -167,7 +168,7 @@ public class VersioningServiceImpl exten url.addParameter(Constants.PARAM_SUCCINCT, getSuccinctParameter()); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset()); if (getSuccinct()) { @@ -187,7 +188,7 @@ public class VersioningServiceImpl exten url.addParameter(Constants.PARAM_SUCCINCT, getSuccinctParameter()); // read and parse - HttpUtils.Response resp = read(url); + Response resp = read(url); List<Object> json = parseArray(resp.getStream(), resp.getCharset()); TypeCache typeCache = new ClientTypeCacheImpl(repositoryId, this); Added: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.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/http/DefaultHttpInvoker.java?rev=1423147&view=auto ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java (added) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java Mon Dec 17 21:12:52 2012 @@ -0,0 +1,198 @@ +package org.apache.chemistry.opencmis.client.bindings.spi.http; + +import java.io.BufferedOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.math.BigInteger; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.List; +import java.util.Map; +import java.util.zip.GZIPOutputStream; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLSocketFactory; + +import org.apache.chemistry.opencmis.client.bindings.impl.ClientVersion; +import org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingsHelper; +import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession; +import org.apache.chemistry.opencmis.commons.SessionParameter; +import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException; +import org.apache.chemistry.opencmis.commons.impl.UrlBuilder; +import org.apache.chemistry.opencmis.commons.spi.AuthenticationProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DefaultHttpInvoker implements HttpInvoker { + + private static final Logger LOG = LoggerFactory.getLogger(DefaultHttpInvoker.class); + + private static final int BUFFER_SIZE = 2 * 1024 * 1024; + + public DefaultHttpInvoker() { + } + + public Response invokeGET(UrlBuilder url, BindingSession session) { + return invoke(url, "GET", null, null, null, session, null, null); + } + + public Response invokeGET(UrlBuilder url, BindingSession session, BigInteger offset, BigInteger length) { + return invoke(url, "GET", null, null, null, session, offset, length); + } + + public Response invokePOST(UrlBuilder url, String contentType, Output writer, BindingSession session) { + return invoke(url, "POST", contentType, null, writer, session, null, null); + } + + public Response invokePUT(UrlBuilder url, String contentType, Map<String, String> headers, Output writer, + BindingSession session) { + return invoke(url, "PUT", contentType, headers, writer, session, null, null); + } + + public Response invokeDELETE(UrlBuilder url, BindingSession session) { + return invoke(url, "DELETE", null, null, null, session, null, null); + } + + private Response invoke(UrlBuilder url, String method, String contentType, Map<String, String> headers, + Output writer, BindingSession session, BigInteger offset, BigInteger length) { + try { + // log before connect + if (LOG.isDebugEnabled()) { + LOG.debug(method + " " + url); + } + + // connect + HttpURLConnection conn = (HttpURLConnection) (new URL(url.toString())).openConnection(); + conn.setRequestMethod(method); + conn.setDoInput(true); + conn.setDoOutput(writer != null); + conn.setAllowUserInteraction(false); + conn.setUseCaches(false); + conn.setRequestProperty("User-Agent", ClientVersion.OPENCMIS_CLIENT); + + // timeouts + int connectTimeout = session.get(SessionParameter.CONNECT_TIMEOUT, -1); + if (connectTimeout >= 0) { + conn.setConnectTimeout(connectTimeout); + } + + int readTimeout = session.get(SessionParameter.READ_TIMEOUT, -1); + if (readTimeout >= 0) { + conn.setReadTimeout(readTimeout); + } + + // set content type + if (contentType != null) { + conn.setRequestProperty("Content-Type", contentType); + } + // set other headers + if (headers != null) { + for (Map.Entry<String, String> header : headers.entrySet()) { + conn.addRequestProperty(header.getKey(), header.getValue()); + } + } + + // authenticate + AuthenticationProvider authProvider = CmisBindingsHelper.getAuthenticationProvider(session); + if (authProvider != null) { + Map<String, List<String>> httpHeaders = authProvider.getHTTPHeaders(url.toString()); + if (httpHeaders != null) { + for (Map.Entry<String, List<String>> header : httpHeaders.entrySet()) { + if (header.getValue() != null) { + for (String value : header.getValue()) { + conn.addRequestProperty(header.getKey(), value); + } + } + } + } + + if (conn instanceof HttpsURLConnection) { + SSLSocketFactory sf = authProvider.getSSLSocketFactory(); + if (sf != null) { + ((HttpsURLConnection) conn).setSSLSocketFactory(sf); + } + + HostnameVerifier hv = authProvider.getHostnameVerifier(); + if (hv != null) { + ((HttpsURLConnection) conn).setHostnameVerifier(hv); + } + } + } + + // range + if ((offset != null) || (length != null)) { + StringBuilder sb = new StringBuilder("bytes="); + + if ((offset == null) || (offset.signum() == -1)) { + offset = BigInteger.ZERO; + } + + sb.append(offset.toString()); + sb.append("-"); + + if ((length != null) && (length.signum() == 1)) { + sb.append(offset.add(length.subtract(BigInteger.ONE)).toString()); + } + + conn.setRequestProperty("Range", sb.toString()); + } + + // compression + Object compression = session.get(SessionParameter.COMPRESSION); + if ((compression != null) && Boolean.parseBoolean(compression.toString())) { + conn.setRequestProperty("Accept-Encoding", "gzip,deflate"); + } + + // locale + if (session.get(CmisBindingsHelper.ACCEPT_LANGUAGE) instanceof String) { + conn.setRequestProperty("Accept-Language", session.get(CmisBindingsHelper.ACCEPT_LANGUAGE).toString()); + } + + // send data + if (writer != null) { + conn.setChunkedStreamingMode((64 * 1024) - 1); + + OutputStream connOut = null; + + Object clientCompression = session.get(SessionParameter.CLIENT_COMPRESSION); + if ((clientCompression != null) && Boolean.parseBoolean(clientCompression.toString())) { + conn.setRequestProperty("Content-Encoding", "gzip"); + connOut = new GZIPOutputStream(conn.getOutputStream(), 4096); + } else { + connOut = conn.getOutputStream(); + } + + OutputStream out = new BufferedOutputStream(connOut, BUFFER_SIZE); + writer.write(out); + out.flush(); + } + + // connect + conn.connect(); + + // get stream, if present + int respCode = conn.getResponseCode(); + InputStream inputStream = null; + if ((respCode == 200) || (respCode == 201) || (respCode == 203) || (respCode == 206)) { + inputStream = conn.getInputStream(); + } + + // log after connect + if (LOG.isTraceEnabled()) { + LOG.trace(method + " " + url + " > Headers: " + conn.getHeaderFields()); + } + + // forward response HTTP headers + if (authProvider != null) { + authProvider.putResponseHeaders(url.toString(), respCode, conn.getHeaderFields()); + } + + // get the response + return new Response(respCode, conn.getResponseMessage(), conn.getHeaderFields(), inputStream, + conn.getErrorStream()); + } catch (Exception e) { + throw new CmisConnectionException("Cannot access " + url + ": " + e.getMessage(), e); + } + } +} Added: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/HttpInvoker.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/http/HttpInvoker.java?rev=1423147&view=auto ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/HttpInvoker.java (added) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/HttpInvoker.java Mon Dec 17 21:12:52 2012 @@ -0,0 +1,39 @@ +package org.apache.chemistry.opencmis.client.bindings.spi.http; + +import java.math.BigInteger; +import java.util.Map; + +import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession; +import org.apache.chemistry.opencmis.commons.impl.UrlBuilder; + +/** + * HTTP Invoker Interface. + */ +public interface HttpInvoker { + + /** + * Executes a HTTP GET request. + */ + Response invokeGET(UrlBuilder url, BindingSession session); + + /** + * Executes a HTTP GET request. + */ + Response invokeGET(UrlBuilder url, BindingSession session, BigInteger offset, BigInteger length); + + /** + * Executes a HTTP POST request. + */ + Response invokePOST(UrlBuilder url, String contentType, Output writer, BindingSession session); + + /** + * Executes a HTTP PUT request. + */ + Response invokePUT(UrlBuilder url, String contentType, Map<String, String> headers, Output writer, + BindingSession session); + + /** + * Executes a HTTP DELETE request. + */ + Response invokeDELETE(UrlBuilder url, BindingSession session); +} Added: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Output.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/http/Output.java?rev=1423147&view=auto ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Output.java (added) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Output.java Mon Dec 17 21:12:52 2012 @@ -0,0 +1,10 @@ +package org.apache.chemistry.opencmis.client.bindings.spi.http; + +import java.io.OutputStream; + +/** + * Output interface. + */ +public interface Output { + void write(OutputStream out) throws Exception; +} \ No newline at end of file Added: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.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/http/Response.java?rev=1423147&view=auto ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.java (added) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.java Mon Dec 17 21:12:52 2012 @@ -0,0 +1,220 @@ +package org.apache.chemistry.opencmis.client.bindings.spi.http; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.math.BigInteger; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.zip.GZIPInputStream; +import java.util.zip.Inflater; +import java.util.zip.InflaterInputStream; + +import org.apache.chemistry.opencmis.commons.impl.Base64; + +/** + * HTTP Response. + */ +public class Response { + private final int responseCode; + private final String responseMessage; + private final Map<String, List<String>> headers; + private InputStream stream; + private String errorContent; + private BigInteger length; + private String charset; + + public Response(int responseCode, String responseMessage, Map<String, List<String>> headers, + InputStream responseStream, InputStream errorStream) { + this.responseCode = responseCode; + this.responseMessage = responseMessage; + stream = responseStream; + + this.headers = new HashMap<String, List<String>>(); + if (headers != null) { + for (Map.Entry<String, List<String>> e : headers.entrySet()) { + this.headers.put(e.getKey() == null ? null : e.getKey().toLowerCase(), e.getValue()); + } + } + + // determine charset + charset = "UTF-8"; + String contentType = getContentTypeHeader(); + if (contentType != null) { + String[] parts = contentType.split(";"); + for (int i = 1; i < parts.length; i++) { + String part = parts[i].trim().toLowerCase(); + if (part.startsWith("charset")) { + int x = part.indexOf('='); + charset = part.substring(x + 1).trim(); + break; + } + } + } + + // if there is an error page, get it + if (errorStream != null) { + if (contentType != null) { + String contentTypeLower = contentType.toLowerCase().split(";")[0]; + if (contentTypeLower.startsWith("text/") || contentTypeLower.endsWith("+xml") + || contentTypeLower.startsWith("application/xml") + || contentTypeLower.startsWith("application/json")) { + StringBuilder sb = new StringBuilder(); + + try { + String encoding = getContentEncoding(); + if (encoding != null) { + if (encoding.toLowerCase().trim().equals("gzip")) { + try { + errorStream = new GZIPInputStream(errorStream, 4096); + } catch (IOException e) { + } + } else if (encoding.toLowerCase().trim().equals("deflate")) { + errorStream = new InflaterInputStream(errorStream, new Inflater(true), 4096); + } + } + + InputStreamReader reader = new InputStreamReader(errorStream, charset); + char[] buffer = new char[4096]; + int b; + while ((b = reader.read(buffer)) > -1) { + sb.append(buffer, 0, b); + } + reader.close(); + + errorContent = sb.toString(); + } catch (IOException e) { + errorContent = "Unable to retrieve content: " + e.getMessage(); + } + } + } else { + try { + errorStream.close(); + } catch (IOException e) { + } + } + + if (responseStream != null) { + try { + responseStream.close(); + } catch (IOException e) { + } + } + + return; + } + + // get the stream length + String lengthStr = getHeader("Content-Length"); + if (lengthStr != null) { + try { + length = new BigInteger(lengthStr); + } catch (NumberFormatException e) { + } + } + + if (stream != null) { + String encoding = getContentEncoding(); + if (encoding != null) { + if (encoding.toLowerCase().trim().equals("gzip")) { + // if the stream is gzip encoded, decode it + length = null; + try { + stream = new GZIPInputStream(stream, 4096); + } catch (IOException e) { + errorContent = e.getMessage(); + stream = null; + try { + responseStream.close(); + } catch (IOException ec) { + } + } + } else if (encoding.toLowerCase().trim().equals("deflate")) { + // if the stream is deflate encoded, decode it + length = null; + stream = new InflaterInputStream(stream, new Inflater(true), 4096); + } + } + + String transferEncoding = getContentTransferEncoding(); + if ((stream != null) && (transferEncoding != null) + && (transferEncoding.toLowerCase().trim().equals("base64"))) { + // if the stream is base64 encoded, decode it + length = null; + stream = new Base64.InputStream(stream); + } + } + } + + public int getResponseCode() { + return responseCode; + } + + public String getResponseMessage() { + return responseMessage; + } + + public Map<String, List<String>> getHeaders() { + return headers; + } + + public String getHeader(String name) { + List<String> list = headers.get(name.toLowerCase(Locale.US)); + if ((list == null) || (list.isEmpty())) { + return null; + } + + return list.get(0); + } + + public String getContentTypeHeader() { + return getHeader("Content-Type"); + } + + public BigInteger getContentLengthHeader() { + String lengthStr = getHeader("Content-Length"); + if (lengthStr == null) { + return null; + } + + try { + return new BigInteger(lengthStr); + } catch (NumberFormatException e) { + return null; + } + } + + public String getLocactionHeader() { + return getHeader("Location"); + } + + public String getContentLocactionHeader() { + return getHeader("Content-Location"); + } + + public String getContentTransferEncoding() { + return getHeader("Content-Transfer-Encoding"); + } + + public String getContentEncoding() { + return getHeader("Content-Encoding"); + } + + public String getCharset() { + return charset; + } + + public BigInteger getContentLength() { + return length; + } + + public InputStream getStream() { + return stream; + } + + public String getErrorContent() { + return errorContent; + } +} \ No newline at end of file Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java?rev=1423147&r1=1423146&r2=1423147&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java Mon Dec 17 21:12:52 2012 @@ -79,11 +79,13 @@ public final class SessionParameter { // --- connection --- + public static final String HTTP_INVOKER_CLASS = "org.apache.chemistry.opencmis.binding.httpinvoker.classname"; + public static final String COMPRESSION = "org.apache.chemistry.opencmis.binding.compression"; public static final String CLIENT_COMPRESSION = "org.apache.chemistry.opencmis.binding.clientcompression"; public static final String COOKIES = "org.apache.chemistry.opencmis.binding.cookies"; - + public static final String HEADER = "org.apache.chemistry.opencmis.binding.header"; public static final String CONNECT_TIMEOUT = "org.apache.chemistry.opencmis.binding.connecttimeout"; Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.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/server/AbstractCmisService.java?rev=1423147&r1=1423146&r2=1423147&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java Mon Dec 17 21:12:52 2012 @@ -458,11 +458,12 @@ public abstract class AbstractCmisServic * <b>Implementation Hints:</b> * <ul> * <li>Bindings: AtomPub, Web Services, Browser, Local</li> - * <li>Implementation is optional.</li> + * <li>Implementation is optional. Convenience implementation is present.</li> * </ul> */ public AllowableActions getAllowableActions(String repositoryId, String objectId, ExtensionsData extension) { - throw new CmisNotSupportedException("Not supported!"); + return getObject(repositoryId, objectId, "cmi:objectId", true, IncludeRelationships.NONE, "cmis:none", false, + false, extension).getAllowableActions(); } /** @@ -487,11 +488,12 @@ public abstract class AbstractCmisServic * <b>Implementation Hints:</b> * <ul> * <li>Bindings: Web Services, Browser, Local</li> - * <li>Implementation is optional.</li> + * <li>Implementation is optional. Convenience implementation is present.</li> * </ul> */ public Properties getProperties(String repositoryId, String objectId, String filter, ExtensionsData extension) { - throw new CmisNotSupportedException("Not supported!"); + return getObject(repositoryId, objectId, filter, false, IncludeRelationships.NONE, "cmis:none", false, false, + extension).getProperties(); } /** @@ -753,12 +755,15 @@ public abstract class AbstractCmisServic * <b>Implementation Hints:</b> * <ul> * <li>Bindings: Web Services, Local</li> - * <li>Implementation is optional.</li> + * <li>Implementation is optional. Convenience implementation is present, if + * {@link #getObjectOfLatestVersion(String, String, String, Boolean, String, Boolean, IncludeRelationships, String, Boolean, Boolean, ExtensionsData)} + * is implemented.</li> * </ul> */ public Properties getPropertiesOfLatestVersion(String repositoryId, String objectId, String versionSeriesId, Boolean major, String filter, ExtensionsData extension) { - throw new CmisNotSupportedException("Not supported!"); + return getObjectOfLatestVersion(repositoryId, objectId, versionSeriesId, major, filter, false, + IncludeRelationships.NONE, "cmis:none", false, false, extension).getProperties(); } /**
