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

  • 相关阅读:
    dubbo记录3(配置、高可用、原理)
    dubbo记录2(运行dubbo的三种方式、与springboot整合、SpringBoot与dubbo整合的三种方式)
    dubbo记录1( 搭建注册中心、管理控制台和监控中心,第一个案例)
    vxe-table: 一个基于 vue 的 PC 端表格组件
    rabbitmq之死信队列,延迟队列,消息可靠投递
    springboot整合rabbitmq
    rabbitmq记录(2)spring整合rabbitmq--手动模式,测试消息的持久化
    rabbitmq记录(1)安装,work模式,发布订阅模式,路由模式,topic模式,spring整合rabbitmq--自动模式
    httpclient upload file
    SpringMVC自定义注解进行参数校验(转)
  • 原文地址:https://www.cnblogs.com/danghuijian/p/4400076.html
Copyright © 2011-2022 走看看