How to handle static content in Spring MVC?

前端 未结 23 2442
春和景丽
春和景丽 2020-11-22 03:28

I am developing a webapp using Spring MVC 3 and have the DispatcherServlet catching all requests to \'/\' like so (web.xml):

  
          


        
23条回答
  •  囚心锁ツ
    2020-11-22 03:49

    The URLRewrite is sort of a "hack" if you want to call it that. What it comes down to is, you're re-inventing the wheel; as there are already existing solutions. Another thing to remember is Http Server = Static content & App server = dynamic content (this is how they were designed). By delegating the appropriate responsibilities to each server you maximize efficiency... but now-a-days this is probably only a concern in a performance critical environments and something like Tomcat would most likely work well in both roles most of the time; but it is still something to keep in mind none the less.

提交回复
热议问题