當前位置: 首頁>>代碼示例>>Java>>正文


Java JacksonFeature類代碼示例

本文整理匯總了Java中org.glassfish.jersey.jackson.JacksonFeature的典型用法代碼示例。如果您正苦於以下問題:Java JacksonFeature類的具體用法?Java JacksonFeature怎麽用?Java JacksonFeature使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JacksonFeature類屬於org.glassfish.jersey.jackson包,在下文中一共展示了JacksonFeature類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: RadioBrowser

import org.glassfish.jersey.jackson.JacksonFeature; //導入依賴的package包/類
/** Custom constructor for mocked unit testing.
 * @param apiUrl the base URL of the API.
 * @param timeout the timeout in milliseconds for connecting
 *                and reading.
 * @param myUserAgent the user agent string to use.
 * */
RadioBrowser(final String apiUrl,
                     final int timeout,
                     final String myUserAgent) {
    if (timeout <= 0) {
        throw new IllegalArgumentException(
                "timeout must be > 0, but is "
                        + timeout);
    }
    this.userAgent = Objects.requireNonNull(myUserAgent,
            "User agent is null");
    Client client = ClientBuilder.newBuilder()
            .register(JacksonFeature.class)
            .build();
    client.property(ClientProperties.CONNECT_TIMEOUT, timeout);
    client.property(ClientProperties.READ_TIMEOUT,    timeout);
    webTarget = client.target(apiUrl);
}
 
開發者ID:sfuhrm,項目名稱:radiobrowser4j,代碼行數:24,代碼來源:RadioBrowser.java

示例2: initApi

import org.glassfish.jersey.jackson.JacksonFeature; //導入依賴的package包/類
private void initApi() {
    ServletContextHandler servletHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
    servletHandler.setContextPath("/api");
    servletHandler.getSessionHandler().setSessionManager(sessionManager);

    servletHandler.addServlet(new ServletHolder(new AsyncSocketServlet()), "/socket");

    ResourceConfig resourceConfig = new ResourceConfig();
    resourceConfig.registerClasses(JacksonFeature.class, ObjectMapperProvider.class, ResourceErrorHandler.class);
    resourceConfig.registerClasses(SecurityRequestFilter.class, CorsResponseFilter.class);
    resourceConfig.packages(ServerResource.class.getPackage().getName());

    servletHandler.addServlet(new ServletHolder(new ServletContainer(resourceConfig)), "/*");

    handlers.addHandler(servletHandler);
}
 
開發者ID:bamartinezd,項目名稱:traccar-service,代碼行數:17,代碼來源:WebServer.java

示例3: startServer

import org.glassfish.jersey.jackson.JacksonFeature; //導入依賴的package包/類
public void startServer() throws TelegramApiException {
    SSLContextConfigurator sslContext = new SSLContextConfigurator();

    // set up security context
    sslContext.setKeyStoreFile(KEYSTORE_SERVER_FILE); // contains server keypair
    sslContext.setKeyStorePass(KEYSTORE_SERVER_PWD);

    ResourceConfig rc = new ResourceConfig();
    rc.register(restApi);
    rc.register(JacksonFeature.class);
    rc.property(JSONConfiguration.FEATURE_POJO_MAPPING, true);
    final HttpServer grizzlyServer = GrizzlyHttpServerFactory.createHttpServer(
            getBaseURI(),
            rc,
            true,
            new SSLEngineConfigurator(sslContext).setClientMode(false).setNeedClientAuth(false));
    try {
        grizzlyServer.start();
    } catch (IOException e) {
        throw new TelegramApiException("Error starting webhook server", e);
    }
}
 
開發者ID:gomgomdev,項目名稱:telegram-bot_misebot,代碼行數:23,代碼來源:Webhook.java

示例4: start

import org.glassfish.jersey.jackson.JacksonFeature; //導入依賴的package包/類
void start() {
    try {
        Config config = core.getConfig();
        String urlStr = config.getString("networking.rest-url");
        ResourceConfig rc = new ResourceConfig();
        rc.register(LoggingFilter.class);
        rc.register(JacksonFeature.class);
        rc.register(CatchAllExceptionMapper.class);
        rc.register(SerializationExceptionMapper.class);
        rc.register(AdminResourceImpl.class);
        rc.register(new KBResourceImpl(core));
        rc.register(new QueryResourceImpl(core));
        httpServer = GrizzlyHttpServerFactory.createHttpServer(URI.create(urlStr), rc, true);
        logger.info(marker, "Stargraph listening on {}", urlStr);
    } catch (Exception e) {
        throw new StarGraphException(e);
    }
}
 
開發者ID:Lambda-3,項目名稱:Stargraph,代碼行數:19,代碼來源:Server.java

示例5: WechatMallApplication

