[Jifty-commit] r719 -
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Tue Mar 21 01:30:00 EST 2006
Author: jesse
Date: Tue Mar 21 01:29:59 2006
New Revision: 719
Modified:
/ (props changed)
jifty/trunk/lib/Jifty/Handler/Static.pm
Log:
r30243 at truegrounds: jesse | 2006-03-21 00:29:31 -0500
* Docs
Modified: jifty/trunk/lib/Jifty/Handler/Static.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Handler/Static.pm (original)
+++ jifty/trunk/lib/Jifty/Handler/Static.pm Tue Mar 21 01:29:59 2006
@@ -46,6 +46,14 @@
bless $self, $class;
}
+
+=head2 handle_request $path
+
+Handle a request for C<$path>. If we can't find a static file of that name, return undef.
+
+
+=cut
+
sub handle_request {
my $self = shift;
my $path = shift;
@@ -67,11 +75,28 @@
}
+
+=head2 client_accepts_gzipped_content
+
+Returns true if it looks like the client accepts gzip encoding. Otherwise, returns false.
+
+
+=cut
+
+
sub client_accepts_gzipped_content {
my $self = shift;
return Jifty->handler->cgi->http('Accept-Encoding') =~ /\bgzip\b/;
}
+
+=head2 file_path $path
+
+Returns the system path for C<$path>, inside the application's static root or, failing that, Jifty's static root.
+Returns undef if it can't find the file in either path.
+
+=cut
+
sub file_path {
my $self = shift;
my $file = shift;
@@ -92,6 +117,13 @@
}
+=head2 mime_type $path
+
+Returns the mime type of the file whose path on disk is C<$path>. Tries to use
+L<MIME::Types> to guess first. If that fails, it falls back to C<File::MMagic>.
+
+=cut
+
sub mime_type {
my $self = shift;
my $local_path = shift;
@@ -107,6 +139,15 @@
}
+=head2 send_gzipped $path $mimetype
+
+Print a gzipped version of C<$path> to STDOUT (the client), identified with a mimetype of C<$mimetype>.
+Eventually, this will cache the file on disk. Right now, it just does the gzipping in memory.
+
+
+=cut
+
+
sub send_gzipped {
my $self = shift;
my $local_path = shift;
@@ -142,6 +183,13 @@
}
}
+=head2 send_gzipped $path $mimetype
+
+Print an uncompressed version of C<$path> to STDOUT (the client), identified with a mimetype of C<$mimetype>.
+
+=cut
+
+
sub send_uncompressed {
my $self = shift;
my $local_path = shift;
@@ -170,12 +218,4 @@
}
}
-sub missing_file {
- # not currently used
- my $self = shift;
- my $file = shift;
- Jifty->log->error("404: user tried to get to ".$file);
- Jifty->web->redirect('/__jifty/error/file_not_found');
-}
-
1;
More information about the Jifty-commit
mailing list