javax.ws.rs.core.Configuration Java Examples

The following examples show how to use javax.ws.rs.core.Configuration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DACAuthFilterFeature.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
@Override
public boolean configure(FeatureContext context) {
  final Configuration configuration = context.getConfiguration();

  Boolean disabled = PropertyHelper.getProperty(configuration, RestServerV2.DAC_AUTH_FILTER_DISABLE);
  // Default is not disabled
  if (disabled != null && disabled) {
    return false;
  }

  context.register(DACAuthFilter.class);
  if (!configuration.isRegistered(RolesAllowedDynamicFeature.class)) {
    context.register(RolesAllowedDynamicFeature.class);
  }
  return true;
}
 
Example #2
Source File: CrnkFeatureTest.java    From crnk-framework with Apache License 2.0 6 votes vote down vote up
private void testSecurityRegistration(boolean enabled) {
	CrnkFeature feature = new CrnkFeature();
	feature.setSecurityEnabled(enabled);
	feature.securityContext = Mockito.mock(SecurityContext.class);

	FeatureContext context = Mockito.mock(FeatureContext.class);
	Mockito.when(context.getConfiguration()).thenReturn(Mockito.mock(Configuration.class));

	feature.configure(context);

	CrnkBoot boot = feature.getBoot();
	if (enabled) {
		SecurityProvider securityProvider = boot.getModuleRegistry().getSecurityProvider();
		Assert.assertNotNull(securityProvider);
	} else {
		Assert.assertEquals(0, boot.getModuleRegistry().getSecurityProviders().size());
	}
}
 
Example #3
Source File: SysFilteringFeature.java    From ameba with MIT License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public boolean configure(FeatureContext context) {
    Configuration configuration = context.getConfiguration();
    if (!configuration.isRegistered(UriConnegFilter.class)) {
        context.register(UriConnegFilter.class, Priorities.AUTHENTICATION - 100);
    }

    if (!context.getConfiguration().isRegistered(DownloadEntityFilter.class)) {
        context.register(DownloadEntityFilter.class);
    }

    if (!configuration.isRegistered(LoadBalancerRequestFilter.class)) {
        context.register(LoadBalancerRequestFilter.class);
    }
    return true;
}
 
Example #4
Source File: ConfigurationImplTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testChecksConstrainedToAnnotationDuringRegistration() {
    TestHandler handler = new TestHandler();
    LogUtils.getL7dLogger(ConfigurableImpl.class).addHandler(handler);

    try (ConfigurableImpl<Client> configurable 
            = new ConfigurableImpl<>(createClientProxy(), RuntimeType.CLIENT)) {
        Configuration config = configurable.getConfiguration();

        configurable.register(ContainerResponseFilterImpl.class);

        assertEquals(0, config.getInstances().size());

        for (String message : handler.messages) {
            if (message.startsWith("WARN") && message.contains("Null, empty or invalid contracts specified")) {
                return; // success
            }
        }
    }
    fail("did not log expected message");
}
 
Example #5
Source File: GrizzlyClientCustomizer.java    From datacollector with Apache License 2.0 6 votes vote down vote up
@Override
public AsyncHttpClientConfig.Builder customize(
    Client client, Configuration config, AsyncHttpClientConfig.Builder configBuilder
) {
  if (useProxy && !StringUtils.isEmpty(username)) {
    Realm realm = new Realm.RealmBuilder().setScheme(Realm.AuthScheme.BASIC)
        .setUsePreemptiveAuth(true)
        .setTargetProxy(true)
        .setPrincipal(username)
        .setPassword(password)
        .build();

    configBuilder.setRealm(realm);
  }
  return configBuilder;
}
 
