I have a SmartGWT app and in it a Filter in which I'm trying to figure out (on login) if the request should be forwarded (e.g. desktop to mobile). The code executes and the browser makes a get request but doesn't get a response and doesn't do a redirect. I've tried with http://google.com and that didn't work too so it must be something else.
public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain) throws ServletException, IOException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
HttpSession session = request.getSession();
WURFLHolder wurfl = (WURFLHolder) getFilterConfig().getServletContext().getAttribute(WURFLHolder.class.getName());
WURFLManager manager = wurfl.getWURFLManager();
Device device = manager.getDeviceForRequest(request);
boolean webBrowser = isWebBrowser(device);
String path = ((HttpServletRequest) request).getRequestURI();
boolean isBrowserOnMobile = true; // webBrowser && path.contains(MOBILE_REQ_PATH);
boolean isMobileOnDesktop = !webBrowser && path.contains(DESKTOP_REQ_PATH);
if (isBrowserOnMobile || isMobileOnDesktop) {
if (isBrowserOnMobile) {
path = "http://www.google.com";
} else {
path = "/PregledPredmeta/MobileAppEntryPoint.html";
}
response.encodeRedirectURL(path);
response.sendRedirect(path);
return;
......