0

I have a Java Spring Webflow application and it need to redirect to it's own sub domain for language choice. i.e. mysite.com to fr.mysite.com.

I have tried externalRedirect, but just shows a blank html page.

Here is the webflow defenition snippet:

<transition on="found" to="redirectOnRetrieve">         
    <evaluate expression="retrieveController.getFoundApplicationRedirect(flowRequestContext)" result="flowScope.redirectUrl"/> 
</transition>

Which determines the URL I need to redirect to. And the following is the view state with the externalRedirect:

<view-state id="redirectOnRetrieve" view="externalRedirect:${flowScope.redirectUrl}"/>

Is it also possible to append request parameters to the URL?

enkor
  • 7,527
  • 3
  • 31
  • 55
  • can't you append them to `flowScope.redirectUrl`? – Philipp Sander Oct 15 '13 at 14:07
  • 1
    For some reason I couldn't. If I tried an externalRedirect from within the flow definition it never worked. No error given and would stay on the same page, with no redirect done. I did find a way though and will post that soon. – enkor Oct 15 '13 at 14:28

2 Answers2

1

I managed to achieve what I was after. Doing a redirect to a subdomain within a webflow. So this is how I managed to get it working.

So in the flow definition I have:

<transition on="found" to="redirectOnRetrieve">         
    <evaluate expression="retrieveController.brokerApplicationRedirect(flowRequestContext)"/> 
</transition>

Now, I did the redirect with in the retrieveController:

   public void brokerApplicationRedirect(RequestContext context) throws IOException, ServletException {
        String urlString = "http://sub.domain.com?param=myparam";        
        context.getExternalContext().requestExternalRedirect(urlString);
    }

So I build up the Url string any way I want then did the redirect within the controller.

enkor
  • 7,527
  • 3
  • 31
  • 55
0

Within flow.xml, the correct EL syntax is #{flowScope.redirectUrl} rather than ${flowScope.redirectUrl}.

dbreaux
  • 4,982
  • 1
  • 25
  • 64