本文整理汇总了Java中org.glassfish.jersey.server.ServerProperties类的典型用法代码示例。如果您正苦于以下问题:Java ServerProperties类的具体用法?Java ServerProperties怎么用?Java ServerProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServerProperties类属于org.glassfish.jersey.server包,在下文中一共展示了ServerProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JerseyApplication
import org.glassfish.jersey.server.ServerProperties; //导入依赖的package包/类
@Inject
public JerseyApplication(ServiceLocator serviceLocator) {
GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(AppLoader.injector);
String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(
CommonProperties.MOXY_JSON_FEATURE_DISABLE,
getConfiguration().getRuntimeType());
property(disableMoxy, true);
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
// add the default Jackson exception mappers
register(JsonParseExceptionMapper.class);
register(JsonMappingExceptionMapper.class);
register(JacksonJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
packages(JerseyApplication.class.getPackage().getName());
for (JerseyConfigurator configurator: AppLoader.getExtensions(JerseyConfigurator.class)) {
configurator.configure(this);
}
}
示例2: XbddApplication
import org.glassfish.jersey.server.ServerProperties; //导入依赖的package包/类
public XbddApplication() {
packages(getClass().getPackage().getName());
// MVC feature
property(JspMvcFeature.TEMPLATE_BASE_PATH, "/WEB-INF/jsp");
register(JspMvcFeature.class);
register(MultiPartFeature.class);
// Logging.
// register(LoggingFilter.class);
property(ServerProperties.TRACING, TracingConfig.ON_DEMAND.name());
register(new AbstractBinder() {
@Override
protected void configure() {
bindFactory(ServletContextMongoClientFactory.class).to(MongoDBAccessor.class).in(Singleton.class);
}
});
}
示例3: Application
import org.glassfish.jersey.server.ServerProperties; //导入依赖的package包/类
public Application() {
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
property(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK, true);
register(UserResource.class);
register(AuthorizationResource.class);
register(CategoryResource.class);
register(FeedResource.class);
register(LicenseV1Resource.class);
register(LicenseV2Resource.class);
register(GsonBodyProvider.class);
register(WebExceptionMapper.class);
register(ConstraintViolationExceptionMapper.class);
register(ValidationConfigurationContextResolver.class);
Log.prefix = "------> [Rebase] ~ ";
MongoDBs.setup();
}
示例4: activate
import org.glassfish.jersey.server.ServerProperties; //导入依赖的package包/类
@Activate
void activate() throws Exception {
super.register(JacksonJaxbJsonProvider.class);
super.property(ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true);
Properties props = new Properties();
props.setProperty(JDBC_URL, "jdbc:h2:./ismPlugin");
props.setProperty(JDBC_USER, "admin");
props.setProperty(JDBC_PASSWORD, "abc12345");
DataSource ds = this.jdbcFactory.createDataSource(props);
this.em = this.resourceFactory
.getProviderFor(this.builder, singletonMap("javax.persistence.nonJtaDataSource", (Object) ds), null)
.getResource(this.txControl);
this.domainApis.init(this.em, this.txControl);
this.deviceApis.init(this.em, this.txControl);
this.securityGroupApis.init(this.em, this.txControl);
this.securityGroupInterfaceApis.init(this.em, this.txControl);
super.registerInstances(this.domainApis, this.deviceApis, this.securityGroupApis,
this.securityGroupInterfaceApis);
this.container = new ServletContainer(this);
}
开发者ID:opensecuritycontroller,项目名称:security-mgr-sample-plugin,代码行数:27,代码来源:SecurityManagerServletDelegate.java
示例5: generateResourceConfig
import org.glassfish.jersey.server.ServerProperties; //导入依赖的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;
}
示例6: BaseApplicaionConfig
import org.glassfish.jersey.server.ServerProperties; //导入依赖的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);
}
}
示例7: configure
import org.glassfish.jersey.server.ServerProperties; //导入依赖的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;
}
示例8: SampleApplication
import org.glassfish.jersey.server.ServerProperties; //导入依赖的package包/类
public SampleApplication() {
setApplicationName("Jersey RESTful Webapp");
LOGGER.info("Initializing '{}'...", this.getApplicationName());
migrate();
String[] packages = {this.getClass().getPackage().getName(), "io.swagger.jaxrs.listing"};
packages(packages);
LOGGER.debug("Registering JAX-RS Components...");
register(SampleObjectMapperProvider.class);
register(jacksonXMLProvider());
register(uriConnegFilter());
register(LoggingFeature.class);
property(ServerProperties.MONITORING_ENABLED, Boolean.TRUE);
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, Boolean.TRUE);
property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_SERVER, "INFO");
property(LoggingFeature.LOGGING_FEATURE_VERBOSITY_SERVER,
LoggingFeature.Verbosity.HEADERS_ONLY);
setUpSwagger();
}
示例9: NiFiRegistryResourceConfig
import org.glassfish.jersey.server.ServerProperties; //导入依赖的package包/类
public NiFiRegistryResourceConfig(@Context ServletContext servletContext) {
// register filters
register(HttpMethodOverrideFilter.class);
// register the exception mappers & jackson object mapper resolver
packages("org.apache.nifi.registry.web.mapper");
// register endpoints
register(AccessPolicyResource.class);
register(AccessResource.class);
register(BucketResource.class);
register(BucketFlowResource.class);
register(FlowResource.class);
register(ItemResource.class);
register(TenantResource.class);
// include bean validation errors in response
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
// this is necessary for the /access/token/kerberos endpoint to work correctly
// when sending 401 Unauthorized with a WWW-Authenticate: Negotiate header.
// if this value needs to be changed, kerberos authentication needs to move to filter chain
// so it can directly set the HttpServletResponse instead of indirectly through a JAX-RS Response
property(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, true);
}
示例10: run
import org.glassfish.jersey.server.ServerProperties; //导入依赖的package包/类
@Override
public void run(S3SrvConfiguration configuration, Environment environment) {
final Credentials credentials = configuration.buildCredentials();
credentials.print();
final StorageBackend storageBackend = configuration.getStorageBackend().build(credentials);
environment.healthChecks().register("StorageBackend", new StorageBackendHealthCheck(storageBackend));
environment.jersey().register(new S3OperationsFacade(storageBackend));
if (configuration.isJerseyLoggingFilterEnabled()) {
// print request / response headers
// printEntity=false because printing consumes the input stream and breaks object creation (PUT Bucket)
environment.jersey().register(new LoggingFilter(Logger.getLogger("InboundRequestResponse"), false));
}
environment.jersey().disable(ServerProperties.WADL_FEATURE_DISABLE);
}
示例11: configure
import org.glassfish.jersey.server.ServerProperties; //导入依赖的package包/类
@Override
protected Application configure() {
//enable(TestProperties.LOG_TRAFFIC);
//enable(TestProperties.DUMP_ENTITY);
//
// TODO: load web.xml directly
// .property(
// "contextConfigLocation",
// "classpath:**/my-web-test-context.xml"
//
return new ResourceConfig(MyResource.class)
.register(ParsecMoxyProvider.class)
.register(JaxbExceptionMapper.class)
.property(JaxbExceptionMapper.PROP_JAXB_DEFAULT_ERROR_CODE, JAXB_ERROR_CODE)
.property(JaxbExceptionMapper.PROP_JAXB_DEFAULT_ERROR_MSG, JAXB_ERROR_MSG)
.register(ValidationConfigurationContextResolver.class)
.register(ParsecValidationExceptionMapper.class)
.property(ParsecValidationExceptionMapper.PROP_VALIDATION_DEFAULT_ERROR_CODE, VALIDATION_ERROR_CODE)
.property(ParsecValidationExceptionMapper.PROP_VALIDATION_DEFAULT_ERROR_MSG, VALIDATION_ERROR_MSG)
.property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true)
.register(new MoxyJsonConfig().setFormattedOutput(true)
.property(MarshallerProperties.BEAN_VALIDATION_MODE, BeanValidationMode.NONE).resolver());
}
示例12: createRestService
import org.glassfish.jersey.server.ServerProperties; //导入依赖的package包/类
private Handler createRestService() {
ResourceConfig rc = new ResourceConfig();
localRestResources.forEach(rc::register);
rc.register(JacksonFeature.class);
rc.register(CORSFilter.class);
rc.addProperties(new HashMap<String,Object>() {{
// Turn off buffering so results can be streamed
put(ServerProperties.OUTBOUND_CONTENT_LENGTH_BUFFER, 0);
}});
ServletHolder holder = new ServletHolder(new ServletContainer(rc));
ServletContextHandler sch = new ServletContextHandler();
sch.setContextPath("/api/v1");
sch.addServlet(holder, "/*");
return sch;
}
示例13: createRestService
import org.glassfish.jersey.server.ServerProperties; //导入依赖的package包/类
private Handler createRestService() {
ResourceConfig rc = new ResourceConfig();
rc.register(systemResource);
rc.register(appResource);
rc.register(JacksonFeature.class);
rc.register(CORSFilter.class);
SwaggerDocs.registerSwaggerJsonResource(rc);
rc.addProperties(new HashMap<String,Object>() {{
// Turn off buffering so results can be streamed
put(ServerProperties.OUTBOUND_CONTENT_LENGTH_BUFFER, 0);
}});
ServletHolder holder = new ServletHolder(new ServletContainer(rc));
ServletContextHandler sch = new ServletContextHandler();
sch.setContextPath("/api/v1");
sch.addServlet(holder, "/*");
GzipHandler gzipHandler = new GzipHandler();
gzipHandler.setHandler(sch);
return gzipHandler;
}
示例14: BaseApplicaionConfig
import org.glassfish.jersey.server.ServerProperties; //导入依赖的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);
}
}
示例15: RESTServer
import org.glassfish.jersey.server.ServerProperties; //导入依赖的package包/类
public RESTServer(ControllerService controllerService, RESTServerConfig restServerConfig) {
this.objectId = "RESTServer";
this.restServerConfig = restServerConfig;
final String serverURI = "http://" + restServerConfig.getHost() + "/";
this.baseUri = UriBuilder.fromUri(serverURI).port(restServerConfig.getPort()).build();
final Set<Object> resourceObjs = new HashSet<>();
resourceObjs.add(new PingImpl());
resourceObjs.add(new StreamMetadataResourceImpl(controllerService));
final ControllerApplication controllerApplication = new ControllerApplication(resourceObjs);
this.resourceConfig = ResourceConfig.forApplication(controllerApplication);
this.resourceConfig.property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
// Register the custom JSON parser.
this.resourceConfig.register(new CustomObjectMapperProvider());
}