portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r702905 - in /portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto: core/PortletContainerImpl.java internal/impl/BaseURLImpl.java
Date Wed, 08 Oct 2008 15:18:56 GMT
Author: ate
Date: Wed Oct  8 08:18:55 2008
New Revision: 702905

URL: http://svn.apache.org/viewvc?rev=702905&view=rev
Log:
Rolling back PortletContainerImpl and BaseURLImpl changes from r662396 as it was done using
a not properly merged/updated base version.
As result, several changes made *before* that point were overridden again and resulted in
the current broken build situation.
After this rollback, I'll apply the intended fixes for r662396 (Pluto-484), as well as try
to merge back in the the later changes to these files for PLUTO-488 and PLUTO-501 

Modified:
    portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java
    portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/BaseURLImpl.java

Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java?rev=702905&r1=702904&r2=702905&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java
(original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/core/PortletContainerImpl.java
Wed Oct  8 08:18:55 2008
@@ -17,22 +17,19 @@
 package org.apache.pluto.core;
 
 import java.io.IOException;
-import java.io.PrintWriter;
 import java.util.Map;
 
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
+import javax.portlet.Event;
 import javax.portlet.PortletException;
 import javax.portlet.PortletPreferences;
 import javax.portlet.PortletRequest;
 import javax.portlet.PortletSecurityException;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
-import javax.portlet.StateAwareResponse;
-import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import javax.portlet.Event;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -41,34 +38,27 @@
 import org.apache.pluto.OptionalContainerServices;
 import org.apache.pluto.PortletContainer;
 import org.apache.pluto.PortletContainerException;
+import org.apache.pluto.PortletEntity;
 import org.apache.pluto.PortletWindow;
 import org.apache.pluto.RequiredContainerServices;
-import org.apache.pluto.descriptors.portlet.PortletAppDD;
-//import org.apache.pluto.driver.core.PortletWindowImpl;
-import org.apache.pluto.internal.PortletDescriptorRegistry;
-import org.apache.pluto.internal.InternalPortletRequest;
-import org.apache.pluto.internal.InternalPortletResponse;
 import org.apache.pluto.internal.InternalActionRequest;
 import org.apache.pluto.internal.InternalActionResponse;
-import org.apache.pluto.internal.InternalEventRequest;
-import org.apache.pluto.internal.InternalEventResponse;
-import org.apache.pluto.internal.InternalPortletWindow;
+import org.apache.pluto.internal.InternalPortletContext;
+import org.apache.pluto.internal.InternalPortletRequest;
+import org.apache.pluto.internal.InternalPortletResponse;
 import org.apache.pluto.internal.InternalRenderRequest;
 import org.apache.pluto.internal.InternalRenderResponse;
 import org.apache.pluto.internal.InternalResourceRequest;
 import org.apache.pluto.internal.InternalResourceResponse;
+import org.apache.pluto.internal.impl.EventRequestImpl;
+import org.apache.pluto.internal.impl.EventResponseImpl;
+import org.apache.pluto.internal.impl.PortletRequestImpl;
+import org.apache.pluto.internal.impl.PortletResponseImpl;
 import org.apache.pluto.internal.impl.StateAwareResponseImpl;
 import org.apache.pluto.spi.EventProvider;
 import org.apache.pluto.spi.FilterManager;
 import org.apache.pluto.spi.PortletURLProvider;
 import org.apache.pluto.spi.optional.PortletInvokerService;
-import org.apache.pluto.internal.impl.EventRequestImpl;
-import org.apache.pluto.internal.impl.EventResponseImpl;
-import org.apache.pluto.internal.impl.InternalPortletWindowImpl;
-import org.apache.pluto.internal.impl.PortletRequestImpl;
-import org.apache.pluto.internal.impl.PortletResponseImpl;
-import org.apache.pluto.internal.impl.ResourceRequestImpl;
-import org.apache.pluto.internal.impl.ResourceResponseImpl;
 import org.apache.pluto.util.StringManager;
 
 
@@ -99,9 +89,6 @@
     /** The optional container services associated with this container. */
     private final OptionalContainerServices optionalContainerServices;
     
-    /** The servlet context associated with this container. */
-    private ServletContext servletContext;
-
     /** Flag indicating whether or not we've been initialized. */
     private boolean initialized = false;
     
@@ -130,14 +117,8 @@
      * Initialize the container for use within the given configuration scope.
      * @param servletContext  the servlet context of the portal webapp.
      */
-    public void init(ServletContext servletContext)
+    public void init()
     throws PortletContainerException {
-    	if (servletContext == null) {
-    		throw new PortletContainerException(
-    				"Unable to initialize portlet container [" + name + "]: "
-    				+ "servlet context is null.");
-    	}
-        this.servletContext = servletContext;
         this.initialized = true;
         infoWithName("Container initialized successfully.");
     }
@@ -154,7 +135,6 @@
      * Destroy this container.
      */
     public void destroy() {
-        this.servletContext = null;
         this.initialized = false;
         infoWithName("Container destroyed.");
     }
@@ -179,60 +159,37 @@
     	
     	ensureInitialized();
     	
-    	
-    	ServletContext srvCtx = null;
-    	
-    	try
-    	{
-    		srvCtx = PortletContextManager.getPortletContext(servletContext,
-                    portletWindow.getContextPath());
-    		
-    	} catch(PortletContainerException ex)
-    	{
-    		LOG.error("Can get portlet context for: " + portletWindow.getContextPath(), ex); 	

-    	}
-    
-    	if (srvCtx == null) 
-		{
-    		PrintWriter writer=null;
-    		writer = response.getWriter();
-    		writer.write("<div class=\"portlet-msg-error\">Portlet '" + portletWindow.getContextPath()
+ "' cannot be loaded because of problems getting servlet context. Pleae check your configuration.</div>");
-    		return; // Can't get portlet context!
-		}
-    		
-    	
-    	
-        InternalPortletWindow internalPortletWindow =
-        	new InternalPortletWindowImpl(srvCtx, portletWindow);
-        
         debugWithName("Render request received for portlet: "
-        		+ portletWindow.getPortletName());
+        		+ portletWindow.getPortletEntity().getPortletDefinition().getPortletName());
         
         InternalRenderRequest renderRequest = getOptionalContainerServices().getPortletEnvironmentService()
