org.weborganic.berlioz.generator
Class GetErrorDetails

java.lang.Object
  extended by org.weborganic.berlioz.generator.GetErrorDetails
All Implemented Interfaces:
ContentGenerator

public final class GetErrorDetails
extends Object
implements ContentGenerator

Generates no content.

This content generator is useful to display information about errors, when a Berlioz service is used for error handling.

Configuration

There is no configuration directly associated with this generator.

However, since the purpose is to display servlet error details, the services using this generator should have their URLs mapped in the Web descriptor for error catching. For example:

<error-page>
   <error-code>404</error-code>
   <location>/not-found.html</location>
 </error-page>
 

Parameters

This generator does not use and require any parameter.

Attributes

This generator will try to retrieve values from the standard Servlet error request attributes.

Returned XML

This generator does not have any content, so the XML content is always empty.

Since Berlioz always wraps generators' content, the final XML is always:

<content generator="org.weborganic.berlioz.generator.GetErrorDetails"
               name="[name]" target="[target]" status="ok">
   <error http-class="[http-class]" http-code="[http-code]" datetime="[iso8601-datetime]" id="[berlioz-id]">
     <title>Not Found</title>
     <message>Not Found</message>
     <request-uri>/fdhvjfdls</request-uri>
     <!-- Any exception will be serialised a XML here -->
   </error>
 </content>
 

Note: since this generator does produce any data, the return status is always ok.

Usage

To use this generator in Berlioz (in /WEB-INF/config/services.xml):

<generator class="org.weborganic.berlioz.generator.GetErrorDetails"
                         name="[name]" target="[target]"/>

Etag

This generator is not cacheble..

Since:
Berlioz 0.8.7
Version:
Berlioz 0.9.0 - 13 October 2011
Author:
Christophe Lauret

Constructor Summary
GetErrorDetails()
           
 
Method Summary
 void process(ContentRequest req, XMLWriter xml)
          Display the error details.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GetErrorDetails

public GetErrorDetails()
Method Detail

process

public void process(ContentRequest req,
                    XMLWriter xml)
             throws IOException
Display the error details. Produces the actual content.

This is the main method of this interface, it should:

Implementation should specify which attribute or parameters are used or required.

Specified by:
process in interface ContentGenerator
Parameters:
req - The content request.
xml - The XML output.
Throws:
IOException - If an I/O error occurs while writing to the XML writer.