2013-03-26 37 views

回答

5

你应该实现一个自定义的ConfigurableNavigationHandler,它将根据动作来源重新映射URL(我假设这里并不是所有的重定向都是https目的地)。举个例子:

public class NavigationHandlerTest extends ConfigurableNavigationHandler { 

private NavigationHandlerTest concreteHandler; 

public NavigationHandlerTest(NavigationHandler concreteHandler) { 
     this.concreteHandler = concreteHandler; 
} 


@Override 
public void handleNavigation(FacesContext context, String fromAction, String outcome) 
{ 
    //here, check where navigation is going to/coming from and based on that build an appropriate URL. 
    if(outcome.equals("someAction"){ 
     outcome = "https://foo.bar.baz"; //set destination url 
      } 


    concreteHandler.handleNavigation(context, fromAction, outcome); 

} 


    } 

注册在您的实现faces-config.xml中

 <application> 
     <navigation-handler>com.example.NavigationHandlerTest</navigation-handler> 
    </application>