| Apache2-REST documentation | Contained in the Apache2-REST distribution. |
Apache2::REST::Handler::bin - Proof of concept for binary output.
Ouputs the logo png image
Allows GET
| Apache2-REST documentation | Contained in the Apache2-REST distribution. |
package Apache2::REST::Handler::bin ; use strict ; use base qw/Apache2::REST::Handler/ ;
sub GET{ my ( $self , $req , $resp ) = @_ ; $req->requestedFormat('bin') ; $resp->binMimeType('image/png') ; my $exFile = __FILE__ ; $exFile =~ s/bin\.pm$/bin_logo.png/ ; open ( INFILE , '<'.$exFile ) or die "Cannot open $exFile\n" ; my $bin = '' ; { local $/ = undef ; $bin = <INFILE>; } close INFILE ; $resp->bin($bin) ; return Apache2::Const::HTTP_OK ; }
sub isAuth{ my ( $self , $met , $req ) = @_ ; return $met eq 'GET' ; } 1;