- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
DirectHandler.EventType
to see which types
of events are covered by this handler.
Direct handlers can be used both with blocking and reactive servers in Helidon.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Types of events that can be triggered outside of router that immediately return a response.static interface
Request information.static class
Response to correctly reply to the original client. -
Method Summary
Modifier and TypeMethodDescriptionstatic DirectHandler
Default handler will HTML encode the message (if any), use the default status code for the event type, and copy all headers configured.handle
(DirectHandler.TransportRequest request, DirectHandler.EventType eventType, Status defaultStatus, ServerResponseHeaders responseHeaders, String message) Handler of responses that bypass routing.default DirectHandler.TransportResponse
handle
(DirectHandler.TransportRequest request, DirectHandler.EventType eventType, Status defaultStatus, ServerResponseHeaders responseHeaders, Throwable thrown) Handler of responses that bypass router.default DirectHandler.TransportResponse
handle
(DirectHandler.TransportRequest request, DirectHandler.EventType eventType, Status defaultStatus, ServerResponseHeaders responseHeaders, Throwable thrown, System.Logger logger) Handler of responses that bypass router.
-
Method Details
-
defaultHandler
Default handler will HTML encode the message (if any), use the default status code for the event type, and copy all headers configured.- Returns:
- default direct handler
-
handle
default DirectHandler.TransportResponse handle(DirectHandler.TransportRequest request, DirectHandler.EventType eventType, Status defaultStatus, ServerResponseHeaders responseHeaders, Throwable thrown) Handler of responses that bypass router.This method should be used to return custom status, header and possible entity. If there is a need to handle more details, please redirect the client to a proper endpoint to handle them. This method shall not send an unsafe message back as an entity to avoid potential data leaks.
- Parameters:
request
- request as received with as much known information as possibleeventType
- type of the eventdefaultStatus
- default status expected to be returnedresponseHeaders
- headers to be added to responsethrown
- throwable caught as part of processing with possible additional details about the reason of failure- Returns:
- response to use to return to original request
-
handle
default DirectHandler.TransportResponse handle(DirectHandler.TransportRequest request, DirectHandler.EventType eventType, Status defaultStatus, ServerResponseHeaders responseHeaders, Throwable thrown, System.Logger logger) Handler of responses that bypass router.This method should be used to return custom status, header and possible entity. If there is a need to handle more details, please redirect the client to a proper endpoint to handle them. This method shall not send an unsafe message back as an entity to avoid potential data leaks.
- Parameters:
request
- request as received with as much known information as possibleeventType
- type of the eventdefaultStatus
- default status expected to be returnedresponseHeaders
- headers to be added to responsethrown
- throwable caught as part of processing with possible additional details about the reason of failurelogger
- Possibly null logger to use for unsafe messages- Returns:
- response to use to return to original request
-
handle
DirectHandler.TransportResponse handle(DirectHandler.TransportRequest request, DirectHandler.EventType eventType, Status defaultStatus, ServerResponseHeaders responseHeaders, String message) Handler of responses that bypass routing.This method should be used to return custom status, header and possible entity. If there is a need to handle more details, please redirect the client to a proper endpoint to handle them.
- Parameters:
request
- request as received with as much known information as possibleeventType
- type of the eventdefaultStatus
- default status expected to be returnedresponseHeaders
- headers to be added to responsemessage
- informative message for cases that are not triggered by an exception, by default this will be called also for exceptional cases with the exception message- Returns:
- response to use to return to original request
-