You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jonathan Layes <j....@layes.com> on 2002/06/14 17:02:05 UTC
Generating a 404 from
Hi all,
I have a few ESQL XSP pages where there is the potential for
the query to not generate any results. In those cases, I would
like to throw a ResourceNotFoundException and let my error
handling (defined in the sitemap) take over and generate a 404
back to the client. Is this a sensible thing to do and, if so,
how do I import ResourceNotFoundException into the context
of the XSP so I can write something like:
<esql:no-results>
<xsp:logic>
throw new ResourceNotFoundException("bla bla");
</xsp:logic>
</esql:no-results>
Thanks, Jonathan
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: Generating a 404 from
Posted by Jonathan Layes <j....@layes.com>.
Hi all,
I'm starting to get pretty good at answering my own Cocoon
questions :) After some digging, I found the xsp:structure
and xsp:include tags in both the included esql logicsheet
and in the logicsheet documentation. By including:
<xsp:structure>
<xsp:include>org.apache.cocoon.ResourceNotFoundException</xsp:include>
</xsp:structure>
at the top of the .xsp, I can later write:
<esql:no-results>
<xsp:logic>
throw new ResourceNotFoundException("There is no resource with that key"
);
</xsp:logic>
</esql:no-results>
and accomplish the desired result - kicking a ResourceNotFoundException
to the generator resulting in a 404 being returned to the client.
Cheers, Jonathan
On Fri, Jun 14, 2002 at 12:02:05PM -0300, Jonathan Layes wrote:
> Hi all,
>
> I have a few ESQL XSP pages where there is the potential for
> the query to not generate any results. In those cases, I would
> like to throw a ResourceNotFoundException and let my error
> handling (defined in the sitemap) take over and generate a 404
> back to the client. Is this a sensible thing to do and, if so,
> how do I import ResourceNotFoundException into the context
> of the XSP so I can write something like:
>
> <esql:no-results>
> <xsp:logic>
> throw new ResourceNotFoundException("bla bla");
> </xsp:logic>
> </esql:no-results>
>
> Thanks, Jonathan
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>