Package org.sonar.api.platform
Class Server
- java.lang.Object
-
- org.sonar.api.platform.Server
-
@ScannerSide @ServerSide @ComputeEngineSide public abstract class Server extends java.lang.Object
Runtime information about server- Since:
- 2.2
-
-
Constructor Summary
Constructors Constructor Description Server()
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description abstract java.lang.String
getContextPath()
Context path of web server.abstract java.lang.String
getId()
UUID identifying the installation.abstract java.lang.String
getPermanentServerId()
Deprecated.replaced bygetId()
in 6.7.abstract java.lang.String
getPublicRootUrl()
Return the public root url, without trailing slash, for instance : https://nemo.sonarqube.org.abstract java.io.File
getRootDir()
Deprecated.in 6.0.abstract java.util.Date
getStartedAt()
Date when server started.abstract java.lang.String
getURL()
Deprecated.since 6.5, please usegetPublicRootUrl()
insteadabstract java.lang.String
getVersion()
Non-null version of SonarQube at runtimeabstract boolean
isDev()
Deprecated.in 6.6abstract boolean
isSecured()
Deprecated.since 5.6, use insteadHttpServletRequest.getHeader(String)
and check that X-Forwarded-Proto header is set to "https".
-
-
-
Method Detail
-
getId
public abstract java.lang.String getId()
UUID identifying the installation. It is persisted so that it does not change over time, even after a restart. In the context of cluster, the value is shared by all the nodes.- Returns:
- a non-null UUID. Format can change over versions.
-
getPermanentServerId
@Deprecated public abstract java.lang.String getPermanentServerId()
Deprecated.replaced bygetId()
in 6.7.Since 6.7, it returns exactlygetId()
. In previous versions it returned ab UUID generated on demand by system administrators and may be null.- Since:
- 2.10
-
getVersion
public abstract java.lang.String getVersion()
Non-null version of SonarQube at runtime
-
getStartedAt
public abstract java.util.Date getStartedAt()
Date when server started. In the context of cluster, this is the date of the startup of the first node. Value is the same on all cluster nodes.
-
getRootDir
@Deprecated public abstract java.io.File getRootDir()
Deprecated.in 6.0. Replaced byServerFileSystem.getHomeDir()
- Returns:
- an existing directory in server and CE environments,
null
in scanner.
-
getContextPath
public abstract java.lang.String getContextPath()
Context path of web server. Value is blank""
by default. When defined by the propertysonar.web.context
of conf/sonar.properties, then value starts but does not end with slash'/'
, for instance"/sonarqube"
.- Returns:
- non-null but possibly blank path
-
getPublicRootUrl
public abstract java.lang.String getPublicRootUrl()
Return the public root url, without trailing slash, for instance : https://nemo.sonarqube.org.- Since:
- 5.4
-
isDev
@Deprecated public abstract boolean isDev()
Deprecated.in 6.6Before version 6.6, the dev mode is enabled when the propertysonar.web.dev
istrue
. Since 6.6,false
is always returned.- Since:
- 5.4
-
isSecured
@Deprecated public abstract boolean isSecured()
Deprecated.since 5.6, use insteadHttpServletRequest.getHeader(String)
and check that X-Forwarded-Proto header is set to "https".Return whether or not the {#getPublicRootUrl} is started with https.- Since:
- 5.4
-
getURL
@Deprecated public abstract java.lang.String getURL()
Deprecated.since 6.5, please usegetPublicRootUrl()
instead- Returns:
- the server URL
- Since:
- since 2.4 on batch side only, since 5.6 on both batch side and server side (WebServer and Compute Engine)
-
-