Loading src/com/owncloud/android/lib/common/method/GzipedPropfind.java 0 → 100644 +64 −0 Original line number Diff line number Diff line package com.owncloud.android.lib.common.method; import org.apache.jackrabbit.webdav.client.methods.PropFindMethod; import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; import org.apache.jackrabbit.webdav.xml.DomUtil; import org.w3c.dom.Document; import org.xml.sax.SAXException; import java.io.IOException; import java.util.zip.GZIPInputStream; import javax.xml.parsers.ParserConfigurationException; public class GzipedPropfind extends PropFindMethod { public GzipedPropfind(String uri) throws IOException { super(uri); } @Override public Document getResponseBodyAsDocument() throws IOException { /*if ( super.responseDocument != null) { // response has already been read return super.responseDocument; }*/ GZIPInputStream in = null; in = new GZIPInputStream(getResponseBodyAsStream()); //InputStream in = getResponseBodyAsStream(); if (in != null) { // read response and try to build a xml document try { return DomUtil.parseDocument(in); } catch (ParserConfigurationException e) { IOException exception = new IOException("XML parser configuration error"); exception.initCause(e); throw exception; } catch (SAXException e) { IOException exception = new IOException("XML parsing error"); exception.initCause(e); throw exception; } finally { in.close(); } } // no body or no parseable. return null; } public GzipedPropfind(String uri, DavPropertyNameSet propNameSet, int depth) throws IOException { super(uri, propNameSet, depth); } public GzipedPropfind(String uri, int propfindType, int depth) throws IOException { super(uri, propfindType, depth); } public GzipedPropfind(String uri, int propfindType, DavPropertyNameSet propNameSet, int depth) throws IOException { super(uri, propfindType, propNameSet, depth); } } src/com/owncloud/android/lib/resources/files/LightReadFolderRemoteOperation.java +3 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ package com.owncloud.android.lib.resources.files; import android.util.Log; import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.method.GzipedPropfind; import com.owncloud.android.lib.common.network.WebdavEntry; import com.owncloud.android.lib.common.network.WebdavUtils; import com.owncloud.android.lib.common.operations.RemoteOperation; Loading Loading @@ -94,7 +95,7 @@ public class LightReadFolderRemoteOperation extends RemoteOperation { try { // remote request query = new PropFindMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath), query = new GzipedPropfind(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath), WebdavUtils.getMinimumPropSet(), // PropFind Properties this.depth); query.setRequestHeader("Accept-Encoding", "deflate,gzip"); Loading Loading @@ -172,7 +173,7 @@ public class LightReadFolderRemoteOperation extends RemoteOperation { // loop to update every child RemoteFile remoteFile; for (int i = 1; i < remoteData.getResponses().length; ++i) { for (int i =0 ; ++i < remoteData.getResponses().length;) { /// new OCFile instance with the data from the server we = new WebdavEntry(remoteData.getResponses()[i], client.getWebdavUri().getPath()); remoteFile = fillOCFile(we); Loading Loading
src/com/owncloud/android/lib/common/method/GzipedPropfind.java 0 → 100644 +64 −0 Original line number Diff line number Diff line package com.owncloud.android.lib.common.method; import org.apache.jackrabbit.webdav.client.methods.PropFindMethod; import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; import org.apache.jackrabbit.webdav.xml.DomUtil; import org.w3c.dom.Document; import org.xml.sax.SAXException; import java.io.IOException; import java.util.zip.GZIPInputStream; import javax.xml.parsers.ParserConfigurationException; public class GzipedPropfind extends PropFindMethod { public GzipedPropfind(String uri) throws IOException { super(uri); } @Override public Document getResponseBodyAsDocument() throws IOException { /*if ( super.responseDocument != null) { // response has already been read return super.responseDocument; }*/ GZIPInputStream in = null; in = new GZIPInputStream(getResponseBodyAsStream()); //InputStream in = getResponseBodyAsStream(); if (in != null) { // read response and try to build a xml document try { return DomUtil.parseDocument(in); } catch (ParserConfigurationException e) { IOException exception = new IOException("XML parser configuration error"); exception.initCause(e); throw exception; } catch (SAXException e) { IOException exception = new IOException("XML parsing error"); exception.initCause(e); throw exception; } finally { in.close(); } } // no body or no parseable. return null; } public GzipedPropfind(String uri, DavPropertyNameSet propNameSet, int depth) throws IOException { super(uri, propNameSet, depth); } public GzipedPropfind(String uri, int propfindType, int depth) throws IOException { super(uri, propfindType, depth); } public GzipedPropfind(String uri, int propfindType, DavPropertyNameSet propNameSet, int depth) throws IOException { super(uri, propfindType, propNameSet, depth); } }
src/com/owncloud/android/lib/resources/files/LightReadFolderRemoteOperation.java +3 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ package com.owncloud.android.lib.resources.files; import android.util.Log; import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.method.GzipedPropfind; import com.owncloud.android.lib.common.network.WebdavEntry; import com.owncloud.android.lib.common.network.WebdavUtils; import com.owncloud.android.lib.common.operations.RemoteOperation; Loading Loading @@ -94,7 +95,7 @@ public class LightReadFolderRemoteOperation extends RemoteOperation { try { // remote request query = new PropFindMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath), query = new GzipedPropfind(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath), WebdavUtils.getMinimumPropSet(), // PropFind Properties this.depth); query.setRequestHeader("Accept-Encoding", "deflate,gzip"); Loading Loading @@ -172,7 +173,7 @@ public class LightReadFolderRemoteOperation extends RemoteOperation { // loop to update every child RemoteFile remoteFile; for (int i = 1; i < remoteData.getResponses().length; ++i) { for (int i =0 ; ++i < remoteData.getResponses().length;) { /// new OCFile instance with the data from the server we = new WebdavEntry(remoteData.getResponses()[i], client.getWebdavUri().getPath()); remoteFile = fillOCFile(we); Loading