本文整理汇总了Java中com.fasterxml.jackson.jaxrs.cfg.Annotations类的典型用法代码示例。如果您正苦于以下问题:Java Annotations类的具体用法?Java Annotations怎么用?Java Annotations使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Annotations类属于com.fasterxml.jackson.jaxrs.cfg包,在下文中一共展示了Annotations类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRegistryClient
import com.fasterxml.jackson.jaxrs.cfg.Annotations; //导入依赖的package包/类
private RegistryEndpoints getRegistryClient(ImageRef imageRef) {
if (!proxyClients.containsKey(imageRef.getRegistryUrl())) {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JavaTimeModule());
Client client = ClientBuilder.newClient()
.register(new JacksonJaxbJsonProvider(mapper, new Annotations[] {Annotations.JACKSON}))
.register(JacksonFeature.class);
String auth = config.getAuthFor(imageRef.getRegistryName());
if (auth != null) {
String[] credentials = new String(Base64.getDecoder().decode(auth), StandardCharsets.UTF_8).split(":");
client.register(HttpAuthenticationFeature.basicBuilder().credentials(credentials[0], credentials[1]));
}
WebTarget webTarget = client.target(imageRef.getRegistryUrl());
proxyClients.put(imageRef.getRegistryUrl(), WebResourceFactory.newResource(RegistryEndpoints.class, webTarget));
}
return proxyClients.get(imageRef.getRegistryUrl());
}
示例2: getSingletons
import com.fasterxml.jackson.jaxrs.cfg.Annotations; //导入依赖的package包/类
@Override
public synchronized Set<Object> getSingletons(String alias) {
Logger logger = LoggerFactory.getLogger(JacksonManagerProvider.class);
Set<Object> singletons = new HashSet<>();
for (JacksonJaxrsService jacksonJaxrsProvider : jaxrsProviders) {
try {
ObjectMapper objectMapper = (ObjectMapper)jacksonJaxrsProvider.getMapperClass().newInstance();
registerModulesWithObjectMapper(objectMapper);
Annotations[] annotations = {Annotations.JACKSON, Annotations.JAXB};
singletons.add(jacksonJaxrsProvider.getProviderClass().getConstructor(objectMapper.getClass(), Annotations[].class).newInstance(objectMapper, annotations));
}
catch (Exception ex) {
logger.error("Exception creating JAXRS provider", ex);
}
}
return singletons;
}
示例3: createProviders
import com.fasterxml.jackson.jaxrs.cfg.Annotations; //导入依赖的package包/类
public static List<Object> createProviders(ObjectMapper objectMapper) {
ArrayList providers = new ArrayList();
Annotations[] annotationsToUse = JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS;
providers.add(new JacksonJaxbJsonProvider(objectMapper, annotationsToUse));
providers.add(new ExceptionResponseMapper());
return providers;
}
示例4: get
import com.fasterxml.jackson.jaxrs.cfg.Annotations; //导入依赖的package包/类
@Override
protected HttpHandler get(Injector injector, Configurations configurations) {
/* Setup our object mapper (could be qualified with path) */
final ObjectMapper mapper = getInstance(injector, ObjectMapper.class, path);
final Map<Class<?>, Integer> contractPriorities = new HashMap<>();
contractPriorities.put(MessageBodyWriter.class, Integer.MIN_VALUE);
contractPriorities.put(MessageBodyReader.class, Integer.MIN_VALUE);
config.register(new JacksonJsonProvider(mapper,
new Annotations[] { Annotations.JACKSON, Annotations.JAXB }),
Collections.unmodifiableMap(contractPriorities));
/* Create a ServiceLocator parent of all locators and inject the configurations */
final ServiceLocator locator = ServiceLocatorFactory.create(injector, path);
/* Set up the ObjectMapper that will be used by this application */
ServiceLocatorUtilities.addOneConstant(locator, mapper, null, ObjectMapper.class);
/* Create a brand new Grizzly HTTP container from Jersey */
log.debug("Jersey application at \"%s\" initializing", path.value());
GrizzlyHttpContainer container = GrizzlyHttpContainerFactory.create(config, locator);
log.info("Jersey application at \"%s\" initialized successfully", path.value());
/* Create our handler and add it to our server configuration */
final HttpServer server = injector.getInstance(HttpServer.class);
server.getServerConfiguration().addHttpHandler(container, path.value());
log.info("Serving \"%s\" using Jersey application \"%s\"", path.value(), config.getApplicationName());
/* All done! */
return container;
}
示例5: JacksonProvider
import com.fasterxml.jackson.jaxrs.cfg.Annotations; //导入依赖的package包/类
/**
* @param mapper
* @param annotationsToUse
*/
public JacksonProvider(ObjectMapper mapper, Annotations[] annotationsToUse) {
super(mapper, annotationsToUse);
mapper.setVisibility(PropertyAccessor.FIELD, Visibility.NONE);
mapper.setVisibility(PropertyAccessor.GETTER, Visibility.PROTECTED_AND_PUBLIC);
mapper.setVisibility(PropertyAccessor.SETTER, Visibility.PROTECTED_AND_PUBLIC);
mapper.configure(MapperFeature.REQUIRE_SETTERS_FOR_GETTERS, true);
mapper.setPropertyNamingStrategy(getPropertyNamingStrategy());
}
示例6: JacksonProvider
import com.fasterxml.jackson.jaxrs.cfg.Annotations; //导入依赖的package包/类
/**
* @param mapper
* @param annotationsToUse
*/
public JacksonProvider(ObjectMapper mapper, Annotations[] annotationsToUse) {
super(mapper, annotationsToUse);
mapper.setVisibility(PropertyAccessor.FIELD, Visibility.NONE);
mapper.setVisibility(PropertyAccessor.GETTER, Visibility.PROTECTED_AND_PUBLIC);
mapper.setVisibility(PropertyAccessor.SETTER, Visibility.PROTECTED_AND_PUBLIC);
mapper.configure(MapperFeature.REQUIRE_SETTERS_FOR_GETTERS, true);
mapper.setPropertyNamingStrategy(getPropertyNamingStrategy());
}
示例7: GedcomxAtomJsonProvider
import com.fasterxml.jackson.jaxrs.cfg.Annotations; //导入依赖的package包/类
protected GedcomxAtomJsonProvider(ObjectMapper mapper, Annotations[] annotationsToUse, Class<?> instanceClass, MediaType mt) {
super(mapper, annotationsToUse);
this.rootClass = Feed.class;
this.mt = mt;
this.instanceClass = instanceClass == null ? this.rootClass : instanceClass;
}
示例8: GedcomJsonProvider
import com.fasterxml.jackson.jaxrs.cfg.Annotations; //导入依赖的package包/类
protected GedcomJsonProvider(ObjectMapper mapper, Annotations[] annotationsToUse, Class<?> instanceClass, MediaType mt) {
super(mapper, annotationsToUse);
this.rootClass = Gedcomx.class;
this.mt = mt;
this.instanceClass = instanceClass == null ? this.rootClass : instanceClass;
}
示例9: MessageBodyWriterJSON
import com.fasterxml.jackson.jaxrs.cfg.Annotations; //导入依赖的package包/类
public MessageBodyWriterJSON(Annotations... annotationsToUse) {
super(annotationsToUse);
}
示例10: ValidatingJacksonJaxbJsonProvider
import com.fasterxml.jackson.jaxrs.cfg.Annotations; //导入依赖的package包/类
public ValidatingJacksonJaxbJsonProvider(Validator validator, ObjectMapper objectMapper, Annotations[] defaultAnnotations) {
super(objectMapper, defaultAnnotations);
this.validator = validator;
}
示例11: RdapJsonProvider
import com.fasterxml.jackson.jaxrs.cfg.Annotations; //导入依赖的package包/类
public RdapJsonProvider(Annotations... annotations) {
this(null, annotations);
}
示例12: RestJacksonJsonProvider
import com.fasterxml.jackson.jaxrs.cfg.Annotations; //导入依赖的package包/类
/**
* Constructor.
*
* @param annotationsToUse annotations to use
*/
public RestJacksonJsonProvider(Annotations... annotationsToUse) {
this(new RestJsonMapper(), annotationsToUse);
}