Package org.springframework.springfaces.config.util

Examples of org.springframework.springfaces.config.util.BeanDefinitionParserHelper


* @author Phillip Webb
*/
class MvcSupportBeanDefinitionParser implements BeanDefinitionParser {

  public BeanDefinition parse(Element element, ParserContext parserContext) {
    BeanDefinitionParserHelper helper = new BeanDefinitionParserHelper(element, parserContext);
    parserContext.pushContainingComponent(helper.getComponentDefinition());

    // Dispatcher + DispatcherAwareBeanPostProcessor
    RuntimeBeanReference dispatcher = getOrRegister(helper, "dispatcher", DefaultDispatcher.class);
    RootBeanDefinition postProcessor = helper.rootBeanDefinition(DispatcherAwareBeanPostProcessor.class);
    postProcessor.getConstructorArgumentValues().addIndexedArgumentValue(0, dispatcher);
    helper.register(postProcessor);

    // State Handler
    RuntimeBeanReference stateHandler = getOrRegister(helper, "state-handler", ClientFacesViewStateHandler.class);

    // Postback Handler
    RootBeanDefinition postbackHandler = helper.rootBeanDefinition(FacesPostbackHandler.class);
    postbackHandler.getConstructorArgumentValues().addIndexedArgumentValue(0, stateHandler);
    helper.register(postbackHandler);

    // Exception Handler
    helper.register(MvcExceptionHandler.class);

    // Destination View Resolvers
    RuntimeBeanReference destinationViewResolvers = createResolverChain(helper, DestinationViewResolverChain.class,
        "destination-view-resolvers", RequestMappedRedirectDestinationViewResolver.class,
        DefaultDestinationViewResolver.class);

    // Navigation View Resolvers
    RuntimeBeanReference navigationViewResolvers = createResolverChain(helper,
        NavigationOutcomeResolverChain.class, "navigation-outcome-resolvers",
        ImplicitNavigationOutcomeResolver.class, NavigationMethodOutcomeResolver.class);

    // Spring Faces Factories
    RootBeanDefinition factories = helper.rootBeanDefinition(SpringFacesFactories.class);
    factories.getConstructorArgumentValues().addIndexedArgumentValue(0, stateHandler);
    factories.getConstructorArgumentValues().addIndexedArgumentValue(1, destinationViewResolvers);
    factories.getPropertyValues().addPropertyValue("navigationOutcomeResolver", navigationViewResolvers);
    helper.register(factories);

    // Interceptor
    RootBeanDefinition interceptor = helper.rootBeanDefinition(FacesHandlerInterceptor.class);
    RootBeanDefinition mappedInterceptor = helper.rootBeanDefinition(MappedInterceptor.class);
    mappedInterceptor.getConstructorArgumentValues().addIndexedArgumentValue(0, (Object) null);
    mappedInterceptor.getConstructorArgumentValues().addIndexedArgumentValue(1, interceptor);
    helper.register(mappedInterceptor);

    parserContext.popAndRegisterContainingComponent();
    return null;
  }
View Full Code Here


  private static final String HANDLER_ADAPTER_BEAN_NAME = HttpRequestHandlerAdapter.class.getName();

  @Override
  protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
    BeanDefinitionParserHelper helper = new BeanDefinitionParserHelper(element, parserContext);

    // Register HttpRequestHandlerAdapter if not already defined
    if (!helper.getParserContext().getRegistry().containsBeanDefinition(HANDLER_ADAPTER_BEAN_NAME)) {
      RootBeanDefinition handlerAdapter = helper.rootBeanDefinition(HttpRequestHandlerAdapter.class);
      parserContext.getRegistry().registerBeanDefinition(HANDLER_ADAPTER_BEAN_NAME, handlerAdapter);
      parserContext.registerComponent(new BeanComponentDefinition(handlerAdapter, HANDLER_ADAPTER_BEAN_NAME));
    }

    // Register the handler
    RegisteredBeanDefinition resourceHandler = helper.register(FacesResourceRequestHandler.class);

    // Register the mapping
    Map<String, String> urlMap = new ManagedMap<String, String>();
    urlMap.put("/javax.faces.resource/**", resourceHandler.getName());
    RootBeanDefinition mapping = helper.rootBeanDefinition(SimpleUrlHandlerMapping.class);
    mapping.getPropertyValues().addPropertyValue("urlMap", urlMap);
    mapping.getPropertyValues().addPropertyValue("order", element.getAttribute("order"));
    helper.register(mapping);

    return null;
  }
View Full Code Here

*/
class ConversionServiceBeanDefinitionParser extends AbstractBeanDefinitionParser {

  @Override
  protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
    BeanDefinitionParserHelper helper = new BeanDefinitionParserHelper(element, parserContext);
    ManagedList<BeanDefinition> converters = new ManagedList<BeanDefinition>();
    converters.add(helper.register(GenericFacesConverter.class).getBeanDefinition());
    RootBeanDefinition conversionService = helper.rootBeanDefinition(FormattingConversionServiceFactoryBean.class);
    conversionService.getPropertyValues().add("converters", converters);
    return conversionService;
  }
View Full Code Here

* @author Phillip Webb
*/
class MvcViewResolverBeanDefinitionParser implements BeanDefinitionParser {

  public BeanDefinition parse(Element element, ParserContext parserContext) {
    BeanDefinitionParserHelper helper = new BeanDefinitionParserHelper(element, parserContext);
    RootBeanDefinition definition = helper.rootBeanDefinition(BookmarkableRedirectViewIdResolver.class);
    definition.getPropertyValues().add("viewClass", FacesView.class);
    addPropertyFromAttribute(definition, element, "prefix");
    addPropertyFromAttribute(definition, element, "suffix");
    addPropertyFromAttribute(definition, element, "order");
    helper.register(definition);
    return definition;
  }
View Full Code Here

* @author Phillip Webb
*/
class IntegrationBeanDefinitionParser implements BeanDefinitionParser {

  public BeanDefinition parse(Element element, ParserContext parserContext) {
    BeanDefinitionParserHelper helper = new BeanDefinitionParserHelper(element, parserContext);
    parserContext.pushContainingComponent(helper.getComponentDefinition());
    helper.register(SpringFacesIntegration.class);
    registerIfAttributeIsTrue(helper, "validators", SpringFacesValidatorSupport.class);
    registerIfAttributeIsTrue(helper, "converters", SpringFacesConverterSupport.class);
    registerIfAttributeIsTrue(helper, "exception-handlers", SpringFacesExceptionHandlerSupport.class,
        ObjectMessageExceptionHandler.class);
    registerIfAttributeIsTrue(helper, "spring-expressions", StandardEvaluationContextPostProcessorSupport.class,
View Full Code Here

TOP

Related Classes of org.springframework.springfaces.config.util.BeanDefinitionParserHelper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.