cziegeler    2004/03/15 02:31:37

  Modified:    .        status.xml
               
src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl
                        PortletWindowAspect.java
               
src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl
                        PortletAdapter.java
  Log:
     <action dev="CZ" type="fix" fixes-bug="26566" due-to="Simon Mieth" 
due-to-email="[EMAIL PROTECTED]">
       Portal: Fix problems with the portal block and using the CLI.
     </action>
  
  Revision  Changes    Path
  1.279     +4 -1      cocoon-2.1/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/status.xml,v
  retrieving revision 1.278
  retrieving revision 1.279
  diff -u -r1.278 -r1.279
  --- status.xml        15 Mar 2004 10:14:39 -0000      1.278
  +++ status.xml        15 Mar 2004 10:31:37 -0000      1.279
  @@ -212,6 +212,9 @@
     <changes>
   
    <release version="@version@" date="@date@">
  +   <action dev="CZ" type="fix" fixes-bug="26566" due-to="Simon Mieth" 
due-to-email="[EMAIL PROTECTED]">
  +     Portal: Fix problems with the portal block and using the CLI.
  +   </action>
      <action dev="CZ" type="fix" fixes-bug="27658" due-to="Michal Durdina" 
due-to-email="[EMAIL PROTECTED]">
        Portal: Add default PropertyManagerService implementation
      </action>
  
  
  
  1.4       +13 -6     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/PortletWindowAspect.java
  
  Index: PortletWindowAspect.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/PortletWindowAspect.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PortletWindowAspect.java  5 Mar 2004 13:02:13 -0000       1.3
  +++ PortletWindowAspect.java  15 Mar 2004 10:31:37 -0000      1.4
  @@ -65,11 +65,18 @@
        * @see 
org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
        */
       public void contextualize(Context context) throws ContextException {
  -        // now get the portal manager
  -        ServletConfig servletConfig = (ServletConfig) 
context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG);
  -        PortletPortalManager portalManager = (PortletPortalManager) 
servletConfig.getServletContext().getAttribute(PortalManager.ROLE);
  -        if ( portalManager != null ) {
  -            this.environment = 
portalManager.getPortletContainerEnvironment();
  +        try {
  +            // now get the portal manager
  +            ServletConfig servletConfig = (ServletConfig) 
context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG);
  +            PortletPortalManager portalManager = (PortletPortalManager) 
servletConfig.getServletContext().getAttribute(PortalManager.ROLE);
  +            if ( portalManager != null ) {
  +                this.environment = 
portalManager.getPortletContainerEnvironment();
  +            }
  +        } catch (ContextException ignore) {
  +            // we ignore the context exception
  +            // this avoids startup errors if the portal is configured for 
the CLI
  +            // environment
  +            this.getLogger().warn("The JSR-168 support is disabled as the 
servlet context is not available.", ignore);
           }
       }
   
  
  
  
  1.7       +24 -8     
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl/PortletAdapter.java
  
  Index: PortletAdapter.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl/PortletAdapter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PortletAdapter.java       5 Mar 2004 13:02:10 -0000       1.6
  +++ PortletAdapter.java       15 Mar 2004 10:31:37 -0000      1.7
  @@ -75,20 +75,30 @@
        */
       public void contextualize(Context context) throws ContextException {
           this.context = context;
  -        // now get the portal manager
  -        ServletConfig servletConfig = (ServletConfig) 
context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG);
  -        PortletPortalManager portalManager = (PortletPortalManager) 
servletConfig.getServletContext().getAttribute(PortalManager.ROLE);
  -        
  -        this.portletContainer = portalManager.getPortletContainer();
  -        this.environment = portalManager.getPortletContainerEnvironment();
  +        try {
  +            // now get the portal manager
  +            ServletConfig servletConfig = (ServletConfig) 
context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG);
  +            PortletPortalManager portalManager = (PortletPortalManager) 
servletConfig.getServletContext().getAttribute(PortalManager.ROLE);
  +            
  +            this.portletContainer = portalManager.getPortletContainer();
  +            this.environment = 
portalManager.getPortletContainerEnvironment();
  +        } catch (ContextException ignore) {
  +            // we ignore the context exception
  +            // this avoids startup errors if the portal is configured for 
the CLI
  +            // environment
  +            this.getLogger().warn("The JSR-168 support is disabled as the 
servlet context is not available.", ignore);
  +        }
       }
  -
  +    
       /* (non-Javadoc)
        * @see 
org.apache.cocoon.portal.coplet.adapter.CopletAdapter#login(org.apache.cocoon.portal.coplet.CopletInstanceData)
        */
       public void login(CopletInstanceData coplet) {
           super.login(coplet);
   
  +        if ( this.portletContainer == null ) {
  +            return;
  +        }
           PortletDefinitionRegistry registry = (PortletDefinitionRegistry) 
environment.getContainerService(PortletDefinitionRegistry.class);
           
           final String portletEntityId = (String) getConfiguration(coplet, 
"portlet");   
  @@ -136,6 +146,9 @@
       public void streamContent(CopletInstanceData coplet,
                                 ContentHandler contentHandler)
       throws SAXException {
  +        if ( this.portletContainer == null ) {
  +            throw new SAXException("Unable to execute JSR-168 portlets 
because of missing servlet context.");
  +        }
           try {
               final String portlet = (String)super.getConfiguration(coplet, 
"portlet");
               if ( portlet == null ) {
  @@ -179,6 +192,9 @@
        */
       public void logout(CopletInstanceData coplet) {
           super.logout(coplet);
  +        if ( this.portletContainer == null ) {
  +            return;
  +        }
           PortletWindow window = (PortletWindow)coplet.getAttribute("window");
           if ( window != null ) {
               coplet.removeAttribute("window");
  
  
  

Reply via email to