title: Can I get the current webflow state within a Spring MVC controller?
body: <p>On the surface, a bit of a strange question! but I am creating a web app that uses both webflow and traditional Spring MVC controllers.</p>
  
  <p>From one of the webflow views, a http request (ajax) is made from the client to a spring controller. When this was originally coded it didnt have much of a logical connection to the webflow, but now things have moved on and the controller could really do with knowing what screen (view-state) the request has come from.</p>
  
  <p>My controller method signature looks like this:</p>
  
  <pre><code>@RequestMapping(value="/AjaxStuff", method=RequestMethod.POST)
  public String ajaxStuff(@ModelAttribute("quote") QB2MotorQuote p_quote, BindingResult p_bindingResult, 
          HttpServletRequest p_req, Model p_model, DefaultMessageContext p_messages) {
  </code></pre>
  
  <p>I know from some of my webflow action classes that I can get the current state from the RequestContext object:</p>
  
  <pre><code>public Event checkDeclines(RequestContext p_ctx) throws Exception {
      // get the current state
      StateDefinition state = p_ctx.getCurrentState();
  </code></pre>
  
  <p>I've never really understood the 'voodoo' :) that Spring does where it can automagically inject parameters just by specifying them on the method signature (surely it can only inject things it knows about ??). I've tried simply changing the method signature of my controller method to inject in the RequestContext (in the vain hope that it will get injected), but it doesn't. It complains that RequestContext is an interface.</p>
  
  <p>So, does anyone know how I can make my controller know about the current webflow state - either through injecting something into the controller method signature, or perhaps I can get it from the http request somehow (or session, which I can get from the request).</p>
  
  <p>Any help with this very much appreciated.</p>