import org.glassfish.jersey.jackson.JacksonFeature; //導入依賴的package包/類
public WechatMallApplication() {

		String admin = "org.jiumao.wechatMall.admin.resource";
		String mall = "org.jiumao.wechatMall.mall.resource";
		String api = "org.jiumao.wechatMall.api.resource";
		String user = "org.jiumao.wechatMall.user.resource";
		packages(admin, mall, api, user);
		register(RequestContextFilter.class);
		register(JacksonFeature.class);
		register(AppkeyServiceFeature.class);
		register(AuthServiceFeature.class);
		register(LoggingResponseFilter.class);
		register(CORSResponseFilter.class);
		
		
	}
 
開發者ID:jiumao-org,項目名稱:wechat-mall,代碼行數:17,代碼來源:WechatMallApplication.java

示例6: TestApplication

import org.glassfish.jersey.jackson.JacksonFeature; //導入依賴的package包/類
public TestApplication(boolean querySpec, boolean jsonApiFilter, boolean serializeLinksAsObjects) {
	property(CrnkProperties.RESOURCE_SEARCH_PACKAGE, "io.crnk.test.mock");
	property(CrnkProperties.SERIALIZE_LINKS_AS_OBJECTS, Boolean.toString(serializeLinksAsObjects));

	if (!querySpec) {
		feature = new CrnkTestFeature(new ObjectMapper(), new QueryParamsBuilder(new DefaultQueryParamsParser()),
				new SampleJsonServiceLocator());
	}
	else {
		feature = new CrnkTestFeature(new ObjectMapper(), new DefaultQuerySpecDeserializer(),
				new SampleJsonServiceLocator());
	}

	feature.addModule(new TestModule());

	if (jsonApiFilter) {
		register(new JsonApiResponseFilter(feature));
		register(new JsonapiExceptionMapperBridge(feature));
		register(new JacksonFeature());
	}

	setupFeature(feature);

	register(feature);
}
 
開發者ID:crnk-project,項目名稱:crnk-framework,代碼行數:26,代碼來源:AbstractClientTest.java

示例7: getClasses

import org.glassfish.jersey.jackson.JacksonFeature; //導入依賴的package包/類
@Override
public Set<Class<?>> getClasses() {
  Set<Class<?>> classes = new HashSet<>();

  // Use Jackson for media types
  classes.add(JacksonFeature.class);

  // Register the service endpoint
  classes.add(HelloService.class);

  // Register the infrastructure endpoint
  classes.add(HealthService.class);

  // the Tracing filter
  classes.add(TraceContainerFilter.class);

  return classes;
}
 
開發者ID:chonton,項目名稱:apm-client,代碼行數:19,代碼來源:HelloApplication.java

示例8: getClasses

import org.glassfish.jersey.jackson.JacksonFeature; //導入依賴的package包/類
@Override
public Set<Class<?>> getClasses() {
  Set<Class<?>> classes = new HashSet<>();

  // Use Jackson for media types
  classes.add(JacksonFeature.class);

  // Register the service endpoint
  classes.add(HelloService.class);

  // Register the infrastructure endpoint
  classes.add(HealthService.class);

  // the Tracing filter is added in web.xml

  return classes;
}
 
開發者ID:chonton,項目名稱:apm-client,代碼行數:18,代碼來源:HelloApplication.java

示例9: startServer

import org.glassfish.jersey.jackson.JacksonFeature; //導入依賴的package包/類
public void startServer() throws TelegramApiRequestException {
    ResourceConfig rc = new ResourceConfig();
    rc.register(restApi);
    rc.register(JacksonFeature.class);

    final HttpServer grizzlyServer;
    if (keystoreServerFile != null && keystoreServerPwd != null) {
        SSLContextConfigurator sslContext = new SSLContextConfigurator();

        // set up security context
        sslContext.setKeyStoreFile(keystoreServerFile); // contains server keypair
        sslContext.setKeyStorePass(keystoreServerPwd);

        grizzlyServer = GrizzlyHttpServerFactory.createHttpServer(getBaseURI(), rc, true,
                new SSLEngineConfigurator(sslContext).setClientMode(false).setNeedClientAuth(false));
    } else {
        grizzlyServer = GrizzlyHttpServerFactory.createHttpServer(getBaseURI(), rc);
    }

    try {
        grizzlyServer.start();
    } catch (IOException e) {
        throw new TelegramApiRequestException("Error starting webhook server", e);
    }
}
 
開發者ID:samurayrj,項目名稱:rubenlagus-TelegramBots,代碼行數:26,代碼來源:DefaultWebhook.java

示例10: Coreference

import org.glassfish.jersey.jackson.JacksonFeature; //導入依賴的package包/類
public Coreference(Config config) {

		log.info("Will use remote coreference resource at: '{}'", config.getString("url"));

		final Client webClient = ClientBuilder.newClient();
		webClient.register(JacksonFeature.class);

		this.textTarget = webClient
                .target(config.getString("url"))
                .path(config.getString("text-path"));
        this.wikiTarget = webClient
                .target(config.getString("url"))
                .path(config.getString("wiki-path"));
        this.wikiLinkTarget = webClient
                .target(config.getString("url"))
                .path(config.getString("wiki-link-path"));

		log.info("Coreference initialized");
	}
 
