----- Original Message ----- From: "giacomo" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, December 29, 2001 12:12 PM Subject: Re: Refactoring and correction of error notification
> > Ken, > > Is this patch ready to be applied before I restructure the CVS repos? It works. So I would say yes. I also included the fix to the multiple error2html stylesheets you told me about. There is still a minor glitch though. I have to request the error page several times before it starts working. I've tried putting the NonCachingXXXPipelines but the problem is still there. The problem came out regardless of my patch, it happened when the setGenerator() code in AbstractEventPipeline changed at some point. It all boils down to the fact that the ComponentManager cannot find the GeneratorSelector. Which is strange, since it does find it for other components. I read something about the sitemap replacing it... but I can't track it down. How many damn ComponentManagers are there? Who the hell is doing what in that code? Here is the log: > > DEBUG (2001-12-27) 14:57.21:537 [core ] (/cocoon/generror) > > HttpProcessor[8080][3]/ExcaliburComponentManager: Could not find component > > for role: org.apache.cocoon.generation.GeneratorSelector <snip/> > > After some invocations/time it cutely says: > > > > DEBUG (2001-12-27) 14:58.14:973 [core ] (/cocoon/generror) > > HttpProcessor[8080][4]/ExcaliburComponentManager: Could not find component > > for role: org.apache.cocoon.generation.GeneratorSelector > > DEBUG (2001-12-27) 14:58.14:973 [core ] (/cocoon/generror) > > HttpProcessor[8080][4]/ExcaliburComponentManager: The Role Manager has not > > been set! > > DEBUG (2001-12-27) 14:58.14:973 [core ] (/cocoon/generror) > > HttpProcessor[8080][4]/AbstractEventPipeline: New GS > > org.apache.cocoon.sitemap.SitemapComponentSelector@24c22b > > DEBUG (2001-12-27) 14:58.14:973 [core ] (/cocoon/generror) > > HttpProcessor[8080][4]/ExcaliburComponentManager: The Role Manager has not > > been set! > > DEBUG (2001-12-27) 14:58.14:973 [core ] (/cocoon/generror) > > HttpProcessor[8080][4]/LogKitLogger: Retrieving a > > org.apache.cocoon.sitemap.NotifyingGenerator from the pool > > DEBUG (2001-12-27) 14:58.14:973 [core ] (/cocoon/generror) > > HttpProcessor[8080][4]/AbstractEventPipeline: > > !NG!org.apache.cocoon.sitemap.NotifyingGenerator@392fe8 > > Then all works perfectly. Go figure. :-/ BTW, since no other replies have been sent to the original mail, I assume that the issues raised aren't fundamental for the moment, so I haven't changed the code. Ciao :-) Ken -- Nicola Ken Barozzi [EMAIL PROTECTED] These are the days of miracle and wonder... ...so don't cry baby, don't cry... Paul Simon > On Thu, 27 Dec 2001, Nicola Ken Barozzi wrote: > > > Attatched is a first release of a possible patch to Cocoon HEAD for the > > correction of the error notification stuff. > > > > I've not yet submitted it as a patch because there are some minor problems > > that I still need to solve before releasing it as such. > > > > This patch contains code and suggestions from Peter Royal whom I thank for > > the valuable and kind cooperation. > > > > What has been done: > > 1- Changed the names of the classes to be more clear; for example > > Notificable becomes Notifying (that notifies), Notification becomes > > SimpleNotifyingBean and ErrorNotifier becomes NotifyingGenerator. > > 2- Refactored the error notification classes to fit under > > components.notification and separated the code that builds a Notifying > > object from the SimpleNotifyingBean for max flexibility: > > (Default)NotifyingBuilder, that is also an Avalon component. In this way > > you can filter your errors without touching the Notification DTD or > > creating custom Generators. > > 3- Added to the objectModel (in sitemap.xsl) from the beginning of > > processing a NotifyingObjects object that can contain any Notifying > > object that any component in the sitemap wants to add to it. In this way > > warnings (from Xalan or Xerces 4 example) can be appended to this and > > reported at the end with a notifications-view. > > 4- Deprecated special method in AbstractEventPipeline for ErrorNotifier; now > > the Notification is gotten from the objectmodel. > > 5- As a direct consequence of point 3 now Actions put in the handle-errors > > sitemap can get the NotifyingObjects and act on those; many times > > requested for error reporting to admins. > > 6- Last, but not least, any Exception that is alse Notifying gets notified > > using Notifying methods by the DefaultNotifyingBuilder. > > > > The DTD of the notification is the same and Notifying is almost identical to > > Notificable (a HashMap became a Map). Old classes and methods have been > > deprecated. > > > > The points that I need to resolve before submitting the patch are: > > I - should Constants.NOTIFYING_OBJECTS be put in the objectmodel and created > > there instead of in the sitemap? > > II - How come the handle-error pipeline works only after some > > time/invocations? The logs say that: > > > > DEBUG (2001-12-27) 14:57.21:537 [core ] (/cocoon/generror) > > HttpProcessor[8080][3]/ExcaliburComponentManager: Could not find component > > for role: org.apache.cocoon.generation.GeneratorSelector > > ERROR (2001-12-27) 14:57.21:537 [core ] (/cocoon/generror) > > HttpProcessor[8080][3]/sitemap_xmap: NotifyingGenerator was not able to > > notify the exception. > > org.apache.avalon.framework.component.ComponentException: Could not find > > component > > at > > org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup(Excal > > iburComponentManager.java:318) > > at > > org.apache.cocoon.components.pipeline.AbstractEventPipeline.setGenerator(Abs > > tractEventPipeline.java:97) > > at > > org.apache.cocoon.components.pipeline.CachingEventPipeline.setGenerator(Cach > > ingEventPipeline.java:75) > > at > > org.apache.cocoon.www.sitemap_xmap.error_process_9_500(sitemap_xmap.java:932 > > 9) > > at org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:3285) > > > > After some invocations/time it cutely says: > > > > DEBUG (2001-12-27) 14:58.14:973 [core ] (/cocoon/generror) > > HttpProcessor[8080][4]/ExcaliburComponentManager: Could not find component > > for role: org.apache.cocoon.generation.GeneratorSelector > > DEBUG (2001-12-27) 14:58.14:973 [core ] (/cocoon/generror) > > HttpProcessor[8080][4]/ExcaliburComponentManager: The Role Manager has not > > been set! > > DEBUG (2001-12-27) 14:58.14:973 [core ] (/cocoon/generror) > > HttpProcessor[8080][4]/AbstractEventPipeline: New GS > > org.apache.cocoon.sitemap.SitemapComponentSelector@24c22b > > DEBUG (2001-12-27) 14:58.14:973 [core ] (/cocoon/generror) > > HttpProcessor[8080][4]/ExcaliburComponentManager: The Role Manager has not > > been set! > > DEBUG (2001-12-27) 14:58.14:973 [core ] (/cocoon/generror) > > HttpProcessor[8080][4]/LogKitLogger: Retrieving a > > org.apache.cocoon.sitemap.NotifyingGenerator from the pool > > DEBUG (2001-12-27) 14:58.14:973 [core ] (/cocoon/generror) > > HttpProcessor[8080][4]/AbstractEventPipeline: > > !NG!org.apache.cocoon.sitemap.NotifyingGenerator@392fe8 > > > > Then all works perfectly. > > Does this have something to do with the Recomposable stuff? > > Suggestions? > > III- I would prefer to add the special NotifyingGenerator > > (ex-ErrorNotifier) to the sitemap in sitemap.roles instead > > of doing it in code in the sitemap. > > I've put tentative code in it (now commented) that doesn't work. > > Does this have something to do with the Recomposable stuff? > > Suggestions? > > > > Things that I will do when this is approved: > > a- create a <notify:xxx> XSP taglib, for reporting errors or setting > > notifictions in the objectmodel. > > b- create a NotifyingBuilder that filters error messages and enhances them > > using a Resource Bundle (taken also from faqs?). > > c- make a notifications-view to see if non-error notifications were issued > > d- documentation > > > > Finally, I've read the Constitution and [VOTE]s must be called by active > > developers. Being a developer, I humbly suggest that an active developer > > asks for a [VOTE] on this issue, being it a refactoring effort that > > touches the objectmodel and maybe Environment. > > > > Thank you. > > Nicola Ken Barozzi > > > > -- > > Nicola Ken Barozzi [EMAIL PROTECTED] > > > > These are the days of miracle and wonder... > > ...so don't cry baby, don't cry... > > Paul Simon > >
*** src/org/apache/cocoon/components/notification/DefaultNotifyingBuilder.java Wed Dec 31 14:00:00 1969 --- src/org/apache/cocoon/components/notification/DefaultNotifyingBuilder.java Sun Dec 23 17:40:00 2001 *************** *** 0 **** --- 1,161 ---- + /***************************************************************************** + * Copyright (C) The Apache Software Foundation. All rights reserved. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * + **************************************************************************** * + */ + + package org.apache.cocoon.components.notification; + + import org.apache.avalon.framework.CascadingThrowable; + import org.apache.avalon.framework.component.Component; + + import org.xml.sax.SAXException; + + import java.io.PrintWriter; + import java.io.StringWriter; + import java.util.Map; + + /** + * Generates an Notifying representation of widely used objects. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> + * @created 24 August 2000 + */ + public class DefaultNotifyingBuilder implements NotifyingBuilder, Component { + + /** Builds a Notifying object (SimpleNotifyingBean in this case) + * that tries to explain what the Object o can reveal. + * @param sender who sent this Object. + * @param o the object to use when building the SimpleNotifyingBean + * @return the Notifying Object that was build + * @see org.apache.cocoon.components.notification.Notifying + */ + public Notifying build (Object sender, Object o) { + if (o instanceof Notifying) { + return (Notifying) o; + } else if (o instanceof Throwable) { + Throwable t = (Throwable) o; + SimpleNotifyingBean n = new SimpleNotifyingBean(sender); + n.setType("error"); + n.setTitle("An error occurred"); + if (t != null) { + n.setSource(t.getClass().getName()); + n.setMessage(t.getMessage()); + n.setDescription(t.toString()); + + Throwable rootT = getRootCause(t); + n.addExtraDescription("original message", rootT.toString()); + + // get the stacktrace: if the exception is a SAXException, + // the stacktrace of the embedded exception is used as the + // SAXException does not append it automatically + Throwable stackTraceException; + if (t instanceof SAXException && ((SAXException) t).getException() != null) { + stackTraceException = ((SAXException) t).getException(); + } else { + stackTraceException = t; + } + //org.apache.avalon.framework.ExceptionUtil.captureStackTrace(); + StringWriter sw = new StringWriter(); + stackTraceException.printStackTrace(new PrintWriter(sw)); + n.addExtraDescription("stacktrace", sw.toString()); + // Add nested throwables description + sw = new StringWriter(); + appendCauses(new PrintWriter(sw), stackTraceException); + String causes = sw.toString(); + if (causes != null && causes.length() != 0) { + n.addExtraDescription("full exception chain stacktrace", causes); + } + } + return n; + } else { + SimpleNotifyingBean n = new SimpleNotifyingBean(sender); + n.setType("unknown"); + n.setTitle("Object notification"); + n.setSource(o.getClass().getName()); + n.setMessage(o.toString()); + n.setDescription("No details available."); + return n; + } + } + + /** Builds a Notifying object (SimpleNotifyingBean in this case) + * that explains a notification. + * @param sender who sent this Object. + * @param o the object to use when building the SimpleNotifyingBean + * @param type see the Notifying apidocs + * @param title see the Notifying apidocs + * @param source see the Notifying apidocs + * @param message see the Notifying apidocs + * @param description see the Notifying apidocs + * @param extra see the Notifying apidocs + * @return the Notifying Object that was build + * @see org.apache.cocoon.components.notification.Notifying + */ + public Notifying build(Object sender, Object o, String type, String title, + String source, String message, String description, Map extra) { + //NKB Cast here is secure, the method is of this class + SimpleNotifyingBean n = (SimpleNotifyingBean) build (sender, o); + + if (type != null) + n.setType(type); + if (title != null) + n.setTitle(title); + if (source != null) + n.setSource(source); + if (message != null) + n.setMessage(message); + if (description != null) + n.setDescription(description); + if (extra != null) + n.replaceExtraDescriptions(extra); + + return n; + } + + + /** + * Print recursively all nested causes of a Throwable in a PrintWriter. + */ + private static void appendCauses (PrintWriter out, Throwable t) { + Throwable cause = null; + if (t instanceof CascadingThrowable) { + cause = ((CascadingThrowable) t).getCause(); + } else if (t instanceof SAXException) { + cause = ((SAXException) t).getException(); + } else if (t instanceof java.sql.SQLException) { + cause = ((java.sql.SQLException) t).getNextException(); + } + if (cause != null) { + out.print("Original exception : "); + cause.printStackTrace(out); + out.println(); + // Recurse + appendCauses(out, cause); + } + } + + /** + * Get root Exception. + */ + private static Throwable getRootCause (Throwable t) { + Throwable cause = null; + if (t instanceof CascadingThrowable) { + cause = ((CascadingThrowable) t).getCause(); + } else if (t instanceof SAXException) { + cause = ((SAXException) t).getException(); + } else if (t instanceof java.sql.SQLException) { + cause = ((java.sql.SQLException) t).getNextException(); + } + if (cause == null) { + return t; + } else { + // Recurse + return getRootCause(cause); + } + } + } + *** src/org/apache/cocoon/components/notification/Notifier.java Wed Dec 31 14:00:00 1969 --- src/org/apache/cocoon/components/notification/Notifier.java Fri Dec 21 15:02:04 2001 *************** *** 0 **** --- 1,140 ---- + /***************************************************************************** + * Copyright (C) The Apache Software Foundation. All rights reserved. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * + *****************************************************************************/ + + package org.apache.cocoon.components.notification; + + import org.apache.cocoon.Constants; + + import org.xml.sax.ContentHandler; + import org.xml.sax.SAXException; + import org.xml.sax.helpers.AttributesImpl; + + import java.io.IOException; + import java.io.OutputStream; + import java.util.Map; + import java.util.Iterator; + + /** + * Generates a representations of the specified Notifying Object. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa + * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> + * @version CVS $Revision: 1.2.2.4 $ $Date: 2001/10/11 08:56:04 $ + */ + + public class Notifier { + + /** + * Generate notification information as a response. + * The notification is directly written to the OutputStream. + * @param n The <code>Notifying</code> object + * @param outputStream The output stream the notification is written to + * This could be <code>null</code>. + * @return The content type for this notification + * (currently always text/html) + */ + public static String notify(Notifying n, + OutputStream outputStream) throws IOException { + + StringBuffer sb = new StringBuffer(); + + sb.append("<html><head><title>").append(n.getTitle()).append("</title>"); + sb.append("<STYLE><!--H1{font-family : sans-serif,Arial,Tahoma;color : +white;background-color : #0086b2;} "); + sb.append("BODY{font-family : sans-serif,Arial,Tahoma;color : +black;background-color : white;} "); + sb.append("B{color : white;background-color : #0086b2;} "); + sb.append("HR{color : #0086b2;} "); + sb.append("--></STYLE> "); + sb.append("</head><body>"); + sb.append("<h1>Cocoon 2 - ").append(n.getTitle()).append("</h1>"); + sb.append("<HR size=\"1\" noshade=\"noshade\">"); + sb.append("<p><b>type</b> ").append(n.getType()).append("</p>"); + sb.append("<p><b>message</b> <u>").append(n.getMessage()).append("</u></p>"); + sb.append("<p><b>description</b> +<u>").append(n.getDescription()).append("</u></p>"); + sb.append("<p><b>sender</b> ").append(n.getSender()).append("</p>"); + sb.append("<p><b>source</b> ").append(n.getSource()).append("</p>"); + + Map extraDescriptions = n.getExtraDescriptions(); + Iterator keyIter = extraDescriptions.keySet().iterator(); + + while (keyIter.hasNext()) { + String key = (String) keyIter.next(); + + sb.append("<p><b>").append(key).append("</b><pre>").append( + extraDescriptions.get(key)).append("</pre></p>"); + } + + sb.append("<HR size=\"1\" noshade>"); + sb.append("</body></html>"); + + if (outputStream != null) + outputStream.write(sb.toString().getBytes()); + // FIXME (SM) how can we send the error with the proper content type? + + return "text/html"; + } + + /** + * Generate notification information in XML format. + */ + public static void notify(Notifying n, ContentHandler ch) throws SAXException { + + final String PREFIX = Constants.ERROR_NAMESPACE_PREFIX; + final String URI = Constants.ERROR_NAMESPACE_URI; + + // Start the document + ch.startDocument(); + ch.startPrefixMapping(PREFIX, URI); + + // Root element. + AttributesImpl atts = new AttributesImpl(); + + atts.addAttribute(URI, "type", PREFIX + ":type", "CDATA", n.getType()); + atts.addAttribute(URI, "sender", PREFIX + ":sender", "CDATA", n.getSender()); + ch.startElement(URI, "notify", PREFIX + ":notify", atts); + ch.startElement(URI, "title", PREFIX + ":title", new AttributesImpl()); + ch.characters(n.getTitle().toCharArray(), 0, n.getTitle().length()); + ch.endElement(URI, "title", PREFIX + ":title"); + ch.startElement(URI, "source", PREFIX + ":source", new AttributesImpl()); + ch.characters(n.getSource().toCharArray(), 0, n.getSource().length()); + ch.endElement(URI, "source", PREFIX + ":source"); + ch.startElement(URI, "message", PREFIX + ":message", new AttributesImpl()); + + if (n.getMessage() != null) { + ch.characters(n.getMessage().toCharArray(), 0, n.getMessage().length()); + } + + ch.endElement(URI, "message", PREFIX + ":message"); + ch.startElement(URI, "description", PREFIX + ":description", + new AttributesImpl()); + ch.characters(n.getDescription().toCharArray(), 0, n.getDescription().length()); + ch.endElement(URI, "description", PREFIX + ":description"); + + Map extraDescriptions = n.getExtraDescriptions(); + Iterator keyIter = extraDescriptions.keySet().iterator(); + + while (keyIter.hasNext()) { + String key = (String) keyIter.next(); + + atts = new AttributesImpl(); + + atts.addAttribute(URI, "description", PREFIX + ":description", "CDATA", key); + ch.startElement(URI, "extra", PREFIX + ":extra", atts); + ch.characters(extraDescriptions.get(key).toString().toCharArray(), 0, + (extraDescriptions.get(key).toString()).length()); + ch.endElement(URI, "extra", PREFIX + ":extra"); + } + + // End root element. + ch.endElement(URI, "notify", PREFIX + ":notify"); + + // End the document. + ch.endPrefixMapping(PREFIX); + ch.endDocument(); + } + } + *** src/org/apache/cocoon/components/notification/Notifying.java Wed Dec 31 14:00:00 1969 --- src/org/apache/cocoon/components/notification/Notifying.java Thu Dec 20 13:11:24 2001 *************** *** 0 **** --- 1,67 ---- + /***************************************************************************** + * Copyright (C) The Apache Software Foundation. All rights reserved. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * + *****************************************************************************/ + + package org.apache.cocoon.components.notification; + + import java.util.Map; + + /** + * Interface for Objects that can notify something. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> + * @created 24 August 2000 + */ + + public interface Notifying { + + /** + * Proposed types of notifications + */ + public static final String UNKNOWN_NOTIFICATION = "unknown"; + public static final String DEBUG_NOTIFICATION = "debug"; + public static final String INFO_NOTIFICATION = "info" ; + public static final String WARN_NOTIFICATION = "warn" ; + public static final String ERROR_NOTIFICATION = "error"; + public static final String FATAL_NOTIFICATION = "fatal"; + + /** + * Gets the Type of the Notifying object + */ + String getType(); + + /** + * Gets the Title of the Notifying object + */ + String getTitle(); + + /** + * Gets the Source of the Notifying object + */ + String getSource(); + + /** + * Gets the Sender of the Notifying object + */ + String getSender(); + + /** + * Gets the Message of the Notifying object + */ + String getMessage(); + + /** + * Gets the Description of the Notifying object + */ + String getDescription(); + + /** + * Gets the ExtraDescriptions of the Notifying object + */ + Map getExtraDescriptions(); + } + *** src/org/apache/cocoon/components/notification/NotifyingBuilder.java Wed Dec 31 14:00:00 1969 --- src/org/apache/cocoon/components/notification/NotifyingBuilder.java Sun Dec 23 17:40:00 2001 *************** *** 0 **** --- 1,56 ---- + /***************************************************************************** + * Copyright (C) The Apache Software Foundation. All rights reserved. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * + *****************************************************************************/ + + package org.apache.cocoon.components.notification; + + import java.util.Map; + + import org.apache.avalon.framework.component.Component; + + /** + * Generates an Notifying representation of widely used objects. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> + * @created 24 August 2000 + */ + + public interface NotifyingBuilder extends Component{ + + /** + * The role implemented by a <code>NotifyingBuilder</code>. + */ + String ROLE = "org.apache.cocoon.components.notification.NotifyingBuilder"; + + /** Builds a Notifying object (SimpleNotifyingObject in this case) + * that tries to explain what the Object o can reveal. + * @param sender who sent this Object. + * @param o the object to use when building the SimpleNotifyingObject + * @return the Notifying Object that was build + * @see org.apache.cocoon.components.notification.Notifying + */ + public Notifying build(Object sender, Object o); + + + /** Builds a Notifying object (SimpleNotifyingObject in this case) + * that explains a notification. + * @param sender who sent this Object. + * @param o the object to use when building the SimpleNotifyingObject + * @param type see the Notifying apidocs + * @param title see the Notifying apidocs + * @param source see the Notifying apidocs + * @param message see the Notifying apidocs + * @param description see the Notifying apidocs + * @param extra see the Notifying apidocs + * @return the Notifying Object that was build + * @see org.apache.cocoon.components.notification.Notifying + */ + public Notifying build(Object sender, Object o, String type, String title, + String source, String message, String description, Map extra); + } + + *** src/org/apache/cocoon/components/notification/NotifyingCascadingRuntimeException.java Wed Dec 31 14:00:00 1969 --- src/org/apache/cocoon/components/notification/NotifyingCascadingRuntimeException.java Sat Dec 29 12:47:28 2001 *************** *** 0 **** --- 1,110 ---- + /***************************************************************************** + * Copyright (C) The Apache Software Foundation. All rights reserved. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * + *****************************************************************************/ + + package org.apache.cocoon.components.notification; + + import org.apache.avalon.framework.CascadingRuntimeException; + + import java.util.Map; + + import java.io.PrintStream; + import java.io.PrintWriter; + + /** + * A CascadingRuntimeException that is also Notifying. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> + * @created 7 December 2001 + */ + public class NotifyingCascadingRuntimeException + extends CascadingRuntimeException + implements Notifying{ + + /** + * The Notifying Object used internally to keep Notifying fields + */ + Notifying n; + + /** + * Construct a new <code>NotifyingCascadingRuntimeException</code> instance. + */ + public NotifyingCascadingRuntimeException(String message) { + super(message, null); + n = new DefaultNotifyingBuilder().build(this, message); + } + + /** + * Creates a new <code>ProcessingException</code> instance. + * + * @param ex an <code>Exception</code> value + */ + public NotifyingCascadingRuntimeException(Exception ex) { + super(ex.getMessage(), ex); + n = new DefaultNotifyingBuilder().build(this, ex); + } + + /** + * Construct a new <code>ProcessingException</code> that references + * a parent Exception. + */ + public NotifyingCascadingRuntimeException(String message, Throwable t) { + super(message, t); + n = new DefaultNotifyingBuilder().build(this, t); + } + + /** + * Gets the Type attribute of the Notifying object + */ + public String getType() { + return n.getType(); + } + + /** + * Gets the Title attribute of the Notifying object + */ + public String getTitle() { + return n.getTitle(); + } + + /** + * Gets the Source attribute of the Notifying object + */ + public String getSource() { + return n.getSource(); + } + + /** + * Gets the Sender attribute of the Notifying object + */ + public String getSender() { + return n.getSender(); + } + + /** + * Gets the Message attribute of the Notifying object + */ + public String getMessage() { + return n.getMessage(); + } + + /** + * Gets the Description attribute of the Notifying object + */ + public String getDescription() { + return n.getDescription(); + } + + /** + * Gets the ExtraDescriptions attribute of the Notifying object + */ + public Map getExtraDescriptions() { + return n.getExtraDescriptions(); + } + + } + *** src/org/apache/cocoon/components/notification/NotifyingObjects.java Wed Dec 31 14:00:00 1969 --- src/org/apache/cocoon/components/notification/NotifyingObjects.java Sun Dec 23 17:06:04 2001 *************** *** 0 **** --- 1,57 ---- + /***************************************************************************** + * Copyright (C) The Apache Software Foundation. All rights reserved. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * + *****************************************************************************/ + + package org.apache.cocoon.components.notification; + + import java.util.List; + import java.util.ArrayList; + import java.util.Iterator; + + /** + * Interface for a List of Objects that can notify something. + * NKB: FIXME The type checks are not complete. + * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> + * @created 18 December 2001 + */ + public class NotifyingObjects{ + + private ArrayList notifyingObjects; + + public NotifyingObjects() + { + notifyingObjects = new ArrayList(); + } + + public synchronized void addNotifying(Notifying n) + { + notifyingObjects.add(n); + } + + public synchronized Notifying getNotifying(int i) + { //NKB cast is safe here + return (Notifying)notifyingObjects.get(i); + } + + public synchronized Notifying getLastNotifying() + { //NKB cast is safe here + return (Notifying)notifyingObjects.get(notifyingObjects.size()-1); + } + + public Iterator iterator() + { + return notifyingObjects.iterator(); + } + + public int size() + { + return notifyingObjects.size(); + } + + + } + *** src/org/apache/cocoon/components/notification/SimpleNotifyingBean.java Wed Dec 31 14:00:00 1969 --- src/org/apache/cocoon/components/notification/SimpleNotifyingBean.java Fri Dec 21 15:07:48 2001 *************** *** 0 **** --- 1,204 ---- + /***************************************************************************** + * Copyright (C) The Apache Software Foundation. All rights reserved. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * + *****************************************************************************/ + + package org.apache.cocoon.components.notification; + + import java.io.PrintWriter; + import java.io.StringWriter; + import java.util.Map; + import java.util.HashMap; + + /** + * A simple bean implementation of Notifying. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> + * @created 24 August 2000 + */ + + public class SimpleNotifyingBean implements Notifying { + + /** + * The type of the notification. Examples can be "warning" or "error" + */ + private String type = "unknown"; + + /** + * The title of the notification. + */ + private String title = ""; + + /** + * The source that generates the notification. + */ + private String source = ""; + + /** + * The sender of the notification. + */ + private String sender = ""; + + /** + * The notification itself. + */ + private String message = "Message not known."; + + /** + * A more detailed description of the notification. + */ + private String description = "No details available."; + + /** + * A HashMap containing extra notifications + */ + private HashMap extraDescriptions = new HashMap(); + + public SimpleNotifyingBean(Object sender) { + this.sender = sender.getClass().getName(); + setSource(this.getClass().getName()); + setTitle("Generic notification"); + } + + /** + * Sets the Type of the SimpleNotifyingBean object + * + *@param type The new Type value + */ + public void setType(String type) { + this.type = type; + } + + /** + * Sets the Title of the SimpleNotifyingBean object + * + *@param title The new Title value + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * Sets the Source of the SimpleNotifyingBean object + * + *@param source The new Source value + */ + public void setSource(String source) { + this.source = source; + } + + /** + * Sets the Sender of the SimpleNotifyingBean object + * + *@param sender The new sender value + */ + private void setSender(Object sender) { + this.sender = sender.getClass().getName(); + } + + /** + * Sets the Sender of the SimpleNotifyingBean object + * + *@param sender The new sender value + */ + private void setSender(String sender) { + this.sender = sender; + } + + /** + * Sets the Message of the SimpleNotifyingBean object + * + *@param message The new Message value + */ + public void setMessage(String message) { + this.message = message; + } + + /** + * Sets the Description of the SimpleNotifyingBean object + * + *@param description The new Description value + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * Sets the ExtraDescriptions of the SimpleNotifyingBean object + * + *@param extraDescriptions The new ExtraDescriptions value + */ + public void addExtraDescription(String extraDescriptionDescription, + String extraDescription) { + this.extraDescriptions.put(extraDescriptionDescription, extraDescription); + } + + /** + * replaces the ExtraDescriptions of the SimpleNotifyingBean object + */ + protected void replaceExtraDescriptions(Map extraDescriptions) { + this.extraDescriptions = new HashMap(extraDescriptions); + } + + /** + * replaces the ExtraDescriptions of the SimpleNotifyingBean object + */ + protected void replaceExtraDescriptions(HashMap extraDescriptions) { + this.extraDescriptions = extraDescriptions; + } + + /** + * Gets the Type of the SimpleNotifyingBean object + */ + public String getType() { + return type; + } + + /** + * Gets the Title of the SimpleNotifyingBean object + */ + public String getTitle() { + return title; + } + + /** + * Gets the Source of the SimpleNotifyingBean object + */ + public String getSource() { + return source; + } + + /** + * Gets the Sender of the SimpleNotifyingBean object + */ + public String getSender() { + return sender; + } + + /** + * Gets the Message of the SimpleNotifyingBean object + */ + public String getMessage() { + return message; + } + + /** + * Gets the Description of the SimpleNotifyingBean object + */ + public String getDescription() { + return description; + } + + /** + * Gets the ExtraDescriptions of the SimpleNotifyingBean object + */ + public Map getExtraDescriptions() { + return extraDescriptions; + } + } + + + *** src/org/apache/cocoon/sitemap/NotifyingGenerator.java Wed Dec 31 14:00:00 1969 --- src/org/apache/cocoon/sitemap/NotifyingGenerator.java Sun Dec 23 17:08:28 2001 *************** *** 0 **** --- 1,73 ---- + /***************************************************************************** + * Copyright (C) The Apache Software Foundation. All rights reserved. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * + *****************************************************************************/ + + package org.apache.cocoon.sitemap; + + import java.util.Map; + import java.io.IOException; + + import org.apache.avalon.excalibur.pool.Recyclable; + import org.apache.avalon.framework.parameters.Parameters; + import org.apache.cocoon.components.notification.Notifying; + import org.apache.cocoon.components.notification.Notifier; + import org.apache.cocoon.components.notification.NotifyingObjects; + import org.apache.cocoon.generation.ComposerGenerator; + import org.apache.cocoon.environment.SourceResolver; + import org.apache.cocoon.ProcessingException; + import org.apache.cocoon.Constants; + + import org.xml.sax.SAXException; + + /** + * Generates an XML representation of the current notification. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Peter Royal</a> + * @created 31 July 2000 + * @version CVS $Revision: 1.5 $ $Date: 2001/10/11 07:28:23 $ + */ + public class NotifyingGenerator extends ComposerGenerator implements Recyclable { + /** + * The <code>Notification</code> to report. + */ + private Notifying notification = null; + + public void setup(SourceResolver resolver, Map objectModel, String src, + Parameters par) throws ProcessingException, SAXException, IOException { + super.setup(resolver, objectModel, src, par); + + NotifyingObjects notifyingObjects = +(NotifyingObjects)objectModel.get(Constants.NOTIFYING_OBJECTS); + + if ( notifyingObjects == null) { + throw new ProcessingException("Expected NotifyingObjects not found in object +model"); + } + + notification = notifyingObjects.getLastNotifying(); + } + + /** + * Generate the notification information in XML format. + * + * @exception SAXException Description of problem there is creating the output +SAX events. + * @throws SAXException when there is a problem creating the + * output SAX events. + */ + public void generate() throws SAXException { + Notifier.notify(notification, this.contentHandler); + } + + /** + * Recycle + */ + public void recycle() { + super.recycle(); + this.notification = null; + } + } + *** src/org/apache/cocoon/Constants.java 17 Dec 2001 20:42:28 -0000 1.15 --- src/org/apache/cocoon/Constants.java 29 Dec 2001 13:19:19 -0000 *************** *** 59,64 **** --- 59,65 ---- * The <code>Constants</code> use throughout the core of the Cocoon engine. * * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Peter Royal</a> * @version CVS $Revision: 1.15 $ $Date: 2001/12/17 20:42:28 $ */ public interface Constants { *************** *** 260,265 **** --- 261,271 ---- * */ String LINK_OBJECT = "link"; + + /** + * The name of a <code>NotifyingObjects</code> object in the so called +objectModel <code>Map</code>. + */ + String NOTIFYING_OBJECTS = "notifying-objects"; /** * Describe variable <code>INDEX_URI</code> here. *************** *** 309,311 **** --- 315,319 ---- boolean DESCRIPTOR_RELOADABLE_DEFAULT = true; } + + *** src/org/apache/cocoon/Notificable.java 9 May 2001 20:49:27 -0000 1.1.1.1 --- src/org/apache/cocoon/Notificable.java 29 Dec 2001 13:19:25 -0000 *************** *** 8,56 **** package org.apache.cocoon; ! import java.util.HashMap; /** * Interface for Objects that can notify something. * ! * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa * @created 24 August 2000 */ ! public interface Notificable { - /** - * Gets the Type attribute of the Notificable object - */ - String getType(); - - /** - * Gets the Title attribute of the Notificable object - */ - String getTitle(); - - /** - * Gets the Source attribute of the Notificable object - */ - String getSource(); - - /** - * Gets the Sender attribute of the Notificable object - */ - String getSender(); - - /** - * Gets the Message attribute of the Notificable object - */ - String getMessage(); - - /** - * Gets the Description attribute of the Notificable object - */ - String getDescription(); - - /** - * Gets the ExtraDescriptions attribute of the Notificable object - */ - HashMap getExtraDescriptions(); } --- 8,24 ---- package org.apache.cocoon; ! import org.apache.cocoon.components.notification.Notifying; /** * Interface for Objects that can notify something. * ! * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> ! * @deprecated Now another interface is used ! * @see org.apache.components.notification.Notifying * @created 24 August 2000 */ ! public interface Notificable extends Notifying{ } *** src/org/apache/cocoon/Notification.java 17 Oct 2001 10:06:24 -0000 1.7 --- src/org/apache/cocoon/Notification.java 29 Dec 2001 13:19:30 -0000 *************** *** 8,289 **** package org.apache.cocoon; import org.apache.avalon.framework.CascadingThrowable; import org.xml.sax.SAXException; import java.io.PrintWriter; import java.io.StringWriter; import java.util.HashMap; /** * Generates an XML representation of the current notification. * ! * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa * @created 24 August 2000 */ ! public class Notification implements Notificable { ! ! /** ! * The type of the notification. Examples can be "warning" or "error" ! */ ! private String type = ""; ! ! /** ! * The title of the notification. ! */ ! private String title = ""; ! ! /** ! * The source that generates the notification. ! */ ! private String source = ""; ! ! /** ! * The sender of the notification. ! */ ! private String sender = ""; ! ! /** ! * The notification itself. ! */ ! private String message = ""; ! ! /** ! * A more detailed description of the notification. ! */ ! private String description = ""; ! ! /** ! * A Hashtable containing extra notifications that do ! */ ! private HashMap extraDescriptions = new HashMap(); ! ! /** ! * Constructor for the Notification object ! */ public Notification(Object sender) { ! setSender(sender); ! } ! ! /** ! * Constructor for the Notification object ! * ! * @param o Description of Parameter ! */ ! public Notification(Object sender, Object o) { ! this(sender); ! setType("object"); ! setTitle("Object notification"); ! setSource(o.getClass().getName()); ! setMessage(o.toString()); ! } ! ! /** ! * Constructor for the Notification object ! * ! * @param t Description of Parameter ! */ ! public Notification(Object sender, Throwable t) { ! this(sender); ! setType("error"); ! setTitle("Cocoon error"); ! if(t != null) ! { ! setSource(t.getClass().getName()); ! setMessage(t.getMessage()); ! setDescription(t.toString()); ! ! extraDescriptions.put("exception", t.toString()); ! // get the stacktrace: if the exception is a SAXException, ! // the stacktrace of the embedded exception is used as the ! // SAXException does not append it automatically ! Throwable stackTraceException; ! if (t instanceof SAXException ! && ((SAXException)t).getException() != null) { ! stackTraceException = ((SAXException)t).getException(); ! } else { ! stackTraceException = t; ! } ! StringWriter sw = new StringWriter(); ! stackTraceException.printStackTrace(new PrintWriter(sw)); ! extraDescriptions.put("stacktrace", sw.toString()); ! ! // Add nested throwables description ! sw = new StringWriter(); ! appendCauses(new PrintWriter(sw), stackTraceException); ! ! String causes = sw.toString(); ! if (causes != null && causes.length() != 0) { ! extraDescriptions.put("original exception", causes); ! } ! ! /* Now handled by appendCauses() ! // if the throwable is a CascadingThrowable the strack trace ! // is automatically appended by the CascadingThrowable, so we ! // only have to deal with the case if the embedded exception ! // of the CascadingThrowable is a SAXException. ! if (t instanceof CascadingThrowable) { ! Throwable cause = ((CascadingThrowable)t).getCause(); ! if(cause != null && cause instanceof SAXException) { ! cause = ((SAXException)cause).getException(); ! if(cause != null) { ! extraDescriptions.put("original exception", cause.toString()); ! stackTrace = new StringWriter(); ! cause.printStackTrace(new PrintWriter(stackTrace)); ! extraDescriptions.put("original exception stacktrace", stackTrace.toString()); ! } ! } ! } ! */ ! } ! } ! ! /** ! * Print recursively all nested causes of a Throwable in a PrintWriter. ! */ ! public void appendCauses(PrintWriter out, Throwable t) { ! Throwable cause = null; ! if (t instanceof CascadingThrowable) { ! cause = ((CascadingThrowable)t).getCause(); ! } else if (t instanceof SAXException) { ! cause = ((SAXException)t).getException(); ! } else if (t instanceof java.sql.SQLException) { ! cause = ((java.sql.SQLException)t).getNextException(); ! } ! ! if (cause != null) { ! out.print("Original exception : "); ! cause.printStackTrace(out); ! out.println(); ! ! // Recurse ! appendCauses(out, cause); ! } ! } ! ! /** ! * Sets the Type attribute of the Notification object ! * ! *@param type The new Type value ! */ ! public void setType(String type) { ! this.type = type; ! } ! ! /** ! * Sets the Title attribute of the Notification object ! * ! *@param title The new Title value ! */ ! public void setTitle(String title) { ! this.title = title; ! } ! ! /** ! * Sets the Source attribute of the Notification object ! * ! *@param source The new Source value ! */ ! public void setSource(String source) { ! this.source = source; ! } ! ! /** ! * Sets the Sender attribute of the Notification object ! * ! *@param sender The new sender value ! */ ! private void setSender(Object sender) { ! this.sender = sender.getClass().getName(); ! } ! ! /** ! * Sets the Sender attribute of the Notification object ! * ! *@param sender The new sender value ! */ ! private void setSender(String sender) { ! this.sender = sender; ! } ! ! /** ! * Sets the Message attribute of the Notification object ! * ! *@param message The new Message value ! */ ! public void setMessage(String message) { ! this.message = message; ! } ! ! /** ! * Sets the Description attribute of the Notification object ! * ! *@param description The new Description value ! */ ! public void setDescription(String description) { ! this.description = description; ! } ! ! /** ! * Sets the ExtraDescriptions attribute of the Notification object ! * ! *@param extraDescriptions The new ExtraDescriptions value ! */ ! public void addExtraDescription(String extraDescriptionDescription, ! String extraDescription) { ! this.extraDescriptions.put(extraDescriptionDescription, ! extraDescription); ! } ! ! /** ! * Gets the Type attribute of the Notification object ! */ ! public String getType() { ! return type; ! } ! ! /** ! * Gets the Title attribute of the Notification object ! */ ! public String getTitle() { ! return title; ! } ! ! /** ! * Gets the Source attribute of the Notification object ! */ ! public String getSource() { ! return source; ! } ! ! /** ! * Gets the Sender attribute of the Notification object ! */ ! public String getSender() { ! return sender; ! } ! ! /** ! * Gets the Message attribute of the Notification object ! */ ! public String getMessage() { ! return message; ! } ! ! /** ! * Gets the Description attribute of the Notification object ! */ ! public String getDescription() { ! return description; ! } - /** - * Gets the ExtraDescriptions attribute of the Notification object - */ - public HashMap getExtraDescriptions() { - return extraDescriptions; - } } --- 8,38 ---- package org.apache.cocoon; + import org.apache.cocoon.components.notification.SimpleNotifyingBean; + import org.apache.avalon.framework.CascadingThrowable; import org.xml.sax.SAXException; import java.io.PrintWriter; import java.io.StringWriter; import java.util.HashMap; + import java.util.Map; /** * Generates an XML representation of the current notification. * ! * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> ! * @deprecated Now another interface is used ! * @see org.apache.components.notification.SimpleNotifyingBean * @created 24 August 2000 */ ! public class Notification extends SimpleNotifyingBean { ! public Notification(Object sender) { ! super(sender); ! } } *** src/org/apache/cocoon/Notifier.java 11 Oct 2001 07:28:15 -0000 1.6 --- src/org/apache/cocoon/Notifier.java 29 Dec 2001 13:19:35 -0000 *************** *** 8,139 **** package org.apache.cocoon; ! import org.xml.sax.ContentHandler; ! import org.xml.sax.SAXException; ! import org.xml.sax.helpers.AttributesImpl; - import java.io.IOException; - import java.io.OutputStream; - import java.util.HashMap; - import java.util.Iterator; /** * Generates an XML representation of the current notification. * ! * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> * @version CVS $Revision: 1.6 $ $Date: 2001/10/11 07:28:15 $ */ ! public class Notifier { - /** - * Generate notification information as a response. - * The notification is directly written to the OutputStream. - * @param n The <code>Notificable</code> object - * @param outputStream The output stream the notification is written to - * This could be <code>null</code>. - * @return The content type for this notification - * (currently always text/html) - */ - public static String notify(Notificable n, OutputStream outputStream) - throws IOException { - StringBuffer sb = new StringBuffer(); - - sb.append("<html><head><title>").append(n.getTitle()).append("</title>"); - sb.append("<STYLE><!--H1{font-family : sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;} "); - sb.append("BODY{font-family : sans-serif,Arial,Tahoma;color : black;background-color : white;} "); - sb.append("B{color : white;background-color : #0086b2;} "); - sb.append("HR{color : #0086b2;} "); - sb.append("--></STYLE> "); - sb.append("</head><body>"); - sb.append("<h1>Cocoon 2 - ").append(n.getTitle()).append("</h1>"); - sb.append("<HR size=\"1\" noshade>"); - sb.append("<p><b>type</b> ").append(n.getType()).append("</p>"); - sb.append("<p><b>message</b> <u>").append(n.getMessage()).append("</u></p>"); - sb.append("<p><b>description</b> <u>").append(n.getDescription()).append("</u></p>"); - sb.append("<p><b>sender</b> ").append(n.getSender()).append("</p>"); - sb.append("<p><b>source</b> ").append(n.getSource()).append("</p>"); - - HashMap extraDescriptions = n.getExtraDescriptions(); - Iterator keyIter = extraDescriptions.keySet().iterator(); - - while (keyIter.hasNext()) { - String key = (String) keyIter.next(); - - sb.append("<p><b>").append(key).append("</b><pre>").append(extraDescriptions.get(key)).append("</pre></p>"); - } - - sb.append("<HR size=\"1\" noshade>"); - sb.append("</body></html>"); - - if (outputStream != null) outputStream.write(sb.toString().getBytes()); - // FIXME (SM) how can we send the error with the proper content type? - - return "text/html"; - } - - /** - * Generate notification information in XML format. - */ - public static void notify(Notificable n, ContentHandler ch) throws SAXException { - - final String PREFIX = Constants.ERROR_NAMESPACE_PREFIX; - final String URI = Constants.ERROR_NAMESPACE_URI; - - // Start the document - ch.startDocument(); - ch.startPrefixMapping(PREFIX, URI); - - // Root element. - AttributesImpl atts = new AttributesImpl(); - - atts.addAttribute(URI, "type", PREFIX+":type", "CDATA", n.getType()); - atts.addAttribute(URI, "sender", PREFIX+":sender", "CDATA", n.getSender()); - ch.startElement(URI, "notify", PREFIX+":notify", atts); - ch.startElement(URI, "title", PREFIX+":title", new AttributesImpl()); - ch.characters(n.getTitle().toCharArray(), 0, n.getTitle().length()); - ch.endElement(URI, "title", PREFIX+":title"); - ch.startElement(URI, "source", PREFIX+":source", new AttributesImpl()); - ch.characters(n.getSource().toCharArray(), 0, n.getSource().length()); - ch.endElement(URI, "source", PREFIX+":source"); - ch.startElement(URI, "message", PREFIX+":message", new AttributesImpl()); - - if (n.getMessage() != null) { - ch.characters(n.getMessage().toCharArray(), 0, - n.getMessage().length()); - } - - ch.endElement(URI, "message", PREFIX+":message"); - ch.startElement(URI, "description", PREFIX+":description", - new AttributesImpl()); - ch.characters(n.getDescription().toCharArray(), 0, - n.getDescription().length()); - ch.endElement(URI, "description", PREFIX+":description"); - - HashMap extraDescriptions = n.getExtraDescriptions(); - Iterator keyIter = extraDescriptions.keySet().iterator(); - - while (keyIter.hasNext()) { - String key = (String) keyIter.next(); - - atts = new AttributesImpl(); - - atts.addAttribute(URI, "description", PREFIX+":description", "CDATA", - key); - ch.startElement(URI, "extra", PREFIX+":extra", atts); - ch.characters(extraDescriptions.get(key).toString().toCharArray(), - 0, (extraDescriptions.get(key).toString()) - .length()); - ch.endElement(URI, "extra", PREFIX+":extra"); - } - - // End root element. - ch.endElement(URI, "notify", PREFIX+":notify"); - - // End the document. - ch.endPrefixMapping(PREFIX); - ch.endDocument(); - } } --- 8,28 ---- package org.apache.cocoon; ! //NKB Import commented to prevent name clashing - using full name instead ! //import org.apache.cocoon.components.notification.Notifier; /** * Generates an XML representation of the current notification. * ! * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> + *@deprecated Now another class is used + * @see org.apache.components.notification.Notifier * @version CVS $Revision: 1.6 $ $Date: 2001/10/11 07:28:15 $ */ ! public class Notifier extends org.apache.cocoon.components.notification.Notifier{ } *** src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl 29 Dec 2001 11:49:44 -0000 1.58 --- src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl 29 Dec 2001 13:19:45 -0000 *************** *** 114,132 **** import org.apache.cocoon.components.pipeline.StreamPipeline; import org.apache.cocoon.components.pipeline.EventPipeline; import org.apache.cocoon.sitemap.Sitemap; ! import org.apache.cocoon.sitemap.ErrorNotifier; import org.apache.cocoon.sitemap.ContentAggregator; import org.apache.cocoon.sitemap.Manager; import org.apache.cocoon.sitemap.SitemapRedirector; import org.apache.cocoon.components.language.markup.xsp.XSPRequestHelper; import org.apache.cocoon.components.language.markup.xsp.XSPResponseHelper; /** * This is the automatically generated class from the sitemap definitions * * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a> * @version CVS $Id: sitemap.xsl,v 1.58 2001/12/29 11:49:44 giacomo Exp $ */ public class <xsl:value-of select="@file-name"/> extends AbstractSitemap { static final String LOCATION = "<xsl:value-of select="translate(@file-path, '/', '.')"/>.<xsl:value-of select="@file-name"/>"; --- 114,141 ---- import org.apache.cocoon.components.pipeline.StreamPipeline; import org.apache.cocoon.components.pipeline.EventPipeline; import org.apache.cocoon.sitemap.Sitemap; ! import org.apache.cocoon.sitemap.NotifyingGenerator; import org.apache.cocoon.sitemap.ContentAggregator; import org.apache.cocoon.sitemap.Manager; import org.apache.cocoon.sitemap.SitemapRedirector; import org.apache.cocoon.components.language.markup.xsp.XSPRequestHelper; import org.apache.cocoon.components.language.markup.xsp.XSPResponseHelper; + import org.apache.cocoon.components.notification.NotifyingBuilder; + import org.apache.cocoon.components.notification.Notifying; + import org.apache.cocoon.components.notification.NotifyingObjects; /** * This is the automatically generated class from the sitemap definitions * * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a> + <<<<<<< sitemap.xsl + * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken +Barozzi</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Peter +Royal</a> + * @version CVS $Id: sitemap.xsl,v 1.57 2001/12/28 19:16:19 bloritsch Exp $ + ======= * @version CVS $Id: sitemap.xsl,v 1.58 2001/12/29 11:49:44 giacomo Exp $ + >>>>>>> 1.58 */ public class <xsl:value-of select="@file-name"/> extends AbstractSitemap { static final String LOCATION = "<xsl:value-of select="translate(@file-path, '/', '.')"/>.<xsl:value-of select="@file-name"/>"; *************** *** 286,292 **** try { <!-- configure well known components first --> ! load_component (Sitemap.GENERATOR, "!error-notifier!", "org.apache.cocoon.sitemap.ErrorNotifier", new DefaultConfiguration("", LOCATION), null); load_component (Sitemap.GENERATOR, "!content-aggregator!", "org.apache.cocoon.sitemap.ContentAggregator", new DefaultConfiguration("", LOCATION), null); load_component (Sitemap.TRANSFORMER, "!link-translator!", "org.apache.cocoon.sitemap.LinkTranslator", new DefaultConfiguration("", LOCATION), null); --- 295,301 ---- try { <!-- configure well known components first --> ! load_component (Sitemap.GENERATOR, "!notifying-generator!", "org.apache.cocoon.sitemap.NotifyingGenerator", new DefaultConfiguration("", LOCATION), null); load_component (Sitemap.GENERATOR, "!content-aggregator!", "org.apache.cocoon.sitemap.ContentAggregator", new DefaultConfiguration("", LOCATION), null); load_component (Sitemap.TRANSFORMER, "!link-translator!", "org.apache.cocoon.sitemap.LinkTranslator", new DefaultConfiguration("", LOCATION), null); *************** *** 630,635 **** --- 639,647 ---- XPath kind expressions in values of src attribute used with generate and transform elements */ List listOfMaps = (List) new ArrayList(); + //Adds Constants.NOTIFYING_OBJECTS to ObjectModel + //NKB FIXME add to ObjectModel? + environment.getObjectModel().put(Constants.NOTIFYING_OBJECTS, new +NotifyingObjects()); SitemapRedirector redirector = new SitemapRedirector(environment); <!-- process the pipelines --> <!-- for each pipeline element generate a try/catch block --> *************** *** 737,746 **** List listOfMaps = (List)(new ArrayList()); Map map; Parameters param; eventPipeline.setGenerator ("!error-notifier!", e.getMessage(), Parameters.EMPTY_PARAMETERS, e); <xsl:apply-templates select="./*"/> } catch (Exception ex) { ! if (getLogger().isErrorEnabled()) getLogger().error("error notifier barfs", ex); throw e; } finally { if(eventPipeline != null) --- 749,776 ---- List listOfMaps = (List)(new ArrayList()); Map map; Parameters param; + <<<<<<< sitemap.xsl + + // Create a Notifying out of this exception and stick it in the object +model Constants.NOTIFYING_OBJECTS + boolean de = getLogger().isDebugEnabled() ? true : false; + de=true; + if(de)getLogger().debug("Starting to build Notifying"); + NotifyingBuilder notifyingBuilder= +(NotifyingBuilder)this.manager.lookup(NotifyingBuilder.ROLE); + if(de)getLogger().debug("Got "+notifyingBuilder); + Notifying currentNotifying = notifyingBuilder.build(this, e); + if(de)getLogger().debug("Built "+currentNotifying); + NotifyingObjects notifyingObjects = +(NotifyingObjects)objectModel.get(Constants.NOTIFYING_OBJECTS); + if(de)getLogger().debug("Got "+notifyingObjects); + notifyingObjects.addNotifying(currentNotifying); + if(de)getLogger().debug("Added to "+notifyingObjects); + eventPipeline.setGenerator ("!notifying-generator!", e.getMessage(), +emptyParam); + + ======= eventPipeline.setGenerator ("!error-notifier!", e.getMessage(), Parameters.EMPTY_PARAMETERS, e); + >>>>>>> 1.58 <xsl:apply-templates select="./*"/> } catch (Exception ex) { ! if (getLogger().isErrorEnabled()) getLogger().error("NotifyingGenerator was not able to notify the exception.", ex); throw e; } finally { if(eventPipeline != null) *************** *** 1919,1921 **** --- 1949,1952 ---- <xsl:template match="map:logicsheet|map:dependency|map:handle-errors"/> </xsl:stylesheet> + *** src/org/apache/cocoon/components/pipeline/AbstractEventPipeline.java 10 Dec 2001 12:56:22 -0000 1.18 --- src/org/apache/cocoon/components/pipeline/AbstractEventPipeline.java 29 Dec 2001 13:19:51 -0000 *************** *** 17,23 **** import org.apache.cocoon.components.saxconnector.SAXConnector; import org.apache.cocoon.environment.Environment; import org.apache.cocoon.generation.Generator; - import org.apache.cocoon.sitemap.ErrorNotifier; import org.apache.cocoon.transformation.Transformer; import org.apache.cocoon.xml.AbstractXMLProducer; import org.apache.cocoon.xml.XMLConsumer; --- 17,22 ---- *************** *** 31,37 **** /** * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> * @author <a href="mailto:cziegeler@Carsten Ziegeler">Carsten Ziegeler</a> ! * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a> * @version CVS $Revision: 1.18 $ $Date: 2001/12/10 12:56:22 $ */ public abstract class AbstractEventPipeline --- 30,38 ---- /** * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> * @author <a href="mailto:cziegeler@Carsten Ziegeler">Carsten Ziegeler</a> ! * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a ! * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> ! * @author <a href="mailto:[EMAIL PROTECTED]">Peter Royal</a> * @version CVS $Revision: 1.18 $ $Date: 2001/12/10 12:56:22 $ */ public abstract class AbstractEventPipeline *************** *** 69,82 **** this.newManager = manager; } public void setGenerator (String role, String source, Parameters param, Exception e) throws Exception { this.setGenerator (role, source, param); ! // FIXME(CZ) What can be done if this is not an ErrorNotifier? ! // (The sitemap uses this setGenerator() method only from inside ! // the error pipeline, when a ErrorNotifier is explicitly generated.) ! if (this.generator instanceof ErrorNotifier) { ! ((ErrorNotifier)this.generator).setException(e); } } --- 70,83 ---- this.newManager = manager; } + /** + * @deprecated The NotifyingGenerator gets the Notificable from the objectModel + */ public void setGenerator (String role, String source, Parameters param, Exception e) throws Exception { this.setGenerator (role, source, param); ! if (this.generator instanceof org.apache.cocoon.sitemap.ErrorNotifier) { ! ((org.apache.cocoon.sitemap.ErrorNotifier)this.generator).setThrowable(e); } } *************** *** 85,91 **** if (this.generator != null) { throw new ProcessingException ("Generator already set. You can only select one Generator (" + role + ")"); } ! this.generatorSelector = (ComponentSelector) this.newManager.lookup(Generator.ROLE + "Selector"); this.generator = (Generator) this.generatorSelector.select(role); this.generatorSource = source; this.generatorParam = param; --- 86,92 ---- if (this.generator != null) { throw new ProcessingException ("Generator already set. You can only select one Generator (" + role + ")"); } ! this.generatorSelector = (ComponentSelector) this.newManager.lookup(Generator.ROLE + "Selector"); this.generator = (Generator) this.generatorSelector.select(role); this.generatorSource = source; this.generatorParam = param; *************** *** 289,291 **** --- 290,293 ---- // Nothing here } } + *** src/org/apache/cocoon/servlet/CocoonServlet.java 28 Dec 2001 17:59:35 -0000 1.58 --- src/org/apache/cocoon/servlet/CocoonServlet.java 29 Dec 2001 13:19:59 -0000 *************** *** 16,23 **** import org.apache.avalon.framework.context.DefaultContext; import org.apache.avalon.framework.logger.Loggable; import org.apache.cocoon.Constants; ! import org.apache.cocoon.Notification; ! import org.apache.cocoon.Notifier; import org.apache.cocoon.ResourceNotFoundException; import org.apache.cocoon.ConnectionResetException; import org.apache.cocoon.Cocoon; --- 16,26 ---- import org.apache.avalon.framework.context.DefaultContext; import org.apache.avalon.framework.logger.Loggable; import org.apache.cocoon.Constants; ! import org.apache.cocoon.components.notification.Notifying; ! import org.apache.cocoon.components.notification.SimpleNotifyingBean; ! import org.apache.cocoon.components.notification.NotifyingBuilder; ! import org.apache.cocoon.components.notification.DefaultNotifyingBuilder; ! import org.apache.cocoon.components.notification.Notifier; import org.apache.cocoon.ResourceNotFoundException; import org.apache.cocoon.ConnectionResetException; import org.apache.cocoon.Cocoon; *************** *** 50,55 **** --- 53,59 ---- import java.lang.reflect.Constructor; import java.net.URL; import java.util.Arrays; + import java.util.HashMap; import java.util.StringTokenizer; /** *************** *** 58,70 **** * @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a> * (Apache Software Foundation, Exoffice Technologies) * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> ! * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a> * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> * @author <a href="mailto:[EMAIL PROTECTED]">Leo Sutic</a> * @version CVS $Revision: 1.58 $ $Date: 2001/12/28 17:59:35 $ */ - public class CocoonServlet extends HttpServlet { protected Logger log; --- 62,73 ---- * @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a> * (Apache Software Foundation, Exoffice Technologies) * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> ! * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a> * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> * @author <a href="mailto:[EMAIL PROTECTED]">Leo Sutic</a> * @version CVS $Revision: 1.58 $ $Date: 2001/12/28 17:59:35 $ */ public class CocoonServlet extends HttpServlet { protected Logger log; *************** *** 730,743 **** if (this.cocoon == null) { res.setStatus(res.SC_INTERNAL_SERVER_ERROR); ! Notification n = new Notification(this, this.exception); ! n.setType("internal-servlet-error"); n.setTitle("Internal servlet error"); n.setSource("Cocoon servlet"); ! n.setMessage("Internal servlet error"); ! n.setDescription("Cocoon was not initialized."); n.addExtraDescription("request-uri", request.getRequestURI()); ! res.setContentType(Notifier.notify(n, res.getOutputStream()));; return; } --- 733,746 ---- if (this.cocoon == null) { res.setStatus(res.SC_INTERNAL_SERVER_ERROR); ! SimpleNotifyingBean n= new SimpleNotifyingBean(this); ! n.setType("fatal"); n.setTitle("Internal servlet error"); n.setSource("Cocoon servlet"); ! n.setMessage("Cocoon was not initialized."); ! n.setDescription("Cocoon was not initialized. Cannot process request."); n.addExtraDescription("request-uri", request.getRequestURI()); ! res.setContentType(Notifier.notify(n, res.getOutputStream())); return; } *************** *** 792,805 **** if (this.cocoon.process(env)) { contentType = env.getContentType(); } else { // means SC_NOT_FOUND res.sendError(res.SC_NOT_FOUND); ! Notification n = new Notification(this); ! n.setType("resource-not-found"); n.setTitle("Resource not found"); n.setSource("Cocoon servlet"); ! n.setMessage("Resource not found"); n.setDescription("The requested URI \"" + request.getRequestURI() + "\" was not found."); --- 795,809 ---- if (this.cocoon.process(env)) { contentType = env.getContentType(); } else { + // Should not get here! // means SC_NOT_FOUND res.sendError(res.SC_NOT_FOUND); ! SimpleNotifyingBean n = new SimpleNotifyingBean(this); ! n.setType("error"); n.setTitle("Resource not found"); n.setSource("Cocoon servlet"); ! n.setMessage("The requested resource not found."); n.setDescription("The requested URI \"" + request.getRequestURI() + "\" was not found."); *************** *** 815,821 **** } res.sendError(res.SC_NOT_FOUND); ! Notification n = new Notification(this); n.setType("resource-not-found"); n.setTitle("Resource not found"); n.setSource("Cocoon servlet"); --- 819,826 ---- } res.sendError(res.SC_NOT_FOUND); ! ! SimpleNotifyingBean n = new SimpleNotifyingBean(this); n.setType("resource-not-found"); n.setTitle("Resource not found"); n.setSource("Cocoon servlet"); *************** *** 828,840 **** // send the notification but don't include it in the output stream // as the status SC_NOT_FOUND is enough res.setContentType(Notifier.notify(n, (OutputStream)null)); } catch (ConnectionResetException cre) { if (log.isWarnEnabled()) { log.warn("The connection was reset", cre); } ! Notification n = new Notification(this); ! n.setType("resource-not-found"); n.setTitle("Resource not found"); n.setSource("Cocoon servlet"); n.setMessage("Resource not found"); --- 833,846 ---- // send the notification but don't include it in the output stream // as the status SC_NOT_FOUND is enough res.setContentType(Notifier.notify(n, (OutputStream)null)); + } catch (ConnectionResetException cre) { if (log.isWarnEnabled()) { log.warn("The connection was reset", cre); } ! SimpleNotifyingBean n = new SimpleNotifyingBean(this); ! n.setType("error"); n.setTitle("Resource not found"); n.setSource("Cocoon servlet"); n.setMessage("Resource not found"); *************** *** 851,862 **** log.error("Problem with servlet", e); } //res.setStatus(res.SC_INTERNAL_SERVER_ERROR); ! Notification n = new Notification(this, e); ! n.setType("internal-server-error"); ! n.setTitle("Internal server error"); ! n.setSource("Cocoon servlet"); ! n.addExtraDescription("request-uri", request.getRequestURI()); ! n.addExtraDescription("path-info", uri); res.setContentType(contentType = Notifier.notify(n, res.getOutputStream())); } --- 857,870 ---- log.error("Problem with servlet", e); } //res.setStatus(res.SC_INTERNAL_SERVER_ERROR); ! ! HashMap extraDescriptions = new HashMap(2); ! extraDescriptions.put("request-uri", request.getRequestURI()); ! extraDescriptions.put("path-info", uri); ! ! Notifying n=new DefaultNotifyingBuilder().build( ! this, e, "fatal","Internal server error","Cocoon servlet",null,null,extraDescriptions); ! res.setContentType(contentType = Notifier.notify(n, res.getOutputStream())); } *** src/org/apache/cocoon/sitemap/ErrorNotifier.java 11 Oct 2001 07:28:23 -0000 1.5 --- src/org/apache/cocoon/sitemap/ErrorNotifier.java 29 Dec 2001 13:20:05 -0000 *************** *** 8,69 **** package org.apache.cocoon.sitemap; import org.apache.avalon.excalibur.pool.Recyclable; ! import org.apache.cocoon.Notification; ! import org.apache.cocoon.Notifier; import org.apache.cocoon.generation.ComposerGenerator; import org.xml.sax.SAXException; /** * Generates an XML representation of the current notification. ! * ! * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> * @created 31 July 2000 * @version CVS $Revision: 1.5 $ $Date: 2001/10/11 07:28:23 $ */ ! public class ErrorNotifier extends ComposerGenerator implements Recyclable { ! /** ! * The <code>Notification</code> to report. ! */ ! private Notification notification = null; ! ! /** ! * Set the Exception to report. ! * ! * @param exception The Exception to report ! */ ! public void setException(Throwable throwable) { ! notification = new Notification(this, throwable); ! notification.setTitle("Error creating the resource"); ! } ! /** ! * Set the Notification to report. ! * ! * @param exception The Exception to report ! */ ! public void setNotification(Object o) { ! notification = new Notification(this, o); ! notification.setTitle("Error creating the resource"); } ! ! /** ! * Generate the notification information in XML format. ! * ! * @exception SAXException Description of problem there is creating the output SAX events. ! * @throws SAXException when there is a problem creating the ! * output SAX events. ! */ ! public void generate() throws SAXException { ! Notifier.notify(notification, this.contentHandler); } ! /** ! * Recycle ! */ ! public void recycle() { ! super.recycle(); ! this.notification = null; } } --- 8,66 ---- package org.apache.cocoon.sitemap; + import java.util.Map; + import java.io.IOException; + import org.apache.avalon.excalibur.pool.Recyclable; ! import org.apache.avalon.framework.parameters.Parameters; ! import org.apache.cocoon.components.notification.Notifying; ! import org.apache.cocoon.components.notification.DefaultNotifyingBuilder; import org.apache.cocoon.generation.ComposerGenerator; + import org.apache.cocoon.environment.SourceResolver; + import org.apache.cocoon.ProcessingException; + import org.apache.cocoon.Constants; + import org.xml.sax.SAXException; /** * Generates an XML representation of the current notification. ! * @deprecated Now using NotifyingGenerator in sitemap ! * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> * @created 31 July 2000 * @version CVS $Revision: 1.5 $ $Date: 2001/10/11 07:28:23 $ */ ! public class ErrorNotifier extends NotifyingGenerator { ! /** ! * The <code>Notification</code> to report. ! */ ! private Notifying notification = null; ! public void setup(SourceResolver resolver, Map objectModel, String src, ! Parameters par) throws ProcessingException, SAXException, IOException { ! try ! { ! super.setup(resolver, objectModel, src, par); } ! catch(ProcessingException pe) ! { ! //do nothing, thrown by superclass that didn't find the object to notify ! //it will be set in setThrowable in this class } + } ! /** ! * Set the Notification to report. ! * @deprecated Now it gets the Exception from the ObjectModel ! * @param exception The Exception to report ! */ ! public void setThrowable(Throwable throwable) { ! if (throwable instanceof Notifying) { ! this.notification = (Notifying) throwable; ! } else { ! notification = new DefaultNotifyingBuilder().build("@deprecated method setThrowable() in ErrorNotifier", throwable); } + } + } + *** src/org/apache/cocoon/sitemap/sitemap.roles 10 Dec 2001 12:56:23 -0000 1.6 --- src/org/apache/cocoon/sitemap/sitemap.roles 29 Dec 2001 13:20:11 -0000 *************** *** 28,35 **** <role name="org.apache.cocoon.generation.GeneratorSelector" shorthand="generator" ! default-class="org.apache.cocoon.sitemap.SitemapComponentSelector"/> ! <role name="org.apache.cocoon.transformation.TransformerSelector" shorthand="transformer" default-class="org.apache.cocoon.sitemap.SitemapComponentSelector"/> --- 28,38 ---- <role name="org.apache.cocoon.generation.GeneratorSelector" shorthand="generator" ! default-class="org.apache.cocoon.sitemap.SitemapComponentSelector"> ! <!--NKB doesnt load it - should be used instead of old error-notifier ! <hint shorthand="!notifying-generator!" class="org.apache.cocoon.sitemap.NotifyingGenerator"/>--> ! </role> ! <role name="org.apache.cocoon.transformation.TransformerSelector" shorthand="transformer" default-class="org.apache.cocoon.sitemap.SitemapComponentSelector"/> *************** *** 41,44 **** --- 44,52 ---- <role name="org.apache.cocoon.reading.ReaderSelector" shorthand="reader" default-class="org.apache.cocoon.sitemap.SitemapComponentSelector"/> + + <role name="org.apache.cocoon.components.notification.NotifyingBuilder" + shorthand="notifying-builder" + +default-class="org.apache.cocoon.components.notification.DefaultNotifyingBuilder"/> + </role-list> *** webapp/sitemap.xmap 23 Dec 2001 09:48:40 -0000 1.72 --- webapp/sitemap.xmap 29 Dec 2001 13:20:20 -0000 *************** *** 1096,1102 **** </map:match> <map:handle-errors> ! <map:transform src="stylesheets/system/error2html.xsl"/> <map:serialize status-code="500"/> </map:handle-errors> --- 1096,1102 ---- </map:match> <map:handle-errors> ! <map:transform src="context://stylesheets/system/error2html.xsl"/> <map:serialize status-code="500"/> </map:handle-errors> *** webapp/protected/sitemap.xmap 22 Oct 2001 10:17:47 -0000 1.7 --- webapp/protected/sitemap.xmap 29 Dec 2001 13:20:24 -0000 *************** *** 94,104 **** </map:act> </map:match> <map:handle-errors> ! <map:transform src="stylesheets/system/error2html.xsl"/> <map:serialize status-code="500"/> </map:handle-errors> ! </map:pipeline> </map:pipelines> --- 94,106 ---- </map:act> </map:match> + <!-- Let parent sitemap treat it <map:handle-errors> ! <map:transform src="context://stylesheets/system/error2html.xsl"/> <map:serialize status-code="500"/> </map:handle-errors> ! --> ! </map:pipeline> </map:pipelines> *** webapp/stylesheets/simple-samples2html.xsl 14 Dec 2001 01:30:36 -0000 1.4 --- webapp/stylesheets/simple-samples2html.xsl 29 Dec 2001 13:20:30 -0000 *************** *** 32,38 **** <table width="100%"> <tr> ! <td valign="top"> <xsl:for-each select="group"> <xsl:variable name="group-position" select="position()"/> <xsl:variable name="current-sample" select="1 + count(../group[position() <= $group-position]/sample)"/> --- 32,38 ---- <table width="100%"> <tr> ! <td width="50%" valign="top"> <xsl:for-each select="group"> <xsl:variable name="group-position" select="position()"/> <xsl:variable name="current-sample" select="1 + count(../group[position() <= $group-position]/sample)"/> *** webapp/sub/stylesheets/error2html.xsl 20 Dec 2001 15:14:34 -0000 1.5 --- webapp/sub/stylesheets/error2html.xsl 29 Dec 2001 13:20:35 -0000 *************** *** 22,28 **** <xsl:value-of select="translate(error:notify/error:extra[2],' ',' ')"/> </pre> <font face="Verdana" size="-2"> ! Brought to you by <a href="http://xml.apache.org/cocoon/">Apache Cocoon</a> in no time! </font> </body> </html> --- 22,28 ---- <xsl:value-of select="translate(error:notify/error:extra[2],' ',' ')"/> </pre> <font face="Verdana" size="-2"> ! This special error layout is specified in the sub sitemap. </font> </body> </html>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]