Apache2::REST::Writer::bin - Apache2::REST::Response Writer for binary


Apache2-REST documentation Contained in the Apache2-REST distribution.

Index


Code Index:

NAME

Top

Apache2::REST::Writer::bin - Apache2::REST::Response Writer for binary

DESCRIPTION

Top

This writer returns the binary part of the response. If the bin_mimetype of the response is set, it returns this mimetype. Otherwise application/bin is returned

new

mimeType

Getter

asBytes

Returns the response as json UTF8 bytes for output.


Apache2-REST documentation Contained in the Apache2-REST distribution.
package Apache2::REST::Writer::bin ;
use strict ;

use JSON::XS ;

use Data::Dumper ;

sub new{
    my ( $class ) = @_;
    return bless {} , $class;
}

sub mimeType{
    my ( $self , $resp ) = @_ ;
    if ( $resp->binMimeType()){
        return $resp->binMimeType() ;
    }
    return 'application/bin' ;
}

sub asBytes{
    my ($self,  $resp ) = @_ ;
    
    return $resp->bin() ;
    
}

1;