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