I have a web app with a web-based configuration UI. If the user accesses via HTTP, I want to alert the user that they should really use HTTPS and give them a link to click on to get to the HTTPS-prefixed URL.
Now, this is pretty straightforward if we're on the default ports, but often, we're not - for example, HTTP might be on 8080, with HTTPS on 8181. I can have some heuristics for figuring out which port to use, e.g. 80->443, 8080->8181, but is there any way to get a list of ports and protocols back from the web container? Ideally Java EE standard, but even container-specific would be a start...
EDIT - one clarification - this is for an 'off-the-shelf' application (OpenSSO), so I'd really like to be able to (a) give the user the choice to go ahead and use an insecure port if they really want to (e.g. they're deploying on their laptop on some container without a secure port) and (b) not make the user edit server.xml.