cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <DHo...@csir.co.za>
Subject Re: Handling "file not found errors"
Date Fri, 10 Oct 2008 10:57:18 GMT
Thanks Alexander
 
I know I do not quite "grok" this yet...
 
I have:
<map:selector name="exception" src="org.apache.cocoon.selection.ExceptionSelector">
  <exception name="not-found" class="org.apache.cocoon.ResourceNotFoundException"/>
  <exception name="file-not-found" class="java.io.FileNotFoundException"/>
</map:selector>  
...
(after the last pipeline)
...
  <map:handle-errors>
    <map:select type="exception">
      <map:when test="not-found">
        <map:generate type="file" src="docs/missing.xml"/>
	 <map:call resource="simple-page2html" status-code="404"/>
      </map:when>
      <map:when test="file-not-found">
        <map:generate type="file" src="docs/missingfile.xml"/>
	 <map:call resource="simple-page2html" status-code="404"/>
      </map:when>
    </map:select>
  </map:handle-errors>	

Which does not seem to work ie. still get same error page below?

Thanks
Derek

>>> On 2008/10/10 at 11:48, in message <76FC7B11-AEC0-4078-A91A-AE52610494F5@gmx.at>,
Alexander Daniel <alexander.daniel@gmx.at> wrote:
On 10.10.2008, at 10:48, Derek Hohls wrote:

> Using Cocoon 2.1.8
>
> I am displaying data from a database that, in theory, contains
> URL links to files on the local server.  Occasionally, for various  
> reasons,
> the files are not available.  At the moment, Cocoon returns an
> informative - but ugly - error page:
>
> Resource not found
> java.io.FileNotFoundException: [path to missing file] (The system  
> cannot find the file specified)
> Cocoon stacktrace[hide]
> Error during resolving of the input stream file: [...]myapp/ 
> sitemap.xmap - 335:73 <map:read>
> file: [...]myapp/sitemap.xmap - 887:66 <map:mount>
>
> Is there a way I can "trap" this error and display a custom page
> with a more friendly message?

This is possible with error handling [1].

Alex

[1] http://cocoon.apache.org/2.1/userdocs/concepts/errorhandling.html 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
For additional commands, e-mail: users-help@cocoon.apache.org 



-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice,
and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message