PDA

View Full Version : SimpleUrlHandlerMapping question - how to bypass it if nothing matches?


shan
Jun 2nd, 2006, 01:33 PM
I apologize if this is too easy a question, but I can't figure it out
currently I'm using a SimpleUrlHandlerMapping to map URLs to controllers
if no match is found, a 404 is sent to the browser

I want to switch the behaviour around, so that if no match is found for the URL, the system actually tries to load the htm file from where it would actually reside if there was no servlet mapping in place

is there a direct way to do this? or do I need to create a secondary HandlerMapping that maps to a ParameterizableViewController that somehow loads views differently?

manifoldronin
Jun 2nd, 2006, 04:44 PM
Did you try setting the mapping's 'defaultHandler' property to a ParameterizableViewController bean?

shan
Jun 2nd, 2006, 05:15 PM
Hi, yeah I still consider that a "match"
what I want to do is fall out of the servlet mapping entirely, but it seems that not possible..?

the closest thing I've come to is to fallback to a "bypass" controller which just returns a null modelandview, and writes the contents of the html file directly into the response, read directly from the filesystem

pretty crappy, but I can't figure out any other way to get out of the MVC framework

manifoldronin
Jun 4th, 2006, 04:15 PM
the closest thing I've come to is to fallback to a "bypass" controller which just returns a null modelandview, and writes the contents of the html file directly into the response, read directly from the filesystem

Actually UrlFilenameViewController was the one I meant to suggest. It pretty much does the "bypass" thing you talk about here.