public final class GetErrorDetails extends Object implements ContentGenerator
This content generator is useful to display information about errors, when a Berlioz service is used for error handling.
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>
This generator does not use and require any parameter.
This generator will try to retrieve values from the standard Servlet error request attributes.
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.pageseeder.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
.
To use this generator in Berlioz (in /WEB-INF/config/services.xml
):
<generator class="org.pageseeder.berlioz.generator.GetErrorDetails"
name="[name]" target="[target]"/>
This generator is not cacheble..
Constructor and Description |
---|
GetErrorDetails() |
Modifier and Type | Method and Description |
---|---|
void |
process(ContentRequest req,
org.pageseeder.xmlwriter.XMLWriter xml)
Display the error details.
|
public void process(ContentRequest req, org.pageseeder.xmlwriter.XMLWriter xml) throws IOException
This is the main method of this interface, it should:
Implementation should specify which attribute or parameters are used or required.
process
in interface ContentGenerator
req
- The content request.xml
- The XML output.IOException
- If an I/O error occurs while writing to the XML writer.Copyright © 2016 Allette Systems. All rights reserved.