java.lang.Object
io.helidon.webserver.JsonService
- All Implemented Interfaces:
Handler
,Service
,BiConsumer<ServerRequest,
ServerResponse>
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.helidon.webserver.Handler
Handler.EntityHandler<T>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
acceptsJson
(ServerRequest request, ServerResponse response) Determines if JSON is an accepted response type, usingAccept
and responseContent-Type
headers.protected MediaType
toJsonResponseType
(MediaType acceptedType) Returns the response type for the given type if it is an accepted JSON type.void
update
(Routing.Rules routingRules) Registers this handler for any HTTP method.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.function.BiConsumer
andThen
-
Constructor Details
-
JsonService
public JsonService()
-
-
Method Details
-
update
Registers this handler for any HTTP method. -
acceptsJson
Determines if JSON is an accepted response type, usingAccept
and responseContent-Type
headers.Sets the response
Content-Type
header if not set and JSON is accepted.- Parameters:
request
- a server requestresponse
- a server response- Returns:
true
if JSON is accepted.
-
toJsonResponseType
Returns the response type for the given type if it is an accepted JSON type.- Parameters:
acceptedType
- The accepted type.- Returns:
- The response type or
null
if not an accepted JSON type.
-