D'apres la doc, il serait possible de mapper un controller avec une url de type "/test/*.html" simplement avec l'annotation @RequestMapping("/test/*.html")

La doc de spring dit :
13.11.3.1. Advanced @RequestMapping options

Ant-style path patterns are supported (e.g. "/myPath/*.do"). At the method level, relative paths (e.g. "edit.do") are supported within the primary mapping expressed at the type level.
The handler method names are taken into account for narrowing if no path was specified explicitly, according to the specified org.springframework.web.servlet.mvc.multiaction.MethodNameResolver (by default an org.springframework.web.servlet.mvc.multiaction.InternalPathMethodNameResolver). Note that this only applies in case of ambiguous annotation mappings that do not specify a path mapping explicitly. In other words, the method name is only used for narrowing among a set of matching methods; it does not constitute a primary path mapping itself.
If you have a single default method (without explicit path mapping), then all requests without a more specific mapped method found will be dispatched to it. If you have multiple such default methods, then the method name will be taken into account for choosing between them.
Path mappings can be narrowed through parameter conditions: a sequence of "myParam=myValue" style expressions, with a request only mapped if each such parameter is found to have the given value. "myParam" style expressions are also supported, with such parameters having to be present in the request (allowed to have any value). Finally, "!myParam" style expressions indicate that the specified parameter is not supposed to be present in the request.
Par contre, je ne comprends pas très bien comment Spring va faire le mapping entre le "*" et la méthode à appeler
Je m'attendais si *= test à ce que Spring appelle ma méthode test() mais cela ne doit pas être ca...

Ci-joint mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
@Controller
@RequestMapping("/test/*.html")
public class TestControllor {
 
    public ModelMap test(ModelMap model) {
        System.out.println("Appel");
        return model;
    }
}
Et mon erreur qund j'appelle test/test.html...
HTTP ERROR: 500
No adapter for handler [TestControllor@1b5391b]: Does your handler implement a supported interface like Controller?
RequestURI=/test/test.html