This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Questions about real world Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Questions about real world" Watch "Questions about real world" New topic
Author

Questions about real world

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

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
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
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.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Questions about real world
 
Similar Threads
Servlet Instance
Deploying EAR files
localhost:8080 --> mydomain.com
Tomcat 4 : How to deploy and run JSP and Servlets
internal or external request.