Example #6
Source File: ParsecValidationAutoDiscoverable.java    From parsec-libraries with Apache License 2.0 6 votes vote down vote up
@Override
public void configure(FeatureContext context) {
    final int priorityInc = 3000;

    // Jersey MOXY provider have higher priority(7000), so we need set higher than it
    int priority = Priorities.USER + priorityInc;
    Configuration config = context.getConfiguration();

    if (!config.isRegistered(ParsecValidationExceptionMapper.class)) {
        context.register(ParsecValidationExceptionMapper.class, priority);
    }
    if (!config.isRegistered(ValidationConfigurationContextResolver.class)) {
        context.register(ValidationConfigurationContextResolver.class, priority);
    }
    if (!config.isRegistered(ParsecMoxyFeature.class)) {
        context.register(ParsecMoxyFeature.class, priority);
    }
    if (!config.isRegistered(JaxbExceptionMapper.class)) {
        context.register(JaxbExceptionMapper.class, priority);
    }
}
 
Example #7
Source File: DACJacksonJaxbJsonFeature.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
@Override
public boolean configure(FeatureContext context) {
  final Configuration config = context.getConfiguration();

  final String jsonFeature = CommonProperties.getValue(config.getProperties(), config.getRuntimeType(),
    InternalProperties.JSON_FEATURE, JSON_FEATURE_CLASSNAME, String.class);
    // Other JSON providers registered.
    if (!JSON_FEATURE_CLASSNAME.equalsIgnoreCase(jsonFeature)) {
      LOGGER.error("Another JSON provider has been registered: {}", jsonFeature);
      return false;
    }

    // Disable other JSON providers.
    context.property(PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE, config.getRuntimeType()),
      JSON_FEATURE_CLASSNAME);

  context.register(DACJacksonJaxbJsonProvider.class);

  return true;
}
 
Example #8
Source File: ParsecMoxyFeature.java    From parsec-libraries with Apache License 2.0 6 votes vote down vote up
@Override
public boolean configure(FeatureContext context) {
    final Configuration config = context.getConfiguration();

    if (CommonProperties.getValue(config.getProperties(), config.getRuntimeType(),
            CommonProperties.MOXY_JSON_FEATURE_DISABLE, Boolean.FALSE, Boolean.class)) {
        return false;
    }

    final String jsonFeature = CommonProperties.getValue(config.getProperties(), config.getRuntimeType(),
            InternalProperties.JSON_FEATURE, JSON_FEATURE, String.class);
    // Other JSON providers registered.
    if (!JSON_FEATURE.equalsIgnoreCase(jsonFeature)) {
        return false;
    }

    // Disable other JSON providers.
    context.property(PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE,
            config.getRuntimeType()), JSON_FEATURE);

    final int workerPriority = Priorities.USER + 3000;
    context.register(ParsecMoxyProvider.class, workerPriority);

    return true;
}
 
Example #9
Source File: TestResourcesFeature.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
@Override
public boolean configure(FeatureContext context) {
  Configuration configuration = context.getConfiguration();
  Boolean enabled = PropertyHelper.getProperty(configuration, RestServerV2.TEST_API_ENABLE);

  // Default is not enabled
  if (enabled == null || !enabled) {
    return false;
  }

  for (Class<?> resource : scanResult.getAnnotatedClasses(RestResourceUsedForTesting.class)) {
    context.register(resource);
  }

  return true;
}
 
Example #10
Source File: DACExceptionMapperFeature.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public boolean configure(FeatureContext context) {
  Configuration configuration = context.getConfiguration();
  Boolean property = PropertyHelper.getProperty(configuration, RestServerV2.ERROR_STACKTRACE_ENABLE);

  // Default is false
  boolean includeStackTraces = property != null && property;

  context.register(new UserExceptionMapper(includeStackTraces));
  context.register(new GenericExceptionMapper(includeStackTraces));

  return true;
}
 
Example #11
Source File: ConfigurationImplTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testFeatureDisabledClass() {
    FeatureContextImpl featureContext = new FeatureContextImpl();
    Configurable<FeatureContext> configurable = new ConfigurableImpl<>(featureContext, RuntimeType.SERVER);
    featureContext.setConfigurable(configurable);
    featureContext.register(DisablableFeature.class);

    Configuration config = configurable.getConfiguration();
    assertFalse(config.isEnabled(DisablableFeature.class));
}
 
