当前位置: 首页>>代码示例>>Java>>正文


Java ResourceConfig类代码示例

本文整理汇总了Java中org.glassfish.jersey.server.ResourceConfig的典型用法代码示例。如果您正苦于以下问题:Java ResourceConfig类的具体用法?Java ResourceConfig怎么用?Java ResourceConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ResourceConfig类属于org.glassfish.jersey.server包,在下文中一共展示了ResourceConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.glassfish.jersey.server.ResourceConfig; //导入依赖的package包/类
@Override
public Application configure() {

    initMocks(this);

    final String baseUri = getBaseUri().toString();
    final String origin = baseUri.substring(0, baseUri.length() - 1);

    final ResourceConfig config = new ResourceConfig();
    config.register(new LdpResource(mockResourceService, ioService, mockBinaryService, BASE_URL));
    config.register(new TestAuthenticationFilter("testUser", ""));
    config.register(new WebAcFilter(emptyList(), mockAccessControlService));
    config.register(new AgentAuthorizationFilter(mockAgentService, asList("testUser")));
    config.register(new MultipartUploader(mockResourceService, mockBinaryResolver, BASE_URL));
    config.register(new CacheControlFilter(86400));
    config.register(new CrossOriginResourceSharingFilter(asList(origin),
                asList("PATCH", "POST", "PUT"),
                asList("Link", "Content-Type", "Accept", "Accept-Datetime"),
                asList("Link", "Content-Type", "Pragma", "Memento-Datetime"), true, 100));
    return config;
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:22,代码来源:LdpAdminResourceTest.java

示例2: httpBuilder

import org.glassfish.jersey.server.ResourceConfig; //导入依赖的package包/类
public static HttpServer httpBuilder (String connectionUrl, String profileName) {
    try {
        URL url = new URL(connectionUrl);

        System.setProperty("spring.profiles.active", profileName);
        AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(SpringAnnotationConfig.class);

        ResourceConfig resourceConfig = new ResourceConfig();
        resourceConfig.register(RequestContextFilter.class);
        resourceConfig.property("contextConfig", annotationConfigApplicationContext);
        resourceConfig.register(RestSupport.class);

        URI baseUri = URI.create(url.getProtocol() + "://" + url.getAuthority());
        return  GrizzlyHttpServerFactory.createHttpServer(baseUri, resourceConfig, false);
    } catch (Exception e) {
        Assert.fail("Could'n parse configfile." + e.getMessage());
    }
    return null;
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:20,代码来源:WebServiceClientHelper.java

示例3: configure

import org.glassfish.jersey.server.ResourceConfig; //导入依赖的package包/类
@Override
protected Application configure() {
    enable(TestProperties.LOG_TRAFFIC);
    enable(TestProperties.DUMP_ENTITY);

    ResourceConfig config = new ResourceConfig();

    FastJsonProvider fastJsonProvider = new FastJsonProvider();
    FastJsonConfig fastJsonConfig = new FastJsonConfig();
    fastJsonConfig.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect, SerializerFeature.BrowserSecure);
    fastJsonProvider.setFastJsonConfig(fastJsonConfig);

    config.register(fastJsonProvider);

    config.packages("com.alibaba.json.bvt.issue_1300");
    return config;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:Issue1341.java

示例4: jerseyServletRegistration

import org.glassfish.jersey.server.ResourceConfig; //导入依赖的package包/类
@Bean
public ServletRegistrationBean jerseyServletRegistration(
    JerseyProperties jerseyProperties, ResourceConfig config) {

    ServletRegistrationBean registration = new ServletRegistrationBean(
        new ServletContainer(config));

    for (Map.Entry<String, String> entry : jerseyProperties.getInit().entrySet()) {
        registration.addInitParameter(entry.getKey(), entry.getValue());
    }

    registration.addUrlMappings("/" +
        (StringUtils.isEmpty(lyreProperties.getApplicationPath()) ? "api" : lyreProperties.getApplicationPath())
        + "/*");
    registration.setName(APIx.class.getName());
    registration.setLoadOnStartup(1);
    return registration;

}
 
开发者ID:groovylabs,项目名称:lyre,代码行数:20,代码来源:Lyre.java

示例5: configure

import org.glassfish.jersey.server.ResourceConfig; //导入依赖的package包/类
@Override
public Application configure() {

    final String baseUri = getBaseUri().toString();
    final String origin = baseUri.substring(0, baseUri.length() - 1);

    // Junit runner doesn't seem to work very well with JerseyTest
    initMocks(this);

    final ResourceConfig config = new ResourceConfig();
    config.register(new LdpResource(mockResourceService, ioService, mockBinaryService, "http://example.org/"));
    config.register(new TestAuthenticationFilter("testUser", "group"));
    config.register(new WebAcFilter(asList(BASIC_AUTH, DIGEST_AUTH), mockAccessControlService));
    config.register(new CrossOriginResourceSharingFilter(asList(origin),
                asList("PATCH", "POST", "PUT"),
                asList("Link", "Content-Type", "Accept", "Accept-Datetime"),
                emptyList(), false, 0));
    return config;
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:20,代码来源:LdpUnauthorizedResourceTest.java

示例6: configure

import org.glassfish.jersey.server.ResourceConfig; //导入依赖的package包/类
@Override
public Application configure() {

    // Junit runner doesn't seem to work very well with JerseyTest
    initMocks(this);

    final String baseUri = getBaseUri().toString();
    final String origin = baseUri.substring(0, baseUri.length() - 1);

    final ResourceConfig config = new ResourceConfig();
    config.register(new LdpResource(mockResourceService, ioService, mockBinaryService, BASE_URL));
    config.register(new MultipartUploader(mockResourceService, mockBinaryResolver, BASE_URL));
    config.register(new CacheControlFilter(86400));
    config.register(new CrossOriginResourceSharingFilter(asList(origin), asList("PATCH", "POST", "PUT"),
                    asList("Link", "Content-Type", "Accept-Datetime"),
                    asList("Link", "Content-Type", "Memento-Datetime"), true, 100));
    return config;
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:19,代码来源:LdpResourceNoAgentTest.java

示例7: configure

import org.glassfish.jersey.server.ResourceConfig; //导入依赖的package包/类
@Override
public Application configure() {

    // Junit runner doesn't seem to work very well with JerseyTest
    initMocks(this);

    final String baseUri = getBaseUri().toString();
    final String origin = baseUri.substring(0, baseUri.length() - 1);

    final ResourceConfig config = new ResourceConfig();
    config.register(new LdpResource(mockResourceService, ioService, mockBinaryService, BASE_URL));
    config.register(new TestAuthenticationFilter("testUser", "group"));
    config.register(new WebAcFilter(emptyList(), mockAccessControlService));
    config.register(new AgentAuthorizationFilter(mockAgentService, emptyList()));
    config.register(new MultipartUploader(mockResourceService, mockBinaryResolver, BASE_URL));
    config.register(new CacheControlFilter(86400));
    config.register(new CrossOriginResourceSharingFilter(asList(origin), asList("PATCH", "POST", "PUT"),
                    asList("Link", "Content-Type", "Accept-Datetime"),
                    asList("Link", "Content-Type", "Memento-Datetime"), true, 100));
    return config;
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:22,代码来源:LdpUserResourceTest.java

示例8: configure

import org.glassfish.jersey.server.ResourceConfig; //导入依赖的package包/类
@Override
public Application configure() {

    initMocks(this);

    final String baseUri = getBaseUri().toString();
    final String origin = baseUri.substring(0, baseUri.length() - 1);

    final ResourceConfig config = new ResourceConfig();
    config.register(new LdpResource(mockResourceService, ioService, mockBinaryService, BASE_URL));
    config.register(new AgentAuthorizationFilter(mockAgentService, emptyList()));
    config.register(new MultipartUploader(mockResourceService, mockBinaryResolver, BASE_URL));
    config.register(new CacheControlFilter(86400));
    config.register(new CrossOriginResourceSharingFilter(asList(origin), asList("PATCH", "POST", "PUT"),
                    asList("Link", "Content-Type", "Accept-Datetime"),
                    asList("Link", "Content-Type", "Memento-Datetime"), true, 100));
    return config;
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:19,代码来源:LdpResourceTest.java

示例9: startServer

import org.glassfish.jersey.server.ResourceConfig; //导入依赖的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

示例10: configure

import org.glassfish.jersey.server.ResourceConfig; //导入依赖的package包/类
@Override
protected Application configure() {
    registry = new SimpleMeterRegistry();
    longTaskRequestStartedLatch = new CountDownLatch(1);
    longTaskRequestReleaseLatch = new CountDownLatch(1);

    final MetricsApplicationEventListener listener = new MetricsApplicationEventListener(
        registry, new DefaultJerseyTagsProvider(), METRIC_NAME, false);

    final ResourceConfig config = new ResourceConfig();
    config.register(listener);
    config.register(
        new TimedResource(longTaskRequestStartedLatch, longTaskRequestReleaseLatch));
    config.register(TimedOnClassResource.class);

    return config;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:18,代码来源:MetricsRequestEventListenerTimedTest.java

示例11: configure

import org.glassfish.jersey.server.ResourceConfig; //导入依赖的package包/类
@Override
protected Application configure() {

	enable(TestProperties.LOG_TRAFFIC);
	enable(TestProperties.DUMP_ENTITY);

	MockitoAnnotations.initMocks(this);

	ResourceConfig rs = new ResourceConfig();
	rs.register(TestBinder.forAllMocksOf(this));
	rs.register(JacksonJaxbJsonProvider.class);
	rs.register(TestResource.class);
	rs.property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, Boolean.TRUE);
	LinkFactoryResourceConfig.configure(rs);
	linkMetaFactory = LinkMetaFactory.createInsecureFactoryForTest();
	return rs;
}
 
开发者ID:Mercateo,项目名称:rest-jersey-utils,代码行数:18,代码来源:AbstractListingResourceTest.java

示例12: startServer

import org.glassfish.jersey.server.ResourceConfig; //导入依赖的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

示例13: configure

import org.glassfish.jersey.server.ResourceConfig; //导入依赖的package包/类
@Override
protected void configure() {
	super.configure();
	
	bind(ResourceConfig.class).toProvider(ResourceConfigProvider.class).in(Singleton.class);
	bind(ServletContainer.class).to(DefaultServletContainer.class);
	
	contribute(FilterChainConfigurator.class, new FilterChainConfigurator() {

		@Override
		public void configure(FilterChainManager filterChainManager) {
			filterChainManager.createChain("/rest/**", "noSessionCreation, authcBasic");
		}
		
	});
	
	contribute(JerseyConfigurator.class, new JerseyConfigurator() {
		
		@Override
		public void configure(ResourceConfig resourceConfig) {
			resourceConfig.packages(RestModule.class.getPackage().getName());
		}
		
	});
	
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:27,代码来源:RestModule.java

示例14: configure

import org.glassfish.jersey.server.ResourceConfig; //导入依赖的package包/类
@Override
protected Application configure() {
    enable(TestProperties.LOG_TRAFFIC);
    enable(TestProperties.DUMP_ENTITY);

    ResourceConfig config = new ResourceConfig();
    //config.register(new FastJsonFeature()).register(FastJsonProvider.class);
    config.register(new FastJsonFeature()).register(new FastJsonProvider().setPretty(true));
    config.packages("com.alibaba.fastjson");
    return config;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:TestIssue885.java

示例15: configure

import org.glassfish.jersey.server.ResourceConfig; //导入依赖的package包/类
@Override
protected Application configure() {
    enable(TestProperties.LOG_TRAFFIC);
    enable(TestProperties.DUMP_ENTITY);

    ResourceConfig config = new ResourceConfig();

    config.register(FastJsonProvider.class);
    config.packages("com.alibaba.json.bvt.issue_1300");
    return config;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:Issue1367_jaxrs.java


注:本文中的org.glassfish.jersey.server.ResourceConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。