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 DescribableHandlerasDescribableHandler(Handler handler)Adapts aHandlerto aDescribableHandlerwithout adding support for API Descriptions if it is not already implemented.static DescribableHandlerchainOf(Handler handler, List<Filter> filters)Creates aHandlerwhich wraps the provided filters around the provided target handler.static DescribableHandlerchainOf(Handler handler, Filter... filters)Creates aHandlerwhich wraps the provided filters around the provided target handler.static DescribableHandlerfiltered(Handler handler, Filter filter)Creates a "filtered handler" instance.static HandlerforbiddenHandler()A common HTTP FrameworkHandlerresponding 403 Forbidden.static HandlerinternalServerErrorHandler(Exception cause)A common HTTP FrameworkHandlerresponding 500 Internal Server Error.
-
-
-
Method Detail
-
filtered
public static DescribableHandler filtered(Handler handler, Filter filter)
Creates a "filtered handler" instance.It will invoke the
firstfilter, giving it thehandlerhandler asnext.- Parameters:
handler- The filtered instancefilter- the filter to apply- Returns:
- a new
Handlerinstance that filters the givenhandler.
-
chainOf
public static DescribableHandler chainOf(Handler handler, Filter... filters)
Creates aHandlerwhich 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 aHandlerwhich 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 aHandlerto aDescribableHandlerwithout 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 FrameworkHandlerresponding 500 Internal Server Error.- Parameters:
cause- The cause of the internal server error.- Returns:
- The handler.
-
-