Example #12
Source File: AssetsFeature.java    From ameba with MIT License 5 votes vote down vote up
/**
 * <p>getAssetMap.</p>
 *
 * @param configuration a {@link javax.ws.rs.core.Configuration} object.
 * @return a {@link java.util.Map} object.
 */
public static Map<String, String[]> getAssetMap(Configuration configuration) {
    Map<String, String[]> assetsMap = Maps.newLinkedHashMap();
    for (String key : configuration.getPropertyNames()) {
        if (key.startsWith(ASSETS_CONF_PREFIX) || key.equals("resource.assets")) {
            String routePath = key.replaceFirst("^resource\\.assets", "");
            if (routePath.startsWith(".")) {
                routePath = routePath.substring(1);
            } else if (StringUtils.isBlank(routePath)) {
                routePath = "assets";
            }

            if (routePath.endsWith("/")) {
                routePath = routePath.substring(0, routePath.lastIndexOf("/"));
            }

            String value = (String) configuration.getProperty(key);
            String[] uris = value.split(",");
            List<String> uriList = Lists.newArrayList();
            for (String uri : uris) {
                uriList.add(uri.endsWith("/") ? uri : uri + "/");
            }
            if (StringUtils.isNotBlank(value)) {
                String[] _uris = assetsMap.get(routePath);
                if (_uris == null) {
                    assetsMap.put(routePath, uriList.toArray(uris));
                } else {
                    assetsMap.put(routePath, ArrayUtils.addAll(_uris, uriList.toArray(uris)));
                }
            }

        }
    }
    return assetsMap;
}
 
Example #13
Source File: JaxRSContainerInstantiator.java    From JaxRSProviders with Apache License 2.0 5 votes vote down vote up
@Override
public IContainer createInstance(ContainerTypeDescription description, Map<String, ?> parameters)
		throws ContainerCreateException {
	Configuration configuration = getConfigurationFromParams(description, parameters);
	if (configuration == null)
		configuration = (this.distprovider == null) ? null : this.distprovider.getConfiguration();
	return createInstance(description, parameters, configuration);
}
 
Example #14
Source File: ViewEngineBaseTest.java    From ozark with Apache License 2.0 5 votes vote down vote up
@Test
public void resolveView() {
	ViewEngineContext ctx = EasyMock.createMock(ViewEngineContext.class);
	Configuration config = EasyMock.createMock(Configuration.class);
	expect(config.getProperty(eq(ViewEngine.VIEW_FOLDER))).andReturn(null);
	expect(ctx.getConfiguration()).andReturn(config);
	expect(ctx.getView()).andReturn("index.jsp");
	expect(ctx.getView()).andReturn("/somewhere/else/index.jsp");
	replay(ctx, config);
	assertThat(viewEngineBase.resolveView(ctx), is("/WEB-INF/views/index.jsp"));
	assertThat(viewEngineBase.resolveView(ctx), is("/somewhere/else/index.jsp"));
	verify(ctx, config);
}
 
Example #15
Source File: QueryDslFeature.java    From ameba with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public boolean configure(FeatureContext context) {
    Configuration cfg = context.getConfiguration();
    if (!cfg.isRegistered(CommonExprTransformer.class))
        context.register(CommonExprTransformer.class);
    if (!cfg.isRegistered(CommonExprArgTransformer.class))
        context.register(CommonExprArgTransformer.class);
    if (!cfg.isRegistered(QuerySyntaxExceptionMapper.class))
        context.register(QuerySyntaxExceptionMapper.class);
    return true;
}
 
Example #16
Source File: AbstractNonParameterizedJerseyStreamingHttpServiceTest.java    From servicetalk with Apache License 2.0 5 votes vote down vote up
@Before
public final void initServerAndClient() throws Exception {
    HttpServerBuilder serverBuilder = HttpServers.forAddress(localAddress(0));
    HttpJerseyRouterBuilder routerBuilder = new HttpJerseyRouterBuilder();
    configureBuilders(serverBuilder, routerBuilder);
    DefaultJerseyStreamingHttpRouter router = routerBuilder.from(application());
    final Configuration config = router.configuration();

    streamingJsonEnabled = getValue(config.getProperties(), config.getRuntimeType(), JSON_FEATURE, "",
            String.class).toLowerCase().contains("servicetalk");

    HttpServerBuilder httpServerBuilder = serverBuilder
            .ioExecutor(SERVER_CTX.ioExecutor())
            .bufferAllocator(SERVER_CTX.bufferAllocator());

    switch (api) {
        case ASYNC_AGGREGATED:
            serverContext = buildRouter(httpServerBuilder, toAggregated(router));
            break;
        case ASYNC_STREAMING:
            serverContext = buildRouter(httpServerBuilder, router);
            break;
        case BLOCKING_AGGREGATED:
            serverContext = buildRouter(httpServerBuilder, toBlocking(router));
            break;
        case BLOCKING_STREAMING:
            serverContext = buildRouter(httpServerBuilder, toBlockingStreaming(router));
            break;
        default:
            throw new IllegalArgumentException(api.name());
    }
    final HostAndPort hostAndPort = serverHostAndPort(serverContext);
    httpClient = HttpClients.forSingleAddress(hostAndPort).buildStreaming();
    hostHeader = hostHeader(hostAndPort);
}
 
Example #17
Source File: DACJacksonJaxbJsonFeature.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
protected ObjectMapper newObjectMapper(Configuration configuration, ScanResult scanResult, ConnectionReader connectionReader) {
  Boolean property = PropertyHelper.getProperty(configuration, RestServerV2.JSON_PRETTYPRINT_ENABLE);
  final boolean prettyPrint = property != null && property;

  ObjectMapper mapper = prettyPrint ? JSONUtil.prettyMapper() : JSONUtil.mapper();

  JSONUtil.registerStorageTypes(mapper, scanResult, connectionReader);
  mapper.addMixIn(VirtualDatasetUI.class, VirtualDatasetUIMixin.class);
  return mapper;
}
 
Example #18
Source File: TableauMessageBodyGenerator.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Inject
public TableauMessageBodyGenerator(@Context Configuration configuration, NodeEndpoint endpoint, OptionManager optionManager) {
  this.endpoint = endpoint;
  this.masterNode = MoreObjects.firstNonNull(endpoint.getAddress(), "localhost");
  this.customizationEnabled = MoreObjects.firstNonNull((Boolean) configuration.getProperty(CUSTOMIZATION_ENABLED), false);
  this.optionManager = optionManager;

  // The EnumValidator lower-cases the enum for some reason, so we upper case it to match our enum values again.
  this.exportType = TableauExportType.valueOf(optionManager.getOption(TABLEAU_EXPORT_TYPE).toUpperCase(Locale.ROOT));
}
 
Example #19
Source File: MetricAppBeanOptional.java    From microprofile-metrics with Apache License 2.0 5 votes vote down vote up
@GET
@Path("/get-context-params")
public String  getContextParams(
        final @Context HttpHeaders httpheaders,
        final @Context Request request,
        final @Context UriInfo uriInfo,
        final @Context ResourceContext resourceContext,
        final @Context Providers providers,
        final @Context Application application,
        final @Context SecurityContext securityContext,
        final @Context Configuration configuration) throws Exception {
    
    return "This is a GET request with context parameters";
}
 
Example #20
Source File: ServerProviderFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void doApplyDynamicFeatures(ClassResourceInfo cri) {
    Set<OperationResourceInfo> oris = cri.getMethodDispatcher().getOperationResourceInfos();
    for (OperationResourceInfo ori : oris) {
        String nameBinding = DEFAULT_FILTER_NAME_BINDING
            + ori.getClassResourceInfo().getServiceClass().getName()
            + "."
            + ori.getMethodToInvoke().toString();
        for (DynamicFeature feature : dynamicFeatures) {
            FeatureContext featureContext = createServerFeatureContext();
            feature.configure(new ResourceInfoImpl(ori), featureContext);
            Configuration cfg = featureContext.getConfiguration();
            for (Object provider : cfg.getInstances()) {
                Map<Class<?>, Integer> contracts = cfg.getContracts(provider.getClass());
                if (contracts != null && !contracts.isEmpty()) {
                    Class<?> providerCls = ClassHelper.getRealClass(getBus(), provider);
                    registerUserProvider(new FilterProviderInfo<Object>(provider.getClass(),
                        providerCls,
                        provider,
                        getBus(),
                        Collections.singleton(nameBinding),
                        true,
                        contracts));
                    ori.addNameBindings(Collections.singletonList(nameBinding));
                }
            }
        }
    }
    Collection<ClassResourceInfo> subs = cri.getSubResources();
    for (ClassResourceInfo sub : subs) {
        if (sub != cri) {
            doApplyDynamicFeatures(sub);
        }
    }
}
 
Example #21
Source File: JacksonFilteringFeature.java    From ameba with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public boolean configure(final FeatureContext context) {
    final Configuration config = context.getConfiguration();

    if (!config.isRegistered(JacksonFilteringFeature.Binder.class)) {
        context.register(new Binder());
        return true;
    }
    return false;
}
 
Example #22
Source File: ThreadLocalContextManager.java    From tomee with Apache License 2.0 5 votes vote down vote up
public static Object findThreadLocal(final Class<?> type) {
    if (Request.class.equals(type)) {
        return REQUEST;
    } else if (UriInfo.class.equals(type)) {
        return URI_INFO;
    } else if (HttpHeaders.class.equals(type)) {
        return HTTP_HEADERS;
    } else if (SecurityContext.class.equals(type)) {
        return SECURITY_CONTEXT;
    } else if (ContextResolver.class.equals(type)) {
        return CONTEXT_RESOLVER;
    } else if (Providers.class.equals(type)) {
        return PROVIDERS;
    } else if (ServletRequest.class.equals(type)) {
        return SERVLET_REQUEST;
    } else if (HttpServletRequest.class.equals(type)) {
        return HTTP_SERVLET_REQUEST;
    } else if (HttpServletResponse.class.equals(type)) {
        return HTTP_SERVLET_RESPONSE;
    } else if (ServletConfig.class.equals(type)) {
        return SERVLET_CONFIG;
    } else if (ServletContext.class.equals(type)) {
        return SERVLET_CONTEXT;
    } else if (ResourceInfo.class.equals(type)) {
        return RESOURCE_INFO;
    } else if (ResourceContext.class.equals(type)) {
        return RESOURCE_CONTEXT;
    } else if (Application.class.equals(type)) {
        return APPLICATION;
    } else if (Configuration.class.equals(type)) {
        return CONFIGURATION;
    }
    return null;
}
 
Example #23
Source File: ConfigurationImplTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testClientFilterContractsOnServerFeatureIsRejected() {
    FeatureContextImpl featureContext = new FeatureContextImpl();
    Configurable<FeatureContext> configurable = new ConfigurableImpl<>(featureContext, RuntimeType.SERVER);
    featureContext.setConfigurable(configurable);
    featureContext.register(TestFilter.class);
    Configuration config = configurable.getConfiguration();
    Map<Class<?>, Integer> contracts = config.getContracts(TestFilter.class);
    assertFalse(contracts.containsKey(ClientRequestFilter.class));
    assertFalse(contracts.containsKey(ClientResponseFilter.class));
    assertTrue(contracts.containsKey(ContainerRequestFilter.class));
    assertTrue(contracts.containsKey(ContainerResponseFilter.class));
}
 
