mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
use ServletContainerDetector instead of SystemUtil
This commit is contained in:
@@ -45,6 +45,7 @@ import org.apache.shiro.subject.Subject;
|
|||||||
import org.codehaus.enunciate.modules.jersey.ExternallyManagedLifecycle;
|
import org.codehaus.enunciate.modules.jersey.ExternallyManagedLifecycle;
|
||||||
|
|
||||||
import sonia.scm.SCMContextProvider;
|
import sonia.scm.SCMContextProvider;
|
||||||
|
import sonia.scm.ServletContainerDetector;
|
||||||
import sonia.scm.Type;
|
import sonia.scm.Type;
|
||||||
import sonia.scm.config.ScmConfiguration;
|
import sonia.scm.config.ScmConfiguration;
|
||||||
import sonia.scm.plugin.PluginManager;
|
import sonia.scm.plugin.PluginManager;
|
||||||
@@ -66,6 +67,8 @@ import java.util.Locale;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
@@ -97,17 +100,20 @@ public class SupportResource
|
|||||||
* @param pluginManager
|
* @param pluginManager
|
||||||
* @param storeFactory
|
* @param storeFactory
|
||||||
* @param repositoryManager
|
* @param repositoryManager
|
||||||
|
* @param request
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
public SupportResource(SCMContextProvider context,
|
public SupportResource(SCMContextProvider context,
|
||||||
ScmConfiguration configuration, PluginManager pluginManager,
|
ScmConfiguration configuration, PluginManager pluginManager,
|
||||||
StoreFactory storeFactory, RepositoryManager repositoryManager)
|
StoreFactory storeFactory, RepositoryManager repositoryManager,
|
||||||
|
HttpServletRequest request)
|
||||||
{
|
{
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.configuration = configuration;
|
this.configuration = configuration;
|
||||||
this.pluginManager = pluginManager;
|
this.pluginManager = pluginManager;
|
||||||
this.storeFactoryClass = storeFactory.getClass();
|
this.storeFactoryClass = storeFactory.getClass();
|
||||||
this.repositoryManager = repositoryManager;
|
this.repositoryManager = repositoryManager;
|
||||||
|
this.request = request;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
@@ -137,7 +143,7 @@ public class SupportResource
|
|||||||
env.put("configuration", configuration);
|
env.put("configuration", configuration);
|
||||||
env.put("pluginManager", pluginManager);
|
env.put("pluginManager", pluginManager);
|
||||||
env.put("runtime", new RuntimeInformation());
|
env.put("runtime", new RuntimeInformation());
|
||||||
env.put("system", new SystemInformation());
|
env.put("system", new SystemInformation(request));
|
||||||
env.put("repositoryHandlers", getRepositoryHandlers());
|
env.put("repositoryHandlers", getRepositoryHandlers());
|
||||||
|
|
||||||
return new Viewable(TEMPLATE, env);
|
return new Viewable(TEMPLATE, env);
|
||||||
@@ -262,12 +268,14 @@ public class SupportResource
|
|||||||
/**
|
/**
|
||||||
* Constructs ...
|
* Constructs ...
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
*/
|
*/
|
||||||
public SystemInformation()
|
public SystemInformation(HttpServletRequest request)
|
||||||
{
|
{
|
||||||
os = SystemUtil.getOS();
|
os = SystemUtil.getOS();
|
||||||
arch = SystemUtil.getArch();
|
arch = SystemUtil.getArch();
|
||||||
container = SystemUtil.getServletContainer().name();
|
container = ServletContainerDetector.detect(request).name();
|
||||||
java = System.getProperty("java.vendor").concat("/").concat(
|
java = System.getProperty("java.vendor").concat("/").concat(
|
||||||
System.getProperty("java.version"));
|
System.getProperty("java.version"));
|
||||||
locale = Locale.getDefault().toString();
|
locale = Locale.getDefault().toString();
|
||||||
@@ -451,6 +459,9 @@ public class SupportResource
|
|||||||
/** Field description */
|
/** Field description */
|
||||||
private RepositoryManager repositoryManager;
|
private RepositoryManager repositoryManager;
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private HttpServletRequest request;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private Class<?> storeFactoryClass;
|
private Class<?> storeFactoryClass;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user