You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/11/05 15:18:41 UTC

svn commit: r592003 - in /lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth: ShibbolethModule.java ShibbolethUtil.java

Author: andreas
Date: Mon Nov  5 06:18:39 2007
New Revision: 592003

URL: http://svn.apache.org/viewvc?rev=592003&view=rev
Log:
Don't include port 443 in URLs. Refactoring: removed code duplication (appending port to server).

Modified:
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethModule.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethUtil.java

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethModule.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethModule.java?rev=592003&r1=592002&r2=592003&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethModule.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethModule.java Mon Nov  5 06:18:39 2007
@@ -95,7 +95,7 @@
                 String outgoingUrl = rewriter.rewrite(webappUrl);
                 if (outgoingUrl.startsWith("/")) {
                     int port = req.getServerPort();
-                    String portSuffix = port == 80 ? "" : ":" + port;
+                    String portSuffix = ShibbolethUtil.getPortSuffix(port);
                     String serverUrl = req.getScheme() + "://" + req.getServerName() + portSuffix;
                     outgoingUrl = serverUrl + outgoingUrl;
                 }

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethUtil.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethUtil.java?rev=592003&r1=592002&r2=592003&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethUtil.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethUtil.java Mon Nov  5 06:18:39 2007
@@ -74,7 +74,7 @@
 
 			if (baseUrl == null) {
 				int port = request.getServerPort();
-				String portSuffix = port == 80 ? "" : ":" + port;
+				String portSuffix = getPortSuffix(port);
 				baseUrl = request.getScheme() + "://" + request.getServerName()
 						+ portSuffix;
 			}
@@ -89,6 +89,10 @@
 
 		return baseUrl;
 	}
+
+    protected static String getPortSuffix(int port) {
+        return (port == 80 || port == 443) ? "" : ":" + port;
+    }
 
 	protected boolean isSslProtected(String webappUrl) {
 		DefaultAccessController accessController = null;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org