Announcement Announcement Module
Collapse
No announcement yet.
Obtaining the FlowSession Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Obtaining the FlowSession

    I'm new to spring and SWF, so I'll try to explain things as best I can. I have my flow definitions setup via the web.xml and other supporting xml files (such as flow definition and beans). What I want to be able to get is the state Id from the current flow when an action has been called. I don't know how to obtain this in my java class where the action is calling a defined bean. How do I get access to the flowrepository, and therefore access to the flowsessions. Or is there a way I can pass in the current flow object to my bean action?

    Thanks,

    -Dennis

  • #2
    Originally posted by motion_157
    What I want to be able to get is the state Id from the current flow when an action has been called.
    What about: requestContext.getCurrentState().getId() ?

    Is that what you're looking for?

    - Sam

    Comment


    • #3
      that would work perfect, but how do I obtain the requestContext in my class though?

      thanks,

      -Dennis

      Comment


      • #4
        Originally posted by motion_157
        that would work perfect, but how do I obtain the requestContext in my class though?
        What kind of class are you talking about specifically?

        If your action is a MultiAction or a subclass thereof (e.g., FormAction), your method must have the following signature:

        Code:
            public Event myCustomActionMethod(final RequestContext context) throws Exception
        Actually, the reference manual (ch. 2.6.2.5) explains this much more thoroughly:

        1. Your Action class must extend from org.springframework.webflow.MultiAction, or another class that
        extends from MultiAction. The multi action cares for the action method dispatch that is based on the
        value of the method property.
        2. Each action method must conform to the signature illustrated above: public Event
        ${method}(RequestContext) { ... }
        In this case, your method will automatically be supplied the context.

        On the other hand, if you are using a POJO action, I don't believe you can directly access the RequestContext, as that is not the point of using a POJO as an action. (SWF community: please correct me if I'm wrong here) Refer to "2.6.2.7. ActionState XML - POJO action method execution" in the reference manual for more details.

        regards,

        Sam

        Comment


        • #5
          Ah, that's the problem, I didn't extend multiaction, therefore I was just using POJO. I was really beginning to wonder how the requestcontext was being grabbed. Thanks for the help!

          Comment

          Working...
          X