title: How to change the original requested page used by j_security_check?
body: <p>When an unauthenticated user request some resources, he will be redirected to a login page but <code>j_security_check</code> will keep the original requested resource. If the user login successfully, it will be redirected to that resource.</p>
  
  <p>The problem is that sometimes the requested resource is dynamic, so it might not exists. I have a lot of places in my application with this behavior, so instead of validate this in each "resource handler" (controller), we are trying to centralize all this logic in a filter that intercept the <code>j_security_check</code> forward to the login page.</p>
  
  <p>Now, how can we get the original requested resource kept by the Form-Based Authentication mechanism? It's vendor dependent? </p>
  
  <p><strong>Another alternative:</strong></p>
  
  <p>If I can run a filter BEFORE the <code>j_security_check</code> I can't modify the URL but I can send a redirect to the user with a "valid URL". But how can I execute a filter before the <code>j_security_check</code>?</p>