Java Code Examples for javax.faces.bean.RequestScoped

The following are top voted examples for showing how to use javax.faces.bean.RequestScoped. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: joinfaces   File: JsfScopeAnnotationsAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnProperty(value = "jsf.scope-configurer.jsf.enabled", havingValue = "true", matchIfMissing = true)
public static BeanFactoryPostProcessor jsfScopeAnnotationsConfigurer(Environment environment) {
	CustomScopeAnnotationConfigurer scopeAnnotationConfigurer = new CustomScopeAnnotationConfigurer();

	scopeAnnotationConfigurer.setOrder(environment.getProperty("jsf.scope-configurer.jsf.order", Integer.class, Ordered.LOWEST_PRECEDENCE));

	scopeAnnotationConfigurer.addMapping(NoneScoped.class, ConfigurableBeanFactory.SCOPE_PROTOTYPE);
	scopeAnnotationConfigurer.addMapping(RequestScoped.class, WebApplicationContext.SCOPE_REQUEST);
	scopeAnnotationConfigurer.addMapping(javax.faces.bean.ViewScoped.class, ViewScope.SCOPE_VIEW);
	scopeAnnotationConfigurer.addMapping(javax.faces.view.ViewScoped.class, ViewScope.SCOPE_VIEW);
	scopeAnnotationConfigurer.addMapping(SessionScoped.class, WebApplicationContext.SCOPE_SESSION);
	scopeAnnotationConfigurer.addMapping(ApplicationScoped.class, WebApplicationContext.SCOPE_APPLICATION);

	return scopeAnnotationConfigurer;
}
 
Example 2
Project: deltaspike   File: JsfRequestBroadcaster.java   View source code 6 votes vote down vote up
@PostConstruct
protected void init()
{
    Map<String, Class> values = new HashMap<String, Class>();
    values.put("value", RequestScoped.class);
    Class<? extends Annotation> initializedAnnotationClass =
        ClassUtils.tryToLoadClassForName("javax.enterprise.context.Initialized");
    if (initializedAnnotationClass != null)
    {
        this.initializedAnnotationInstance = AnnotationInstanceProvider.of(initializedAnnotationClass, values);
    }

    Class<? extends Annotation> destroyedAnnotationClass =
        ClassUtils.tryToLoadClassForName("javax.enterprise.context.Destroyed");
    if (destroyedAnnotationClass != null)
    {
        this.destroyedAnnotationInstance = AnnotationInstanceProvider.of(destroyedAnnotationClass, values);
    }
}
 
Example 3
Project: joinfaces   File: JsfClassFactory.java   View source code 5 votes vote down vote up
/**
 * Ignore ViewScoped, SessionScoped, RequestScoped and NoneScoped annotations
 * because spring will take care of them.
 * @return set of annotations to exclude from handlesType
 */
private Set<Class<? extends Annotation>> annotationsToExclude() {
	Set<Class<? extends Annotation>> result = new HashSet<>();
	if (this.jsfAnnotatedClassFactoryConfiguration.isExcludeScopedAnnotations()) {
		result.add(ViewScoped.class);
		result.add(SessionScoped.class);
		result.add(RequestScoped.class);
		result.add(NoneScoped.class);
	}
	return result;
}