Java 类org.glassfish.jersey.server.ServerProperties 实例源码

项目:gitplex-mit    文件:JerseyApplication.java   
@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);
    }
}
项目:XBDD    文件:XbddApplication.java   
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);
        }
    });
}
项目:rebase-server    文件:Application.java   
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();
}
项目:security-mgr-sample-plugin    文件:SecurityManagerServletDelegate.java   
@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);
}
项目:Graphene    文件:GrapheneRESTServer.java   
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;
}
项目:azeroth    文件:BaseApplicaionConfig.java   
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);
    }
}
项目:rest-jersey-utils    文件:AbstractListingResourceTest.java   
@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;
}
项目:jersey-2.x-webapp-for-servlet-container    文件:SampleApplication.java   
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();
}
项目:nifi-registry    文件:NiFiRegistryResourceConfig.java   
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);
}
项目:s3srv    文件:S3SrvApplication.java   
@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);
}
项目:parsec-libraries    文件:JerseyValidationTest.java   
@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());

}
项目:app-runner-router    文件:WebServer.java   
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;
}
项目:app-runner    文件:WebServer.java   
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;
}
项目:jeesuite-libs    文件:BaseApplicaionConfig.java   
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);
    }
}
项目:pravega    文件:RESTServer.java   
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());

}
项目:jobproxy    文件:JobProxyServer.java   
/**
 * Start simple http server.
 * 
 * @param debug - if set to true prints out all request and respone headers. That can produce a lot debug informations.
 */
public void startServer(boolean debug) {
    if (debug) {
        server = JdkHttpServerFactory.createHttpServer(jobProxyServerUri,
            new ResourceConfig(Ping.class, Submit.class, State.class, Delete.class)
            .property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true)
            .property(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK, true)
            .register(new LoggingFilter(java.util.logging.Logger.getAnonymousLogger(), true))
            .packages(MODEL_PACKAGE));
    } else {
        server = JdkHttpServerFactory.createHttpServer(jobProxyServerUri,
            new ResourceConfig(Ping.class, Submit.class, State.class, Delete.class)
            .property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true)
            .property(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK, true)
            .packages(MODEL_PACKAGE));
    }

}
项目:ksql    文件:KsqlRestApplication.java   
@Override
public void configureBaseApplication(Configurable<?> config, Map<String, String> metricTags) {
  // Would call this but it registers additional, unwanted exception mappers
  // super.configureBaseApplication(config, metricTags);
  // Instead, just copy+paste the desired parts from Application.configureBaseApplication() here:
  ObjectMapper jsonMapper = getJsonMapper();
  new SchemaMapper().registerToObjectMapper(jsonMapper);

  JacksonMessageBodyProvider jsonProvider = new JacksonMessageBodyProvider(jsonMapper);
  config.register(jsonProvider);
  config.register(JsonParseExceptionMapper.class);

  // Don't want to buffer rows when streaming JSON in a request to the query resource
  config.property(ServerProperties.OUTBOUND_CONTENT_LENGTH_BUFFER, 0);
  if (enableQuickstartPage) {
    config.property(ServletProperties.FILTER_STATIC_CONTENT_REGEX, "^/quickstart\\.html$");
  }
}
项目:docker-stats-cloudwatch    文件:DockerStatsDaemon.java   
public static void main(String... args) throws Exception {

        Server server = new Server(9999);
        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
        context.setContextPath("/");
        server.setHandler(context);

        ServletContainer servletContainer = new ServletContainer();
        ServletHolder servletHolder = new ServletHolder(servletContainer);
        servletHolder.setInitParameter(ServerProperties.PROVIDER_PACKAGES, "zanox.docker.rest");
        servletHolder.setInitParameter("com.sun.jersey.config.property.resourceConfigClass",
                "com.sun.jersey.api.core.PackagesResourceConfig");

        context.addServlet(servletHolder, "/*");
        server.start();

        HttpClient httpClient = new HttpClient();
        httpClient.start();

        ContentResponse response = httpClient
                .GET("http://127.0.0.1:9999/docker-stats/start");

    }
