Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to recognize a a http error code from within GWT?
    text
    copied!<p>When my users try to do an action our website after their session has expired (for instance, if they left their browser open), the server responds with a HTTP Status 405 because the user is no longer logged in. </p> <p>When this happens, I want to redirect the user to the login screen. </p> <p>How can I recognize when a 405 error code is returned within GWT so I can then redirect the users?</p> <p>Thanks</p> <p><strong>Edit:</strong> Here's the filter I'm using:</p> <pre><code>public class AuthenticationFilter implements Filter { public void destroy() { } public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { if (req instanceof HttpServletRequest) { boolean isLoggedIn = CustomSecurity.login((HttpServletRequest)req); if (isLoggedIn) { // TODO: How to redirect the user here??? } } chain.doFilter(req, res); } public void init(FilterConfig arg0) throws ServletException { } } </code></pre> <p><strong>web.xml</strong> content:</p> <pre><code>&lt;filter&gt; &lt;filter-name&gt;Authentication Filter&lt;/filter-name&gt; &lt;filter-class&gt;com.company.AuthenticationFilter&lt;/filter-class&gt; &lt;/filter&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;Authentication Filter&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; </code></pre> <p>How can I make that redirect the user? Also, is there a way to force the whole browser to redirect? Since this goes into a widget, I think a Window.Location.assign('url') will only redirect the widget's HTML content.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload