
|
If you were logged in you would be able to see more operations.
|
|
|
|
Environment:
|
Nightly snapshot 2.5.2 20080216-405
|
|
Issue Links:
|
Related
|
|
|
|
This issue is related to:
|
|
SPR-4474
@RequestMapping has no means to default the request method at the type level
|
|
|
|
|
|
|
|
Consider the below controller; the goal is to map multiple methods, accessible via POST only, using the naming scheme from InternalPathMethodNameResolver. This does not work because:
1) The naming scheme from InternalPathMethodNameResolver is only invoked is the @RequestParam is empty (no value, method, or parameters);
2) The request method cannot be specified at the type level (explicitly prohibited by DefaultAnnotationHandlerMapping)
Our use case for this is converting several legacy Servlets that do an if/else match on the URL in doPost() - it would be trivial to convert these if the POST could be combined with the InternalPathMethodNameResolver (ideally the POST could be defaulted at the type level).
@Controller
@RequestMapping("/foo/*.do")
public static class MultiMethodController
{
@RequestMapping(method = RequestMethod.POST)
public void withWriter( Writer w )
{
System.out.println( "writWriter invoked" );
}
@RequestMapping(method = RequestMethod.POST)
public void withWriter2( Writer w )
{
System.out.println( "writWriter2 invoked" );
}
}
|
|
Description
|
Consider the below controller; the goal is to map multiple methods, accessible via POST only, using the naming scheme from InternalPathMethodNameResolver. This does not work because:
1) The naming scheme from InternalPathMethodNameResolver is only invoked is the @RequestParam is empty (no value, method, or parameters);
2) The request method cannot be specified at the type level (explicitly prohibited by DefaultAnnotationHandlerMapping)
Our use case for this is converting several legacy Servlets that do an if/else match on the URL in doPost() - it would be trivial to convert these if the POST could be combined with the InternalPathMethodNameResolver (ideally the POST could be defaulted at the type level).
@Controller
@RequestMapping("/foo/*.do")
public static class MultiMethodController
{
@RequestMapping(method = RequestMethod.POST)
public void withWriter( Writer w )
{
System.out.println( "writWriter invoked" );
}
@RequestMapping(method = RequestMethod.POST)
public void withWriter2( Writer w )
{
System.out.println( "writWriter2 invoked" );
}
} |
Show » |
|
I'll consider allowing for request method mappings at the type level as well.
Juergen