port « Host « JSP-Servlet Q&A





1. How can I get a the host name (with port) that a servlet is at    stackoverflow.com

I thought ServletContext might provide a method. Does the getAttribute() method of ServletContext provide any help i.e. is there an attribute name (maybe "host", "port") that will be of help. The reason ...

2. What would be a better design to resolve host/port lookups    stackoverflow.com

static image (e.g. car.png)
<table><tr><td><img src="http://<somehost>:<someport>/images/car.png" /></td></tr></table>

(e.g. lookup by id=123456 and fetched via a servlet from the database)
<table><tr><td><img src="http://<somehost>:<someport>/doc?id=123456"/></td></tr></table>
We generate snippets of HTML code (as mentioned above) and store these in the ...

3. is it possible to use CNAME (alias) for     stackoverflow.com

Is there a way i can hide the port from url and use cname (alias) instead of :. For e.g. If my url is http://myserver.com:40089/webapps/index.jsp Is its possible for me to ...