public final class SpaUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
doRedirect(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
java.lang.String target)
Perform server redirect into root page.
|
static boolean |
isHtmlRequest(javax.servlet.http.HttpServletRequest req)
Checks if provided request expects html response (by accept header).
|
static boolean |
isRootPage(java.lang.String currentPath,
java.lang.String rootPath)
Note that root path is not the index page, but root mapping path, which will implicitly lead to index page.
|
static boolean |
isSpaRoute(javax.servlet.http.HttpServletRequest req,
java.util.regex.Pattern noRedirect)
Checks if request could be actually a client side route.
|
static void |
noCache(javax.servlet.http.HttpServletResponse resp)
Applies response header to prevent caching (because SPA page should not be cached).
|
public static boolean isRootPage(java.lang.String currentPath,
java.lang.String rootPath)
currentPath - current pathrootPath - application root pathpublic static boolean isHtmlRequest(javax.servlet.http.HttpServletRequest req)
req - request instancepublic static boolean isSpaRoute(javax.servlet.http.HttpServletRequest req,
java.util.regex.Pattern noRedirect)
req - request instancenoRedirect - no-redirect patternpublic static void noCache(javax.servlet.http.HttpServletResponse resp)
resp - response instancepublic static void doRedirect(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
java.lang.String target)
throws java.io.IOException,
javax.servlet.ServletException
No cache header is applied to response to prevent index page caching (by this route).
req - request instanceres - response instancetarget - spa root pathjava.io.IOException - on errorjavax.servlet.ServletException - on error