當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。