craigmcc    01/07/24 17:09:34

  Modified:    catalina/src/share/org/apache/catalina/authenticator
                        FormAuthenticator.java
  Log:
  When processing a form-based login, and redirecting back to the originally
  requested resource, include any query string that was part of the original
  request in the URL to which the redirect occurs.  In that way, request
  parameters that were specified as part of the original request will not be
  lost.
  
  PR: Bugzilla #2768
  Submitted by: Vincente Salvador <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  1.12      +14 -9     
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authenticator/FormAuthenticator.java
  
  Index: FormAuthenticator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authenticator/FormAuthenticator.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- FormAuthenticator.java    2001/07/22 20:09:19     1.11
  +++ FormAuthenticator.java    2001/07/25 00:09:34     1.12
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authenticator/FormAuthenticator.java,v
 1.11 2001/07/22 20:09:19 pier Exp $
  - * $Revision: 1.11 $
  - * $Date: 2001/07/22 20:09:19 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/authenticator/FormAuthenticator.java,v
 1.12 2001/07/25 00:09:34 craigmcc Exp $
  + * $Revision: 1.12 $
  + * $Date: 2001/07/25 00:09:34 $
    *
    * ====================================================================
    *
  @@ -88,7 +88,7 @@
    * Authentication, as described in the Servlet API Specification, Version 2.2.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.11 $ $Date: 2001/07/22 20:09:19 $
  + * @version $Revision: 1.12 $ $Date: 2001/07/25 00:09:34 $
    */
   
   public final class FormAuthenticator
  @@ -230,7 +230,7 @@
   
           // Redirect the user to the original request URI (which will cause
           // the original request to be restored)
  -        requestURI = savedRequestURI(session);
  +        requestURI = savedRequestURL(session);
           if (debug >= 1)
               log("Redirecting to '" + requestURI + "'");
           hres.sendRedirect(hres.encodeRedirectURL(requestURI));
  @@ -397,18 +397,23 @@
   
   
       /**
  -     * Return the request URI from the saved request.
  +     * Return the request URI (with the corresponding query string, if any)
  +     * from the saved request so that we can redirect to it.
        *
        * @param session Our current session
        */
  -    private String savedRequestURI(Session session) {
  +    private String savedRequestURL(Session session) {
   
           SavedRequest saved =
             (SavedRequest) session.getSession().getAttribute(Constants.FORM_KEY);
           if (saved == null)
               return (null);
  -        else
  -            return (saved.getRequestURI());
  +        StringBuffer sb = new StringBuffer(saved.getRequestURI());
  +        if (saved.getQueryString() != null) {
  +            sb.append('?');
  +            sb.append(saved.getQueryString());
  +        }
  +        return (sb.toString());
   
       }
   
  
  
  

Reply via email to