remm        2003/05/27 10:02:36

  Modified:    catalina/src/share/org/apache/catalina/realm RealmBase.java
  Log:
  - Refactor without using SSL URLs, similar to what is done for sendRedirect.
  
  Revision  Changes    Path
  1.13      +15 -22    
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/RealmBase.java
  
  Index: RealmBase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/RealmBase.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- RealmBase.java    23 Apr 2003 16:14:12 -0000      1.12
  +++ RealmBase.java    27 May 2003 17:02:36 -0000      1.13
  @@ -72,8 +72,6 @@
   import java.security.NoSuchAlgorithmException;
   import java.security.cert.X509Certificate;
   import java.io.IOException;
  -import java.net.URL;
  -import java.net.MalformedURLException;
   import java.util.Set;
   
   import javax.servlet.http.HttpServletRequest;
  @@ -669,9 +667,15 @@
           }
   
           // Redirect to the corresponding SSL port
  +        StringBuffer file = new StringBuffer();
           String protocol = "https";
           String host = hrequest.getServerName();
  -        StringBuffer file = new StringBuffer(hrequest.getRequestURI());
  +        // Protocol
  +        file.append(protocol).append("://");
  +        // Host with port
  +        file.append(host).append(":").append(redirectPort);
  +        // URI
  +        file.append(hrequest.getRequestURI());
           String requestedSessionId = hrequest.getRequestedSessionId();
           if ((requestedSessionId != null) &&
               hrequest.isRequestedSessionIdFromURL()) {
  @@ -683,21 +687,10 @@
               file.append('?');
               file.append(queryString);
           }
  -        URL url = null;
  -        try {
  -            url = new URL(protocol, host, redirectPort, file.toString());
  -            if (log.isDebugEnabled())
  -                log.debug("  Redirecting to " + url.toString());
  -            hresponse.sendRedirect(url.toString());
  -            return (false);
  -        } catch (MalformedURLException e) {
  -            if (log.isDebugEnabled())
  -                log.debug("  Cannot create new URL", e);
  -            hresponse.sendError
  -                (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
  -                 hrequest.getRequestURI());
  -            return (false);
  -        }
  +        if (log.isDebugEnabled())
  +            log.debug("  Redirecting to " + file.toString());
  +        hresponse.sendRedirect(file.toString());
  +        return (false);
   
       }
       
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to