OpenFrame::WebApp::Segment::Decline::StaticContent - decline if request uri is for static content.


OpenFrame-WebApp documentation Contained in the OpenFrame-WebApp distribution.

Index


Code Index:

NAME

Top

OpenFrame::WebApp::Segment::Decline::StaticContent - decline if request uri is for static content.

SYNOPSIS

Top

  $pipe->add_segment( OpenFrame::WebApp::Segment::StaticContent->new )

DESCRIPTION

Top

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).

AUTHOR

Top

Steve Purkis <spurkis@quiup.com>

SEE ALSO

Top

MIME::Types, OpenFrame::WebApp::Segment::Decline


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__

#------------------------------------------------------------------------------