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

Explain when to use MediaType constants

    Details

    • Type: Task
    • Status: Closed
    • Priority: Trivial
    • Resolution: Complete
    • Affects Version/s: 4.1 GA, 4.2 GA
    • Fix Version/s: 4.2.3
    • Component/s: [Documentation], Web
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      Hello

      I know work around

      @RequestMapping(value="something", 
      			    method=RequestMethod.GET,
      			    produces=MediaType.APPLICATION_XML_VALUE)
      
      @RequestMapping(value="something", 
      			    method=RequestMethod.GET,
      			    produces=MediaType.APPLICATION_JSON_VALUE)
      

      It for REST working around the @ResponseBody

      To load a JSP/HTML view my method returns a String to be resolved later through a ViewResolver's implementation

      I am wondered when has sense use:

      • MediaType.TEXT_HTML_VALUE

      Thank you.

        Attachments

          Activity

            People

            • Assignee:
              rstoya05-aop Rossen Stoyanchev
              Reporter:
              dr_pompeii Manuel Jordan
              Last updater:
              St├ęphane Nicoll
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 4 weeks, 1 day ago