You can generate the 404 error by specifying a status-code for serialize:

   <map:serialize type="xml" status-code="404"/>

But you'll also need some sort of dummy/error document to be serialized.

Or (I think) you can do a cocoon.sendStatus( 404 ) from flowscript.

But I thought that the error handler would only catch exceptions.
This would be a successful completion of a pipeline that resulted in a 404 error to the browser,
so I would think it would not trigger the handle-errors block.

( I'm new to this myself, so correct me if I'm wrong.
  I only chimed in because I'm working on something like the above
  in my sitemap right now. )


-- Steve Majewski


On Aug 11, 2006, at 4:41 PM, footh wrote:

I have a sitemap that first goes through a javaflow,
then is forwarded to an aggregation of several
different pieces.

One of those pieces is the main content.  If a URL is
requested that doesn't exist, grabbing the main
content will cause a null error in the pipeline (but
since it "matches" a pipeline, a 404 error will not be
thrown).

I need these instances to produce 404 error because
I'm getting killed by search engines that are
requesting URLs that don't exist anymore. They are not
getting 404 so they keep trying the URLs which causes
my log file to balloon in size.

So, anyway, I've figured out I should use the
"resource-exists" selector on the main content
aggregation part.  But, if the resource doesn't exist,
I want to force a 404 error so the "handle-errors"
block properly handles the error.  However, I can't
figure out how to generate an error that moves the
sitemap processing to the handle-errors block.  Here
is the pipeline snippet in question:

<map:match pattern="**-content">
  <map:select type="resource-exists">
    <map:when test="documents/{1}.xml">
      <map:generate type="jx"
src="documents/{1}.xml"/>
      <map:serialize type="xml"/>
    </map:when>
    <map:otherwise>
    <!-- force 404 error here!!! -->
    </map:otherwise>
  </map:select>
</map:match>

So, in the "otherwise" block, I'd like to force a 404
error.  I'm hoping there is a really simple way to do
this.  Anyone have a suggestion?

Thanks,

JF


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to