You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by dd...@apache.org on 2005/01/23 05:26:56 UTC
svn commit: r126192 - in portals/pluto/trunk/portal/src: java/org/apache/pluto/portalImpl/core webapp/WEB-INF webapp/WEB-INF/config/services
Author: ddewolf
Date: Sat Jan 22 20:26:54 2005
New Revision: 126192
URL: http://svn.apache.org/viewcvs?view=rev&rev=126192
Log:
Patching PortalURL for JIRA-81: THANKS Jeremy Boynes
-- remove the dependency upon a hard coded to a single host.
-- maps with both secure and insecure mappings
Modified:
portals/pluto/trunk/portal/src/java/org/apache/pluto/portalImpl/core/PortalURL.java
portals/pluto/trunk/portal/src/java/org/apache/pluto/portalImpl/core/ResourceURLProviderImpl.java
portals/pluto/trunk/portal/src/webapp/WEB-INF/config/services/ConfigService.properties
portals/pluto/trunk/portal/src/webapp/WEB-INF/web.xml
Modified: portals/pluto/trunk/portal/src/java/org/apache/pluto/portalImpl/core/PortalURL.java
Url: http://svn.apache.org/viewcvs/portals/pluto/trunk/portal/src/java/org/apache/pluto/portalImpl/core/PortalURL.java?view=diff&rev=126192&p1=portals/pluto/trunk/portal/src/java/org/apache/pluto/portalImpl/core/PortalURL.java&r1=126191&p2=portals/pluto/trunk/portal/src/java/org/apache/pluto/portalImpl/core/PortalURL.java&r2=126192
==============================================================================
--- portals/pluto/trunk/portal/src/java/org/apache/pluto/portalImpl/core/PortalURL.java (original)
+++ portals/pluto/trunk/portal/src/java/org/apache/pluto/portalImpl/core/PortalURL.java Sat Jan 22 20:26:54 2005
@@ -34,30 +34,11 @@
public class PortalURL {
- static String hostNameHTTP;
- static String hostNameHTTPS;
-
- static
- {
- String hostName = Config.getParameters().getString ("host.name", "localhost");
- String hostPortHTTP = Config.getParameters().getString ("host.port.http", "80");
- String hostPortHTTPS = Config.getParameters().getString ("host.port.https", "443");
-
- StringBuffer hostHTTP = new StringBuffer("http://");
- hostHTTP.append(hostName);
- if (!hostPortHTTP.equals("80")) {
- hostHTTP.append(":");
- hostHTTP.append(hostPortHTTP);
- }
- hostNameHTTP = hostHTTP.toString();
-
- StringBuffer hostHTTPS = new StringBuffer("https://");
- hostHTTPS.append(hostName);
- if (!hostPortHTTPS.equals("443")) {
- hostHTTPS.append(":");
- hostHTTPS.append(hostPortHTTPS);
- }
- hostNameHTTPS = hostHTTPS.toString();
+ private static final String insecureServlet;
+ private static final String secureServlet;
+ static {
+ insecureServlet = Config.getParameters().getString("servlet.insecure");
+ secureServlet = Config.getParameters().getString("servlet.secure");
}
/**
@@ -89,17 +70,6 @@
return result.toString();
}
- static public String getBaseURLexcludeContext()
- {
- StringBuffer result = new StringBuffer(256);
-
- result.append(hostNameHTTP);
-
- return result.toString();
- }
-
-
- private String base;
private List startGlobalNavigation = new ArrayList();
private List startLocalNavigation = new ArrayList();
private HashMap startControlParameter = new HashMap();
@@ -116,7 +86,6 @@
public PortalURL(PortalEnvironment env)
{
environment = env;
- this.base = getBasePortalURL(environment);
}
/**
@@ -214,7 +183,8 @@
result.append((String)iterator.next());
while (iterator.hasNext()) {
result.append("/");
- result.append((String)iterator.next());
+ String st = (String)iterator.next();
+ result.append(st);
}
}
return result.toString();
@@ -311,8 +281,8 @@
} else {
secure=environment.getRequest().isSecure();
}
- urlBase.append(secure?hostNameHTTPS:hostNameHTTP);
- urlBase.append(base);
+ urlBase.append(environment.getRequest().getContextPath());
+ urlBase.append(secure ? secureServlet : insecureServlet);
String url = urlBase.toString();
String global = getGlobalNavigationAsString();
@@ -320,6 +290,7 @@
url += "/";
url += global;
}
+
String control = getControlParameterAsString(controlParam);
if (control.length() > 0) {
Modified: portals/pluto/trunk/portal/src/java/org/apache/pluto/portalImpl/core/ResourceURLProviderImpl.java
Url: http://svn.apache.org/viewcvs/portals/pluto/trunk/portal/src/java/org/apache/pluto/portalImpl/core/ResourceURLProviderImpl.java?view=diff&rev=126192&p1=portals/pluto/trunk/portal/src/java/org/apache/pluto/portalImpl/core/ResourceURLProviderImpl.java&r1=126191&p2=portals/pluto/trunk/portal/src/java/org/apache/pluto/portalImpl/core/ResourceURLProviderImpl.java&r2=126192
==============================================================================
--- portals/pluto/trunk/portal/src/java/org/apache/pluto/portalImpl/core/ResourceURLProviderImpl.java (original)
+++ portals/pluto/trunk/portal/src/java/org/apache/pluto/portalImpl/core/ResourceURLProviderImpl.java Sat Jan 22 20:26:54 2005
@@ -31,7 +31,7 @@
public ResourceURLProviderImpl(DynamicInformationProviderImpl provider,
PortletWindow portletWindow)
{
- this.base = PortalURL.getBaseURLexcludeContext();
+// this.base = PortalURL.getBaseURLexcludeContext();
}
// ResourceURLProvider implementation.
@@ -48,6 +48,7 @@
public String toString()
{
+/*
URL url = null;
if (!"".equals(stringUrl))
@@ -63,7 +64,8 @@
}
return ((url==null)?"":url.toString());
-
+*/
+ return stringUrl;
}
}
Modified: portals/pluto/trunk/portal/src/webapp/WEB-INF/config/services/ConfigService.properties
Url: http://svn.apache.org/viewcvs/portals/pluto/trunk/portal/src/webapp/WEB-INF/config/services/ConfigService.properties?view=diff&rev=126192&p1=portals/pluto/trunk/portal/src/webapp/WEB-INF/config/services/ConfigService.properties&r1=126191&p2=portals/pluto/trunk/portal/src/webapp/WEB-INF/config/services/ConfigService.properties&r2=126192
==============================================================================
--- portals/pluto/trunk/portal/src/webapp/WEB-INF/config/services/ConfigService.properties (original)
+++ portals/pluto/trunk/portal/src/webapp/WEB-INF/config/services/ConfigService.properties Sat Jan 22 20:26:54 2005
@@ -42,3 +42,5 @@
portletcontainer.entrance.impl = org.apache.pluto.PortletContainerImpl
portletcontainer.entrance.wrapper.impl = org.apache.pluto.portalImpl.core.PortletContainerWrapperImpl
+servlet.insecure=/portal
+servlet.secure=/secure
Modified: portals/pluto/trunk/portal/src/webapp/WEB-INF/web.xml
Url: http://svn.apache.org/viewcvs/portals/pluto/trunk/portal/src/webapp/WEB-INF/web.xml?view=diff&rev=126192&p1=portals/pluto/trunk/portal/src/webapp/WEB-INF/web.xml&r1=126191&p2=portals/pluto/trunk/portal/src/webapp/WEB-INF/web.xml&r2=126192
==============================================================================
--- portals/pluto/trunk/portal/src/webapp/WEB-INF/web.xml (original)
+++ portals/pluto/trunk/portal/src/webapp/WEB-INF/web.xml Sat Jan 22 20:26:54 2005
@@ -47,6 +47,10 @@
<url-pattern>/portal/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
+ <servlet-name>pluto</servlet-name>
+ <url-pattern>/secure/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
<servlet-name>TCKDriver</servlet-name>
<url-pattern>/tck/*</url-pattern>
</servlet-mapping>
@@ -63,6 +67,21 @@
<role-name>tomcat</role-name>
</auth-constraint>
</security-constraint>
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name/>
+ <url-pattern>/secure/*</url-pattern>
+ <http-method>GET</http-method>
+ <http-method>POST</http-method>
+ <http-method>PUT</http-method>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>tomcat</role-name>
+ </auth-constraint>
+ <user-data-constraint>
+ <transport-guarantee>CONFIDENTIAL</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
<login-config>
<auth-method>BASIC</auth-method>