gatein SVN: r5209 - in portal/branches/branch-GTNPORTAL-1643/webui: portal/src/main/java/org/exoplatform/portal/webui/workspace and 1 other directory.
by do-not-reply@jboss.org
Author: phuong_vu
Date: 2010-11-22 17:58:49 -0500 (Mon, 22 Nov 2010)
New Revision: 5209
Modified:
portal/branches/branch-GTNPORTAL-1643/webui/framework/src/main/java/org/exoplatform/webui/core/UIComponentDecorator.java
portal/branches/branch-GTNPORTAL-1643/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMaskWorkspace.java
Log:
GTNPORTAL-1682 Should change setUIComponent method of UIComponentDecorator class
Modified: portal/branches/branch-GTNPORTAL-1643/webui/framework/src/main/java/org/exoplatform/webui/core/UIComponentDecorator.java
===================================================================
--- portal/branches/branch-GTNPORTAL-1643/webui/framework/src/main/java/org/exoplatform/webui/core/UIComponentDecorator.java 2010-11-22 21:17:29 UTC (rev 5208)
+++ portal/branches/branch-GTNPORTAL-1643/webui/framework/src/main/java/org/exoplatform/webui/core/UIComponentDecorator.java 2010-11-22 22:58:49 UTC (rev 5209)
@@ -48,14 +48,15 @@
return uicomponent_;
}
- public void setUIComponent(UIComponent uicomponent)
+ public UIComponent setUIComponent(UIComponent uicomponent)
{
+ UIComponent oldOne = uicomponent_;
+// if (uicomponent_ != null)
+// uicomponent_.setParent(null);
+ uicomponent_ = uicomponent;
if (uicomponent_ != null)
- uicomponent_.setRendered(false);
- uicomponent_ = uicomponent;
- if (uicomponent_ == null)
- return;
- uicomponent_.setParent(this);
+ uicomponent_.setParent(this);
+ return oldOne;
}
@SuppressWarnings("unchecked")
Modified: portal/branches/branch-GTNPORTAL-1643/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMaskWorkspace.java
===================================================================
--- portal/branches/branch-GTNPORTAL-1643/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMaskWorkspace.java 2010-11-22 21:17:29 UTC (rev 5208)
+++ portal/branches/branch-GTNPORTAL-1643/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMaskWorkspace.java 2010-11-22 22:58:49 UTC (rev 5209)
@@ -93,10 +93,11 @@
return createUIComponent(clazz, null, null);
}
- public void setUIComponent(UIComponent uicomponent)
+ public UIComponent setUIComponent(UIComponent uicomponent)
{
- super.setUIComponent(uicomponent);
+ UIComponent oldOne = super.setUIComponent(uicomponent);
setShow(uicomponent != null);
+ return oldOne;
}
static public class CloseActionListener extends EventListener<UIComponent>
14 years, 1 month
gatein SVN: r5208 - components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers.
by do-not-reply@jboss.org
Author: mwringe
Date: 2010-11-22 16:17:29 -0500 (Mon, 22 Nov 2010)
New Revision: 5208
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationDispatcher.java
Log:
Clean up an error message to better indicate what the problem is when using wsrp v1.
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationDispatcher.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationDispatcher.java 2010-11-22 19:37:42 UTC (rev 5207)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationDispatcher.java 2010-11-22 21:17:29 UTC (rev 5208)
@@ -115,7 +115,14 @@
}
else
{
- return new ErrorResponse("Did not get a resource URL or a resource ID, cannot fetch resource.");
+ if (consumer.isUsingWSRP2())
+ {
+ return new ErrorResponse("Did not get a resource URL or a resource ID, cannot fetch resource.");
+ }
+ else //using WSRP1
+ {
+ return new ErrorResponse("Did not get a resource URL, cannot fetch resource.");
+ }
}
}
else if (invocation instanceof EventInvocation)
14 years, 1 month
gatein SVN: r5207 - portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm.
by do-not-reply@jboss.org
Author: bdaw
Date: 2010-11-22 14:37:42 -0500 (Mon, 22 Nov 2010)
New Revision: 5207
Modified:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
Log:
GTNPORTAL-1677: NullPointerException with LDAP in GroupDAOImpl.findGroups
Modified: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2010-11-22 16:32:04 UTC (rev 5206)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2010-11-22 19:37:42 UTC (rev 5207)
@@ -370,7 +370,8 @@
{
String id = g.getParentId();
if ((parent == null && id == null)
- || (id != null && id.equals(parent.getId())))
+ || (parent != null && id != null && id.equals(parent.getId()))
+ || (parent == null && id != null && id.equals("/")))
{
exoGroups.add(g);
continue;
14 years, 1 month
gatein SVN: r5206 - portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application.
by do-not-reply@jboss.org
Author: mwringe
Date: 2010-11-22 11:32:04 -0500 (Mon, 22 Nov 2010)
New Revision: 5206
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
Log:
GTNWSRP-169: if we receive a response which contains characters we should treat this as a text file. Note that some mime types (for example application/javascript) should be treated as text.
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2010-11-22 16:28:06 UTC (rev 5205)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2010-11-22 16:32:04 UTC (rev 5206)
@@ -437,7 +437,7 @@
log.trace("Try to get a resource of type: " + contentType + " for the portlet: "
+ uiPortlet.getPortletContext());
- if (contentType.startsWith("text"))
+ if (piResponse.getChars() != null || contentType.startsWith("text"))
{
context.getResponse().setContentType(contentType);
context.getWriter().write(piResponse.getContent());
14 years, 1 month
gatein SVN: r5205 - components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers.
by do-not-reply@jboss.org
Author: mwringe
Date: 2010-11-22 11:28:06 -0500 (Mon, 22 Nov 2010)
New Revision: 5205
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/DirectResourceServingHandler.java
Log:
GTNWSRP-169: check if we are receiving a mime type of application/javascript or application/x-javascript and set requires rewriting if true.
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/DirectResourceServingHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/DirectResourceServingHandler.java 2010-11-22 14:46:50 UTC (rev 5204)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/DirectResourceServingHandler.java 2010-11-22 16:28:06 UTC (rev 5205)
@@ -105,7 +105,10 @@
ResourceContext resourceContext;
MediaType type = MediaType.create(contentType);
- if (TypeDef.TEXT.equals(type.getType()))
+
+ //TODO: handle this better, we should probably have a class in the common module to determine if the MediaType should be treated as a text
+ // file or as binary content. We also need to implement the algorithm to determine the character encoding.
+ if (TypeDef.TEXT.equals(type.getType()) || (TypeDef.APPLICATION.equals(type.getType()) && (type.getSubtype().getName().contains("javascript"))))
{
// determine the charset of the content, if any
String charset = "UTF-8";
@@ -126,7 +129,7 @@
// process markup if needed
SubtypeDef subtype = type.getSubtype();
- if (SubtypeDef.HTML.equals(subtype) || SubtypeDef.CSS.equals(subtype) || SubtypeDef.JAVASCRIPT.equals(subtype) || SubtypeDef.XML.equals(subtype))
+ if (SubtypeDef.HTML.equals(subtype) || SubtypeDef.CSS.equals(subtype) || subtype.getName().contains("javascript") || SubtypeDef.XML.equals(subtype))
{
resourceContext.setRequiresRewriting(true);
}
14 years, 1 month
gatein SVN: r5204 - in epp/portal/branches/EPP_5_1_Branch: webui/framework/src/main/java/org/exoplatform/webui/application and 1 other directories.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-11-22 09:46:50 -0500 (Mon, 22 Nov 2010)
New Revision: 5204
Modified:
epp/portal/branches/EPP_5_1_Branch/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java
epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java
epp/portal/branches/EPP_5_1_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletApplicationController.java
Log:
JBEPP-657: java.lang.Exception: Cannot find the configuration for the component
Modified: epp/portal/branches/EPP_5_1_Branch/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java 2010-11-22 14:41:04 UTC (rev 5203)
+++ epp/portal/branches/EPP_5_1_Branch/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java 2010-11-22 14:46:50 UTC (rev 5204)
@@ -49,7 +49,7 @@
private HashMap<String, Object> attributes_;
- private HashMap<String, Application> applications_;
+ private volatile HashMap<String, Application> applications_;
private HashMap<String, WebRequestHandler> handlers_;
@@ -89,14 +89,36 @@
return applications;
}
- public void removeApplication(String appId)
+ public synchronized void removeApplication(String appId)
{
applications_.remove(appId);
}
- public void addApplication(Application app)
+ /**
+ * This methods will add the new application if and only if it hasn't yet been registered
+ * @param app the {@link Application} to add
+ * @return the given application if no application with the same id has been added
+ * otherwise the application already registered
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends Application> T addApplication(T app)
{
- applications_.put(app.getApplicationId(), app);
+ Application result = getApplication(app.getApplicationId());
+ if (result == null)
+ {
+ synchronized (this)
+ {
+ result = getApplication(app.getApplicationId());
+ if (result == null)
+ {
+ HashMap<String, Application> applications = new HashMap<String, Application>(applications_);
+ applications.put(app.getApplicationId(), app);
+ this.applications_ = applications;
+ result = app;
+ }
+ }
+ }
+ return (T)result;
}
public void register(WebRequestHandler handler) throws Exception
Modified: epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java 2010-11-22 14:41:04 UTC (rev 5203)
+++ epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java 2010-11-22 14:46:50 UTC (rev 5204)
@@ -19,7 +19,14 @@
package org.exoplatform.webui.application;
-import org.exoplatform.webui.config.*;
+import org.exoplatform.webui.config.Component;
+import org.exoplatform.webui.config.ComponentHandle;
+import org.exoplatform.webui.config.Event;
+import org.exoplatform.webui.config.EventInterceptor;
+import org.exoplatform.webui.config.InitParams;
+import org.exoplatform.webui.config.Param;
+import org.exoplatform.webui.config.Validator;
+import org.exoplatform.webui.config.WebuiConfiguration;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
@@ -37,9 +44,9 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
/**
* May 10, 2006
@@ -55,7 +62,7 @@
* <p/>
* The components of which we manage the configuration
*/
- private Map<String, Component> configs_ = new HashMap<String, Component>();
+ private final Map<String, Component> configs_ = new ConcurrentHashMap<String, Component>();
/** The logger. */
private final Logger log;
Modified: epp/portal/branches/EPP_5_1_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletApplicationController.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletApplicationController.java 2010-11-22 14:41:04 UTC (rev 5203)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portlet/src/main/java/org/exoplatform/webui/application/portlet/PortletApplicationController.java 2010-11-22 14:46:50 UTC (rev 5204)
@@ -133,7 +133,7 @@
{
application = new PortletApplication(getPortletConfig());
application.onInit();
- controller.addApplication(application);
+ application = controller.addApplication(application);
}
return application;
}
14 years, 1 month
gatein SVN: r5203 - epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-11-22 09:41:04 -0500 (Mon, 22 Nov 2010)
New Revision: 5203
Modified:
epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java
Log:
JBEPP-577: Concurrency problem (HashMap used in class ConfigurationManager in multithreaded environment)
Rolledback, replaced by JBEPP-657
Modified: epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java 2010-11-22 14:16:31 UTC (rev 5202)
+++ epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java 2010-11-22 14:41:04 UTC (rev 5203)
@@ -40,7 +40,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
/**
* May 10, 2006
@@ -56,16 +55,8 @@
* <p/>
* The components of which we manage the configuration
*/
- //private Map<String, Component> configs_ = new HashMap<String, Component>();
+ private Map<String, Component> configs_ = new HashMap<String, Component>();
- /**
- * Minh Hoang TO: First attempt to synchronize the map, we simply replace HashMap with ConcurrentHashMap
- * and default values for load factor, initial capacity and concurrentcyLevel
- *
- * TODO: Need to examine the performance influence in the future for a better synchronizing
- */
- private Map<String, Component> configs_ = new ConcurrentHashMap<String, Component>();
-
/** The logger. */
private final Logger log;
14 years, 1 month
gatein SVN: r5202 - in components/wci/branches/adf: test/servers/jboss51 and 1 other directories.
by do-not-reply@jboss.org
Author: alain_defrance
Date: 2010-11-22 09:16:31 -0500 (Mon, 22 Nov 2010)
New Revision: 5202
Modified:
components/wci/branches/adf/jetty/src/main/java/org/gatein/wci/jetty/Jetty6ServletContainerContext.java
components/wci/branches/adf/test/servers/jboss51/pom.xml
components/wci/branches/adf/wci/src/main/doc/wci-authentication.odp
components/wci/branches/adf/wci/src/main/doc/wci-authentication.pdf
Log:
change cargo version & fix some problems about native jetty implementation
Modified: components/wci/branches/adf/jetty/src/main/java/org/gatein/wci/jetty/Jetty6ServletContainerContext.java
===================================================================
--- components/wci/branches/adf/jetty/src/main/java/org/gatein/wci/jetty/Jetty6ServletContainerContext.java 2010-11-22 12:45:20 UTC (rev 5201)
+++ components/wci/branches/adf/jetty/src/main/java/org/gatein/wci/jetty/Jetty6ServletContainerContext.java 2010-11-22 14:16:31 UTC (rev 5202)
@@ -111,7 +111,6 @@
else if (bean instanceof WebAppContext)
{
WebAppContext wac = (WebAppContext)bean;
- System.out.println("ADDING WEBAPP " + wac.getWar());
registerWebAppContext(wac);
}
}
@@ -137,7 +136,7 @@
public void remove(Relationship relationship)
{
- //ignore event for now
+ removeBean(relationship.getChild());
}
private void startWebAppContext(WebAppContext webappContext)
@@ -192,7 +191,6 @@
private void unregisterWebAppContext(WebAppContext wac)
{
- System.out.println("UNREGISTERWEBAPPCONTEXT : " + wac);
if (monitoredContexts.contains(wac.getServletContext().getServletContextName()))
{
monitoredContexts.remove(wac.getServletContext().getServletContextName());
Modified: components/wci/branches/adf/test/servers/jboss51/pom.xml
===================================================================
--- components/wci/branches/adf/test/servers/jboss51/pom.xml 2010-11-22 12:45:20 UTC (rev 5201)
+++ components/wci/branches/adf/test/servers/jboss51/pom.xml 2010-11-22 14:16:31 UTC (rev 5202)
@@ -190,12 +190,6 @@
<!-- JBoss Deployer -->
<dependency>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-core-tools-jboss-deployer-5.1-and-onwards</artifactId>
- <version>${version.cargo}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.jboss.integration</groupId>
<artifactId>jboss-profileservice-spi</artifactId>
<version>5.1.0.SP1</version>
@@ -374,6 +368,8 @@
</plugins>
</build>
<properties>
+ <!-- Fix 1.0.3 deployment problems with jboss51 deployer-->
+ <version.cargo>1.0.2</version.cargo>
</properties>
<profiles>
Modified: components/wci/branches/adf/wci/src/main/doc/wci-authentication.odp
===================================================================
(Binary files differ)
Modified: components/wci/branches/adf/wci/src/main/doc/wci-authentication.pdf
===================================================================
(Binary files differ)
14 years, 1 month
gatein SVN: r5201 - in portal/trunk/docs/reference-guide/en: modules and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-11-22 07:45:20 -0500 (Mon, 22 Nov 2010)
New Revision: 5201
Modified:
portal/trunk/docs/reference-guide/en/images/WSRP/producer_default.png
portal/trunk/docs/reference-guide/en/images/WSRP/producer_registration.png
portal/trunk/docs/reference-guide/en/modules/WSRP.xml
Log:
- GTNWSRP-145: Improved style a little and updated producer configuration screenshots (one of them was incorrect with respect to text).
Modified: portal/trunk/docs/reference-guide/en/images/WSRP/producer_default.png
===================================================================
(Binary files differ)
Modified: portal/trunk/docs/reference-guide/en/images/WSRP/producer_registration.png
===================================================================
(Binary files differ)
Modified: portal/trunk/docs/reference-guide/en/modules/WSRP.xml
===================================================================
--- portal/trunk/docs/reference-guide/en/modules/WSRP.xml 2010-11-22 11:13:50 UTC (rev 5200)
+++ portal/trunk/docs/reference-guide/en/modules/WSRP.xml 2010-11-22 12:45:20 UTC (rev 5201)
@@ -933,24 +933,25 @@
<title>Importing and exporting portlets</title>
<para>Import and export are new functionalities added in WSRP 2. Exporting a portlet allows a consumer to get
an opaque representation of the portlet which can then be use by the corresponding import operation to
- reconstitute it. This is mostly used in migration scenarios during batch operations. Since &PRODUCT_NAME;
+ reconstitute it. It is mostly used in migration scenarios during batch operations. Since &PRODUCT_NAME;
does not currently support automated migration of portal data, the functionality that we provide as part of
WSRP 2 is necessarily less complete than it could be with full portal support.
</para>
- <para>The import/export implementation in &PRODUCT; allows users to export portlets from a given consumer and
- then import them back to replace existing portlets assigned to windows on pages by the previously exported
- portlets. Let us walk through an example to make things clearer.
+ <para>The import/export implementation in &PRODUCT; allows users to export portlets from a given consumer.
+ These portlets can then be used to replace existing content on pages. This is accomplished by assiging
+ previously exported portlets to replace the content displayed by windows on the portal's pages. Let us walk
+ through an example to make things clearer.
</para>
<para>Clicking on the "Export" action for a given consumer will display the list of portlets currently made
- available by this specific consumer, as shown below:
+ available by this specific consumer. An example of such a list is shown below:
</para>
<mediaobject>
<imageobject>
<imagedata fileref="images/WSRP/export_portlet_list.png" format="PNG" align="center" valign="middle"/>
</imageobject>
</mediaobject>
- <para>Once you have selected portlets to export, you can then click on the "Export" button to export the selected
- portlets, which will then be made available for later import:
+ <para>Once portlets have been selected, they can be exported by clicking on the "Export" button thus making
+ them available for later import:
</para>
<mediaobject>
<imageobject>
@@ -1009,7 +1010,7 @@
portlet name to indicate that we want to import its data and then select the
<literal>page1</literal>
in the list of available pages. The screen will then refresh to display the list of available windows on
- that page, as seen below:
+ that page, similar to the one seen below:
</para>
<mediaobject>
<imageobject>
@@ -1020,8 +1021,8 @@
being able to complete the import operation. Let's select the
<literal>/samples-remotecontroller-portlet.RemoteControl (remote)</literal>
window, at which point the "Import" button will become enabled, indicating that we now have all the
- necessary data to perform the import. If all goes well, pressing that button should result in the following
- screen:
+ necessary data to perform the import. If all goes well, pressing that button should result in a screen
+ similar to the one below:
</para>
<mediaobject>
<imageobject>
@@ -1120,6 +1121,8 @@
registration property description for which consumers must provide acceptable values to successfully
register.
</para>
+ <para>New in &PRODUCT;, we now display the WSDL URLs to access &PRODUCT_NAME;'s WSRP producer either in WSRP 1
+ or WSRP 2 mode.</para>
</sect2>
<sect2 id="registration-configuration">
14 years, 1 month
gatein SVN: r5200 - in epp/portal/branches/EPP_5_1_Branch: component/web/security/src/main/java/org/exoplatform/web/security/proxy and 3 other directories.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-11-22 06:13:50 -0500 (Mon, 22 Nov 2010)
New Revision: 5200
Added:
epp/portal/branches/EPP_5_1_Branch/component/web/security/src/main/java/org/exoplatform/web/security/proxy/
epp/portal/branches/EPP_5_1_Branch/component/web/security/src/main/java/org/exoplatform/web/security/proxy/ProxyFilterService.java
epp/portal/branches/EPP_5_1_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ProxyServletFilter.java
Removed:
epp/portal/branches/EPP_5_1_Branch/component/web/security/src/main/java/org/exoplatform/web/security/proxy/ProxyFilterService.java
Modified:
epp/portal/branches/EPP_5_1_Branch/gadgets/server/src/main/webapp/WEB-INF/web.xml
epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml
Log:
JBEPP-642: Gadget proxy can serve as anonymous proxy
GTNPORTAL-1674: Domain based gadget proxy filtering
Copied: epp/portal/branches/EPP_5_1_Branch/component/web/security/src/main/java/org/exoplatform/web/security/proxy (from rev 5184, portal/trunk/component/web/security/src/main/java/org/exoplatform/web/security/proxy)
Deleted: epp/portal/branches/EPP_5_1_Branch/component/web/security/src/main/java/org/exoplatform/web/security/proxy/ProxyFilterService.java
===================================================================
--- portal/trunk/component/web/security/src/main/java/org/exoplatform/web/security/proxy/ProxyFilterService.java 2010-11-19 17:45:49 UTC (rev 5184)
+++ epp/portal/branches/EPP_5_1_Branch/component/web/security/src/main/java/org/exoplatform/web/security/proxy/ProxyFilterService.java 2010-11-22 11:13:50 UTC (rev 5200)
@@ -1,194 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.web.security.proxy;
-
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.container.xml.ValuesParam;
-import org.gatein.common.logging.Logger;
-import org.gatein.common.logging.LoggerFactory;
-
-import javax.servlet.http.HttpServletRequest;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.regex.Pattern;
-
-/**
- * The proxy filter service is used for filtering http access when it is performed by GateIn.
- * The following rules applies to the filtering:
- *
- * <ul>
- * <li>Same host URI grants access</li>
- * <li>A black list match of the host denies access</li>
- * <li>A white list match of the host grants access</li>
- * <li>Access is denied</li>
- * </ul>
- *
- * The service is configured by
- * <ul>
- * <li>a <code>white-list</code> parameter that specifies a list of white list rules</li>
- * <li>a <code>black-list</code> parameter that specifies a list of black list rules</li>
- * </ul>
- *
- * Rules are trimmed and the wildcard character can be used to match any number of character.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ProxyFilterService
-{
-
- /** . */
- private static final Logger log = LoggerFactory.getLogger(ProxyFilterService.class);
-
- /** . */
- private final List<Pattern> whiteList;
-
- /** . */
- private final List<Pattern> blackList;
-
- public ProxyFilterService(InitParams params)
- {
- this.whiteList = createList(params.getValuesParam("white-list"));
- this.blackList = createList(params.getValuesParam("black-list"));
-
- // A bit of logging
- log.debug("Proxy filter service white list " + whiteList);
- log.debug("Proxy filter service black list " + blackList);
- }
-
- private List<Pattern> createList(ValuesParam values)
- {
- if (values != null)
- {
- ArrayList<Pattern> patterns = new ArrayList<Pattern>();
- for (Object value : values.getValues())
- {
- String s = ((String)value).trim();
- StringBuilder sb = new StringBuilder("^");
- for (int i = 0;i < s.length();i++)
- {
- char c = s.charAt(i);
- switch (c)
- {
- case '*':
- sb.append(".*");
- break;
- case '[':
- case '\\':
- case '^':
- case '$':
- case '.':
- case '|':
- case '?':
- case '+':
- case '(':
- case ')':
- sb.append("\\");
- sb.append(c);
- break;
- default:
- sb.append(c);
- break;
- }
- }
- sb.append("$");
- Pattern pattern = Pattern.compile(sb.toString());
- patterns.add(pattern);
- }
- return Collections.unmodifiableList(patterns);
- }
- else
- {
- return Collections.emptyList();
- }
- }
-
- /**
- * Returns true if access to a remote URI should be granted.
- *
- * @param request the servlet request doing the request
- * @param container the portal container associated with the request
- * @param remoteURI the remote URI to check
- * @return the access to the remote URI
- */
- public boolean accept(
- HttpServletRequest request,
- PortalContainer container,
- URI remoteURI)
- {
- boolean trace = log.isTraceEnabled();
-
- //
- String remoteHost = remoteURI.getHost();
-
- // Filter based on same server name
- String remoteServerName = request.getServerName();
- if (remoteHost.equals(remoteServerName))
- {
- if (trace)
- {
- log.trace("Same host matching for URI " + remoteURI);
- }
- return true;
- }
-
- // Otherwise go through black list first
- for (int i = 0;i < blackList.size();i++)
- {
- Pattern pattern = blackList.get(i);
- boolean rejected = pattern.matcher(remoteHost).matches();
- if (trace)
- {
- log.trace("Black list " + pattern + (rejected ? " matched URI " : " did not match URI") + remoteURI);
- }
- if (rejected)
- {
- return false;
- }
- }
-
- // Finally go through white list first
- for (int i = 0;i < whiteList.size();i++)
- {
- Pattern pattern = whiteList.get(i);
- boolean accepted = pattern.matcher(remoteHost).matches();
- if (trace)
- {
- log.trace("White list " + pattern + (accepted ? " matched URI " : " did not match URI") + remoteURI);
- }
- if (accepted)
- {
- return true;
- }
- }
-
- //
- if (trace)
- {
- log.trace("Rejected implicitely uri " + remoteURI);
- }
-
- //
- return false;
- }
-}
Copied: epp/portal/branches/EPP_5_1_Branch/component/web/security/src/main/java/org/exoplatform/web/security/proxy/ProxyFilterService.java (from rev 5184, portal/trunk/component/web/security/src/main/java/org/exoplatform/web/security/proxy/ProxyFilterService.java)
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/web/security/src/main/java/org/exoplatform/web/security/proxy/ProxyFilterService.java (rev 0)
+++ epp/portal/branches/EPP_5_1_Branch/component/web/security/src/main/java/org/exoplatform/web/security/proxy/ProxyFilterService.java 2010-11-22 11:13:50 UTC (rev 5200)
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.web.security.proxy;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.ValuesParam;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
+
+import javax.servlet.http.HttpServletRequest;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Pattern;
+
+/**
+ * The proxy filter service is used for filtering http access when it is performed by GateIn.
+ * The following rules applies to the filtering:
+ *
+ * <ul>
+ * <li>Same host URI grants access</li>
+ * <li>A black list match of the host denies access</li>
+ * <li>A white list match of the host grants access</li>
+ * <li>Access is denied</li>
+ * </ul>
+ *
+ * The service is configured by
+ * <ul>
+ * <li>a <code>white-list</code> parameter that specifies a list of white list rules</li>
+ * <li>a <code>black-list</code> parameter that specifies a list of black list rules</li>
+ * </ul>
+ *
+ * Rules are trimmed and the wildcard character can be used to match any number of character.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ProxyFilterService
+{
+
+ /** . */
+ private static final Logger log = LoggerFactory.getLogger(ProxyFilterService.class);
+
+ /** . */
+ private final List<Pattern> whiteList;
+
+ /** . */
+ private final List<Pattern> blackList;
+
+ public ProxyFilterService(InitParams params)
+ {
+ this.whiteList = createList(params.getValuesParam("white-list"));
+ this.blackList = createList(params.getValuesParam("black-list"));
+
+ // A bit of logging
+ log.debug("Proxy filter service white list " + whiteList);
+ log.debug("Proxy filter service black list " + blackList);
+ }
+
+ private List<Pattern> createList(ValuesParam values)
+ {
+ if (values != null)
+ {
+ ArrayList<Pattern> patterns = new ArrayList<Pattern>();
+ for (Object value : values.getValues())
+ {
+ String s = ((String)value).trim();
+ StringBuilder sb = new StringBuilder("^");
+ for (int i = 0;i < s.length();i++)
+ {
+ char c = s.charAt(i);
+ switch (c)
+ {
+ case '*':
+ sb.append(".*");
+ break;
+ case '[':
+ case '\\':
+ case '^':
+ case '$':
+ case '.':
+ case '|':
+ case '?':
+ case '+':
+ case '(':
+ case ')':
+ sb.append("\\");
+ sb.append(c);
+ break;
+ default:
+ sb.append(c);
+ break;
+ }
+ }
+ sb.append("$");
+ Pattern pattern = Pattern.compile(sb.toString());
+ patterns.add(pattern);
+ }
+ return Collections.unmodifiableList(patterns);
+ }
+ else
+ {
+ return Collections.emptyList();
+ }
+ }
+
+ /**
+ * Returns true if access to a remote URI should be granted.
+ *
+ * @param request the servlet request doing the request
+ * @param container the portal container associated with the request
+ * @param remoteURI the remote URI to check
+ * @return the access to the remote URI
+ */
+ public boolean accept(
+ HttpServletRequest request,
+ PortalContainer container,
+ URI remoteURI)
+ {
+ boolean trace = log.isTraceEnabled();
+
+ //
+ String remoteHost = remoteURI.getHost();
+
+ // Filter based on same server name
+ String remoteServerName = request.getServerName();
+ if (remoteHost.equals(remoteServerName))
+ {
+ if (trace)
+ {
+ log.trace("Same host matching for URI " + remoteURI);
+ }
+ return true;
+ }
+
+ // Otherwise go through black list first
+ for (int i = 0;i < blackList.size();i++)
+ {
+ Pattern pattern = blackList.get(i);
+ boolean rejected = pattern.matcher(remoteHost).matches();
+ if (trace)
+ {
+ log.trace("Black list " + pattern + (rejected ? " matched URI " : " did not match URI") + remoteURI);
+ }
+ if (rejected)
+ {
+ return false;
+ }
+ }
+
+ // Finally go through white list first
+ for (int i = 0;i < whiteList.size();i++)
+ {
+ Pattern pattern = whiteList.get(i);
+ boolean accepted = pattern.matcher(remoteHost).matches();
+ if (trace)
+ {
+ log.trace("White list " + pattern + (accepted ? " matched URI " : " did not match URI") + remoteURI);
+ }
+ if (accepted)
+ {
+ return true;
+ }
+ }
+
+ //
+ if (trace)
+ {
+ log.trace("Rejected implicitely uri " + remoteURI);
+ }
+
+ //
+ return false;
+ }
+}
Copied: epp/portal/branches/EPP_5_1_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ProxyServletFilter.java (from rev 5184, portal/trunk/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ProxyServletFilter.java)
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ProxyServletFilter.java (rev 0)
+++ epp/portal/branches/EPP_5_1_Branch/gadgets/core/src/main/java/org/exoplatform/portal/gadget/core/ProxyServletFilter.java 2010-11-22 11:13:50 UTC (rev 5200)
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.gadget.core;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.web.security.proxy.ProxyFilterService;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URI;
+
+/**
+ * The proxy servlet filter is a servlet filter placed in front of Shindig proxy servlet.
+ * It filters a request and allows only the request satisfying the following:
+ * <ul>
+ * <li>the request has an URL parameter</li>
+ * <li>the request can locate a container associated with the request</li>
+ * <li>the request can locate the {@link ProxyFilterService} within the container</li>
+ * <li>the method {@link ProxyFilterService#accept(HttpServletRequest, PortalContainer, URI)} invocation returns true</li>
+ * </ul>
+ *
+ * This service is located in front and does not use Shindig integration point (such as org.apache.shindig.gadgets.GadgetBlacklist}
+ * as the execution is performed by a thread that is not associated with the portal request precluding any access to
+ * information enabling contextual filtering.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ProxyServletFilter implements Filter
+{
+
+ /** . */
+ private ServletContext ctx;
+
+ public void init(FilterConfig cfg) throws ServletException
+ {
+ this.ctx = cfg.getServletContext();
+ }
+
+ public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException
+ {
+ HttpServletRequest hreq = (HttpServletRequest)req;
+ HttpServletResponse hresp = (HttpServletResponse)resp;
+
+ // Get URL
+ String url = hreq.getParameter("url");
+ if (url == null)
+ {
+ hresp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "No URL");
+ }
+ else
+ {
+ // Get container
+ PortalContainer container = PortalContainer.getInstance(ctx);
+ if (container == null)
+ {
+ hresp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not access container for servlet context " + ctx.getContextPath());
+ }
+ else
+ {
+ ProxyFilterService service = (ProxyFilterService)container.getComponentInstanceOfType(ProxyFilterService.class);
+ if (service == null)
+ {
+ hresp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not access proxy filter service " + ctx.getContextPath());
+ }
+ else
+ {
+ URI uri = URI.create(url);
+ if (!service.accept(hreq, container, uri))
+ {
+ hresp.sendError(HttpServletResponse.SC_FORBIDDEN, "Gadget " + url + " is blacklisted");
+ }
+ else
+ {
+ chain.doFilter(req, resp);
+ }
+ }
+ }
+ }
+ }
+
+ public void destroy()
+ {
+ }
+}
Modified: epp/portal/branches/EPP_5_1_Branch/gadgets/server/src/main/webapp/WEB-INF/web.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/gadgets/server/src/main/webapp/WEB-INF/web.xml 2010-11-22 07:01:01 UTC (rev 5199)
+++ epp/portal/branches/EPP_5_1_Branch/gadgets/server/src/main/webapp/WEB-INF/web.xml 2010-11-22 11:13:50 UTC (rev 5200)
@@ -26,6 +26,9 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="Shindig"
version="2.5">
+
+ <display-name>eXoGadgetServer</display-name>
+
<!-- configuration -->
<!-- If you have your own Guice module(s), put them here as a colon-separated list. -->
<context-param>
@@ -44,6 +47,11 @@
<filter-name>authFilter</filter-name>
<filter-class>org.apache.shindig.auth.AuthenticationServletFilter</filter-class>
</filter>
+
+ <filter>
+ <filter-name>ProxyServletFilter</filter-name>
+ <filter-class>org.exoplatform.portal.gadget.core.ProxyServletFilter</filter-class>
+ </filter>
<filter-mapping>
<filter-name>authFilter</filter-name>
@@ -65,6 +73,11 @@
<url-pattern>/gadgets/api/rpc/*</url-pattern>
</filter-mapping>
+ <filter-mapping>
+ <filter-name>ProxyServletFilter</filter-name>
+ <servlet-name>proxy</servlet-name>
+ </filter-mapping>
+
<listener>
<listener-class>org.apache.shindig.common.servlet.GuiceServletContextListener</listener-class>
</listener>
Modified: epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml 2010-11-22 07:01:01 UTC (rev 5199)
+++ epp/portal/branches/EPP_5_1_Branch/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml 2010-11-22 11:13:50 UTC (rev 5200)
@@ -163,6 +163,23 @@
<type>org.exoplatform.groovyscript.text.TemplateService</type>
</component>
+ <component>
+ <key>org.exoplatform.web.security.proxy.ProxyFilterService</key>
+ <type>org.exoplatform.web.security.proxy.ProxyFilterService</type>
+ <init-params>
+ <values-param>
+ <!-- The white list -->
+ <name>white-list</name>
+ <!-- We accept anything not black listed -->
+ <value>*</value>
+ </values-param>
+ <values-param>
+ <name>black-list</name>
+ <value>*.evil.org</value>
+ </values-param>
+ </init-params>
+ </component>
+
<external-component-plugins>
<target-component>org.exoplatform.services.cache.ExoCacheFactory</target-component>
<component-plugin>
14 years, 1 month