Example #24
Source File: FastJsonFeature.java    From uavstack with Apache License 2.0 5 votes vote down vote up
@Override
public boolean configure(final FeatureContext context) {
    try {
        final Configuration config = context.getConfiguration();

        final String jsonFeature = CommonProperties.getValue(
                config.getProperties()
                , config.getRuntimeType()
                , InternalProperties.JSON_FEATURE, JSON_FEATURE,
                String.class
        );

        // Other JSON providers registered.
        if (!JSON_FEATURE.equalsIgnoreCase(jsonFeature)) {
            return false;
        }

        // Disable other JSON providers.
        context.property(
                PropertiesHelper.getPropertyNameForRuntime(InternalProperties.JSON_FEATURE, config.getRuntimeType())
                , JSON_FEATURE);

        // Register FastJson.
        if (!config.isRegistered(FastJsonProvider.class)) {
            context.register(FastJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
        }
    } catch (NoSuchMethodError e) {
        // skip
    }

    return true;
}
 
Example #25
Source File: ViewEnginesProducer.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@ApplicationScoped
@Produces
@ViewEngines
public List<ViewEngine> getViewEngines(BeanManager beanManager, PortletContext portletContext,
	Configuration configuration) {

	List<ViewEngine> viewEngines = BeanUtil.getBeanInstances(beanManager, ViewEngine.class);

	viewEngines.add(new ViewEngineJspImpl(configuration, portletContext));

	Collections.sort(viewEngines, new DescendingPriorityComparator(ViewEngine.PRIORITY_APPLICATION));

	return viewEngines;
}
 
Example #26
Source File: AdditionalRegistrationTest.java    From microprofile-rest-client with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldRegisterInstance() {
    TestClientRequestFilter instance = new TestClientRequestFilter();
    RestClientBuilder builder = RestClientBuilder.newBuilder().register(instance);
    Configuration configuration = builder.getConfiguration();
    assertTrue(configuration.isRegistered(TestClientRequestFilter.class), TestClientRequestFilter.class + " should be registered");
    assertTrue(configuration.isRegistered(instance), TestClientRequestFilter.class + " should be registered");
}
 
Example #27
Source File: AdditionalRegistrationTest.java    From microprofile-rest-client with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldRegisterInstanceWithPriority() {
    Integer priority = 1000;
    TestClientRequestFilter instance = new TestClientRequestFilter();
    RestClientBuilder builder = RestClientBuilder.newBuilder().register(instance, priority);
    Configuration configuration = builder.getConfiguration();
    assertTrue(configuration.isRegistered(TestClientRequestFilter.class), TestClientRequestFilter.class + " should be registered");
    assertTrue(configuration.isRegistered(instance), TestClientRequestFilter.class + " should be registered");
    Map<Class<?>, Integer> contracts = configuration.getContracts(TestClientRequestFilter.class);
    assertEquals(contracts.size(), 1, "There should be a registered contract for "+TestClientRequestFilter.class);
    assertEquals(contracts.get(ClientRequestFilter.class), priority, "The priority for "+TestClientRequestFilter.class+" should be 1000");
}
 
Example #28
Source File: ClientBuilderImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
public ClientBuilder withConfig(Configuration cfg) {
    if (cfg.getRuntimeType() != RuntimeType.CLIENT) {
        throw new IllegalArgumentException();
    }
    configImpl = new ClientConfigurableImpl<>(this, cfg);
    return this;
}
 
Example #29
Source File: TemplateHelper.java    From ameba with MIT License 5 votes vote down vote up
/**
 * Get output encoding from configuration.
 *
 * @param configuration Configuration.
 * @param suffix        Template processor suffix of the
 *                      to configuration property {@link org.glassfish.jersey.server.mvc.MvcFeature#ENCODING}.
 * @return Encoding read from configuration properties or a default encoding if no encoding is configured.
 */
public static Charset getTemplateOutputEncoding(Configuration configuration, String suffix) {
    final String enc = PropertiesHelper.getValue(configuration.getProperties(), MvcFeature.ENCODING + suffix,
            String.class, null);
    if (enc == null) {
        return DEFAULT_ENCODING;
    } else {
        return Charset.forName(enc);
    }
}
 
Example #30
Source File: RedirectScopeManagerInjectionVerifyTest.java    From krazo with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotFailInitializationIfContextInjectionHappened() {

  RedirectScopeManager redirectScopeManager = new RedirectScopeManager();
  setFieldValue(redirectScopeManager, "config", createDummyInstance(Configuration.class));
  setFieldValue(redirectScopeManager, "response", createDummyInstance(HttpServletResponse.class));
  redirectScopeManager.init();

}