本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例11: jerseyConfig
import org.glassfish.jersey.server.ResourceConfig; //导入方法依赖的package包/类
@Bean
public ResourceConfig jerseyConfig() {
ResourceConfig cfg = new ResourceConfig();
cfg.property("test", "customConfig");
return cfg;
}