项目:antioch    文件:TestApplication.java   
public TestApplication() {
  // Bean Validation error messages in the response entity.
  property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);

  // X-Jersey-Tracing-nnn diagnostic response headers
  property(ServerProperties.TRACING, "ALL");

  // Server-side request logging, including entities
  register(new LoggingFilter(getAnonymousLogger(), true));

  // Validation configuration
  register(ValidationConfigurationContextResolver.class);

  // JSON configuration
  register(JsonConfiguration.class);
}
项目:antioch    文件:TestApplication.java   
public TestApplication() {
  // Bean Validation error messages in the response entity.
  property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);

  // X-Jersey-Tracing-nnn diagnostic response headers
  property(ServerProperties.TRACING, "ALL");

  // Server-side request logging, including entities
  register(new LoggingFilter(getAnonymousLogger(), true));

  // Validation configuration
  register(ValidationConfigurationContextResolver.class);

  // JSON configuration
  register(JsonConfiguration.class);
}
项目:datacollector    文件:DisconnectedSSOManager.java   
public void registerResources(ServletContextHandler handler) {
  ServletHolder jerseyServlet = new ServletHolder(ServletContainer.class);
  jerseyServlet.setInitParameter(ServerProperties.PROVIDER_PACKAGES, getClass().getPackage().getName());
  jerseyServlet.setInitParameter(
      ServletProperties.JAXRS_APPLICATION_CLASS,
      DisconnectedResourceConfig.class.getName()
  );
  handler.addServlet(jerseyServlet, SECURITY_RESOURCES);

  AuthenticationResourceHandler authenticationResourceHandler =
      new AuthenticationResourceHandler(getAuthentication(), false);

  handler.setAttribute(DISCONNECTED_SSO_AUTHENTICATION_HANDLER_ATTR, authenticationResourceHandler);

  handler.setAttribute(DISCONNECTED_SSO_SERVICE_ATTR, getSsoService());

  ServletHolder login = new ServletHolder(new DisconnectedLoginServlet((DisconnectedSSOService) getSsoService()));
  handler.addServlet(login, DisconnectedLoginServlet.URL_PATH);

  ServletHolder logout = new ServletHolder(new DisconnectedLogoutServlet((DisconnectedSSOService) getSsoService()));
  handler.addServlet(logout, DisconnectedLogoutServlet.URL_PATH);
}
项目:datacollector    文件:WebServerModule.java   
@Provides(type = Type.SET)
ContextConfigurator provideJersey() {
  return new ContextConfigurator() {
    @Override
    public void init(ServletContextHandler context) {
      // REST API that requires authentication
      ServletHolder protectedRest = new ServletHolder(new ServletContainer());
      protectedRest.setInitParameter(
          ServerProperties.PROVIDER_PACKAGES, SWAGGER_PACKAGE + "," +
          RestAPI.class.getPackage().getName()
      );
      protectedRest.setInitParameter(ServletProperties.JAXRS_APPLICATION_CLASS, RestAPIResourceConfig.class.getName());
      context.addServlet(protectedRest, "/rest/*");

      // REST API that it does not require authentication
      ServletHolder publicRest = new ServletHolder(new ServletContainer());
      publicRest.setInitParameter(ServerProperties.PROVIDER_PACKAGES, PublicRestAPI.class.getPackage().getName());
      publicRest.setInitParameter(ServletProperties.JAXRS_APPLICATION_CLASS, RestAPIResourceConfig.class.getName());
      context.addServlet(publicRest, "/public-rest/*");
    }
  };
}
项目:git-webapp    文件:ApiConfig.java   
@Inject
public ApiConfig(ServiceLocator serviceLocator) {
  register(JacksonFeature.class);
  register(ValidationFeature.class);
  property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, "true");

  register(AuthenticationRequestFilter.class);
  register(AdminNecessaryRequestFilter.class);
  register(RepositoryControllRequestFilter.class);

  register(HttpCacheControlFilter.class);

  register(ApiForbiddenExceptionMapper.class);
  register(ApiNotFoundExceptionMapper.class);
  register(ApiLoginRequiredExceptionMapper.class);
  register(AjaxValidationErrorExceptionMapper.class);
  register(PostErrorResponseFilter.class);

  GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
  GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
  guiceBridge.bridgeGuiceInjector(GuiceListener.get());

  packages(false, this.getClass().getPackage() + ".rs");
}
项目:git-webapp    文件:AppConfig.java   
@Inject
public AppConfig(ServiceLocator serviceLocator) {
  register(FreemarkerMvcFeature.class);
  property(FreemarkerMvcFeature.TEMPLATES_BASE_PATH, "/WEB-INF/templates");
  property(FreemarkerMvcFeature.TEMPLATE_OBJECT_FACTORY, FlexibleConfiguration.class);

  register(AttachContextInterceptor.class);
  register(ValidationFeature.class);
  property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, "true");

  register(AuthenticationRequestFilter.class);
  register(AdminNecessaryRequestFilter.class);
  register(RepositoryControllRequestFilter.class);
  register(HtmlLoginRequiredExceptionMapper.class);

  register(HttpCacheControlFilter.class);

  GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
  GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
  guiceBridge.bridgeGuiceInjector(GuiceListener.get());

  packages(false, this.getClass().getPackage() + ".html");
}
项目:tajo    文件:TajoRestService.java   
@Override
protected void serviceInit(Configuration conf) throws Exception {
  GsonFeature gsonFeature = new GsonFeature(PlanGsonHelper.registerAdapters());

  ClientApplication clientApplication = new ClientApplication(masterContext);
  ResourceConfig resourceConfig = ResourceConfig.forApplication(clientApplication)
      .register(gsonFeature)
      .register(LoggingFilter.class)
      .property(ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true)
      .property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true);
  TajoConf tajoConf = (TajoConf) conf;

  InetSocketAddress address = tajoConf.getSocketAddrVar(TajoConf.ConfVars.REST_SERVICE_ADDRESS);
  URI restServiceURI = new URI("http", null, address.getHostName(), address.getPort(), "/rest", null, null);
  int workerCount = TajoConf.getIntVar(tajoConf, TajoConf.ConfVars.REST_SERVICE_RPC_SERVER_WORKER_THREAD_NUM);
  restServer = NettyRestServerFactory.createNettyRestServer(restServiceURI, resourceConfig, workerCount, false);

  super.serviceInit(conf);

  LOG.info("Tajo Rest Service initialized.");
}
项目:Cheddar    文件:RestResourceConfig.java   
@Autowired
public RestResourceConfig(final ApplicationContext applicationContext) {
    property("contextConfig", applicationContext);
    scanner = new ClassPathScanningCandidateComponentProvider(true);
    scanner.resetFilters(false);
    scanner.addIncludeFilter(new AnnotationTypeFilter(Path.class));
    scanner.addIncludeFilter(new AnnotationTypeFilter(Provider.class));
    register(RequestContextFilter.class);
    register(MultiPartFeature.class);
    register(ObjectMapperProvider.class);
    register(JacksonFeature.class);
    registerResources("com.clicktravel.cheddar.rest.exception.mapper", "com.clicktravel.cheddar.server.http.filter",
            "com.clicktravel.cheddar.server.rest.resource.status", "com.clicktravel.services",
            "com.clicktravel.cheddar.rest.body.writer");
    property(ServerProperties.LOCATION_HEADER_RELATIVE_URI_RESOLUTION_DISABLED, true);
}
项目:rack-java    文件:RackApiApplicationConfig.java   
/**
 * コンストラクタです。
 */
