Hola ranchers. I just want to ask questions about the real world (novice questions). 1. in our machines we use the following: http://localhost:8080/mycontext/store/addtosc (/store/addtosc is url mapping for a servlet). what approach that is used in the real sites: <a href="/mycontext/store/addtosc"> <a href="http://localhost:8080/mycontext/store/addtosc"> 2. in real sites, we write: http://www.mydomain.com/index.jsp where is the context? (I mean why we don't write www.mydomain.com/context/index.jsp
The reason you don't often see an explicit application context named on large commercial servers is that they typically only run one application on each domain. If you are expecting lots of traffic, it often makes sense not to share the server with other applications. Servlet containers recognize a special context (known as "ROOT") which is used if no context name is supplied in the URL. This is commonly used when only a single application is needed, to simplify the client URLs.
Another common way to hide the context is to use a web server to redirect requests to the application server, and allow the web server to map requests to the application server context. Therefore requests to the web server on 'www.mydomain.com/*' will result in requests to '/mydomain/*' on the app server. There are various reasons to do this.A single web server can manage several domains as 'virtual hosts' then treat these differently. It can also allow you to set up rules in the web server to serve static content before redirecting other requests to the application server. You can also encrypt the internal traffic for security, allow the web server to manage external encryption, put the web server in a 'demilitarised zone' to improve security.