Checking in changes prior to tagging of version 1.101. Changelog diff is:
[catagits/Catalyst-View-ContentNegotiation-XHTML.git] / README
CommitLineData
06cf3efb 1NAME
84a4f22a 2 Catalyst::View::ContentNegotiation::XHTML - Adjusts the response
3 Content-Type header to application/xhtml+xml if the browser accepts it.
06cf3efb 4
5SYNOPSIS
778b6a5a 6 package Catalyst::View::TT;
7
8 use Moose;
9 use namespace::clean -except => 'meta';
10
11 extends qw/Catalyst::View::TT/;
12 with qw/Catalyst::View::ContentNegotiation::XHTML/;
13
06cf3efb 14 1;
778b6a5a 15
06cf3efb 16DESCRIPTION
84a4f22a 17 This is a simple Role which sets the response "Content-Type" to be
778b6a5a 18 "application/xhtml+xml" if the users browser sends an "Accept" header
19 indicating that it is willing to process that MIME type.
0f9bcf09 20
84a4f22a 21 Changing the "Content-Type" to "application/xhtml+xml" causes browsers
22 to interpret the page as XML, meaning that your markup must be well
23 formed.
0f9bcf09 24
84a4f22a 25CAVEATS
06cf3efb 26 This is useful when you're developing your application, as you know that
778b6a5a 27 all pages you view are parsed as XML, so any errors caused by your
28 markup not being well-formed will show up at once.
29
84a4f22a 30 Whilst this module is has been tested against most popular browsers
31 including Internet Explorer, it may cause unexpected results on browsers
32 which do not properly support the "application/xhtml+xml" MIME type.
33
778b6a5a 34METHOD MODIFIERS
35 after process
36 Changes the response "Content-Type" if appropriate (from the requests
37 "Accept" header).
0f9bcf09 38
06cf3efb 39METHODS
778b6a5a 40 pragmatic_accept
41 Some browsers (such as Internet Explorer) have a nasty way of sending
42 Accept */* and this claiming to support XHTML just as well as HTML.
43 Saving to a file on disk or opening with another application does count
44 as accepting, but it really should have a lower q value then text/html.
45 This sub takes a pragmatic approach and corrects this mistake by
46 modifying the Accept header before passing it to content negotiation.
0f9bcf09 47
778b6a5a 48ATTRIBUTES
49 variants
50 Returns an array ref of 3 part arrays, comprising name, priority, output
51 mime-type, which is used for the content negotiation algorithm.
52
53PRIVATE METHODS
54 _build_variants
55 Returns the default variant attribute contents.
0f9bcf09 56
778b6a5a 57SEE ALSO
58 Catalyst::View::TT::XHTML - Trivial Catalyst TT view using this role.
59 <http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html> - Content
60 negotiation RFC.
61
62BUGS
778b6a5a 63 Should be split into a base ContentNegotiation role which is consumed by
64 ContentNegotiation::XHTML.
0f9bcf09 65
06cf3efb 66AUTHOR
84a4f22a 67 Original author and maintainer - Tomas Doran (t0m)
68 "<bobtfish@bobtfish.net>"
06cf3efb 69
70CONTRIBUTORS
84a4f22a 71 David Dorward - test patches and */* pragmatism to make it work for
72 browsers which aren't firefox.
778b6a5a 73 Florian Ragwitz (rafl) "<rafl@debian.org>" - Conversion into a Moose
84a4f22a 74 Role, which is what the module should have been originally.
0f9bcf09 75
06cf3efb 76COPYRIGHT
77 This module itself is copyright (c) 2008 Tomas Doran and is licensed
78 under the same terms as Perl itself.
0f9bcf09 79