public RackApiApplicationConfig() {

    packages(RackApiScanPackage.class.getPackage().getName());
    packages(ConnectorScanPackage.class.getPackage().getName());
    packages(SpringLifecycleListener.class.getPackage().getName());
    property(ServerProperties.JSON_PROCESSING_FEATURE_DISABLE, true);
    property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
    register(ValidationConfigurationContextResolver.class);
    register(JacksonFeature.class);
    register(LoggingFilter.class);
    register(LocaleContextFilter.class);
    register(EncodingFilter.class);
    register(GZipEncoder.class);
    registerClasses(JerseyConfigs.getExcpetionMappers());
}
项目:devicehive-java-server    文件:JerseyConfig.java   
public JerseyConfig() {
    scan("com.devicehive.resource.converters",
            "com.devicehive.resource.exceptions",
            "com.devicehive.resource.filter");

    registerClasses(AuthApiInfoResourceImpl.class,
            JwtTokenResourceImpl.class);

    property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);

    register(RequestContextFilter.class);
    register(LoggingFeature.class);
    register(ContentTypeFilter.class);

    register(io.swagger.jaxrs.listing.ApiListingResource.class);
    register(io.swagger.jaxrs.listing.SwaggerSerializers.class);
}
项目:devicehive-java-server    文件:JerseyConfig.java   
public JerseyConfig() {
    scan("com.devicehive.resource.converters",
            "com.devicehive.resource.exceptions",
            "com.devicehive.resource.filter");

    registerClasses(ApiInfoResourceImpl.class,
            ConfigurationResourceImpl.class,
            DeviceCommandResourceImpl.class,
            DeviceNotificationResourceImpl.class,
            DeviceResourceImpl.class,
            NetworkResourceImpl.class,
            DeviceTypeResourceImpl.class,
            WelcomeResourceImpl.class,
            UserResourceImpl.class);

    property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);

    register(RequestContextFilter.class);
    register(LoggingFeature.class);
    register(ContentTypeFilter.class);

    register(io.swagger.jaxrs.listing.ApiListingResource.class);
    register(io.swagger.jaxrs.listing.SwaggerSerializers.class);
}
项目:devicehive-java-server    文件:JerseyConfig.java   
public JerseyConfig() {
    scan("com.devicehive.resource.converters",
            "com.devicehive.resource.exceptions",
            "com.devicehive.resource.filter");

    registerClasses(PluginApiInfoResourceImpl.class,
            PluginResourceImpl.class);

    property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);

    register(RequestContextFilter.class);
    register(LoggingFeature.class);
    register(ContentTypeFilter.class);

    register(io.swagger.jaxrs.listing.ApiListingResource.class);
    register(io.swagger.jaxrs.listing.SwaggerSerializers.class);
}
项目:continuous-performance-evaluation    文件:RestConfiguration.java   
public RestConfiguration() {
    // Resources
    packages(new String[]{
        HandlingReportService.class.getPackage().getName(),
        GraphTraversalService.class.getPackage().getName(),
        CargoMonitoringService.class.getPackage().getName()});
    // Enable Bean Validation error messages.
    property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
    // Providers - JSON.
    register(new MoxyJsonFeature());
    register(new JsonMoxyConfigurationContextResolver()); // TODO See if this can be removed.
}
项目:sdn-controller-nsc-plugin    文件:SampleSdnServletDelegate.java   
@Activate
void activate() throws Exception {

    super.register(JacksonJaxbJsonProvider.class);
    super.property(ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true);
    super.registerInstances(this.inspectionPortApis, this.portApis, this.inspectionHookApis);
    this.container = new ServletContainer(this);
}
项目:osc-core    文件:ApiServletDelegate.java   
@Activate
void activate() {
    //Json feature
    super.register(JacksonJaxbJsonProvider.class);

    //Auth Filters
    super.registerInstances(this.oscAuthFilter, this.localHostAuthFilter);

    //Exception mappers
    super.register(BadRequestExceptionMapper.class);
    super.register(InternalServerErrorExceptionMapper.class);
    super.register(JsonProcessingExceptionMapper.class);
    super.register(NotFoundExceptionMapper.class);
    super.register(PathParamExceptionMapper.class);
    super.register(XMLParseExceptionMapper.class);

    //Properties
    super.property(ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true);

    // agent & server apis
    super.registerInstances(this.alarmApis, this.alertApis, this.applianceApis, this.distributedApplianceApis,
            this.distributedApplianceInstanceApis, this.jobApis, this.managerApis, this.managerConnectorApis,
            this.nsmMgrApis, this.serverDebugApis, this.serverMgmtApis, this.virtualSystemApis,
            this.virtualizationConnectorApis);

    this.container = new ServletContainer(this);
}
项目:user-task    文件:JerseyConfig.java   
public JerseyConfig() {
    property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
    register(WebApplicationExceptionMapper.class);
    register(ApiListingResource.class);
    register(UserResourceImpl.class);
    register(TaskResourceImpl.class);
}
项目:dotwebstack-framework    文件:HttpConfiguration.java   
public HttpConfiguration(@NonNull List<HttpModule> httpModules) {
  register(HostPreMatchingRequestFilter.class);
  register(WebApplicationExceptionMapper.class);
  property(ServletProperties.FILTER_STATIC_CONTENT_REGEX, "/(robots.txt|(assets|webjars)/.*)");
  property(ServerProperties.WADL_FEATURE_DISABLE, true);
  httpModules.forEach(module -> module.initialize(this));
}
项目:QDrill    文件:DrillRestServer.java   
public DrillRestServer(final WorkManager workManager) {
  register(DrillRoot.class);
  register(StatusResources.class);
  register(StorageResources.class);
  register(ProfileResources.class);
  register(QueryResources.class);
  register(MetricsResources.class);
  register(ThreadsResources.class);
  register(FreemarkerMvcFeature.class);
  register(MultiPartFeature.class);
  property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true);


  //disable moxy so it doesn't conflict with jackson.
  final String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(CommonProperties.MOXY_JSON_FEATURE_DISABLE, getConfiguration().getRuntimeType());
  property(disableMoxy, true);

  register(JsonParseExceptionMapper.class);
  register(JsonMappingExceptionMapper.class);
  register(GenericExceptionMapper.class);

  JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
  provider.setMapper(workManager.getContext().getConfig().getMapper());
  register(provider);

  register(new AbstractBinder() {
    @Override
    protected void configure() {
      bind(workManager).to(WorkManager.class);
      bind(workManager.getContext().getConfig().getMapper()).to(ObjectMapper.class);
      bind(workManager.getContext().getPersistentStoreProvider()).to(PStoreProvider.class);
      bind(workManager.getContext().getStorage()).to(StoragePluginRegistry.class);
    }
  });
}
项目:SlideBar    文件:MainBack.java   
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;
    }
}
项目:redirector    文件:WebServiceAPIStackWorkerBackgroundTestSuite.java   
@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);
}
项目:redirector    文件:WebServiceAPITestSuite.java   
@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);
}
项目:redirector    文件:RestApiEndpoint.java   
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);
}