-            .createRenderRequest(this, request, response, internalPortletWindow);
+            .createRenderRequest(this, request, response, portletWindow);
 
         InternalRenderResponse renderResponse = getOptionalContainerServices().getPortletEnvironmentService()
-            .createRenderResponse(this, request, response, internalPortletWindow);
+            .createRenderResponse(this, request, response, portletWindow);
 
+        String appId = portletWindow.getPortletEntity().getPortletDefinition().getApplication().getId();
+        InternalPortletContext portletContext = optionalContainerServices.getPortletRegistryService().getPortletContext(appId);
+        
         PortletInvokerService invoker = optionalContainerServices.getPortletInvokerService();
 
         try {
-            ContainerInvocation.setInvocation(this, internalPortletWindow);
+            ContainerInvocation.setInvocation(this, portletWindow);
             //Filter initialisation
-            FilterManager filterManager = filterInitialisation(internalPortletWindow,PortletRequest.RENDER_PHASE);
-            invoker.render(renderRequest, renderResponse, internalPortletWindow, filterManager);
+            FilterManager filterManager = filterInitialisation(portletWindow,PortletRequest.RENDER_PHASE);
+            invoker.render(portletContext.getServletContext(), renderRequest, renderResponse,
portletWindow, filterManager);
         } finally {
             ContainerInvocation.clearInvocation();
         }
         
         debugWithName("Portlet rendered for: "
-        		+ portletWindow.getPortletName());
+        		+ portletWindow.getPortletEntity().getPortletDefinition().getPortletName());
     }
 
     /**
      * Indicates that a portlet resource Serving occured in the current request and calls
      * the processServeResource method of this portlet.
-     * @param internalPortletWindow the portlet Window
+     * @param PortletWindow the portlet Window
      * @param request               the servlet request
      * @param response              the servlet response
      * @throws PortletException          if one portlet has trouble fulfilling
@@ -247,32 +204,30 @@
 		
     	ensureInitialized();
     	
-        InternalPortletWindow internalPortletWindow =
-        	new InternalPortletWindowImpl(
-                    PortletContextManager.getPortletContext(servletContext,
-                        portletWindow.getContextPath()),
-                    portletWindow);
         debugWithName("Resource request received for portlet: "
-        		+ portletWindow.getPortletName());
+        		+ portletWindow.getPortletEntity().getPortletDefinition().getPortletName());
         
         InternalResourceRequest resourceRequest = getOptionalContainerServices().getPortletEnvironmentService()
-            .createResourceRequest(this, request, response, internalPortletWindow);
+            .createResourceRequest(this, request, response, portletWindow);
 
         InternalResourceResponse resourceResponse = getOptionalContainerServices().getPortletEnvironmentService()
-            .createResourceResponse(this, request, response, internalPortletWindow);
+            .createResourceResponse(this, request, response, portletWindow);
 
+        String appId = portletWindow.getPortletEntity().getPortletDefinition().getApplication().getId();
+        InternalPortletContext portletContext = optionalContainerServices.getPortletRegistryService().getPortletContext(appId);
+        
         PortletInvokerService invoker = optionalContainerServices.getPortletInvokerService();
 
         try {
-            ContainerInvocation.setInvocation(this, internalPortletWindow);
-            FilterManager filterManager = filterInitialisation(internalPortletWindow,PortletRequest.RESOURCE_PHASE);
-            invoker.serveResource(resourceRequest, resourceResponse, internalPortletWindow,
filterManager);
+            ContainerInvocation.setInvocation(this, portletWindow);
+            FilterManager filterManager = filterInitialisation(portletWindow,PortletRequest.RESOURCE_PHASE);
+            invoker.serveResource(portletContext.getServletContext(), resourceRequest, resourceResponse,
portletWindow, filterManager);
         } finally {
             ContainerInvocation.clearInvocation();
         }
         
         debugWithName("Portlet resource for: "
-        		+ portletWindow.getPortletName());
+        		+ portletWindow.getPortletEntity().getPortletDefinition().getPortletName());
 	}
     
     /**
@@ -293,35 +248,33 @@
     	
     	ensureInitialized();
     	
-        InternalPortletWindow internalPortletWindow =
-        	new InternalPortletWindowImpl(
-                    PortletContextManager.getPortletContext(servletContext,
-                        portletWindow.getContextPath()), portletWindow);
-
         debugWithName("Action request received for portlet: "
-    			+ portletWindow.getPortletName());
+    			+ portletWindow.getPortletEntity().getPortletDefinition().getPortletName());
     	
         InternalActionRequest actionRequest = getOptionalContainerServices().getPortletEnvironmentService()
-            .createActionRequest(this, request, response, internalPortletWindow);
+            .createActionRequest(this, request, response, portletWindow);
 
         InternalActionResponse actionResponse = getOptionalContainerServices().getPortletEnvironmentService()
-            .createActionResponse(this, request, response, internalPortletWindow);
+            .createActionResponse(this, request, response, portletWindow);
+
+        String appId = portletWindow.getPortletEntity().getPortletDefinition().getApplication().getId();
+        InternalPortletContext portletContext = optionalContainerServices.getPortletRegistryService().getPortletContext(appId);
 
         PortletInvokerService invoker = optionalContainerServices.getPortletInvokerService();
 
         try {
-            ContainerInvocation.setInvocation(this, internalPortletWindow);
-            FilterManager filterManager = filterInitialisation(internalPortletWindow,PortletRequest.ACTION_PHASE);
-            invoker.action(actionRequest, actionResponse, internalPortletWindow, filterManager);
+            ContainerInvocation.setInvocation(this, portletWindow);
+            FilterManager filterManager = filterInitialisation(portletWindow,PortletRequest.ACTION_PHASE);
+            invoker.action(portletContext.getServletContext(), actionRequest, actionResponse,
portletWindow, filterManager);
         }
         finally {
             ContainerInvocation.clearInvocation();
         }
 
         debugWithName("Portlet action processed for: "
-        		+ portletWindow.getPortletName());
+        		+ portletWindow.getPortletEntity().getPortletDefinition().getPortletName());
         
-        PortletURLProvider portletURLProvider = requiredContainerServices.getPortalCallbackService().getPortletURLProvider(request,
internalPortletWindow);
+        PortletURLProvider portletURLProvider = requiredContainerServices.getPortalCallbackService().getPortletURLProvider(request,
portletWindow);
         
         portletURLProvider.savePortalURL(request);
         saveChangedParameters((PortletRequest)actionRequest, (StateAwareResponseImpl)actionResponse,
portletURLProvider);
@@ -339,7 +292,7 @@
         	debugWithName("No redirect location specified.");
             PortletURLProvider redirectURL = requiredContainerServices
             		.getPortalCallbackService()
-            		.getPortletURLProvider(request, internalPortletWindow);
+            		.getPortletURLProvider(request, portletWindow);
             
             saveChangedParameters((PortletRequest)actionRequest, (StateAwareResponseImpl)actionResponse,
redirectURL);
             
@@ -369,34 +322,31 @@
     	
     	ensureInitialized();
     	
-        InternalPortletWindow internalPortletWindow =
-        		new InternalPortletWindowImpl(
-                    PortletContextManager.getPortletContext(servletContext,
-                        portletWindow.getContextPath()),
-                    portletWindow);
-
         debugWithName("Load request received for portlet: "
-        		+ portletWindow.getPortletName());
+        		+ portletWindow.getPortletEntity().getPortletDefinition().getPortletName());
         
 
         InternalRenderRequest renderRequest =
             getOptionalContainerServices().getPortletEnvironmentService()
-                .createRenderRequest(this, request, response, internalPortletWindow);
+                .createRenderRequest(this, request, response, portletWindow);
 
         InternalRenderResponse renderResponse =
             getOptionalContainerServices().getPortletEnvironmentService()
-                .createRenderResponse(this, request, response, internalPortletWindow);
+                .createRenderResponse(this, request, response, portletWindow);
+
+        String appId = portletWindow.getPortletEntity().getPortletDefinition().getApplication().getId();
+        InternalPortletContext portletContext = optionalContainerServices.getPortletRegistryService().getPortletContext(appId);
 
         PortletInvokerService invoker = optionalContainerServices.getPortletInvokerService();
 
         try {
-            ContainerInvocation.setInvocation(this, internalPortletWindow);
-            invoker.load(renderRequest, renderResponse, internalPortletWindow);
+            ContainerInvocation.setInvocation(this, portletWindow);
+            invoker.load(portletContext.getServletContext(), renderRequest, renderResponse,
portletWindow);
         } finally {
             ContainerInvocation.clearInvocation();
         }
 
-        debugWithName("Portlet loaded for: " + portletWindow.getPortletName());
+        debugWithName("Portlet loaded for: " + portletWindow.getPortletEntity().getPortletDefinition().getPortletName());
     }
     
 
@@ -406,26 +356,23 @@
     throws PortletException, IOException, PortletContainerException {
         ensureInitialized();
 
-        InternalPortletWindow internalPortletWindow =
-            new InternalPortletWindowImpl(
-                PortletContextManager.getPortletContext(servletContext,
-                    portletWindow.getContextPath()), portletWindow);
-
         debugWithName("Admin request received for portlet: "
-            +portletWindow.getPortletName());
+            +portletWindow.getPortletEntity().getPortletDefinition().getPortletName());
 
         InternalPortletRequest internalRequest =
-            new AdminRequest(this, internalPortletWindow, servletRequest) { };
+            new AdminRequest(this, portletWindow, servletRequest) { };
 
         InternalPortletResponse internalResponse =
-            new AdminResponse(this, internalPortletWindow, servletRequest, servletResponse);
+            new AdminResponse(this, portletWindow, servletRequest, servletResponse);
 
-        PortletInvokerService invoker =
-            optionalContainerServices.getPortletInvokerService();
+        String appId = portletWindow.getPortletEntity().getPortletDefinition().getApplication().getId();
+        InternalPortletContext portletContext = optionalContainerServices.getPortletRegistryService().getPortletContext(appId);
+        
+        PortletInvokerService invoker = optionalContainerServices.getPortletInvokerService();
 
         try {
-            ContainerInvocation.setInvocation(this, internalPortletWindow);
-            invoker.admin(internalRequest, internalResponse, internalPortletWindow);
+            ContainerInvocation.setInvocation(this, portletWindow);
+            invoker.admin(portletContext.getServletContext(), internalRequest, internalResponse,
portletWindow);
         } finally {
             ContainerInvocation.clearInvocation();
         }
@@ -453,43 +400,6 @@
         return optionalContainerServices;
     }
     
-    public PortletAppDD getPortletApplicationDescriptor(String context) 
-        throws PortletContainerException {
-        
-        // make sure the container has initialized
-        ensureInitialized();
-        
-        // sanity check
-        if (context == null || context.trim().equals("")) {
-            final String msg = "Context was null or the empty string.";
-            errorWithName(msg);
-            throw new PortletContainerException(msg);
-        }
-        
-        // obtain the context of the portlet
-        ServletContext portletCtx = PortletContextManager.getPortletContext(servletContext,
context);
-        
-        // obtain the portlet application descriptor for the portlet
-        // context.
-        PortletAppDD portletAppDD = PortletDescriptorRegistry
-                                        .getRegistry()
-                                        .getPortletAppDD(portletCtx);
-        
-        // we can't return null
-        if (portletAppDD == null) {
-            final String msg = "Obtained a null portlet application description for " +
-                "portlet context [" + context + "]";
-            errorWithName(msg);
-            throw new PortletContainerException(msg);
-        }
-        
-        return portletAppDD;        
-    }
-    
-    public ServletContext getServletContext() {
-		return servletContext;
-	}
-    
     /**
      * Fire Event for the portlet associated with the given portlet window and eventName
      * @param portletWindow  the portlet window.
@@ -508,35 +418,31 @@
 
     	ensureInitialized();
 
-    	InternalPortletWindow internalPortletWindow = new InternalPortletWindowImpl(
-                PortletContextManager.getPortletContext(servletContext,
-                		window.getContextPath()), window);
-//    	InternalPortletWindow internalPortletWindow =
-//    		new PortletWindowImpl(servletContext, window);
     	debugWithName("Event request received for portlet: "
-    			+ window.getPortletName());
+    			+ window.getPortletEntity().getPortletDefinition().getPortletName());
 
     	EventRequestImpl eventRequest = new EventRequestImpl(
-    			this, internalPortletWindow, request, event);
+    			this, window, request, event);
     	EventResponseImpl eventResponse = new EventResponseImpl(
-    			this, internalPortletWindow, request, response);
+    			this, window, request, response);
 
     	
+        String appId = window.getPortletEntity().getPortletDefinition().getApplication().getId();
+        InternalPortletContext portletContext = optionalContainerServices.getPortletRegistryService().getPortletContext(appId);
+
     	PortletInvokerService invoker = optionalContainerServices.getPortletInvokerService();
 
         try {
-            ContainerInvocation.setInvocation(this, internalPortletWindow);
-            FilterManager filterManager = filterInitialisation(internalPortletWindow,PortletRequest.EVENT_PHASE);
-            invoker.event(eventRequest, eventResponse, internalPortletWindow, filterManager);
+            ContainerInvocation.setInvocation(this, window);
+            FilterManager filterManager = filterInitialisation(window,PortletRequest.EVENT_PHASE);
+            invoker.event(portletContext.getServletContext(), eventRequest, eventResponse,
window, filterManager);
         }
         finally {
             ContainerInvocation.clearInvocation();
         }
-//    	PortletInvoker invoker = new PortletInvoker(internalPortletWindow);
-//    	invoker.event(eventRequest, eventResponse);
 
     	debugWithName("Portlet event processed for: "
-    			+ window.getPortletName());
+    			+ window.getPortletEntity().getPortletDefinition().getPortletName());
 
     	// After processing event, change the redirect URL for rendering.
     	String location = eventResponse.getRedirectLocation();
@@ -547,7 +453,7 @@
     		debugWithName("No redirect location specified.");
     		PortletURLProvider redirectURL = requiredContainerServices
     		.getPortalCallbackService()
-    		.getPortletURLProvider(request, internalPortletWindow);
+    		.getPortletURLProvider(request, window);
 
     		saveChangedParameters(eventRequest, eventResponse, redirectURL);
 
@@ -633,7 +539,7 @@
 		redirectURL.setAction(false);
 
 		// Set secure of the redirect URL if necessary.
-		if (redirectURL.isSecureSupported()) {
+		if (request.isSecure()) {
 			try {
 				redirectURL.setSecure();
 			} catch (PortletSecurityException e) {
@@ -663,24 +569,22 @@
 	
 	/**
 	 * The method initialise the FilterManager for later use in the PortletServlet
-	 * @param internalPortletWindow the InternalPortletWindow
+	 * @param PortletWindow the PortletWindow
 	 * @param lifeCycle like ACTION_PHASE, RENDER_PHASE,...
 	 * @return FilterManager
 	 * @throws PortletContainerException
 	 */
