Lines 52-57
Link Here
|
52 |
import java.net.URI; |
52 |
import java.net.URI; |
53 |
import java.net.URISyntaxException; |
53 |
import java.net.URISyntaxException; |
54 |
import java.net.URL; |
54 |
import java.net.URL; |
|
|
55 |
import java.net.URLConnection; |
55 |
import java.text.DateFormat; |
56 |
import java.text.DateFormat; |
56 |
import java.text.ParseException; |
57 |
import java.text.ParseException; |
57 |
import java.text.SimpleDateFormat; |
58 |
import java.text.SimpleDateFormat; |
Lines 168-173
Link Here
|
168 |
private static final String L10N_ATTR_LOCALIZED_MODULE_DESCRIPTION = "OpenIDE-Module-Long-Description"; // NOI18N |
169 |
private static final String L10N_ATTR_LOCALIZED_MODULE_DESCRIPTION = "OpenIDE-Module-Long-Description"; // NOI18N |
169 |
|
170 |
|
170 |
private static String GZIP_EXTENSION = ".gz"; // NOI18N |
171 |
private static String GZIP_EXTENSION = ".gz"; // NOI18N |
|
|
172 |
private static String GZIP_MIME_TYPE = "application/x-gzip"; // NOI18N |
171 |
|
173 |
|
172 |
public synchronized static Map<String, UpdateItem> getUpdateItems (URL url, AutoupdateCatalogProvider provider) throws IOException { |
174 |
public synchronized static Map<String, UpdateItem> getUpdateItems (URL url, AutoupdateCatalogProvider provider) throws IOException { |
173 |
Map<String, UpdateItem> items = new HashMap<String, UpdateItem> (); |
175 |
Map<String, UpdateItem> items = new HashMap<String, UpdateItem> (); |
Lines 206-212
Link Here
|
206 |
if (p != null) { |
208 |
if (p != null) { |
207 |
URL url = p.getUpdateCenterURL (); |
209 |
URL url = p.getUpdateCenterURL (); |
208 |
if (url != null) { |
210 |
if (url != null) { |
209 |
res = url.getPath ().toLowerCase ().endsWith (GZIP_EXTENSION); |
211 |
try { |
|
|
212 |
URLConnection conn = url.openConnection(); |
213 |
String contentType = conn.getContentType(); |
214 |
res = GZIP_MIME_TYPE.equals(contentType); |
215 |
} catch (IOException ex) { |
216 |
ERR.log (Level.WARNING, "Cannot read Content-Type HTTP header, using file extension"); |
217 |
res = url.getPath ().toLowerCase ().endsWith (GZIP_EXTENSION); |
218 |
} |
210 |
ERR.log (Level.FINER, "Is GZIP " + url + " ? " + res); |
219 |
ERR.log (Level.FINER, "Is GZIP " + url + " ? " + res); |
211 |
} else { |
220 |
} else { |
212 |
ERR.log (Level.WARNING, "AutoupdateCatalogProvider has not URL."); |
221 |
ERR.log (Level.WARNING, "AutoupdateCatalogProvider has not URL."); |