java - My response.sendRedirect isn't working -


i have smartgwt app , in filter in i'm trying figure out (on login) if request should forwarded (e.g. desktop mobile). code executes , browser makes request doesn't response , doesn't redirect. i've tried http://google.com , didn't work must 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; 

......

did send content http response before using response.sendredirect()? use http redirect header, can't send response browser. space or line-break/new-line can stop redirect.

if you've checked code , make sure haven't sent content browser, can use javascript redirection <script>location.href='yoururl';</script>. not cool solution, works.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -