Interface IServletContextInfo

  • All Superinterfaces:
    Serializable

    public interface IServletContextInfo
    extends Serializable
    Common interfaces for accessing servlet context information.
    Since:
    8.0.1
    Author:
    XIMA MEDIA GmbH
    See Also:
    ServletContext
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      @NotBlank String getContextPath()
      Returns the context path of the web application.
      default String getInitParameter​(String name)
      Returns a String containing the value of the named context-wide initialization parameter, or null if the parameter does not exist.
      @NotNull Map<String,​String> getInitParams()
      Returns all named context-wide initialization parameters.
      String getRealRootPath()
      Gets the real path of the context root.
      @NotBlank String getServerInfo()
      Returns the name and version of the servlet container on which the servlet is running.
      String getSessionCookieDomain()
      Gets the domain name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.
      int getSessionCookieMaxAge()
      Gets the lifetime (in seconds) of the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.
      String getSessionCookieName()
      Gets the name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.
      String getSessionCookiePath()
      Gets the path that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.
      String getVirtualServerName()
      Returns the configuration name of the logical host on which the ServletContext is deployed.
    • Method Detail

      • getContextPath

        @NotBlank
        @NotBlank String getContextPath()
        Returns the context path of the web application. The context path is the portion of the request URI that is used to select the context of the request. The context path always comes first in a request URI. If this context is the "root" context rooted at the base of the Web server's URL name space, this path will be an empty string. Otherwise, if the context is not rooted at the root of the server's name space, the path starts with a / character but does not end with a / character.
        Returns:
        the context path of the web application.
        See Also:
        ServletContext.getContextPath()
      • getRealRootPath

        String getRealRootPath()
        Gets the real path of the context root. The real path is an absolute file path on the server's filesystem.
        Returns:
        the real path of the context root.
        See Also:
        ServletContext.getRealPath(String)
      • getInitParams

        @NotNull
        @NotNull Map<String,​String> getInitParams()
        Returns all named context-wide initialization parameters. This makes available configuration information useful to an entire web application. For example, it can provide a webmaster's email address or the name of a system that holds critical data.
        Returns:
        a Map of all named context-wide initialization parameters.
        See Also:
        ServletContext.getInitParameterNames()
      • getInitParameter

        default String getInitParameter​(String name)
        Returns a String containing the value of the named context-wide initialization parameter, or null if the parameter does not exist. This method can make available configuration information useful to an entire web application. For example, it can provide a webmaster's email address or the name of a system that holds critical data.
        Parameters:
        name - a String containing the name of the parameter whose value is requested
        Returns:
        a String containing the value of the context's initialization parameter, or null if the context's initialization parameter does not exist.
        See Also:
        ServletContext.getInitParameter(String)
      • getServerInfo

        @NotBlank
        @NotBlank String getServerInfo()
        Returns the name and version of the servlet container on which the servlet is running. The form of the returned string is servername/version number. For example, the JavaServer Web Development Kit may return the string JavaServer Web Dev Kit/1.0. The servlet container may return other optional information after the primary string in parentheses, for example, JavaServer Web Dev Kit/1.0 (JDK 1.1.6; Windows NT 4.0 x86). See ServletContext.getServerInfo().
        Returns:
        a String containing at least the servlet container name and version number
        See Also:
        ServletContext.getServerInfo()
      • getSessionCookieDomain

        String getSessionCookieDomain()
        Gets the domain name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired. See .
        Returns:
        the session cookie domain if set and null otherwise.
        See Also:
        SessionCookieConfig.getDomain()
      • getSessionCookieMaxAge

        int getSessionCookieMaxAge()
        Gets the lifetime (in seconds) of the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired. By default, -1 is returned.
        Returns:
        the lifetime (in seconds) of the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired, or -1 (the default)
        See Also:
        SessionCookieConfig.getMaxAge()
      • getSessionCookieName

        String getSessionCookieName()
        Gets the name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired. By default, JSESSIONID will be used as the cookie name.
        Returns:
        the cookie name if set and null otherwise.
        See Also:
        SessionCookieConfig.getName()
      • getSessionCookiePath

        String getSessionCookiePath()
        Gets the path that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired. By default, the context path of the ServletContext from which this SessionCookieConfig was acquired will be used.
        Returns:
        the cookie path if set and null otherwise.
        See Also:
        SessionCookieConfig.getPath()
      • getVirtualServerName

        String getVirtualServerName()
        Returns the configuration name of the logical host on which the ServletContext is deployed. Servlet containers may support multiple logical hosts. This method must return the same name for all the servlet contexts deployed on a logical host, and the name returned by this method must be distinct, stable per logical host, and suitable for use in associating server configuration information with the logical host. The returned value is NOT expected or required to be equivalent to a network address or hostname of the logical host.
        Returns:
        a String containing the configuration name of the logical host on which the servlet context is deployed.
        See Also:
        ServletContext.getVirtualServerName()