Class Server

    • 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 by getId() 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 use getPublicRootUrl() instead
      abstract java.lang.String getVersion()
      Non-null version of SonarQube at runtime
      abstract boolean isDev()
      Deprecated.
      in 6.6
      abstract boolean isSecured()
      Deprecated.
      since 5.6, use instead HttpServletRequest.getHeader(String) and check that X-Forwarded-Proto header is set to "https".
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Server

        public Server()
    • 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 by getId() in 6.7.
        Since 6.7, it returns exactly getId(). 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 by ServerFileSystem.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 property sonar.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.6
        Before version 6.6, the dev mode is enabled when the property sonar.web.dev is true. Since 6.6, false is always returned.
        Since:
        5.4
      • isSecured

        @Deprecated
        public abstract boolean isSecured()
        Deprecated.
        since 5.6, use instead HttpServletRequest.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 use getPublicRootUrl() 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)