Ahh, you forgot to look at the superclass ServletRequest and it's getScheme method which eliminates the need for the switch. It will also allow you to configure the server's ports without having to alter your code.
Also, getContextPath will provide the preceeding forward slash so you don't want to put it between getServerName and getContextPath
I agree with Bear though, it's much too long; begs for a custom tag. [ September 16, 2005: Message edited by: Ben Souther ]