You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by pa...@apache.org on 2001/10/15 05:38:19 UTC

cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets WebPagePortlet.java

paulsp      01/10/14 20:38:19

  Modified:    src/java/org/apache/jetspeed/portal/portlets
                        WebPagePortlet.java
  Log:
  getURL() was no longer retrieves content twice.  Thanks to David Sean Taylor
  for pointing out the problem.
  
  Revision  Changes    Path
  1.4       +6 -12     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/WebPagePortlet.java
  
  Index: WebPagePortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/WebPagePortlet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WebPagePortlet.java	2001/10/07 12:29:15	1.3
  +++ WebPagePortlet.java	2001/10/15 03:38:19	1.4
  @@ -122,24 +122,21 @@
               e.printStackTrace();
               throw new PortletException( e.toString() );
           }
  -            
  -       
       }
       
       /**
        * took this from FileServerPortlet as it was private 
        *
  -     * FIXME: Currently only the expiration the HTTP Reponse header is honored. 
  -     *        Expiration information in <meta> tags are not honored 
       */
  +    // FIXME: Currently only the expiration the HTTP Reponse header is honored. 
  +    //        Expiration information in <meta> tags are not honored 
       private String getURL(String url) throws IOException {
   
           int CAPACITY = 1024;
           URL            pageUrl = new URL(url);
           URLConnection  pageConn = pageUrl.openConnection();
  -        long           pageExpiration = pageConn.getExpiration();
  -
  -        InputStream is = pageUrl.openStream();
  +        long           pageExpiration = 0;
  +        InputStream    is = pageConn.getInputStream();
           ByteArrayOutputStream buffer = new ByteArrayOutputStream();
   
           //now process the InputStream...
  @@ -151,6 +148,7 @@
               buffer.write( bytes, 0, readCount);
           }
   
  +        pageExpiration = pageConn.getExpiration();
           is.close();
   
           // Only set the page expiration it the page has not expired
  @@ -158,11 +156,7 @@
             Log.debug( "WebPagePortlet caching URL: " + url + " Expiration: " + pageExpiration);
             setExpirationMillis(pageExpiration);
           }
  -
  -        return buffer.toString();
  -            
   
  +        return buffer.toString();            
       }
  -
   }
  -
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org