Grails 403处理多部分请求

时间:2014-10-26 08:07:17

标签: grails error-handling multipart

我有一个简单的Grails 2.3.7应用程序,在UrlMappings.groovy中配置了错误处理:

class UrlMappings {

    static mappings = {
        "403"(controller: "error", action: "handleForbidden")
        "404"(controller: "error", action: "handleNotFound")
        "500"(controller: "error", action: "handleError")
    }
}

当我通过常规请求访问禁止的URL时,这可以正常工作,但是当我将多部分请求(例如上传文件)发布到禁止的URL时,服务器总是返回500错误,其中包含以下stacktrace:

ERROR errors.GrailsExceptionResolver  - IllegalArgumentException occurred when processing  request: [POST] /igetit/
Method name must not be null. Stacktrace follows:
Message: Method name must not be null
    Line | Method
->>  112 | notNull                               in org.springframework.util.Assert
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    156 | findMethod                            in org.springframework.util.ReflectionUtils
|     41 | retrieveAction . . . . . . . . . . .  in grails.plugin.cache.web.ProxyAwareMixedGrailsControllerHelper
|    226 | executeAction                         in org.codehaus.groovy.grails.web.servlet.mvc.AbstractGrailsControllerHelper
|    197 | handleURI . . . . . . . . . . . . . . in     ''
|    121 | handleURI                             in     ''
|     72 | handleRequest . . . . . . . . . . . . in org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController
|     48 | handle                                in org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter
|    355 | doDispatch . . . . . . . . . . . . .  in org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet
|    856 | doService                             in org.springframework.web.servlet.DispatcherServlet
|    953 | processRequest . . . . . . . . . . .  in org.springframework.web.servlet.FrameworkServlet
|    855 | doPost                                in     ''
|    646 | service . . . . . . . . . . . . . . . in javax.servlet.http.HttpServlet
|    829 | service                               in org.springframework.web.servlet.FrameworkServlet
|    727 | service . . . . . . . . . . . . . . . in javax.servlet.http.HttpServlet
|    303 | internalDoFilter                      in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter . . . . . . . . . . . . . .  in     ''
|    134 | doFilter                              in org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter
|    241 | internalDoFilter . . . . . . . . . .  in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter                              in     ''
|    330 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    108 | invoke                                in org.springframework.security.web.access.intercept.FilterSecurityInterceptor
|     84 | doFilter . . . . . . . . . . . . . .  in     ''
|    342 | doFilter                              in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    113 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.access.ExceptionTranslationFilter
|    342 | doFilter                              in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|     -1 | call . . . . . . . . . . . . . . . .  in javax.servlet.FilterChain$doFilter
|     88 | processFilterChain                    in com.odobo.grails.plugin.springsecurity.rest.RestTokenValidationFilter
|     -1 | this$3$processFilterChain . . . . . . in     ''
|     56 | doFilter                              in     ''
|    342 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|     53 | doFilter                              in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
|    342 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    146 | doFilter                              in org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter
|    342 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    150 | doFilter                              in org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter
|    342 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|     -1 | call                                  in javax.servlet.FilterChain$doFilter
|    108 | doFilter . . . . . . . . . . . . . .  in com.odobo.grails.plugin.springsecurity.rest.RestAuthenticationFilter
|    342 | doFilter                              in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    199 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter
|     49 | doFilter                              in grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter
|    342 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|     82 | doFilter                              in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
|    342 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|     -1 | call                                  in javax.servlet.FilterChain$doFilter
|     66 | doFilter . . . . . . . . . . . . . .  in com.odobo.grails.plugin.springsecurity.rest.RestLogoutFilter
|    342 | doFilter                              in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|     65 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.context.SecurityContextPersistenceFilter
|    342 | doFilter                              in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    192 | doFilterInternal . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy
|    166 | doFilter                              in     ''
|    343 | invokeDelegate . . . . . . . . . . .  in org.springframework.web.filter.DelegatingFilterProxy
|    260 | doFilter                              in     ''
|    241 | internalDoFilter . . . . . . . . . .  in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter                              in     ''
|    101 | doFilter . . . . . . . . . . . . . .  in org.springframework.web.filter.OncePerRequestFilter
|    241 | internalDoFilter                      in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter . . . . . . . . . . . . . .  in     ''
|    748 | invoke                                in org.apache.catalina.core.ApplicationDispatcher
|    488 | processRequest . . . . . . . . . . .  in     ''
|    411 | doForward                             in     ''
|    338 | forward . . . . . . . . . . . . . . . in     ''
|    332 | forwardRequestForUrlMappingInfo       in org.codehaus.groovy.grails.web.util.WebUtils
|    297 | forwardRequestForUrlMappingInfo . . . in     ''
|    152 | doDispatch                            in org.codehaus.groovy.grails.web.servlet.ErrorHandlingServlet
|    856 | doService . . . . . . . . . . . . . . in org.springframework.web.servlet.DispatcherServlet
|    953 | processRequest                        in org.springframework.web.servlet.FrameworkServlet
|    855 | doPost . . . . . . . . . . . . . . .  in     ''
|    646 | service                               in javax.servlet.http.HttpServlet
|    829 | service . . . . . . . . . . . . . . . in org.springframework.web.servlet.FrameworkServlet
|    727 | service                               in javax.servlet.http.HttpServlet
|    303 | internalDoFilter . . . . . . . . . .  in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter                              in     ''
|    233 | executeFilterChainWithWrappedResponse in org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter
|    208 | obtainContent                         in     ''
|    153 | doFilter . . . . . . . . . . . . . .  in     ''
|    241 | internalDoFilter                      in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter . . . . . . . . . . . . . .  in     ''
|    330 | doFilter                              in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    108 | invoke . . . . . . . . . . . . . . .  in org.springframework.security.web.access.intercept.FilterSecurityInterceptor
|     84 | doFilter                              in     ''
|    342 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    113 | doFilter                              in org.springframework.security.web.access.ExceptionTranslationFilter
|    342 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|     -1 | call                                  in javax.servlet.FilterChain$doFilter
|     88 | processFilterChain . . . . . . . . .  in com.odobo.grails.plugin.springsecurity.rest.RestTokenValidationFilter
|     -1 | this$3$processFilterChain             in     ''
|     56 | doFilter . . . . . . . . . . . . . .  in     ''
|    342 | doFilter                              in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|     53 | doFilter . . . . . . . . . . . . . .  in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
|    342 | doFilter                              in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    139 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter
|    342 | doFilter                              in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    150 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter
|    342 | doFilter                              in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|     -1 | call . . . . . . . . . . . . . . . .  in javax.servlet.FilterChain$doFilter
|    108 | doFilter                              in com.odobo.grails.plugin.springsecurity.rest.RestAuthenticationFilter
|    342 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    199 | doFilter                              in org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter
|     49 | doFilter . . . . . . . . . . . . . .  in grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter
|    342 | doFilter                              in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|     82 | doFilter . . . . . . . . . . . . . .  in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
|    342 | doFilter                              in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|     -1 | call . . . . . . . . . . . . . . . .  in javax.servlet.FilterChain$doFilter
|     66 | doFilter                              in com.odobo.grails.plugin.springsecurity.rest.RestLogoutFilter
|    342 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|     87 | doFilter                              in org.springframework.security.web.context.SecurityContextPersistenceFilter
|    342 | doFilter . . . . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    192 | doFilterInternal                      in org.springframework.security.web.FilterChainProxy
|    160 | doFilter . . . . . . . . . . . . . .  in     ''
|    343 | invokeDelegate                        in org.springframework.web.filter.DelegatingFilterProxy
|    260 | doFilter . . . . . . . . . . . . . .  in     ''
|    241 | internalDoFilter                      in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter . . . . . . . . . . . . . .  in     ''
|     69 | doFilterInternal                      in org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter
|    107 | doFilter . . . . . . . . . . . . . .  in org.springframework.web.filter.OncePerRequestFilter
|    241 | internalDoFilter                      in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter . . . . . . . . . . . . . .  in     ''
|    748 | invoke                                in org.apache.catalina.core.ApplicationDispatcher
|    488 | processRequest . . . . . . . . . . .  in     ''
|    411 | doForward                             in     ''
|    338 | forward . . . . . . . . . . . . . . . in     ''
|    466 | custom                                in org.apache.catalina.core.StandardHostValve
|    337 | status . . . . . . . . . . . . . . .  in     ''
|    202 | invoke                                in     ''
|     98 | invoke . . . . . . . . . . . . . . .  in org.apache.catalina.valves.ErrorReportValve
|    116 | invoke                                in org.apache.catalina.core.StandardEngineValve
|    408 | service . . . . . . . . . . . . . . . in org.apache.catalina.connector.CoyoteAdapter
|   1040 | process                               in org.apache.coyote.http11.AbstractHttp11Processor
|    607 | process . . . . . . . . . . . . . . . in org.apache.coyote.AbstractProtocol$AbstractConnectionHandler
|    313 | run                                   in org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor
|   1145 | runWorker . . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor
|    615 | run                                   in java.util.concurrent.ThreadPoolExecutor$Worker
^    724 | run . . . . . . . . . . . . . . . . . in java.lang.Thread

我可以使用这种声明性语法处理多部分请求的403错误,还是有另一种方法来处理它们?

0 个答案:

没有答案