Hi John, Thank you for your hint. I wrote an exception included it in my xsp and performed the necessary steps in the sitemap and IT WORKED.
For all people who have a similar problem I summarize te steps in detail: My exception derived from org.apache.cocoon.ProcessingException (see http://cocoon.apache.org/2.1/userdocs/concepts/errorhandling.html ): package myPack; import org.apache.cocoon.*; import org.apache.avalon.framework.*; public class MyEmptyResultException extends org.apache.cocoon.ProcessingException { public MyEmptyResultException(String msg) { super(msg); } } My xsp: : <xsp:structure> <xsp:include>MyPack.*</xsp:include> </xsp:structure> <xsp:logic> : : /*auxilliary method for throwing the exception*/ protected void throwMyEmptyResultException() throws MyEmptyResultException { throw new MyEmptyResultException("No results Found on your query"); } : : </xsp:logic> : : <esql:no-results> <xsp:logic>throwMyEmptyResultException();</xsp:logic> </esql:no-results> : The Sitemap: : : <map:selector logger="sitemap.selector.exception" name="exception" src="org.apache.cocoon.selection.ExceptionSelector"> : : <exception class="MyPack.MyEmptyResultException" name="no-sql-results"/> : : </map:selector> : : : <map:handle-errors> <map:select type="exception"> <map:when test="no-sql-results"> <map:generate src="xml/error-not-found.xml"/> <map:transform src="xsl/error-not-found.xsl"/> <map:serialize status-code="404"/> </map:when> </map:select> </map:handle-errors> : : : _______________________________________________________ Am Mittwoch, 10. M�rz 2004 11:41 schrieb John L. Webber: > One way to solve the problem would be to throw a domain-specific > exception in the generator and use a selector for this exception in the > map:handle-errors for the pipeline. For example: > > <map:handle-errors> > <map:select type="exception"> > <map:when test="our-custom-exception"> > <map:generate src="niceerror.xsp" type="serverpages"/> > <map:transform src="html/site2html.xsl"> > <map:parameter name="pageTitle" value=": Resource not found"/> > </map:transform> > <map:serialize status-code="404"/> > </map:when> > </map:select> > </map:handle-errors> > > John > > thorsten schmid wrote: > >Hello, > > > >Does anyone now how to generate a 404 error page in xsp? > >We have an xsp-page searching a database for hits on clicked hyperlinks. > >Because the site is also visited by search engines, I want the server to > >respond with 404 status page as soon as the query returns no result. > >Otherwise the webcrawler would spider several 'sorry no result found' - > > pages. That would not make any sense at all. > > > >What I have been trying so far is to use the action logicsheet to > > redirect to an unknown uri to let cocoon serve the error page. But the > > use of the action logicsheet is not allowed within a generator. > > > >Does anyone have hints on how to solve the problem?? > >Best regards > >Thorsten > > > > > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] -- Thorsten Schmid NovoCron Technologies Am Steg 3, 89231 Neu-Ulm Fon: +49-731-9723757 Fax: +49-731-9723818 Mobil: +49-170-3021585 mailto:[EMAIL PROTECTED] www.novocron.de --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
