Spring: not accept POST request under mvc:resources? how to fix that

后端 未结 1 617
没有蜡笔的小新
没有蜡笔的小新 2021-01-21 14:27

I am using spring framework in my project,

Here is part of my web.xml:


    SpringMvcServlet
             


        
1条回答
  •  自闭症患者
    2021-01-21 14:41

    First of all: I think you abuse the ResourceHttpRequestHandler when you try to use it for POST requests. -- And I am not sure that every thing works correct if you made this handler to handle POST requests.


    configure an instance of class org.springframework.web.servlet.resource.ResourceHttpRequestHandler. This has the super class WebContentGenerator and this super class has a property Set supportedMethods.

    So all what you need to do is:

    
        
           GET
           HEAD
           POST
        
    
    

    Unfortunately this requires that you configure the ResourceHttpRequestHandler by hand instead of using

    
         
             
                  
             
         
                
    
    
    
          
          
             
                GET
                HEAD
                POST
             
         
         
    
    

    I have not proved this configuration, I have just written it down from what the ResourceBeanDefintionParser does.

    0 讨论(0)
提交回复
热议问题