NAME
Catalyst::TraitFor::Request::REST::ForBrowsers::AndPJAX - Acknowledge
"PJAX" requests as browser requests
VERSION
This document describes version 0.001 of
Catalyst::TraitFor::Request::REST::ForBrowsers::AndPJAX - released June
06, 2012 as part of Catalyst-TraitFor-Request-REST-ForBrowsers-AndPJAX.
SYNOPSIS
# in your app class
use CatalystX::RoleApplicator;
__PACKAGE__->apply_request_class_roles(qw/
Catalyst::TraitFor::Request::REST::ForBrowsers::AndPJAX
/);
# then, off in an controller somewhere...
sub action_GET_html { ... also called for PJAX requests ... }
DESCRIPTION
This is a tiny little Catalyst::Request class trait that recognizes that
a PJAX request is also a browser request, and thus looks_like_browser()
also returns true when the method is GET and the "X-Pjax" header is
present and is 'true'.
This allows actions using an action class of REST::ForBrowsers to
transparently handle PJAX requests, without requiring any more
modification to the controller or application than applying this trait
to the request class, rather than plain-old
Catalyst::TraitFor::Request::REST::ForBrowsers.
METHODS
looks_like_browser
This method is wrapped to return true if the method is GET and the
"X-Pjax" header is present and is 'true'.
Otherwise we hand things off to the original method, to render its
verdict as to the tenor of the request.
SEE ALSO
Please see those modules/websites for more information related to this
module.
* Catalyst::TraitFor::Request::REST::ForBrowsers
* Catalyst::Action::REST::ForBrowsers
* Plack::Middleware::Pjax
SOURCE
The development version is on github at
<http://github.com/RsrchBoy/catalyst-traitfor-request-rest-forbrowsers-a
ndpjax> and may be cloned from
<git://github.com/RsrchBoy/catalyst-traitfor-request-rest-forbrowsers-an
dpjax.git>
BUGS
Please report any bugs or feature requests on the bugtracker website
https://github.com/RsrchBoy/catalyst-traitfor-request-rest-forbrowsers-a
ndp jax/issues
When submitting a bug or request, please include a test-file or a patch
to an existing test-file that illustrates the bug or desired feature.
AUTHOR
Chris Weyl <cweyl@alumni.drew.edu>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2012 by Chris Weyl.
This is free software, licensed under:
The GNU Lesser General Public License, Version 2.1, February 1999