-	private FilterManager filterInitialisation(InternalPortletWindow internalPortletWindow,String
lifeCycle) throws PortletContainerException{
-    	PortletAppDD portletAppDD = getOptionalContainerServices().getPortletRegistryService().getPortletApplicationDescriptor(internalPortletWindow.getContextPath());
-        String portletName = internalPortletWindow.getPortletName();
-        
-        return requiredContainerServices.getPortalCallbackService().getFilterManager(portletAppDD,portletName,lifeCycle);
+	private FilterManager filterInitialisation(PortletWindow portletWindow,String lifeCycle)
throws PortletContainerException{
+	    PortletEntity pe = portletWindow.getPortletEntity();
+        return requiredContainerServices.getPortalCallbackService().getFilterManager(pe.getPortletDefinition().getApplication(),pe.getPortletDefinition().getPortletName(),lifeCycle);
     }
 	
 	class AdminRequest extends PortletRequestImpl {
 
         public AdminRequest(PortletContainer container,
-                            InternalPortletWindow internalPortletWindow,
+                            PortletWindow portletWindow,
                             HttpServletRequest servletRequest) {
-            super(container, internalPortletWindow, servletRequest);
+            super(container, portletWindow, servletRequest);
         }
 
         public PortletPreferences getPreferences() {
@@ -691,10 +595,10 @@
     class AdminResponse extends PortletResponseImpl {
 
         public AdminResponse(PortletContainer container,
-                             InternalPortletWindow internalPortletWindow,
+                             PortletWindow portletWindow,
                              HttpServletRequest servletRequest,
                              HttpServletResponse servletResponse) {
-            super(container, internalPortletWindow, servletRequest, servletResponse);
+            super(container, portletWindow, servletRequest, servletResponse);
         }
     }
 }

Modified: portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/BaseURLImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/BaseURLImpl.java?rev=702905&r1=702904&r2=702905&view=diff
==============================================================================
--- portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/BaseURLImpl.java
(original)
+++ portals/pluto/branches/2.0-spi-refactoring/pluto-container/src/main/java/org/apache/pluto/internal/impl/BaseURLImpl.java
Wed Oct  8 08:18:55 2008
@@ -37,10 +37,10 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.pluto.PortletContainer;
 import org.apache.pluto.PortletContainerException;
-import org.apache.pluto.descriptors.portlet.PortletAppDD;
-import org.apache.pluto.descriptors.portlet.PortletDD;
-import org.apache.pluto.descriptors.portlet.SupportsDD;
-import org.apache.pluto.internal.InternalPortletWindow;
+import org.apache.pluto.PortletWindow;
+import org.apache.pluto.om.portlet.Portlet;
+import org.apache.pluto.om.portlet.PortletApp;
+import org.apache.pluto.om.portlet.Supports;
 import org.apache.pluto.spi.PortletURLListener;
 import org.apache.pluto.spi.PortletURLProvider;
 import org.apache.pluto.util.StringManager;
@@ -62,7 +62,7 @@
 	protected boolean secure;
 	protected PortletContainer container;
 	protected PortletMode mode = null;
-	protected InternalPortletWindow internalPortletWindow;
+	protected PortletWindow portletWindow;
 	protected javax.servlet.http.HttpServletRequest servletRequest;
 	protected javax.servlet.http.HttpServletResponse servletResponse;
 	protected WindowState state;
@@ -71,12 +71,12 @@
 	protected PortalContext context;
 	
 	public BaseURLImpl(PortletContainer container,
-			InternalPortletWindow internalPortletWindow,
+			PortletWindow portletWindow,
 			javax.servlet.http.HttpServletRequest servletRequest,
 			javax.servlet.http.HttpServletResponse servletResponse,
 			boolean isAction, boolean isResourceServing) {
 		this.container = container;
-		this.internalPortletWindow = internalPortletWindow;
+		this.portletWindow = portletWindow;
 		this.servletRequest = servletRequest;
 		this.servletResponse = servletResponse;
 		secure = servletRequest.isSecure();
@@ -105,7 +105,7 @@
 	        throw new IllegalArgumentException(
 	            "name and value must not be null");
 	    }
-	    List<String> publicRenderParameterNames = internalPortletWindow.getPortletEntity().getPortletDefinition().getPublicRenderParameter();
+	    List<String> publicRenderParameterNames = portletWindow.getPortletEntity().getPortletDefinition().getPublicRenderParameter();
 	    if (publicRenderParameterNames == null){
 	    	parameters.put(name, new String[]{value});
 	    }
@@ -124,7 +124,7 @@
 	        throw new IllegalArgumentException(
 	        	"name and values must not be null or values be an empty array");
 	    }
-		List<String> publicRenderParameterNames = internalPortletWindow.getPortletEntity().getPortletDefinition().getPublicRenderParameter();
+		List<String> publicRenderParameterNames = portletWindow.getPortletEntity().getPortletDefinition().getPublicRenderParameter();
 	    
 		if (publicRenderParameterNames == null){
 			parameters.put(name, StringUtils.copy(values));
@@ -160,7 +160,7 @@
         
         this.parameters.clear();
         this.publicRenderParameters.clear();
-        List<String> publicPortletRenderParameterNames = internalPortletWindow.getPortletEntity().getPortletDefinition().getPublicRenderParameter();
+        List<String> publicPortletRenderParameterNames = portletWindow.getPortletEntity().getPortletDefinition().getPublicRenderParameter();
         if (parameters.keySet()!= null){
         	for (Object key : parameters.keySet()) {
         		if (publicPortletRenderParameterNames == null)
@@ -182,23 +182,19 @@
         PortletURLProvider urlProvider = container
         		.getRequiredContainerServices()
         		.getPortalCallbackService()
-        		.getPortletURLProvider(servletRequest, internalPortletWindow);
-        if (urlProvider.isSecureSupported()) {
-            urlProvider.setSecure();
-        } else {
-        	LOG.info("Secure URLs not supported.");
+        		.getPortletURLProvider(servletRequest, portletWindow);
+        if(urlProvider.isSecureSupported()) {
+            throw new PortletSecurityException("Secure URLs not supported.");
         }
 	}
 
 	public String toString(){
-	    StringBuffer url = new StringBuffer(200);
-	
 	    PortletURLProvider urlProvider = container
 	    		.getRequiredContainerServices()
 	    		.getPortalCallbackService()
-	    		.getPortletURLProvider(servletRequest, internalPortletWindow);
+	    		.getPortletURLProvider(servletRequest, portletWindow);
 	
-	    PortletURLListener portletURLFilterListener = portletURLFilterListener = container
+	    PortletURLListener portletURLFilterListener = container
 			.getRequiredContainerServices()
 			.getPortalCallbackService().getPortletURLListener();
 	    if (mode != null) {
@@ -213,16 +209,10 @@
 	    else if (isResourceServing){
 	    	urlProvider.setResourceServing(true);
 	    }
-	    try {
-	    	
-	    	PortletAppDD portletAppDD = container.getPortletApplicationDescriptor(internalPortletWindow.getContextPath());
 
-//	    	container.getOptionalContainerServices().getPortletRegistryService().getRegisteredPortletApplications()
-//			PortletAppDD portletAppDD = container.getPortletApplicationDescriptor(  );
-			portletURLFilterListener.callListener(portletAppDD,this,isAction,isResourceServing);
-		} catch (PortletContainerException e1) {
-			e1.printStackTrace();
-		}
-        
+        PortletApp portletAppDD = portletWindow.getPortletEntity().getPortletDefinition().getApplication();
 
+//      container.getOptionalContainerServices().getPortletRegistryService().getRegisteredPortletApplications()
+//      PortletAppDD portletAppDD = container.getPortletApplicationDescriptor(  );
+        portletURLFilterListener.callListener(portletAppDD,this,isAction,isResourceServing);
 	    
         if (secure && urlProvider.isSecureSupported()) {
             try {
@@ -241,9 +231,7 @@
 	    
 	    urlProvider.setPublicRenderParameters(publicRenderParameters);
 	    
-	    url.append(urlProvider.toString());
-	
-	    return url.toString();
+	    return urlProvider.toString();
 	}
 	// --------------------------------------------------------------------------------------------
 
@@ -286,11 +274,11 @@
 	        return true;
 	    }
 	
-	    PortletDD dd = internalPortletWindow.getPortletEntity()
+	    Portlet dd = portletWindow.getPortletEntity()
 	        .getPortletDefinition();
 	    Iterator supports = dd.getSupports().iterator();
 	    while(supports.hasNext()) {
-	        SupportsDD support = (SupportsDD)supports.next();
+	        Supports support = (Supports)supports.next();
 	        if (support.getPortletModes() != null){
 	        	Iterator modes = support.getPortletModes().iterator();
 		        while(modes.hasNext()) {
@@ -334,12 +322,11 @@
 	}
 
 	public void write(Writer out) throws IOException {
-		StringBuffer url = new StringBuffer(200);
 		
 	    PortletURLProvider urlProvider = container
 	    		.getRequiredContainerServices()
 	    		.getPortalCallbackService()
-	    		.getPortletURLProvider(servletRequest, internalPortletWindow);
+	    		.getPortletURLProvider(servletRequest, portletWindow);
 	
 	    PortletURLListener portletURLFilterListener = portletURLFilterListener = container
 			.getRequiredContainerServices()
@@ -356,16 +343,10 @@
 	    else if (isResourceServing){
 	    	urlProvider.setResourceServing(true);
 	    }
-	    try {
-	    	
-	    	PortletAppDD portletAppDD = container.getPortletApplicationDescriptor(internalPortletWindow.getContextPath());
 
-//	    	container.getOptionalContainerServices().getPortletRegistryService().getRegisteredPortletApplications()
-//			PortletAppDD portletAppDD = container.getPortletApplicationDescriptor(  );
-			portletURLFilterListener.callListener(portletAppDD,this,isAction,isResourceServing);
-		} catch (PortletContainerException e1) {
-			e1.printStackTrace();
-		}
-        
+        PortletApp portletAppDD = portletWindow.getPortletEntity().getPortletDefinition().getApplication();
 
+//      container.getOptionalContainerServices().getPortletRegistryService().getRegisteredPortletApplications()
+//      PortletAppDD portletAppDD = container.getPortletApplicationDescriptor(  );
+        portletURLFilterListener.callListener(portletAppDD,this,isAction,isResourceServing);
 	    
         if (secure && urlProvider.isSecureSupported()) {
             try {
@@ -384,9 +365,7 @@
 	    
 	    urlProvider.setPublicRenderParameters(publicRenderParameters);
 	    
-	    url.append(urlProvider.toString());
-	
-	    out.write(url.toString());
+	    out.write(urlProvider.toString());
 	}
 
 	public void write(Writer out, boolean escapeXML) throws IOException {
@@ -395,12 +374,12 @@
 	}
 
 	public void addProperty(String key, String value) {
-		container.getRequiredContainerServices().getPortalCallbackService().addResponseProperty(servletRequest,
internalPortletWindow, key, value);
+		container.getRequiredContainerServices().getPortalCallbackService().addResponseProperty(servletRequest,
portletWindow, key, value);
 		
 	}
 
 	public void setProperty(String key, String value) {
-		container.getRequiredContainerServices().getPortalCallbackService().setResponseProperty(servletRequest,
internalPortletWindow, key, value);
+		container.getRequiredContainerServices().getPortalCallbackService().setResponseProperty(servletRequest,
portletWindow, key, value);
 		
 	}
 
@@ -410,7 +389,7 @@
 		String[] tmp1 = this.servletRequest.getParameterValues(name);
 		if (tmp1!=null)
 			lenght += tmp1.length;
-		PortletURLProvider urlProvider = container.getRequiredContainerServices().getPortalCallbackService().getPortletURLProvider(servletRequest,
internalPortletWindow);
+		PortletURLProvider urlProvider = container.getRequiredContainerServices().getPortalCallbackService().getPortletURLProvider(servletRequest,
portletWindow);
 		String[] tmp2 = urlProvider.getPrivateRenderParameters(name);
 		if (tmp2!=null)
 			lenght += tmp2.length;



Mime
View raw message