@Beta public class KryoFeature extends Object implements javax.ws.rs.core.Feature
Feature used to register Kryo providers.
For the security reasons, Kryo#setRegistrationRequired(true) should be specified.
Unless KryoFeature#registrationRequired(false)
is registered, a ContextResolver<Kryo>
should be registered.
There the user is expected to create new Kryo
instance with the registrations:
public Kryo getContext(Class> type) { ... Kryo kryo = new Kryo(); kryo.setRegistrationRequired(true); kryo.register(The_class_for_which_the_KryoMessageBodyProvider_should_be_allowed); ... return kryo; }Note that
ContextResolver#getContext
is invoked just once when creating KryoPool
and the type
argument
is null
.
Constructor and Description |
---|
KryoFeature() |
Modifier and Type | Method and Description |
---|---|
boolean |
configure(javax.ws.rs.core.FeatureContext context) |
static KryoFeature |
registrationRequired(boolean registrationRequired) |
public static KryoFeature registrationRequired(boolean registrationRequired)
public boolean configure(javax.ws.rs.core.FeatureContext context)
configure
in interface javax.ws.rs.core.Feature
Copyright © 2007-2021, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.