Problems with JSF navigation rules using HTTPS redirection

I'm having problems using <redirect/ > navigation rules. My application runs on HTTPS, and when <redirect/ > is used in the navigation rule, the redirection is done using HTTP, not HTTPS. Is there any way to solve this?

0
source share
1 answer

You must implement a custom ConfigurableNavigationHandler that reassigns the URL based on the source of the action (I assume here that not all of your redirects are for https addresses). As an example:

  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); } } 

Register your implementation in faces-config.xml

  <application> <navigation-handler>com.example.NavigationHandlerTest</navigation-handler> </application> 
+5
source

All Articles