Package org.openhab.core.io.http
Interface HandlerContext
public interface HandlerContext
Handler context represents a present state of all handlers placed in execution chain.
There are two basic operations located in this type - first allows to continue execution and let next handler be
called. Second is intended to break the chain and force handlers to process error and generate error response.
When Handler decide to not call context by delegating further handler to get called via
execute(HttpServletRequest, HttpServletResponse)
nor error(Exception)
then chain is stopped.
By this simple way handlers can decide to hold processing and generate own response.- Author:
- Ćukasz Dywicki - Initial contribution
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Signal that an error occurred during handling of request.void
execute
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Delegate execution to next handler in the chain, if available.boolean
hasError()
Checks if has any errors occurred while handling request.
-
Field Details
-
ERROR_ATTRIBUTE
- See Also:
-
-
Method Details
-
execute
void execute(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Delegate execution to next handler in the chain, if available. When current handler is last in processing queue then nothing happens, execution chain returns to its caller.- Parameters:
request
- Request.response
- Response.
-
error
Signal that an error occurred during handling of request. Call to this method will break normal execution chain and force handling of error. -
hasError
boolean hasError()Checks if has any errors occurred while handling request.- Returns:
- True if an exception occurred while handling request.
-