Re: JSF + Prettyfaces, Force login page to redirect to https

Splash Forums PrettyFaces Users JSF + Prettyfaces, Force login page to redirect to https Re: JSF + Prettyfaces, Force login page to redirect to https

#22521

Hey Lincoln,

I don’t like the first shorthand option because it doesn’t allow to distinguish between permanent and temporary redirects any more.

The second option looks nicer. But I’m not sure if the captureIn() is a bit “too much”. What about if the “URL building” is done by a separate class. Something like this:

.defineRule()
.when(Path.matches("/login").and(Scheme.matches("http")))
.perform(Redirect.temporary(CurrentURL.toScheme("https"))

or with the capturing:

.defineRule()
.when(URL.captureIn("url").and(Path.matches("/login")).and(Scheme.matches("http")))
.perform(Redirect.permanent(URL.capturedWith("url").toScheme("https")))