本文整理汇总了Java中org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider类的典型用法代码示例。如果您正苦于以下问题:Java JacksonJaxbJsonProvider类的具体用法?Java JacksonJaxbJsonProvider怎么用?Java JacksonJaxbJsonProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JacksonJaxbJsonProvider类属于org.codehaus.jackson.jaxrs包,在下文中一共展示了JacksonJaxbJsonProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSingletons
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; //导入依赖的package包/类
public HashSet<Object> getSingletons(){
ObjectMapper mapper = new ObjectMapper();
JacksonJaxbJsonProvider jaxbProvider = new JacksonJaxbJsonProvider();
jaxbProvider.setMapper(mapper);
singletons.add(jaxbProvider);
if(Activator.BUNDLE==null){
throw new IllegalArgumentException("WebSocketService.BUNDLE is null!");
}
IGuicer guicer = Guicer.getInstance(Activator.BUNDLE);
//create the rest object make sure dependencies are injected via guice.
IRestWebSocket restWebSocket = guicer.createObject(IRestWebSocket.class);
if(restWebSocket==null){
throw new IllegalArgumentException("restWebSocket is null!!!");
}
//add it
singletons.add(restWebSocket);
return singletons;
}
示例2: getJSONResponse
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; //导入依赖的package包/类
static ClientResponse getJSONResponse(String url, String content_type) {
ClientConfig config = new DefaultClientConfig();
config.getClasses().add(JacksonJaxbJsonProvider.class);
config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
WebResource webResource = getWebResource(url,config,content_type);
return webResource.accept(content_type).get(ClientResponse.class);
}
示例3: postJSONResponse
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; //导入依赖的package包/类
static ClientResponse postJSONResponse(String url, String content_type,String body) {
ClientConfig config = new DefaultClientConfig();
config.getClasses().add(JacksonJaxbJsonProvider.class);
config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
WebResource webResource = getWebResource(url,config,content_type);
return webResource.accept(content_type).post(ClientResponse.class,body);
}
示例4: TestModelBase
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; //导入依赖的package包/类
protected TestModelBase(Class<?> clazz) throws Exception {
super();
this.clazz = clazz;
context = new JAXBContextResolver().getContext(clazz);
mapper = new JacksonJaxbJsonProvider().locateMapper(clazz,
MediaType.APPLICATION_JSON_TYPE);
}
示例5: getService
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; //导入依赖的package包/类
/**
* Returns a reference to the Data Quality service (proxy) to be used.
*
* @return A reference to the Data Quality service (proxy) to be used
*/
public DataQualityService getService()
{
DataQualityService retVal = null;
// set up providers
List<Object> providers = new ArrayList<Object>();
JacksonJaxbJsonProvider jsonProvider = new JacksonJaxbJsonProvider(new CustomObjectMapper(), DEFAULT_ANNOTATIONS);
ErrorResponseExceptionMapper srvExMapper = new ErrorResponseExceptionMapper();
providers.add(jsonProvider);
providers.add(srvExMapper);
if (endPoint != null)
{
// initialize proxy
retVal = JAXRSClientFactory.create(endPoint, DataQualityService.class, providers);
}
else // fall-back (local or non-NEO runtime env)
{
// TODO - remove hard-coded URL
String remoteProxy = MessageFormat.format("https://dqaas{0}.hanatrial.ondemand.com/dq", System.getenv("HC_ACCOUNT"));
retVal = JAXRSClientFactory.create(remoteProxy, DataQualityService.class, providers);
}
return retVal;
}
示例6: createRESTClientProxy
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Override
protected <T> T createRESTClientProxy(String apiUrl, Class<T> proxy) {
URI i = null;
try {
i = new URI(apiUrl);
} catch (URISyntaxException ex) {
throw new RuntimeException(ex);
}
ResteasyClientBuilder builder = new ResteasyClientBuilder();
builder.connectionCheckoutTimeout(CONNECTION_SETUP_TO, TimeUnit.SECONDS);
builder.socketTimeout(CONNECTION_SETUP_TO, TimeUnit.SECONDS);
builder.httpEngine(new URLConnectionEngine());
ResteasyProviderFactory.getInstance().register(builder);
ResteasyClient client = builder.build();
client.register(new ClientRequestFilter() {
@Override
public void filter(ClientRequestContext requestContext) throws IOException {
requestContext.getHeaders().add("User-Agent", getImplementationName() + "=" + getVersion());
}
});
ObjectMapper mapper = new ObjectMapper();
JacksonJaxbJsonProvider jaxbProvider
= new JacksonJaxbJsonProvider(mapper, JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS);
mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector());
mapper.configure(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
builder.register(jaxbProvider);
builder.register(proxy);
ResteasyWebTarget resteasyWebTarget = client.target(i);
return resteasyWebTarget.proxy(proxy);
}
示例7: getSingletons
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Override
public HashSet<Object> getSingletons(){
ObjectMapper mapper = new ObjectMapper();
JacksonJaxbJsonProvider jaxbProvider = new JacksonJaxbJsonProvider();
jaxbProvider.setMapper(mapper);
singletons.add(jaxbProvider);
if(Activator.bundle==null){
throw new IllegalArgumentException("WebSocketService.BUNDLE is null!");
}
IGuicer guicer = Guicer.getInstance(Activator.bundle);
//create the rest object make sure dependencies are injected via guice.
IRestWebSocket restWebSocket = guicer.createObject(IRestWebSocket.class);
if(restWebSocket==null){
throw new IllegalArgumentException("restWebSocket is null!!!");
}
//add it
singletons.add(restWebSocket);
return singletons;
}
示例8: JiraRestAccess
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; //导入依赖的package包/类
public JiraRestAccess(String url, String user, String password) {
this.restHome = url + JIRA_REST_API_SUFFIX;
String userAndPassword = user + ':' + password;
this.authentification = new String(Base64.getEncoder().encode(userAndPassword.getBytes()));
JacksonJsonProvider jacksonJsonProvider =
new JacksonJaxbJsonProvider().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper = jacksonJsonProvider.locateMapper(Object.class, MediaType.APPLICATION_JSON_TYPE);
ClientConfig cfg = new DefaultClientConfig();
cfg.getSingletons().add(jacksonJsonProvider);
this.client = Client.create(cfg);
// this.client.addFilter(new LoggingFilter(System.out));
}
示例9: configureServlets
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Override
protected void configureServlets() {
bind(ClustersResource.class);
bind(ConfigurationResource.class);
bind(SchedulerStateResource.class);
bind(ControllerResource.class);
bind(ArtifactsResource.class);
bind(GuiceContainer.class);
bind(JacksonJaxbJsonProvider.class).in(Scopes.SINGLETON);
serve("/api/*").with(GuiceContainer.class);
}
示例10: getClasses
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Override
public Set<Class<?>> getClasses() {
final Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(JacksonJaxbJsonProvider.class);
classes.addAll(getRestRegistrationService().getClasses());
return classes;
}
示例11: setUp
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
HippoRepositoryFactory.setDefaultRepository(background);
super.setUp();
startServer();
client = WebClient.create(HTTP_ENDPOINT_ADDRESS, Collections.singletonList(new JacksonJaxbJsonProvider()), "admin", "admin", null);
}
示例12: startServer
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; //导入依赖的package包/类
private static void startServer() throws Exception {
Object jacksonJaxbJsonProvider = new JacksonJaxbJsonProvider();
Object crossOriginResourceSharingFilter = new CrossOriginResourceSharingFilter();
Object customWebApplicationExceptionMapper = new CustomWebApplicationExceptionMapper();
Object hippoAuthenticationRequestHandler = new HippoAuthenticationRequestHandler();
Object apiDeclarationProvider = new ApiDeclarationProvider();
Object resourceListingProvider = new ResourceListingProvider();
Object customJacksonConfig = new CustomJacksonConfig();
List<Object> providers = new ArrayList<Object>();
providers.add(customJacksonConfig);
providers.add(jacksonJaxbJsonProvider);
providers.add(crossOriginResourceSharingFilter);
providers.add(customWebApplicationExceptionMapper);
providers.add(hippoAuthenticationRequestHandler);
providers.add(apiDeclarationProvider);
providers.add(resourceListingProvider);
List<Class<?>> serviceClasses = new ArrayList<Class<?>>();
serviceClasses.add(ApiListingResourceJSON.class);
serviceClasses.add(RootResource.class);
serviceClasses.add(SystemResource.class);
serviceClasses.add(NodesResource.class);
serviceClasses.add(PropertiesResource.class);
serviceClasses.add(QueryResource.class);
serviceClasses.add(StatsResource.class);
serviceClasses.add(UsersResource.class);
serviceClasses.add(GroupsResource.class);
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setProviders(providers);
sf.setResourceClasses(serviceClasses);
sf.setAddress(HTTP_ENDPOINT_ADDRESS);
cxfServer = sf.create();
}
示例13: JerseyConnector
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; //导入依赖的package包/类
public JerseyConnector(Logger logger) {
if (logger != null)
this.logger = new JerseyLoggingFilter(logger);
ClientConfig clientConfig = new DefaultClientConfig();
clientConfig.getClasses().add(JacksonJaxbJsonProvider.class);
clientConfig.getClasses().add(OpenStackObjectMapper.class);
client = Client.create(clientConfig);
}
示例14: RESTApplication
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; //导入依赖的package包/类
@Inject
public RESTApplication(ServiceLocator serviceLocator) {
log.info("Initialisation de l'application");
classes.add(LdapResource.class);
classes.add(NameNotFoundMapper.class);
classes.add(MultiPartFeature.class);
JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
singletons.add(provider);
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(SPRING_CONFIG);
Rest2LdapConfig config = ctx.getBean("rest2ldapConfig", Rest2LdapConfig.class);
ILdapDAO ldapDAO = ctx.getBean(ILdapDAO.class);
DynamicConfiguration dc = Injections.getConfiguration(serviceLocator);
Injections.addBinding(
Injections.newBinder(ctx).to(ApplicationContext.class), dc);
Injections.addBinding(
Injections.newBinder(config).to(Rest2LdapConfig.class), dc);
Injections.addBinding(
Injections.newBinder(ldapDAO).to(ILdapDAO.class), dc);
dc.commit();
testLdapConnection(ctx);
}
示例15: getSingletons
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; //导入依赖的package包/类
public HashSet<Object> getSingletons(){
ObjectMapper mapper = new ObjectMapper();
JacksonJaxbJsonProvider jaxbProvider = new JacksonJaxbJsonProvider();
jaxbProvider.setMapper(mapper);
singletons.add(jaxbProvider);
if(WebshellServiceActivator.BUNDLE==null){
throw new IllegalArgumentException("WebshellServiceActivator.BUNDLE is null!");
}
IGuicer guicer = Guicer.getInstance(WebshellServiceActivator.BUNDLE);
//create the rest object make sure dependencies are injected via guice.
IRestWebshell restWebshell = (IRestWebshell) guicer.createObject(IRestWebshell.class);
RestSimple restSimple = (RestSimple) guicer.createObject(RestSimple.class);
if(restWebshell==null){
throw new IllegalArgumentException("restWebshell is null!!!");
}
//add it
singletons.add(restWebshell);
singletons.add(restSimple);
return singletons;
}