This is a discussion on Re: Can output filter return "page not found"? - modperl ; Sounds like something I would *not* do. If you are going to return a 404, why not do it as soon as possible. Generating data only to return a 404 sounds like useless extra work unless you are caching the ...
Sounds like something I would *not* do. If you are going to return a
404, why not do it as soon as possible.
Generating data only to return a 404 sounds like useless extra work
unless you are caching the same data for future requests.
On 12/17/07, Marc M. Adkins
> Thanks, good hint. I was thinking that myself overnight.
> Here's the basic scenario:
> I use the main request handler to generate XML. I have a framework that
> allows me to glue together various sub-handlers (from my framework, not
> Apache handlers) to add disparate data elements into the XML depending
> on the context of the page.
> Then I use an output filter to process the XML using XSLT. This
> completely separates data from presentation. Works really well except
> for my current issue. Seems like a reasonable use of the Apache 2.x
> handler structure.
> So I don't actually know whether the template exists until the output
> filter. I don't want to pollute my data generation phase with checking
> ahead for the template. I'm also not sure why Apache isn't detecting
> that the template doesn't exist ... it should look like any other
> servable resource.
> So before I start messing with headers I think I'll look at the way my
> configuration file is set up. Perhaps I'm doing something stupid there.
> I'm using
instead of (or whatever) to
> configure the output filter ... maybe it's something like that.
> Thanks again!
> Adam Prime wrote:
> > If you're using the bucket brigade API you'd have to intercept the
> > headers and modify them there. You might have an easier time doing
> > something like this using the stream API, but i don't really know, just
> > taking a shot in the dark. I'd think that it's certainly possible
> > though, somehow.
> > That said you might be better served catching whatever situation is
> > causing you to want to do this earlier in the request cycle and keeping
> > the response phase from doing whatever it wants to do in the first place
> > and just causing the 404 to happen then.
> > Adam
> > Marc M. Adkins wrote:
> >> Hmmm...it's a bucket brigade FilterRequestHandler output filter. It
> >> seems to not care what return code I use, whatever is in the bucket
> >> brigade goes out. Can I not return Apache2::Const::NOT_FOUND from
> >> handler()? That seems odd.
> >> Marc M. Adkins wrote:
> >>> I'm trying to cause a 404 error from an output filter and it isn't
> >>> doing what I expect. Is this even possible?
> >>> mma