Static content. difference in tomcat6 and tomcat7 behavior

Sorry if I ask what was asked 1000 times, but I searched for it and found nothing :)

I have 2 tomcat installations. tomcat 6 on windows and tomcat 7 on linux machine. I have a project that uses spring and has some static content that I would like to serve without making requests through Spring.

here is my servlet configuration:

<servlet-mapping>
  <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
  <url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
 <servlet-name>default</servlet-name>
 <url-pattern>/static/*</url-pattern>
</servlet-mapping>

my static files are in the "static" folder next to the WEB-INF folder.

Now the funniest thing is that on tomcat7, when I make a request http://myserver.com/myproject/static/css/main.css , it looks for the file in /webapps/myproject/static/css/main.css, but in tomcat6 he searches for it in /webapps/myproject/css/main.css and creates an error saying that there is no such file.

, ?

+3
2

Tomcat. API- . , Tomcat , /WEB-INF /META-INF , . 50026 Tomcat 6.0.30 .

: web.xml . , .

+2

, casey , BalusC , URL . , URL- .

casey

0

Source: https://habr.com/ru/post/1787033/


All Articles