Fixed MP19 uploads. Added request/response body. Added support in all Engines for...
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Response.pm
CommitLineData
fc7ec1d9 1package Catalyst::Response;
2
3use strict;
4use base 'Class::Accessor::Fast';
5
6__PACKAGE__->mk_accessors(qw/cookies headers output redirect status/);
7
f7e4e231 8sub content_encoding { shift->headers->content_encoding(@_) }
9sub content_length { shift->headers->content_length(@_) }
10sub content_type { shift->headers->content_type(@_) }
11sub header { shift->headers->header(@_) }
12
fc7ec1d9 13=head1 NAME
14
15Catalyst::Response - Catalyst Response Class
16
17=head1 SYNOPSIS
18
b22c6668 19 $resp = $c->response;
06e1b616 20 $resp->body;
b5176d9e 21 $resp->content_encoding;
22 $resp->content_length;
23 $resp->content_type;
b22c6668 24 $resp->cookies;
aa64bada 25 $resp->header;
b22c6668 26 $resp->headers;
27 $resp->output;
28 $resp->redirect;
29 $resp->status;
30
31See also L<Catalyst::Application>.
fc7ec1d9 32
33=head1 DESCRIPTION
34
61b1e958 35This is the Catalyst Response class, which provides a set of accessors
36to response data.
b22c6668 37
38=head1 METHODS
fc7ec1d9 39
b22c6668 40=over 4
fc7ec1d9 41
06e1b616 42=item $resp->body
43
44Shortcut for $resp->output.
45
b5176d9e 46=item $resp->content_encoding
47
48Shortcut to $resp->headers->content_encoding
49
50=item $resp->content_length
51
52Shortcut to $resp->headers->content_length
53
54=item $resp->content_type
55
56Shortcut to $resp->headers->content_type
57
b22c6668 58=item $resp->cookies
fc7ec1d9 59
61b1e958 60Returns a reference to a hash containing the cookies to be set.
fc7ec1d9 61
62 $c->response->cookies->{foo} = { value => '123' };
63
b5176d9e 64=item $resp->header
65
66Shortcut to $resp->headers->header
67
b22c6668 68=item $resp->headers
fc7ec1d9 69
70Returns a L<HTTP::Headers> object containing the headers.
71
72 $c->response->headers->header( 'X-Catalyst' => $Catalyst::VERSION );
73
b22c6668 74=item $resp->output($text)
fc7ec1d9 75
76Contains the final output.
77
61b1e958 78 $c->response->output('Catalyst rocks!');
fc7ec1d9 79
b22c6668 80=item $resp->redirect($url)
fc7ec1d9 81
82Contains a location to redirect to.
83
84 $c->response->redirect('http://slashdot.org');
85
b22c6668 86=item status
fc7ec1d9 87
88Contains the HTTP status.
89
90 $c->response->status(404);
91
b22c6668 92=back
93
fc7ec1d9 94=head1 AUTHOR
95
96Sebastian Riedel, C<sri@cpan.org>
61b1e958 97Marcus Ramberg, C<mramberg@cpan.org>
fc7ec1d9 98
99=head1 COPYRIGHT
100
61b1e958 101This program is free software, you can redistribute it and/or modify
102it under the same terms as Perl itself.
fc7ec1d9 103
104=cut
105
1061;