開發者ID:Lambda-3,項目名稱:Graphene,代碼行數:20,代碼來源:Coreference.java

示例11: generateResourceConfig

import org.glassfish.jersey.jackson.JacksonFeature; //導入依賴的package包/類
static ResourceConfig generateResourceConfig(Config config, Graphene graphene) {
	ResourceConfig rc = new ResourceConfig();

	// settings
	rc.property(ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true);
	rc.property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true); // TODO: remove in production

	// basic features
	rc.register(CORSFilter.class);
	rc.register(JacksonFeature.class);
	rc.register(ValidationFeature.class);

	// custom resources
	GrapheneResourceFactory factory = new GrapheneResourceFactory(config, graphene);

	rc.register(factory.createResource(AdminResource.class));
	rc.register(factory.createResource(CoreferenceResource.class));
	rc.register(factory.createResource(RelationExtractionResource.class));

	return rc;
}
 
開發者ID:Lambda-3,項目名稱:Graphene,代碼行數:22,代碼來源:GrapheneRESTServer.java

示例12: getRegistryClient

import org.glassfish.jersey.jackson.JacksonFeature; //導入依賴的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());
}
 
開發者ID:swissquote,項目名稱:carnotzet,代碼行數:20,代碼來源:DockerRegistry.java

示例13: BaseApplicaionConfig

import org.glassfish.jersey.jackson.JacksonFeature; //導入依賴的package包/類
public BaseApplicaionConfig() {
    //設置默認時區
    System.setProperty("user.timezone", "Asia/Shanghai");

    register(ValidationContextResolver.class);
    property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
    property(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK, true);

    this.packages(packages());
    register(ObjectMapperResolver.class);
    register(JacksonFeature.class);
    register(JacksonJsonProvider.class);
    register(new BaseExceptionMapper(createExcetionWrapper()));
    register(RequestContextFilter.class);

    register(DefaultWebFilter.class);

    if (FilterConfig.apiDocEnabled()) {
        register(SwaggerSerializers.class);
    }
}
 
開發者ID:warlock-china,項目名稱:azeroth,代碼行數:22,代碼來源:BaseApplicaionConfig.java

示例14: startServer

import org.glassfish.jersey.jackson.JacksonFeature; //導入依賴的package包/類
protected void startServer() {
        WifiManager wifiMgr = (WifiManager) getApplicationContext()
                .getSystemService(Service.WIFI_SERVICE);
        if (wifiMgr.isWifiEnabled()) {
            // Deprecated. Does not support ipv6. *shrug* :)
            String ipAddress = Formatter.formatIpAddress(wifiMgr.getConnectionInfo()
                    .getIpAddress());

            URI baseUri = UriBuilder.fromUri("http://" + ipAddress)
                    .port(49152)
                    .build();
            ResourceConfig config = new ResourceConfig(SseFeature.class)
                    .register(JacksonFeature.class);
            config.registerInstances(new SecureFilter(this));
            config.registerInstances(new DeskDroidResource(this));
//            server = JettyHttpContainerFactory.createServer(baseUri, config);
            server = GrizzlyHttpServerFactory.createHttpServer(baseUri, config);
        }
    }
 
開發者ID:PacktPublishing,項目名稱:Java-9-Programming-Blueprints,代碼行數:20,代碼來源:DeskDroidService.java

示例15: JbrickWSApplication

import org.glassfish.jersey.jackson.JacksonFeature; //導入依賴的package包/類
public JbrickWSApplication() {
	// Registrazione del package contenente le risorse
	packages("it.makeit.jbrick.ws.resources"); 
	packages("it.makeit.profiler.ws.resources");
	packages("it.makeit.jbrick.configdb.ws.resources");
	packages("it.makeit.jbrick.scheduler.ws.resources");
	packages("it.makeit.zefiro.ws.resources");

	// Registrazione di jackson-media-provider e configurazione serializzatore
	register(JacksonFeature.class);
	register(JbrickJacksonConfigurator.class);

	// Registrazione del listener delle eccezioni
	register(ExceptionListener.class);
	
	// Registrazione exception mapper
	register(JbrickExceptionMapper.class);
	
	// Registrazione Multipart Feature per upload file
	register(MultiPartFeature.class);
	
	// Registrazione filtri
	register(AuthenticationFilter.class);
	register(LogFilter.class);
}
 
開發者ID:MakeITBologna,項目名稱:zefiro,代碼行數:26,代碼來源:JbrickWSApplication.java


注:本文中的org.glassfish.jersey.jackson.JacksonFeature類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。