Skip to content

Add ability for CNVR to search view names that use file extensions [SPR-7117] #11777

@spring-projects-issues

Description

@spring-projects-issues

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:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions