Java 类javax.ws.rs.core.Configurable 实例源码

项目:FoDBugTrackerUtility    文件:ApacheConnectorProvider.java   
private static ApacheConnector getConnector(final Configurable<?> component) {
    if (!(component instanceof Initializable)) {
        throw new IllegalArgumentException(
                LocalizationMessages.INVALID_CONFIGURABLE_COMPONENT_TYPE(component.getClass().getName()));
    }

    final Initializable<?> initializable = (Initializable<?>) component;
    Connector connector = initializable.getConfiguration().getConnector();
    if (connector == null) {
        initializable.preInitialize();
        connector = initializable.getConfiguration().getConnector();
    }

    if (connector instanceof ApacheConnector) {
        return (ApacheConnector) connector;
    } else {
        throw new IllegalArgumentException(LocalizationMessages.EXPECTED_CONNECTOR_PROVIDER_NOT_USED());
    }
}
项目: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$");
  }
}
项目:ksql    文件:KsqlRestApplication.java   
@Override
public void setupResources(Configurable<?> config, KsqlRestConfig appConfig) {
  config.register(serverInfoResource);
  config.register(statusResource);
  config.register(ksqlResource);
  config.register(streamedQueryResource);
  config.register(new KsqlExceptionMapper());
}
项目:ksql    文件:MockApplication.java   
@Override
public void setupResources(Configurable<?> configurable, KsqlRestConfig ksqlRestConfig) {
  configurable.register(new MockKsqlResources());
  configurable.register(streamedQueryResource);
  configurable.register(new MockStatusResource());
  configurable.property(ServerProperties.OUTBOUND_CONTENT_LENGTH_BUFFER, 0);
}
项目:fabric8-cxf-shiro    文件:SecurityFeatureProvider.java   
/**
 * We need this implementation because of
 * https://issues.apache.org/jira/browse/CXF-5252 <p> TODO remove when CXF
 * 3.0.0 is released.
 */
public void configure(ResourceInfo resourceInfo, Configurable context) {
  if (resourceInfo.getResourceMethod().isAnnotationPresent(
      RequiresAuthentication.class)) {
    context.register(new SecurityFilter(authService));
  }
}
项目:rest-utils    文件:Application.java   
/**
 * Register standard components for a JSON REST application on the given JAX-RS configurable,
 * which can be either an ResourceConfig for a server or a ClientConfig for a Jersey-based REST
 * client.
 */
public void configureBaseApplication(Configurable<?> config, Map<String, String> metricTags) {
  T restConfig = getConfiguration();

  registerJsonProvider(config, restConfig, true);
  registerFeatures(config, restConfig);
  registerExceptionMappers(config, restConfig);

  config.register(new MetricsResourceMethodApplicationListener(metrics, "jersey",
                                                               metricTags, restConfig.getTime()));

  config.property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
}
项目:rest-utils    文件:Application.java   
/**
 * Register a body provider and optional exception mapper for (de)serializing JSON in
 * request/response entities.
 * @param config The config to register the provider with
 * @param restConfig The application's configuration
 * @param registerExceptionMapper Whether or not to register an additional exception mapper for
 *                                handling errors in (de)serialization
 */
protected void registerJsonProvider(
    Configurable<?> config,
    T restConfig,
    boolean registerExceptionMapper
) {
  ObjectMapper jsonMapper = getJsonMapper();
  JacksonMessageBodyProvider jsonProvider = new JacksonMessageBodyProvider(jsonMapper);
  config.register(jsonProvider);
  if (registerExceptionMapper) {
    config.register(JsonParseExceptionMapper.class);
  }
}
项目:rest-utils    文件:MetricsResourceMethodApplicationListenerIntegrationTest.java   
@Override
public void setupResources(Configurable<?> config, TestRestConfig appConfig) {
  resourceConfig = config;
  config.register(PrivateResource.class);
  // ensures the dispatch error message gets shown in the response
  // as opposed to a generic error page
  config.property(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, true);
}
项目:cf-java-logging-support    文件:RequestMetricsFilterRegistry.java   
public static void registerContainerFilters(Configurable<ResourceConfig> config) {
    config.register(RequestMetricsContainerRequestFilter.class);
    config.register(RequestMetricsContainerResponseFilter.class);
}
项目:soabase    文件:InternalCommonConfig.java   
@Override
public Configurable<Configurable> property(String name, Object value)
{
    config.property(name, value);
    return this;
}
项目:soabase    文件:InternalCommonConfig.java   
@Override
public Configurable<Configurable> register(Class<?> componentClass)
{
    config.register(componentClass);
    return this;
}
项目:soabase    文件:InternalCommonConfig.java   
@Override
public Configurable<Configurable> register(Class<?> componentClass, int priority)
{
    config.register(componentClass, priority);
    return this;
}
项目:soabase    文件:InternalCommonConfig.java   
@Override
public Configurable<Configurable> register(Class<?> componentClass, Class<?>... contracts)
{
    config.register(componentClass, contracts);
    return this;
}
项目:soabase    文件:InternalCommonConfig.java   
@Override
public Configurable<Configurable> register(Class<?> componentClass, Map<Class<?>, Integer> contracts)
{
    config.register(componentClass, contracts);
    return this;
}
项目:soabase    文件:InternalCommonConfig.java   
@Override
public Configurable<Configurable> register(Object component)
{
    config.register(component);
    return this;
}
项目:soabase    文件:InternalCommonConfig.java   
@Override
public Configurable<Configurable> register(Object component, int priority)
{
    config.register(component, priority);
    return this;
}
项目:soabase    文件:InternalCommonConfig.java   
@Override
public Configurable<Configurable> register(Object component, Class<?>... contracts)
{
    config.register(component, contracts);
    return this;
}
项目:soabase    文件:InternalCommonConfig.java   
@Override
public Configurable<Configurable> register(Object component, Map<Class<?>, Integer> contracts)
{
    config.register(component, contracts);
    return this;
}
项目:soabase    文件:JerseyGuiceModule.java   
public Configurable<?> configurable()
{
    return commonConfig;
}
项目:rest-utils    文件:HelloWorldApplication.java   
@Override
public void setupResources(Configurable<?> config, HelloWorldRestConfig appConfig) {
  config.register(new HelloWorldResource(appConfig));
  config.property(ServletProperties.FILTER_STATIC_CONTENT_REGEX, "/(static/.*|.*\\.html|)");
}
项目:rest-utils    文件:Application.java   
public void configureBaseApplication(Configurable<?> config) {
  configureBaseApplication(config, null);
}
项目:rest-utils    文件:Application.java   
/**
 * Register handlers for translating exceptions into responses.
 * @param config The config to register the mappers with
 * @param restConfig The application's configuration
 */
