Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Apache Tomcat is a Java-based web server. A web server can host many web applications. If you consider the term "site" to mean "web application", then Tomcat can host many "sites."
The question about the URL is tricky. In practice, you would never have "*.html" as the value of servlet-mapping url-pattern because this would prevent you from efficiently serving static HTML pages.
The other tricky part of this question is you are not told how the domain name is mapped to the web application, so you wouldn't be able to see if "myapp" is needed or not. A domain name can be mapped in a few different ways.
These are a couple of good examples of problems with commercial online-testing for software development/design skills. In many cases, the Instructional Designers that create these tests don't have actual programming or software engineering experience. Surfing the web and asking forum questions to create a technical test is not the same as a seasoned expert creating a test.
When we just consider that the domain-name mapping is not part of the exam we can say that the question is about everything behind the server (www.mysite.com)
so can /base.html point to a servlet or can /myapp/base.html map to a servlet. I would say it is the last option where myapp would be the context-root of the web-app.
Have a look at the following picture
Every web-app has to have a context-root, so the question is can the web-app have a context root of an empty String (or does it need a name like myapp). The answer might be found in the HttpServletRequest interface method String getContextPath().
Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets in the default (root) context, this method returns "".
It seems there is a possibility that this method returns an empty String, but how to create a servlet in the default (root) context I have no idea. Maybe this is only possible by the guys who make the web-container. This makes both answers possible.....
similarily a servlet could be hosted probably and that would result in a mapping like is mentioned in question.So both are true and possible mappings for the servlets.
Now, the other question ,
how many sites can run on one tomcat?
I wanted to know that in real world when some company is using Apche Tomcat as webserver\container then in that case what will be there site folder(s)?
they will only make one myapp and put it in webapps & use it as a site folder?
or they will get the whole webapps folder of tomcat and they can put myapp1, myapp2 etc?
| Pursuing Bachelor of Engineering | OSUM Club Leader | SCJP 6 | SCWCD 5 |...