12.2.4. Path Redirection
PicketLink allows you to define redirection rules for a specific path. This feature allows you to perform a HTTP redirect depending on a specific condition.
The most simple example about how to use this feature is when you defined a logout path to your application.
httpBuilder
.forPath("/logout")
.logout()
.redirectTo("/goodbye.html");
In this case, once the user is logged out, PicketLink will redirect the user to a /goodbye.html page.
But some times you may want to perform a redirect depending on a specific condition. For example, let's define a rule where if a request is not authorized the user will be redirect to a specific error page:
httpBuilder
.forPath("/admin/*")
.authorizeWith()
.role("Administrator")
.redirectTo("/accessDenied.html").whenForbidden();
You can do the same thing if some error occurs during the request processing.
httpBuilder
.forPath("/admin/*")
.authorizeWith()
.role("Administrator")
.redirectTo("/error.html").whenError();
If you want to simplify your configuration, you can define all redirect rules by Section 12.2.2, “Grouping Paths”.

