Spring MVC noHandlerFound never called -
my application configured annotations , want 404's handled @controlleradvice or exceptionresolver. however, dispatcherservlet not throwing nohnadlerfoundexception when expected.
some other background: using spring security:
filterregistration.dynamic springsecurityfilterchain = container.addfilter("springsecurityfilterchain", new delegatingfilterproxy()); springsecurityfilterchain.addmappingforurlpatterns(null, false, "/*"); springsecurityfilterchain.setasyncsupported(true);
and dispatcherservlet config:
dispatcherservlet ds = new dispatcherservlet(mvccontext); ds.setthrowexceptionifnohandlerfound(true); servletregistration.dynamic dispatcher = container.addservlet("servletdispatcher", ds); dispatcher.setloadonstartup(1); dispatcher.setasyncsupported(true); dispatcher.addmapping("/");
the problem comes when processing bad request: /myapp/bad_request dispatcherservlet.dodispatch():920
// determine handler current request. mappedhandler = gethandler(processedrequest); if (mappedhandler == null || mappedhandler.gethandler() == null) { nohandlerfound(processedrequest, response); return; }
gethandler returns handler of type defaultservlethttprequethandler, named "default" , never throws nohandlerfoundexception.
any idea how tweak configuration make work?
Comments
Post a Comment