• 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"/>

  • 相关阅读:
    Java内存回收
    Android四大基本组件介绍与生命周期
    JAVA中获取当前系统时间
    jquery如何判断元素是否被点击_百度知道
    css控制div显示/隐藏方法及2种方法比较原码
    点击图标不断震动效果
    jquery 如何动态添加、删除class样式方法介绍_jquery_脚本之家
    HTML5绘制矩形和圆形并且还有获取在这个图层内的坐标的思路和代码
    Attribute name invalid for tag form according to TLD异常解决办法_gaigai_百度空间
    html5绘图
  • 原文地址:https://www.cnblogs.com/danghuijian/p/4400076.html
Copyright © 2020-2023  润新知