javax.faces.bean.RequestScoped Java Examples

The following examples show how to use javax.faces.bean.RequestScoped. 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: JsfScopeAnnotationsAutoConfiguration.java    From joinfaces with Apache License 2.0 6 votes vote down vote up
@Bean
@ConditionalOnProperty(value = "joinfaces.scope-configurer.jsf.enabled", havingValue = "true", matchIfMissing = true)
public static CustomScopeAnnotationConfigurer jsfScopeAnnotationsConfigurer(Environment environment) {
	CustomScopeAnnotationConfigurer scopeAnnotationConfigurer = new CustomScopeAnnotationConfigurer();

	scopeAnnotationConfigurer.setOrder(environment.getProperty("joinfaces.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(ViewScoped.class, ViewScope.SCOPE_VIEW);
	scopeAnnotationConfigurer.addMapping(SessionScoped.class, WebApplicationContext.SCOPE_SESSION);
	scopeAnnotationConfigurer.addMapping(ApplicationScoped.class, WebApplicationContext.SCOPE_APPLICATION);

	try {
		Class<? extends Annotation> cdiViewScopedClass = (Class<? extends Annotation>) Class.forName("javax.faces.view.ViewScoped");
		scopeAnnotationConfigurer.addMapping(cdiViewScopedClass, ViewScope.SCOPE_VIEW);
	}
	catch (ClassNotFoundException ignored) {
		// JSF 2.1 or lower
	}

	return scopeAnnotationConfigurer;
}
 
Example #2
Source File: JsfRequestBroadcaster.java    From deltaspike with Apache License 2.0 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);
    }
}