mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 01:15:44 +01:00
use gzip compression for plugin center
This commit is contained in:
@@ -58,7 +58,7 @@ public class ScmConfiguration
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
public static final String DEFAULT_PLUGINURL =
|
public static final String DEFAULT_PLUGINURL =
|
||||||
"http://plugins.scm-manager.org/plugins.xml";
|
"http://plugins.scm-manager.org/plugins.xml.gz";
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
public static final String PATH =
|
public static final String PATH =
|
||||||
|
|||||||
@@ -49,11 +49,14 @@ import sonia.scm.cache.SimpleCache;
|
|||||||
import sonia.scm.config.ScmConfiguration;
|
import sonia.scm.config.ScmConfiguration;
|
||||||
import sonia.scm.security.SecurityContext;
|
import sonia.scm.security.SecurityContext;
|
||||||
import sonia.scm.util.AssertUtil;
|
import sonia.scm.util.AssertUtil;
|
||||||
|
import sonia.scm.util.IOUtil;
|
||||||
import sonia.scm.util.SecurityUtil;
|
import sonia.scm.util.SecurityUtil;
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -62,6 +65,7 @@ import java.util.HashSet;
|
|||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import javax.xml.bind.JAXBContext;
|
import javax.xml.bind.JAXBContext;
|
||||||
import javax.xml.bind.JAXBException;
|
import javax.xml.bind.JAXBException;
|
||||||
@@ -467,10 +471,22 @@ public class DefaultPluginManager implements PluginManager
|
|||||||
configuration.getPluginUrl());
|
configuration.getPluginUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String pluginUrl = configuration.getPluginUrl();
|
||||||
|
|
||||||
|
if (Util.isNotEmpty(pluginUrl))
|
||||||
|
{
|
||||||
|
InputStream input = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
center = (PluginCenter) unmarshaller.unmarshal(
|
input = new URL(pluginUrl).openStream();
|
||||||
new URL(configuration.getPluginUrl()));
|
|
||||||
|
if (pluginUrl.endsWith(".gz"))
|
||||||
|
{
|
||||||
|
input = new GZIPInputStream(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
center = (PluginCenter) unmarshaller.unmarshal(input);
|
||||||
preparePlugins(center);
|
preparePlugins(center);
|
||||||
cache.put(PluginCenter.class.getName(), center);
|
cache.put(PluginCenter.class.getName(), center);
|
||||||
|
|
||||||
@@ -486,6 +502,11 @@ public class DefaultPluginManager implements PluginManager
|
|||||||
{
|
{
|
||||||
throw new PluginLoadException(ex);
|
throw new PluginLoadException(ex);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IOUtil.close(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user