cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/pluto PortletURLProviderImpl.java
Date Fri, 19 Mar 2004 07:24:12 GMT
cziegeler    2004/03/18 23:24:12

  Modified:    src/blocks/portal/java/org/apache/cocoon/portal/pluto
                        PortletURLProviderImpl.java
  Log:
  Fix problems with core debug logging and PortletURL toString() method (reported in bug 27518)
  
  Revision  Changes    Path
  1.6       +39 -49    cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java
  
  Index: PortletURLProviderImpl.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PortletURLProviderImpl.java	18 Mar 2004 19:01:15 -0000	1.5
  +++ PortletURLProviderImpl.java	19 Mar 2004 07:24:12 -0000	1.6
  @@ -72,6 +72,9 @@
       /** Parameters */
       protected Map parameters;
       
  +    /** The generated url */
  +    protected String generatedURL;
  +    
       /**
        * Constructor
        */
  @@ -165,59 +168,46 @@
        * @see java.lang.Object#toString()
        */
       public String toString() {
  -        return this.toString(null);
  -    }
  -
  -    /**
  -     * Get the URI and add the event
  -     */
  -    public String toString(Event additionalEvent) {
  -        final PortletWindowImpl impl = (PortletWindowImpl)this.portletWindow;
  -        final CopletLayout cl = impl.getLayout();
  -        Event sizingEvent = null;
  -        if ( cl != null ) {
  -            final CopletInstanceData cid = cl.getCopletInstanceData();
  -            WindowState oldState = (WindowState)cid.getAttribute("window-state"); 
  -            if ( oldState == null ) {
  -                oldState = WindowState.NORMAL;
  -            }
  -            if ( this.state != null && !this.state.equals(oldState) ) {
  -                if ( oldState.equals(WindowState.MAXIMIZED) ) {
  -                    sizingEvent = new FullScreenCopletEvent( cid, null );             
      
  -                } else {
  -                    if ( this.state.equals(WindowState.MAXIMIZED) ) {
  -                        sizingEvent = new FullScreenCopletEvent( cid, cl );           
                                
  +        if ( this.generatedURL == null ) {
  +            final PortletWindowImpl impl = (PortletWindowImpl)this.portletWindow;
  +            final CopletLayout cl = impl.getLayout();
  +            Event sizingEvent = null;
  +            if ( cl != null ) {
  +                final CopletInstanceData cid = cl.getCopletInstanceData();
  +                WindowState oldState = (WindowState)cid.getAttribute("window-state"); 
  +                if ( oldState == null ) {
  +                    oldState = WindowState.NORMAL;
  +                }
  +                if ( this.state != null && !this.state.equals(oldState) ) {
  +                    if ( oldState.equals(WindowState.MAXIMIZED) ) {
  +                        sizingEvent = new FullScreenCopletEvent( cid, null );         
          
  +                    } else {
  +                        if ( this.state.equals(WindowState.MAXIMIZED) ) {
  +                            sizingEvent = new FullScreenCopletEvent( cid, cl );       
                                    
  +                        }
                       }
                   }
               }
  -        }
  -        PortalService service = null;
  -        try {
  -            service = (PortalService) this.manager.lookup(PortalService.ROLE);
  -            if ( service.getPortalName() == null ) {
  -                // this happens when the core log is set to debug
  -                // and Cocoon debugs all session attributes
  -                // otherwise this can't happen
  -                return super.toString();
  -            }
  -            LinkService linkService = service.getComponentManager().getLinkService();
  -            
  -            //TODO - secure
  -            List l = new ArrayList();
  -            if ( additionalEvent != null ) {
  -                l.add(additionalEvent);
  -            }
  -            if ( sizingEvent != null ) {
  -                l.add(sizingEvent);
  +            PortalService service = null;
  +            try {
  +                service = (PortalService) this.manager.lookup(PortalService.ROLE);
  +                LinkService linkService = service.getComponentManager().getLinkService();
  +                
  +                //TODO - secure
  +                List l = new ArrayList();
  +                if ( sizingEvent != null ) {
  +                    l.add(sizingEvent);
  +                }
  +                l.add(this);
  +                this.generatedURL = linkService.getLinkURI(l);
  +                
  +            } catch (ServiceException se) {
  +                throw new CascadingRuntimeException("Unable to lookup portal service.",
se);
  +            } finally {
  +                this.manager.release(service);
               }
  -            l.add(this);
  -            return linkService.getLinkURI(l);
  -            
  -        } catch (ServiceException se) {
  -            throw new CascadingRuntimeException("Unable to lookup portal service.", se);
  -        } finally {
  -            this.manager.release(service);
           }
  +        return this.generatedURL;
       }
   
       /* (non-Javadoc)
  
  
  

Mime
View raw message