Add ability for CNVR to search view names that use file extensions [SPR-7117] #11777
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
David Turanski opened SPR-7117 and commented
A common pattern for supporting multiple document types with a single controller is to append the file extension to the bean name and use BeanNameViewResolver. For example if an application requires both Excel and PDF renderings of the logical view name "view", the corresponding bean names would be "view.xls" and "view.pdf". CNVR currently does not support this pattern since it only tries to resolve "view"
The proposed enhancement uses the mediaTypes map (or JAF in some cases) to obtain the file extension. The request can use path extension, accept header, or request parameter containing the extension. The mediaTypes map is reversed searched to obtain the file extension corresponding to each requested media type (Accept header can specify multiple types). A second pass is made through the view resolvers appending "." + file extension to the view name
A patch is attached
Attachments:
The text was updated successfully, but these errors were encountered: