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


Java ResourceConfig.property方法代码示例

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


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

示例1: 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

示例2: generateResourceConfig

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

示例3: 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

示例4: jerseyApplicationConfig

import org.glassfish.jersey.server.ResourceConfig; //导入方法依赖的package包/类
@Bean
public ResourceConfig jerseyApplicationConfig() {
	ResourceConfig resourceConfig = new ResourceConfig();
	if (configurationProperties.isForwardOn404()) {
		resourceConfig.property(ServletProperties.FILTER_FORWARD_ON_404, true);
	}
	return resourceConfig;
}
 
开发者ID:holon-platform,项目名称:holon-jaxrs,代码行数:9,代码来源:JerseyServerAutoConfiguration.java

示例5: startRestServer

import org.glassfish.jersey.server.ResourceConfig; //导入方法依赖的package包/类
public static HttpServer startRestServer() {
    BeanConfig beanConfig = new BeanConfig();
    beanConfig.setVersion("1.0.0");
    beanConfig.setTitle("SlideBar REST Interface");
    beanConfig.setResourcePackage(RootResource.class.getPackage().getName());
    beanConfig.setSchemes(new String[] { "http" });
    beanConfig.setHost("localhost:5055");
    beanConfig.setScan(true);

    final ResourceConfig rc = new ResourceConfig();
    rc.packages(RootResource.class.getPackage().getName());
    rc.register(LoggingFeature.class);
    rc.register(JacksonFeature.class);
    rc.register(ApiListingResource.class);
    rc.register(SwaggerSerializers.class);
    rc.property(ServerProperties.WADL_FEATURE_DISABLE, true);

    Logger l = Logger.getLogger("org.glassfish.grizzly.http.server.HttpHandler");
    l.setLevel(Level.FINE);
    l.setUseParentHandlers(false);
    ConsoleHandler ch = new ConsoleHandler();
    ch.setLevel(Level.ALL);
    l.addHandler(ch);

    try {
        return GrizzlyHttpServerFactory.createHttpServer(new URI("http://localhost:5055"), rc);
    } catch (URISyntaxException e) {
        e.printStackTrace();
        return null;
    }
}
 
开发者ID:SlideKB,项目名称:SlideBar,代码行数:32,代码来源:MainBack.java

示例6: configure

import org.glassfish.jersey.server.ResourceConfig; //导入方法依赖的package包/类
@Override
public ResourceConfig configure() {
    ResourceConfig rc = new FactCastRestApplication();
    ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
    rc.property("contextConfig", ctx);

    rc.register(SpringLifecycleListener.class);
    rc.register(RequestContextFilter.class);

    return rc;
}
 
开发者ID:uweschaefer,项目名称:factcast,代码行数:12,代码来源:RootDocumentation0Test.java

示例7: startTestSuite

