Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the default servlet for mapping with undefined servlet

I have a Servlet mapping in my application with out a servlet defined for it.

Eclipse produces a warning on it:

The servlet mapping "/docs/*" refers to a servlet that is not defined
<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/docs/*</url-pattern>
</servlet-mapping>    

There is no defined servlet default. But it is only a warrning, the application itself works fine and serves content from that url pattern.

Is there a "default" servlet that handles those servlet mappings? if not? how does this even work?

Additional Info

I have another mapping like so and it has a servlet:

com.sun.jersey.spi.spring.container.servlet.SpringServlet
<servlet-mapping>
    <servlet-name>springDispatcher</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

So to Kayaman's answer. if i remove the "redundant" mapping. the /docs functionality stops working.

what i actually want is to know what servlet is the default one so i can create a servlet for my mapping and avoid the warnings.

Thanks.

like image 328
Gleeb Avatar asked Sep 16 '13 11:09

Gleeb


1 Answers

Oracle docs:

Each Web application has a default servlet. This default servlet can be a servlet that you specify, or, if you do not specify a default servlet, WebLogic Server uses an internal servlet called the FileServlet as the default servlet.

You can register any servlet as the default servlet. Writing your own default servlet allows you to use your own logic to decide how to handle a request that falls back to the default servlet.

Setting Up a Default Servlet

Tomcat Specific

like image 117
Suresh Atta Avatar answered Oct 25 '22 06:10

Suresh Atta