Package com.avoka.fc.core.util
Class RedirectUtils
- java.lang.Object
-
- com.avoka.fc.core.util.RedirectUtils
-
public class RedirectUtils extends Object
Provides utility methods related to HTTP redirect.- Since:
- 3.6.5
-
-
Field Summary
Fields Modifier and Type Field Description static String
REDIRECT_CONTENT_PATTERN
The pattern containing the alternative redirect instructions into which the location will be substituted
-
Constructor Summary
Constructors Constructor Description RedirectUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
evaluateRedirect(String location, HttpServletRequest request)
See if the current user needs custom redirect behavior.static String
generateRedirectLocation(String location, Map<String,?> params, HttpServletRequest request, HttpServletResponse response)
static String
getSessionEntryUrl(HttpServletRequest request)
Return the session stored Entry URL for SSO integration support.static void
performRedirect(String location, Map<String,?> params, HttpServletRequest request, HttpServletResponse response)
Performs a standard redirect.static void
performRefreshRedirect(String location, Map<String,?> params, HttpServletRequest request, HttpServletResponse response)
Performs an alternative redirect.static String
storeSessionEntryUrl(HttpServletRequest request)
Stores the Entry URL in the session for SSO integration support.
-
-
-
Field Detail
-
REDIRECT_CONTENT_PATTERN
public static final String REDIRECT_CONTENT_PATTERN
The pattern containing the alternative redirect instructions into which the location will be substituted- See Also:
- Constant Field Values
-
-
Method Detail
-
storeSessionEntryUrl
public static String storeSessionEntryUrl(HttpServletRequest request)
Stores the Entry URL in the session for SSO integration support.- Parameters:
request
- the servlet request (required)- Returns:
- the stored URL stored in the session
- Since:
- 4.0.0
-
getSessionEntryUrl
public static String getSessionEntryUrl(HttpServletRequest request)
Return the session stored Entry URL for SSO integration support.- Parameters:
request
- the servlet request (required)- Returns:
- the Entry URL if available or null otherwise
- Since:
- 4.0.0
-
evaluateRedirect
public static boolean evaluateRedirect(String location, HttpServletRequest request)
See if the current user needs custom redirect behavior. Whether an alternative redirect is required is determined by matching the user-agent header against the value of the deployment propertyDeploymentProperty.PROPERTY_ALTERNATIVE_REDIRECT_USER_AGENTS
. Note: If location is empty, this method returns true. This is to support special cases in Click, where setRedirect(null) is called in certain onDestroy handlers. The standard methodPage.setRedirect(String, java.util.Map)
includes handling of null locations.- Parameters:
location
- the location to redirect to (optional)request
- the HTTP servlet request (required)- Returns:
- true if a "normal" redirect should be performed; false if an alternative redirect method should be used (the caller can elect to use
performRefreshRedirect(String, Map, HttpServletRequest, HttpServletResponse)
)
-
generateRedirectLocation
public static String generateRedirectLocation(String location, Map<String,?> params, HttpServletRequest request, HttpServletResponse response)
-
performRedirect
public static void performRedirect(String location, Map<String,?> params, HttpServletRequest request, HttpServletResponse response)
Performs a standard redirect.- Parameters:
location
- the location to redirect to (required)params
- the map of request parametersresponse
- the HTTP servlet response (required)
-
performRefreshRedirect
public static void performRefreshRedirect(String location, Map<String,?> params, HttpServletRequest request, HttpServletResponse response)
Performs an alternative redirect. This can be necessary if standard HTTP redirects are not supported (e.g. Android stock browser 4.2)- Parameters:
location
- the location to redirect to (required)params
- the map of request parametersrequest
- the HTTP servlet request (required)response
- the HTTP servlet response (required)
-
-