aerogear-controller 1.0.1

org.jboss.aerogear.controller.filter
Class ErrorFilter

java.lang.Object
  extended by org.jboss.aerogear.controller.filter.ErrorFilter
All Implemented Interfaces:
javax.servlet.Filter

@WebFilter(filterName="aerogear-error-filter",
           urlPatterns="/ErrorFilter",
           dispatcherTypes=FORWARD)
public class ErrorFilter
extends Object
implements javax.servlet.Filter

This Filter is used for default error handling when no explicit error route has configured.

See Also:
ErrorHandler

Field Summary
private static String TEMPLATE
           
 
Constructor Summary
ErrorFilter()
           
 
Method Summary
 void destroy()
           
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
          Writes a general error page response to the client.
 void init(javax.servlet.FilterConfig filterConfig)
           
static String readTemplate(String templatePath, Throwable throwable)
          Reads the template and makes Throwable available as a variable named 'exception'.
private static void safeClose(InputStream in)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMPLATE

private static final String TEMPLATE
See Also:
Constant Field Values
Constructor Detail

ErrorFilter

public ErrorFilter()
Method Detail

init

public void init(javax.servlet.FilterConfig filterConfig)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Filter
Throws:
javax.servlet.ServletException

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws IOException,
                     javax.servlet.ServletException
Writes a general error page response to the client.

Specified by:
doFilter in interface javax.servlet.Filter
Throws:
IOException
javax.servlet.ServletException

readTemplate

public static String readTemplate(String templatePath,
                                  Throwable throwable)
Reads the template and makes Throwable available as a variable named 'exception'.

The template language used by this method is MVEL2 (http://mvel.codehaus.org/).

Parameters:
templatePath - the path to the template used for displaying the exception.
throwable - the exception to be used in the target template.
Returns:
String the result of processing the passed-in template.

safeClose

private static void safeClose(InputStream in)

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Filter

aerogear-controller 1.0.1

Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.