Package edu.wisc.game.web
Class ContextInfo
- java.lang.Object
-
- edu.wisc.game.web.ResultsBase
-
- edu.wisc.game.web.ContextInfo
-
- Direct Known Subclasses:
FrontEndForm2
public class ContextInfo extends ResultsBase
Prepares some information needed for proper URL construction in our app.
-
-
Field Summary
Fields Modifier and Type Field Description String
clientUrl
The main GUI Client URL to use (dev or prod).String
cp
boolean
dev
True if we're to use the dev version of the GUI client rather than the prod one.String
exp
Optional; used in some pages.String
host
int
localPort
int
port
int
serverPort
String
serverUrl
The Game Server URL for REST calls (based on the HTTP request we have just received).-
Fields inherited from class edu.wisc.game.web.ResultsBase
displayName, infomsg, uid
-
-
Constructor Summary
Constructors Constructor Description 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".
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
devProd()
Do we use the "dev" or "prod" client?String
getVersion()
-
Methods inherited from class edu.wisc.game.web.ResultsBase
exceptionTrace, getDisplayText, getErrmsg, getError, getEx, giveError, giveError, loggedIn, setErrmsg, setError
-
-
-
-
Field Detail
-
host
public String host
-
port
public int port
-
serverPort
public int serverPort
-
localPort
public int localPort
-
cp
public String cp
-
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.
-
-