wood burning stoves
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "Questions about real world" Watch "Questions about real world" New topic

Questions about real world

Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

Hola ranchers.
I just want to ask questions about the real world (novice questions).
1. in our machines we use the following:
(/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:
where is the context?
(I mean why we don't write www.mydomain.com/context/index.jsp
Frank Carver

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

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
It's not a secret anymore!