I found the problem, it was in my session_handler.pl, which is pretty much a stock version that I got off of masonhq.com for use with MasonX::Request::WithApacheSession. I commented out:
# return -1 if $r->content_type && $r->content_type !~ m|^text/|io; out of my handler sub. Now it works fine but I'm wondering if this is the best way to handle it - it seems this line is here to restrict my mason app from serving anything other than a text/(html|plain) document. Will commenting this out cause any problems? Justin Sherrard Burton wrote: > john is right about the whitespace, but a 404 would have nothing to do > with whether the content is generated on the fly or served from > somewhere else on the filesystem. > > my guess is that something is not quite right with your mason setup. i > would break it down to a simple test case where you have a dhandler that > just dumps the apache headers or something simple like that, because it > doesn't look like your dhandler is actually getting called. you could > also create the same kind of test component in an actual file with a > .html or .pdf extension to see if they are served and parsed by mason. > > > > John Williams wrote: > >> You have carriage returns before and after <% $output %> which could be >> messing up your pdf, and which would definitely mess up a gif or jpeg. >> >> Try putting the output inside the <%init> section and abort when you are >> done, like this: >> >> <%init> >> # ... generate pdf ... >> $r->content_type('application/pdf'); >> $m->clear_buffer; >> $m->print($output); >> $m->abort; >> </%init> >> >> ~ John Williams >> >> >> On Tue, 11 Jul 2006, J Cook wrote: >> >> >> >>> Hi, >>> >>> I have a module that generates a pdf file on the fly that I want to use >>> with Mason. So I have a directory named /pdfs and a dhandler that looks >>> like: >>> >>> <%init> >>> my $file_name = ($r->filename =~ /.*?\/pdfs\/(.*?)\.pdf/gi); >>> $r->content_type('application/pdf'); >>> my $output = generate_pdf($file_name); >>> </%init> >>> >>> <% $output %> >>> >>> <%flags> >>> inherit => undef >>> </%flags> >>> >>> And I have in httpd.conf I have: >>> >>> <FilesMatch "(\.html|.pdf)$"> >>> SetHandler perl-script >>> PerlHandler MyApp::Mason >>> </FilesMatch> >>> >>> First off the file_name must match a database row, so generate_pdf can >>> use that info to make the pdf. So when I call something like: >>> http://example.com/pdfs/12345.pdf >>> I want to see a pdf pop up, but all I get is a 404 'Not Found' error. On >>> masonhq.com in the FAQs I read: >>> >>> "Use mod_perl's $r->content_type function to set the appropriate MIME >>> type. This will allow you to output, for example, a GIF file, even if >>> your component is called dynamicImage.html." >>> >>> Does this mean that Mason cannot serve a pdf file that is generated on >>> the fly like this? Do I need to name it with a .html extension and hope >>> this doesn't break in certain browsers? Or is it something in my code >>> above that is wrong? >>> >>> Justin >>> >>> >>> ------------------------------------------------------------------------- >>> Using Tomcat but need to do more? Need to support web services, security? >>> Get stuff done quickly with pre-integrated technology to make your job >>> easier >>> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>> _______________________________________________ >>> Mason-users mailing list >>> Mason-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/mason-users >>> >>> >> >> >> ------------------------------------------------------------------------- >> Using Tomcat but need to do more? Need to support web services, security? >> Get stuff done quickly with pre-integrated technology to make your job easier >> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> _______________________________________________ >> Mason-users mailing list >> Mason-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/mason-users >> > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Mason-users mailing list > Mason-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mason-users > > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users