Return-Path: X-Original-To: apmail-chemistry-dev-archive@www.apache.org Delivered-To: apmail-chemistry-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 71F5B17B5C for ; Thu, 9 Apr 2015 08:50:34 +0000 (UTC) Received: (qmail 56826 invoked by uid 500); 9 Apr 2015 08:50:12 -0000 Delivered-To: apmail-chemistry-dev-archive@chemistry.apache.org Received: (qmail 56765 invoked by uid 500); 9 Apr 2015 08:50:12 -0000 Mailing-List: contact dev-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list dev@chemistry.apache.org Received: (qmail 56753 invoked by uid 99); 9 Apr 2015 08:50:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Apr 2015 08:50:12 +0000 Date: Thu, 9 Apr 2015 08:50:12 +0000 (UTC) From: =?utf-8?Q?Florian_M=C3=BCller_=28JIRA=29?= To: dev@chemistry.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CMIS-906) doc.getContentStreamLength() returns the length of whole content even it is partial retrieved MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CMIS-906?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:all-tabpanel ] Florian M=C3=BCller updated CMIS-906: -------------------------------- Description:=20 I have a test to just retrieve partial content: {code:java} public void getContentRange() throws IOException{ =09 byte[] content =3D "Hello World, this is for contentstream range tes= t!".getBytes(); =20 =09 InputStream stream =3D new ByteArrayInputStream(content); ContentStream contentStream =3D session.getObjectFactory().createCo= ntentStream("hello.txt", content.length, "text/plain", stream); =09 =20 // (minimal set: name and object type id) Map properties =3D new HashMap(); properties.put(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_DOCUMENT= .value()); properties.put(PropertyIds.NAME, "hello"); =20 Document doc =3D this.scratchFolder.createDocument(properties, cont= entStream, VersioningState.MAJOR); =20 ContentStream retrieved =3D doc.getContentStream("0", BigInteger.v= alueOf(5), BigInteger.valueOf(5)); System.out.println("streamlength: " + doc.getContentStreamLength())= ; =09} {code} The test only retrieve from position 5, length 5 of contentstream, but the = {{doc.getContentStreamlength()}} actually return 50 (the length of whole oc= ntent). On server side implmentation, we actually set the length to 5: ContentStream [filename=3Dhello.txt, length=3D5, MIME type=3Dtext/plain, ha= s stream=3Dtrue][extensions=3Dnull] I traced the client.bindings.spi.atompub.ObjectServiceImple, the response h= eader is: {noformat} {cache-control=3D[private, max-age=3D0], content-type=3D[text/plain], null= =3D[HTTP/1.1 206 Partial Content], transfer-encoding=3D[chunked], content-d= isposition=3D[attachment; filename=3Dhello.txt], content-language=3D[en-US]= , server=3D[Apache-Chemistry-OpenCMIS/1.0.0-SNAPSHOT], date=3D[Thu, 09 Apr = 2015 06:43:24 GMT], content-range=3D[bytes 5-9/*]} {noformat} The code set the length using {{result.setLength(resp.getContentLength());}= } Is this a bug?=20 was: I have a test to just retrieve partial content: public void getContentRange() throws IOException{ =09 byte[] content =3D "Hello World, this is for contentstream range tes= t!".getBytes(); =20 =09 InputStream stream =3D new ByteArrayInputStream(content); ContentStream contentStream =3D session.getObjectFactory().createCo= ntentStream("hello.txt", content.length, "text/plain", stream); =09 =20 // (minimal set: name and object type id) Map properties =3D new HashMap(); properties.put(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_DOCUMENT= .value()); properties.put(PropertyIds.NAME, "hello"); =20 Document doc =3D this.scratchFolder.createDocument(properties, cont= entStream, VersioningState.MAJOR); =20 ContentStream retrieved =3D doc.getContentStream("0", BigInteger.v= alueOf(5), BigInteger.valueOf(5)); System.out.println("streamlength: " + doc.getContentStreamLength())= ; =09} The test only retrieve from position 5, length 5 of contentstream, but the = doc.getContentStreamlength() actually return 50( the length of whole ocnten= t). On server side implmentation, we actually set the length to 5: ContentStream [filename=3Dhello.txt, length=3D5, MIME type=3Dtext/plain, ha= s stream=3Dtrue][extensions=3Dnull] I traced the client.bindings.spi.atompub.ObjectServiceImple, the response h= eader is: {cache-control=3D[private, max-age=3D0], content-type=3D[text/plain], null= =3D[HTTP/1.1 206 Partial Content], transfer-encoding=3D[chunked], content-d= isposition=3D[attachment; filename=3Dhello.txt], content-language=3D[en-US]= , server=3D[Apache-Chemistry-OpenCMIS/1.0.0-SNAPSHOT], date=3D[Thu, 09 Apr = 2015 06:43:24 GMT], content-range=3D[bytes 5-9/*]} The code set the length using result.setLength(resp.getContentLength()); Is this a bug?=20 > doc.getContentStreamLength() returns the length of whole content even it = is partial retrieved > -------------------------------------------------------------------------= -------------------- > > Key: CMIS-906 > URL: https://issues.apache.org/jira/browse/CMIS-906 > Project: Chemistry > Issue Type: Bug > Components: opencmis-client-bindings > Affects Versions: OpenCMIS 0.13.0 > Environment: WIN > Reporter: James Li > Priority: Minor > > I have a test to just retrieve partial content: > {code:java} > public void getContentRange() throws IOException{ > =09 byte[] content =3D "Hello World, this is for contentstream range t= est!".getBytes(); =20 > =09 InputStream stream =3D new ByteArrayInputStream(content); > ContentStream contentStream =3D session.getObjectFactory().create= ContentStream("hello.txt", content.length, "text/plain", stream); > =09 =20 > // (minimal set: name and object type id) > Map properties =3D new HashMap(); > properties.put(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_DOCUME= NT.value()); > properties.put(PropertyIds.NAME, "hello"); > =20 > Document doc =3D this.scratchFolder.createDocument(properties, co= ntentStream, VersioningState.MAJOR); > =20 > ContentStream retrieved =3D doc.getContentStream("0", BigInteger= .valueOf(5), BigInteger.valueOf(5)); > System.out.println("streamlength: " + doc.getContentStreamLength(= )); > =09} > {code} > The test only retrieve from position 5, length 5 of contentstream, but th= e {{doc.getContentStreamlength()}} actually return 50 (the length of whole = ocntent). > On server side implmentation, we actually set the length to 5: > ContentStream [filename=3Dhello.txt, length=3D5, MIME type=3Dtext/plain, = has stream=3Dtrue][extensions=3Dnull] > I traced the client.bindings.spi.atompub.ObjectServiceImple, the response= header is: > {noformat} > {cache-control=3D[private, max-age=3D0], content-type=3D[text/plain], nul= l=3D[HTTP/1.1 206 Partial Content], transfer-encoding=3D[chunked], content-= disposition=3D[attachment; filename=3Dhello.txt], content-language=3D[en-US= ], server=3D[Apache-Chemistry-OpenCMIS/1.0.0-SNAPSHOT], date=3D[Thu, 09 Apr= 2015 06:43:24 GMT], content-range=3D[bytes 5-9/*]} > {noformat} > The code set the length using {{result.setLength(resp.getContentLength())= ;}} > Is this a bug?=20 -- This message was sent by Atlassian JIRA (v6.3.4#6332)