$m->clear_buffer();
$m->print(<binary blob>);
$m->flush_buffer();
$m->abort();

Sounds like a good solution.  What I do is set/check attrs in my  
autohandler to see if I should print anything or call other  
components (like a header or footer).  But I like the solution above  
better in this case.

On Nov 15, 2007, at 1:06 PM, Brian Barto wrote:

> On 11/15/07, Jonathan Swartz <[EMAIL PROTECTED]> wrote:
>> http://www.masonhq.com/?FAQ:Components#h-
>> i_m_trying_to_generate_an_image_or_other_binary_file__but_it_seems_to 
>> _be
>> _getting_corrupted_
>
> Thanks but this link describes an issue different from my situation.
> My data is being corupted because the autohandler is printing HTML
> data before the subcomponent prints the binary data. And it is not an
> option for me to set the inherit flag of the requested component to
> undef since it is conditional whether the download.mas subcomponent is
> called.
>
> It is possible to set the inherit flag conditionally? Rather than
> doing it in a <%flags> block? That would possibly work.
>
>
>> On Nov 15, 2007, at 10:36 AM, Brian Barto wrote:
>>
>>> Hello all. I am trying to return a binary file from a subcomponent.
>>> However, the autohandler and requested component (e.g.  
>>> index.html) are
>>> being sent to the client along with the binary info, thus corrupting
>>> the data. Is it possible to get ONLY the output from a subcomponent
>>> and somehow suppress the requested component and autohandler?
>>>
>>> Here is an example stack of what I am dealing with:
>>>
>>> autohandler -> index.html -> download.mas
>>>
>>> ...where download.mas actually sends the binary info.
>>>
>>> Here is the code I am using in my download.mas component:
>>>
>>> $r->content_type('application/octet-stream');
>>> $r->header_out('Content-disposition' => ("attachment;
>>> filename=name.bin"));
>>> $m->print($binary_data);
>>>
>
> ---------------------------------------------------------------------- 
> ---
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Mason-users mailing list
> Mason-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mason-users


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to