M
MattC
I have a servlet application. Based on a user request the application
will generate an email that contains a URL to one of the applications
screens. This application must run in a variety of environments.
My question is how do I dynamically determine if the URL should use
HTTP or HTTPS? The only solution I can think of is to do something like
this:
String protocol = httpServletRequest.getProtocol();
if (protocol.indexOf("HTTPS") > -1) {
// protocol is HTTPS
} else {
// protocol is HTTP
}
Will this work? Is this the best way to accomplish this?
Thanks,
will generate an email that contains a URL to one of the applications
screens. This application must run in a variety of environments.
My question is how do I dynamically determine if the URL should use
HTTP or HTTPS? The only solution I can think of is to do something like
this:
String protocol = httpServletRequest.getProtocol();
if (protocol.indexOf("HTTPS") > -1) {
// protocol is HTTPS
} else {
// protocol is HTTP
}
Will this work? Is this the best way to accomplish this?
Thanks,