zoukankan      html  css  js  c++  java
  • spring mvc不能下载cab包等插件问题

    default-servlet-handler

    <!-- Handles HTTP GET requests for static resources by efficiently serving up static resources in the ${webappRoot}/resources directory -->

    <default-servlet-handler/>

    在配置文件中加上这句话。

    Spring参考手册 mvc:default-servlet-handler

    This tag allows for mapping the DispatcherServlet to "/" (thus overriding the mapping of the container's default Servlet), while still allowing static resource requests to be handled by the container's default Servlet. 
    这个标签吧DispatcherServlet 映射到"/"(从而覆盖容器的默认servlet的映射),也允许容器默认的servlet处理静态资源的请求。
    //我感觉这句的意思就是:DispatcherServlet把找不到的请求映射到默认的servlet,从而实现处理静态资源的请求。不知理解的对不对?

    It configures a DefaultServletHttpRequestHandler with a URL mapping (given a lowest precedence order) of "/**". 
    This handler will forward all requests to the default Servlet.
    配置了DefaultServletHttpRequestHandler最后来处理"/**"的请求。
    这个处理器会把所有的请求跳转到容器默认servlet。

    To enable this feature using the default setup, simply include the tag in the form:
    标签的默认设置就可以实现这个功能:
    <mvc:default-servlet-handler/>
    The caveat to overriding the "/" Servlet mapping is that the RequestDispatcher for the default Servlet must be retrieved by name rather than by path. 
    覆盖"/"映射会导致默认servlet的RequestDispatcher必须用名字取回而不是路径。(不知道什么意思,是不是跟下一句有关联呐,使用名字找默认servlet)

    The DefaultServletHttpRequestHandler will attempt to auto-detect the default Servlet for the container at startup time, using a list of known names for most of the major Servlet containers (including Tomcat, Jetty, Glassfish, JBoss, Resin, WebLogic, and WebSphere). 
    DefaultServletHttpRequestHandler在容器启动是会使用主流web容器默认servlet的名称列表自动查找容器的默认servlet,包括Tomcat, Jetty, Glassfish, JBoss, Resin, WebLogic, and WebSphere。

    If the default Servlet has been custom configured with a different name, or if a different Servlet container is being used where the default Servlet name is unknown, then the default Servlet's name must be explicitly provided as in the following example:
    如果为默认servlet配置了新的名称,或者这个容器servlet名字不在spring列表中是,必须显式配置默认servlet的名字,如下:
    <mvc:default-servlet-handler default-servlet-name="myCustomDefaultServlet"/>

  • 相关阅读:
    使用nginx搭建https服务器
    CentOS6.*安装gitolite
    Nginx 下配置SSL证书的方法
    Nginx Location配置总结
    最优二叉树(哈夫曼树)知识点
    utf8字节
    utf8字节
    nginx 配置日志
    nginx 配置日志
    elk 索引
  • 原文地址:https://www.cnblogs.com/danghuijian/p/4400076.html
Copyright © 2011-2022 走看看