Class ContextInfo

  • Direct Known Subclasses:
    FrontEndForm2

    public class ContextInfo
    extends ResultsBase
    Prepares some information needed for proper URL construction in our app.
    • Field Detail

      • port

        public int port
      • serverPort

        public int serverPort
      • localPort

        public int localPort
      • dev

        public boolean dev
        True if we're to use the dev version of the GUI client rather than the prod one. (This flag comes from the URL query string, dev=true, and controls the choice of the clientUrl).
      • serverUrl

        public String serverUrl
        The Game Server URL for REST calls (based on the HTTP request we have just received). This can be passed to the GUI client so that it would be using our Game Server (and not a Game Server somewhere else). The value is, for example, http://localhost:8080/w2020-dev or https://rulegame.wisc.edu/w2020
      • clientUrl

        public String clientUrl
        The main GUI Client URL to use (dev or prod). It normally comes from the master config file.
      • exp

        public String exp
        Optional; used in some pages. More usually, null.
    • Constructor Detail

      • ContextInfo

        public ContextInfo​(jakarta.servlet.http.HttpServletRequest request,
                           jakarta.servlet.http.HttpServletResponse response)
        Note that request.getProtocol() is not helpful to distinguish HTTP from HTTPS, as it seems to always return "HTTP". OTOH, using port 443 is a good indicator of HTTPS being used.

        We use getServerPort() rather than getLocalPort() because it's more helpful in the situation when a firewall with port forwarding is used. E.g. when the (external) port 80 is forwarded by the firewall to port 1234 (as it is the case on the DIMACS host), getServerPort() will still give us 80.

    • Method Detail

      • devProd

        public String devProd()
        Do we use the "dev" or "prod" client?
      • getVersion

        public String getVersion()