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

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Git Commits
Graeme Rocher made changes - 05/Aug/09 2:23 AM
Field Original Value New Value
Fix Version/s 2.0 [ 15421 ]
Graeme Rocher made changes - 17/May/10 4:16 PM
Assignee Graeme Rocher [ graemerocher ]
Contegix Support made changes - 24/Mar/11 9:23 PM
Project Import Thu Mar 24 21:22:24 CDT 2011 [ 1301019744151 ]
Burt Beckwith made changes - 03/Aug/11 11:50 AM
Workflow jira [ 33689 ] Grails [ 40581 ]
Burt Beckwith made changes - 09/Aug/11 6:29 PM
Workflow Grails [ 40581 ] Copy of Grails [ 48012 ]
Burt Beckwith made changes - 09/Aug/11 7:00 PM
Workflow Copy of Grails [ 48012 ] Grails [ 55422 ]
Burt Beckwith made changes - 20/Aug/11 10:36 PM
Workflow Grails [ 55422 ] Grails2 [ 62970 ]
Burt Beckwith made changes - 21/Dec/11 1:22 PM
Workflow Grails2 [ 62970 ] jira [ 77023 ]
Burt Beckwith made changes - 21/Dec/11 1:29 PM
Workflow jira [ 77023 ] Grails2 [ 79721 ]
Peter Ledbrook made changes - 20/Jan/12 3:00 AM
Last Reviewed 01/Jan/10
Peter Ledbrook made changes - 23/Jan/12 5:33 AM
Workflow Grails2 [ 79721 ] jira [ 88939 ]
Peter Ledbrook made changes - 23/Jan/12 5:42 AM
Workflow jira [ 88939 ] Grails2 [ 97205 ]
Hide
Permalink
Rick Jensen added a comment - 01/Mar/12 1:07 PM

Given the planed additional support for REST in v2.2, and the fact that REST is highly reliant on content types, it would be great if this could be targeted at v2.2 instead of v3.

Show
Rick Jensen added a comment - 01/Mar/12 1:07 PM Given the planed additional support for REST in v2.2, and the fact that REST is highly reliant on content types, it would be great if this could be targeted at v2.2 instead of v3.
Graeme Rocher made changes - 02/Mar/12 12:03 AM
Fix Version/s 2.1 [ 12801 ]
Fix Version/s 3.0 [ 11042 ]
Graeme Rocher made changes - 16/May/12 7:04 AM
Fix Version/s 2.1 [ 13117 ]
Fix Version/s 2.1-RC1 [ 12801 ]
Graeme Rocher made changes - 23/May/12 5:19 AM
Fix Version/s 2.1 [ 13125 ]
Fix Version/s 2.1-RC2 [ 13117 ]
Graeme Rocher made changes - 20/Jun/12 5:58 AM
Fix Version/s 2.1 [ 13133 ]
Fix Version/s 2.1-RC3 [ 13125 ]
Graeme Rocher made changes - 05/Jul/12 6:10 AM
Fix Version/s 2.2 [ 13093 ]
Fix Version/s 2.1 [ 13133 ]
Graeme Rocher made changes - 19/Sep/12 7:06 AM
Fix Version/s 2.3 [ 13311 ]
Fix Version/s 2.2-RC1 [ 13093 ]
Peter Ledbrook made changes - 28/Feb/13 6:17 AM
Parent GRAILS-9888 [ 43881 ]
Issue Type Improvement [ 4 ] Sub-task [ 5 ]
Hide
Permalink
Iván López added a comment - 04/May/13 12:49 AM

Instead of using these fragment of code in all gsps, I think you could use an 'after' filter to check the headers and set the content-type.

Show
Iván López added a comment - 04/May/13 12:49 AM Instead of using these fragment of code in all gsps, I think you could use an 'after' filter to check the headers and set the content-type.
Graeme Rocher made changes - 09/May/13 8:25 AM
Fix Version/s 2.3-M2 [ 13457 ]
Fix Version/s 2.3-M1 [ 13311 ]

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.