protected void registerExceptionMappers(Configurable<?> config, T restConfig) {
  config.register(ConstraintViolationExceptionMapper.class);
  config.register(new WebApplicationExceptionMapper(restConfig));
  config.register(new GenericExceptionMapper(restConfig));
}
项目:rest-utils    文件:StaticResourcesTest.java   
@Override
public void setupResources(Configurable<?> config, TestRestConfig appConfig) {
  this.resourceConfig = config;
  config.register(DynamicResource.class);
  config.property(ServletProperties.FILTER_STATIC_CONTENT_REGEX, "/(index\\.html|)");
}
项目:rest-utils    文件:ExceptionHandlingTest.java   
@Override
public void setupResources(Configurable<?> config, TestRestConfig appConfig) {
  resourceConfig = config;
  config.register(ExceptionResource.class);
}
项目:rest-utils    文件:ShutdownTest.java   
@Override
public void setupResources(Configurable<?> config, TestRestConfig appConfig) {
  config.register(resource);
}
项目:rest-utils    文件:SaslTest.java   
@Override
public void setupResources(Configurable<?> config, TestRestConfig appConfig) {
  config.register(new SaslTestResource());
}
项目:rest-utils    文件:SslTest.java   
@Override
public void setupResources(Configurable<?> config, TestRestConfig appConfig) {
  config.register(new SslTestResource());
}
项目:FoDBugTrackerUtility    文件:ApacheConnectorProvider.java   
/**
 * Retrieve the underlying Apache {@link HttpClient} instance from
 * {@link org.glassfish.jersey.client.JerseyClient} or {@link org.glassfish.jersey.client.JerseyWebTarget}
 * configured to use {@code ApacheConnectorProvider}.
 *
 * @param component {@code JerseyClient} or {@code JerseyWebTarget} instance that is configured to use
 *                  {@code ApacheConnectorProvider}.
 * @return underlying Apache {@code HttpClient} instance.
 *
 * @throws java.lang.IllegalArgumentException in case the {@code component} is neither {@code JerseyClient}
 *                                            nor {@code JerseyWebTarget} instance or in case the component
 *                                            is not configured to use a {@code ApacheConnectorProvider}.
 * @since 2.8
 */
public static HttpClient getHttpClient(final Configurable<?> component) {
    return getConnector(component).getHttpClient();
}
项目:FoDBugTrackerUtility    文件:ApacheConnectorProvider.java   
/**
 * Retrieve the underlying Apache {@link CookieStore} instance from
 * {@link org.glassfish.jersey.client.JerseyClient} or {@link org.glassfish.jersey.client.JerseyWebTarget}
 * configured to use {@code ApacheConnectorProvider}.
 *
 * @param component {@code JerseyClient} or {@code JerseyWebTarget} instance that is configured to use
 *                  {@code ApacheConnectorProvider}.
 * @return underlying Apache {@code CookieStore} instance.
 * @throws java.lang.IllegalArgumentException in case the {@code component} is neither {@code JerseyClient}
 *                                            nor {@code JerseyWebTarget} instance or in case the component
 *                                            is not configured to use a {@code ApacheConnectorProvider}.
 * @since 2.16
 */
public static CookieStore getCookieStore(final Configurable<?> component) {
    return getConnector(component).getCookieStore();
}
项目:rest-utils    文件:Application.java   
/**
 * Register resources or additional Providers, ExceptionMappers, and other JAX-RS components with
 * the Jersey application. This, combined with your Configuration class, is where you can
 * customize the behavior of the application.
 */
public abstract void setupResources(Configurable<?> config, T appConfig);
项目:rest-utils    文件:Application.java   
/**
 * Register server features
 * @param config The config to register the features with
 * @param restConfig The application's configuration
 */
protected void registerFeatures(Configurable<?> config, T restConfig) {
  config.register(ValidationFeature.class);
}
项目:nexus-public    文件:RestClientConfiguration.java   
void apply(Configurable<?> builder);