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


Java ServerProperties类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:24,代码来源:JerseyApplication.java

示例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);
		}
	});
}
 
开发者ID:orionhealth,项目名称:XBDD,代码行数:21,代码来源:XbddApplication.java

示例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();
}
 
开发者ID:drakeet,项目名称:rebase-server,代码行数:20,代码来源:Application.java

示例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;
}
 
开发者ID:Lambda-3,项目名称:Graphene,代码行数:22,代码来源:GrapheneRESTServer.java

示例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);
    }
}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:22,代码来源:BaseApplicaionConfig.java

示例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;
}
 
开发者ID:Mercateo,项目名称:rest-jersey-utils,代码行数:18,代码来源:AbstractListingResourceTest.java

示例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();
}
 
开发者ID:durimkryeziu,项目名称:jersey-2.x-webapp-for-servlet-container,代码行数:27,代码来源:SampleApplication.java

示例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);
}
 
开发者ID:apache,项目名称:nifi-registry,代码行数:26,代码来源:NiFiRegistryResourceConfig.java

示例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);
}
 
开发者ID:jenshadlich,项目名称:s3srv,代码行数:19,代码来源:S3SrvApplication.java

示例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());

}
 
开发者ID:yahoo,项目名称:parsec-libraries,代码行数:25,代码来源:JerseyValidationTest.java

示例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;
}
 
开发者ID:danielflower,项目名称:app-runner-router,代码行数:19,代码来源:WebServer.java

示例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;
}
 
开发者ID:danielflower,项目名称:app-runner,代码行数:23,代码来源:WebServer.java

示例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);
	}
}
 
开发者ID:vakinge,项目名称:jeesuite-libs,代码行数:23,代码来源:BaseApplicaionConfig.java

示例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());

}
 
开发者ID:pravega,项目名称:pravega,代码行数:19,代码来源:RESTServer.java


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