import org.glassfish.jersey.server.ResourceConfig; //导入方法依赖的package包/类
@BeforeClass
public static void startTestSuite() throws Exception {
    ResourceConfig resourceConfig = new ResourceConfig(
            StacksController.class,
            DataServiceExceptionMapper.class,
            DataSourceConnectorExceptionMapper.class,
            ServiceUnavailableExceptionMapper.class,
            ServiceExceptionMapper.class,
            RedirectorLockReleaseExceptionMapper.class,
            NoDataSourceConnectionExceptionMapper.class,
            RedirectorDataSourceExceptionMapper.class,
            ValidationExceptionMapper.class);
    resourceConfig.property(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, "true");
    HttpTestServerHelper.createAndStartHttpServer(resourceConfig);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:16,代码来源:WebServiceAPIStackWorkerBackgroundTestSuite.java

示例8: startTestSuite

import org.glassfish.jersey.server.ResourceConfig; //导入方法依赖的package包/类
@BeforeClass
public static void startTestSuite() throws Exception {
    ResourceConfig resourceConfig = new ResourceConfig(
            DeciderRulesController.class,
            DistributionController.class,
            DistributionControllerOffline.class,
            NamespaceController.class,
            NamespaceControllerOffline.class,
            PendingChangesControllerOffline.class,
            PendingChangesController.class,
            PartnersController.class,
            StacksController.class,
            RulesController.class,
            RulesControllerOffline.class,
            RedirectorController.class,
            RedirectorTestSuiteController.class,
            SummaryController.class,
            ServersController.class,
            ServersControllerOffline.class,
            UrlRulesController.class,
            UrlRulesControllerOffline.class,
            WhitelistedController.class,
            WhiteListOfflineController.class,
            WhitelistedStackUpdatesController.class,
            StackCommentsController.class,
            SettingsController.class,
            TrafficController.class,
            TemplateFlavorRulesController.class,
            TemplateUrlRulesController.class,
            RedirectorModelInitializerController.class,
            DataServiceExceptionMapper.class,
            DataSourceConnectorExceptionMapper.class,
            ServiceUnavailableExceptionMapper.class,
            ServiceExceptionMapper.class,
            RedirectorLockReleaseExceptionMapper.class,
            NoDataSourceConnectionExceptionMapper.class,
            RedirectorDataSourceExceptionMapper.class, ValidationExceptionMapper.class);
    resourceConfig.property(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, "true");
    HttpTestServerHelper.createAndStartHttpServer(resourceConfig);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:41,代码来源:WebServiceAPITestSuite.java

示例9: start

import org.glassfish.jersey.server.ResourceConfig; //导入方法依赖的package包/类
public void start() throws Exception {
    ResourceConfig resourceConfig = new ResourceConfig(
        DeciderRulesController.class,
        DistributionController.class,
        DistributionControllerOffline.class,
        NamespaceController.class,
        NamespaceControllerOffline.class,
        PendingChangesControllerOffline.class,
        PendingChangesController.class,
        PartnersController.class,
        StacksController.class,
        RulesController.class,
        RulesControllerOffline.class,
        RedirectorController.class,
        RedirectorTestSuiteController.class,
        SummaryController.class,
        ServersController.class,
        ServersControllerOffline.class,
        UrlRulesController.class,
        UrlRulesControllerOffline.class,
        WhitelistedController.class,
        WhiteListOfflineController.class,
        WhitelistedStackUpdatesController.class,
        SettingsController.class,
        TrafficController.class,
        TemplateFlavorRulesController.class,
        TemplateUrlRulesController.class,
        DataServiceExceptionMapper.class,
        DataSourceConnectorExceptionMapper.class,
        ServiceUnavailableExceptionMapper.class,
        ServiceExceptionMapper.class,
        RedirectorLockReleaseExceptionMapper.class,
        NoDataSourceConnectionExceptionMapper.class,
        RedirectorDataSourceExceptionMapper.class);
    resourceConfig.property(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, "true");
    HttpTestServerHelper.createAndStartHttpServer(resourceConfig);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:38,代码来源:RestApiEndpoint.java

示例10: startServer

import org.glassfish.jersey.server.ResourceConfig; //导入方法依赖的package包/类
/**
 * Starts Grizzly HTTP server exposing JAX-RS resources defined in this application.
 * @return Grizzly HTTP server.
 */
public static HttpServer startServer(int port) {
    HashMap properties = new HashMap();

    bridgeLog();

    // create a resource config that scans for JAX-RS resources and providers
    // in io.github.javathought.devoxx package
    final ResourceConfig rc = new ResourceConfig().packages("io.github.javathought.devoxx", "org.glassfish.jersey.examples.jackson");
    rc.register(SecurityFilter.class);
    rc.register(CrossDomainFilter.class);
    rc.register(SelectableEntityFilteringFeature.class);
    rc.property(SelectableEntityFilteringFeature.QUERY_PARAM_NAME, "select");
    rc.register(JacksonFeature.class);
    rc.register(RolesAllowedDynamicFeature.class);
    rc.register(CsrfProtectionFilter.class);

    rc.register(ApiListingResource.class);
    rc.register(SwaggerSerializers.class);
    BeanConfig beanConfig = new BeanConfig();
    beanConfig.setVersion("1.0");
    beanConfig.setSchemes(new String[]{"http"});
    beanConfig.setHost("localhost:8084");
    beanConfig.setBasePath("/myapp");
    beanConfig.setResourcePackage("io.github.javathought.devoxx.resources");
    beanConfig.setPrettyPrint(true);
    beanConfig.setScan(true);
    // create and start a new instance of grizzly http server
    // exposing the Jersey application at BASE_URI
    return GrizzlyHttpServerFactory.createHttpServer(URI.create(getBaseUri(port)), rc);
}
 
开发者ID:javathought,项目名称:devoxx-2017,代码行数:35,代码来源:Main.java

示例11: jerseyConfig

import org.glassfish.jersey.server.ResourceConfig; //导入方法依赖的package包/类
@Bean
public ResourceConfig jerseyConfig() {
	ResourceConfig cfg = new ResourceConfig();
	cfg.property("test", "customConfig");
	return cfg;
}
 
开发者ID:holon-platform,项目名称:holon-jaxrs,代码行数:7,代码来源:TestJerseyAutoConfigurationConditional.java


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