Package org.forgerock.http.handler
Class Handlers
- java.lang.Object
-
- org.forgerock.http.handler.Handlers
-
public final class Handlers extends Object
Utility methods for creating common types of handlers.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DescribableHandler
asDescribableHandler(Handler handler)
Adapts aHandler
to aDescribableHandler
without adding support for API Descriptions if it is not already implemented.static DescribableHandler
chainOf(Handler handler, List<Filter> filters)
Creates aHandler
which wraps the provided filters around the provided target handler.static DescribableHandler
chainOf(Handler handler, Filter... filters)
Creates aHandler
which wraps the provided filters around the provided target handler.static DescribableHandler
filtered(Handler handler, Filter filter)
Creates a "filtered handler" instance.static Handler
forbiddenHandler()
A common HTTP FrameworkHandler
responding 403 Forbidden.static Handler
internalServerErrorHandler(Exception cause)
A common HTTP FrameworkHandler
responding 500 Internal Server Error.
-
-
-
Method Detail
-
filtered
public static DescribableHandler filtered(Handler handler, Filter filter)
Creates a "filtered handler" instance.It will invoke the
first
filter, giving it thehandler
handler asnext
.- Parameters:
handler
- The filtered instancefilter
- the filter to apply- Returns:
- a new
Handler
instance that filters the givenhandler
.
-
chainOf
public static DescribableHandler chainOf(Handler handler, Filter... filters)
Creates aHandler
which wraps the provided filters around the provided target handler.- Parameters:
handler
- The target handler which will be invoked once processing has reached the end of the filter chain.filters
- The list of filters to be processed before invoking the target.- Returns:
- A
Handler
. - See Also:
chainOf(Handler, List)
-
chainOf
public static DescribableHandler chainOf(Handler handler, List<Filter> filters)
Creates aHandler
which wraps the provided filters around the provided target handler.- Parameters:
handler
- The target handler which will be invoked once processing has reached the end of the filter chain.filters
- The list of filters to be processed before invoking the target.- Returns:
- A
Handler
. - See Also:
chainOf(Handler, Filter...)
-
asDescribableHandler
public static DescribableHandler asDescribableHandler(Handler handler)
Adapts aHandler
to aDescribableHandler
without adding support for API Descriptions if it is not already implemented.- Parameters:
handler
- The handler.- Returns:
- The describable handler.
-
internalServerErrorHandler
public static Handler internalServerErrorHandler(Exception cause)
A common HTTP FrameworkHandler
responding 500 Internal Server Error.- Parameters:
cause
- The cause of the internal server error.- Returns:
- The handler.
-
-