Issue
Related to this question, is the idea of a default servlet that serves static content a standard (even if a de facto one) across servlet containers, or does its use restrict deployment to Tomcat / Jetty?
For example, 1 shows this method for getting the default dispatcher:
final RequestDispatcher rd = getServletContext().getNamedDispatcher("default");
From a quick search it seems that this would also work on Jetty. How broadly will this technique work for obtaining a default servlet? For the servlet containers that have a default servlet, is it always a static content servlet?
Solution
It's not a standard, but without it appservers can't serve static content. It's just crucial.
[edit] I saw you edited and elaborated your question in a more clear manner:
For example, [1] shows this method for getting the default dispatcher:
final RequestDispatcher rd = getServletContext().getNamedDispatcher("default");
From a quick search it seems that this would also work on Jetty. How broadly will this technique work for obtaining a default servlet? For the servlet containers that have a default servlet, is it always a static content servlet?
In that case, it may be a defacto standard, but I wouldn't rely much on that and for sure not code against implementation specific details or even defacto standards. Ask yourself: what's the sense/value of dispatching the request to the defaultservlet? Exactly, nothing.
Answered By - BalusC
Answer Checked By - Terry (JavaFixing Volunteer)