Grails JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile
Grails
  • Grails
  • GRAILS-9888 REST and URL mapping changes
  • GRAILS-4938

Support content negotiation for GSP pages

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Sub-task Sub-task
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.2-M1
  • Fix Version/s: 2.3-M2
  • Component/s: View technologies
  • Labels:
    None

Description

Like any sane person, I want my XHTML pages to be served with the application/xhtml+xml MIME type to browsers that support it and as text/html to the rest. However, Grails seems to serve GSPs as text/html unless response.setContentType() is explicitly called. Is that right? As a workaround, I've added

<g:if test="${header(name: 'accept')?.contains('application/xhtml+xml')}">
	<% response.setContentType('application/xhtml+xml') %>
</g:if><g:else>
	<% response.setContentType('text/html') %>
</g:else>

to the top of all of my GSPs. This seems to work. But I'd think that the logical place to put this rule would be in Config.groovy, with the other MIME types. Something like

grails.mime.types = [ html: ['text/html', 'application/xhtml+xml'],
				gsp: ['text/html', 'application/xhtml+xml'],
				xml: ['text/xml', 'application/xml'],
				...]

which, currently, has no apparent effect. Or is there something simpler I'm overlooking?

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Git Commits
There are no git log entries for this issue yet.

People

  • Assignee:
    Unassigned
    Reporter:
    Trevor Burnham
Vote (2)
Watch (4)

Dates

  • Created:
    04/Aug/09 11:37 AM
    Updated:
    09/May/13 8:25 AM
    Last Reviewed:
    01/Jan/10

Agile

  • View on Board
  • Atlassian JIRA (v5.2.1#813-sha1:277a546)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Grails project. Try JIRA - bug tracking software for your team.