| OpenFrame-WebApp documentation | Contained in the OpenFrame-WebApp distribution. |
OpenFrame::WebApp::Segment::Decline::StaticContent - decline if request uri is for static content.
$pipe->add_segment( OpenFrame::WebApp::Segment::StaticContent->new )
Inherits from OpenFrame::WebApp::Segment::Decline.
Declines if the request uri looks like it's for static content (currently a mime type of image/css).
Steve Purkis <spurkis@quiup.com>
| OpenFrame-WebApp documentation | Contained in the OpenFrame-WebApp distribution. |
package OpenFrame::WebApp::Segment::Decline::StaticContent; use MIME::Types; use base qw( OpenFrame::WebApp::Segment::Decline ); our $VERSION = (split(/ /, '$Revision: 1.1 $'))[1]; sub should_decline { my $self = shift; my $request = $self->store->get('OpenFrame::Request') || return; my $uri = $request->uri || return; my $mtype = MIME::Types->new->mimeTypeOf( $uri ) || return; return 1 if ($mtype->subType eq 'css'); return 1 if ($mtype->mediaType eq 'image'); return 0; } 1; __END__ #------------------------------------------------------------------------------