An open API service indexing awesome lists of open source software.

https://github.com/rsrchboy/catalyst-traitfor-request-rest-forbrowsers-andpjax


https://github.com/rsrchboy/catalyst-traitfor-request-rest-forbrowsers-andpjax

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

=pod

=encoding utf-8

=for :stopwords Chris Weyl PJAX Pjax

=head1 NAME

Catalyst::TraitFor::Request::REST::ForBrowsers::AndPJAX - Acknowledge C requests as browser requests

=head1 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.

=head1 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 ... }

=head1 DESCRIPTION

This is a tiny little L 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 C 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 L.

=head1 METHODS

=head2 looks_like_browser

This method is wrapped to return true if the method is GET and the C
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.

=head1 SEE ALSO

Please see those modules/websites for more information related to this module.

=over 4

=item *

L

=item *

L

=item *

L

=back

=head1 SOURCE

The development version is on github at L
and may be cloned from L

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website
https://github.com/RsrchBoy/catalyst-traitfor-request-rest-forbrowsers-andp
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.

=head1 AUTHOR

Chris Weyl

=head1 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