Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-11543

Add support for 404, 204, and 3xx responses to the MVC config

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 3.2.8, 4.0.2
    • Fix Version/s: 4.1 RC1
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      SPR-11541 encouraged me to open this issue

      Currently one can easily register views to Controllers by WebMvcConfigurer as this:

      	/**
      	 * Add view controllers to create a direct mapping between a URL path and
      	 * view name without the need for a controller in between.
      	 */
      	void addViewControllers(ViewControllerRegistry registry);
      

      What I would like to see is easy ways to provide mapping between common http status's such as 404, 301, 302 and 204. It would be great to have redirections, not founds and no contents controllers without the need for a controller by new registry types.

      	void addRedirectControllers(RedirectControllerRegistry registry);
      	void addNoContentControllers(NoContentControllerRegistry registry);
      	void addNotFoundControllers(NotFoundControllerRegistry registry);
      

      This will greatly reduce unnecessary repeated codes.

        Attachments

          Activity

            People

            • Assignee:
              sdeleuze Sébastien Deleuze
              Reporter:
              cemokoc cemo koc
              Last updater:
              Stéphane Nicoll
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                4 years, 18 weeks, 5 days ago