Alex-Fill / droidpres

Automatically exported from code.google.com/p/droidpres
0 stars 0 forks source link

Желательные доработки #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Добавить поддержку GZip
...
postMethod.addHeader("Accept-Encoding", "gzip");
HttpResponse response = client.execute(postMethod);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK) {
    throw new XMLRPCException("HTTP status code: " + statusCode + " != " + HttpStatus.SC_OK);
            }

XmlPullParser pullParser = XmlPullParserFactory.newInstance().newPullParser();
entity = response.getEntity();
InputStream is = entity.getContent();
Header contentEncoding = response.getFirstHeader("Content-Encoding");
    if (contentEncoding != null && contentEncoding.getValue().equalsIgnoreCase("gzip")) {
        is = new GZIPInputStream(is);
    } 

Reader reader = new InputStreamReader(new BufferedInputStream(is));
...

Вообще убрать XML-RPC, если грузить товар 
объемом не 10-20 штук а например от 1000 и выше 
идет очень долгий процесс разбора 
пришедших данных.

Original issue reported on code.google.com by hawordg@gmail.com on 22 Nov 2011 at 5:50