2013-10-11 22 views
0

我有一個Java Spring Webflow應用程序,它需要重定向到它自己的子域以進行語言選擇。即mysite.com到fr.mysite.com。在Spring WebFlow中重定向/轉發到子域

我試過externalRedirect,但只是顯示一個空白的html頁面。

這裏是一個Webflow defenition片段:

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

由此決定我需要重定向到URL。以下是帶有externalRedirect的視圖狀態:

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

是否也可以將請求參數追加到URL?

+0

你不能將它們附加到'flowScope.redirectUrl'嗎? –

+1

由於某種原因,我不能。如果我從流程定義中嘗試了一個externalRedirect,它從來沒有工作過。沒有錯誤給出,並將保持在同一頁面上,沒有重定向完成。我確實找到了一個方法,並會很快發佈。 – enkor

回答

1

我設法實現了我之前的工作。在webflow中重定向到子域。所以這就是我設法讓它工作的方式。

所以在流程定義,我有:

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

現在,我做了重定向與在retrieveController:

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

所以我建立的URL字符串什麼辦法,我想那麼做控制器內的重定向。

0

在flow.xml中,正確的EL語法是#{flowScope.redirectUrl}而不是${flowScope.redirectUrl}