Announcement Announcement Module
Collapse
No announcement yet.
bean-import in parent uses path relative to child Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • bean-import in parent uses path relative to child

    (Using SWF 2.0.7)
    parent: /WEB-INF/flows/myParent.xml
    bean: /WEB-INF/flows/myBean.xml
    child: /WEB-INF/flows/child/myChild.xml

    The parent includes:
    Code:
    <bean-import resource="myBean.xml"/>
    The child includes "myParent" as a parent. When trying to render the child page, I get:

    Code:
    Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/flows/child/myBean.xml]
    The bean-import tag specifies for the resource attribute:
    The relative resource path to the bean definition file to import. Imported bean definitions are then
    referenceable by this flow. The resource path is relative to this document.
    For example:
    <bean-import resource="orderitem-flow-beans.xml"/>
    ... would look for 'orderitem-flow-beans.xml' in the same directory as this document.
    The Spring Web Flow documentation states
    Paths to external resources in the parent flow should be absolute. Relative paths will break when the two flows are merged unless the parent and child flow are in the same directory. Once merged, all relative paths in the parent flow will become relative to the child flow.
    Is it possible to specify an absolute path for the bean-import in the parent flow?

    In this case, the parent flow is abstract, so I have been able to work-around it by including the bean-imports only in the child. Is this the only way to handle this situation?

  • #2
    A work-around

    I also just ran into this issue with webflow 2.3.0.RELEASE. It is treating the <bean-import resource="..."/> as relative to the child flow even though its imported via the parent-flow, and won't allow absolute paths.

    I had a lot of child flows and didn't want to add the bean-import to all of them, so instead I added myBean.xml files to each directory in which child flows are contained, which import the actual myBean.xml files i.e.

    flows ->

    parent-flow.xml
    myBeans.xml (contains actual bean definitions)
    childFlowDirectory ->

    child1.xml
    child2.xml
    myBeans.xml (imports ../myBeans.xml)

    Comment

    Working...
    X