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

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
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;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.