portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pau...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/util HTMLRewriter.java
Date Fri, 09 Nov 2001 07:11:59 GMT
paulsp      01/11/08 23:11:59

  Modified:    src/java/org/apache/jetspeed/portal/portlets
                        WebPagePortlet.java
               src/java/org/apache/jetspeed/util HTMLRewriter.java
  Log:
  WebPagePortlet.java:
  o Remove excess comments
  o Get page is the cached copy expiration <= current time
  o Close reader when done
  o Clear the content before setting content (workaround, but do not know root problem)
  o Initialize convertedString to null
  
  HTMLRewriter.java:
  o Reset result buffer before each use.
  
  Revision  Changes    Path
  1.7       +7 -10     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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WebPagePortlet.java	2001/11/07 22:11:58	1.6
  +++ WebPagePortlet.java	2001/11/09 07:11:59	1.7
  @@ -120,8 +120,6 @@
                           .equalsIgnoreCase("yes")
                    );
   
  -            Log.debug("*** Created rewriter for " + config.getURL() );
  -
           } catch (Exception e) {
               Log.info("Exception occurred:" + e.toString());
               e.printStackTrace();
  @@ -186,17 +184,14 @@
           {
               if (pageCached)
               {
  -                Log.debug("[cached] in getContent for " + config.getURL() );
  -    
                   if (null == getExpirationMillis())
                       return getContent( data, null, true);
   
  -                if (getExpirationMillis().longValue() < System.currentTimeMillis())
  +                if (getExpirationMillis().longValue() <= System.currentTimeMillis())
                       return getWebPageContent(data, config);
       
                   return getContent( data, null , true );
               }
  -            Log.debug("[not cached] in getContent for " + config.getURL() );
           }
           catch (Exception e)
           {
  @@ -209,7 +204,7 @@
       private ConcreteElement getWebPageContent( RunData data, PortletConfig config )
       {    
           
  -        String convertedString;  // parsed and re-written HTML
  +        String convertedString = null;  // parsed and re-written HTML
           ClearElement element = null;
   
           try 
  @@ -217,16 +212,18 @@
               Reader htmlReader = getReader( config.getURL() );
               //FIXME: HTMLRewriter should take a Reader, and work
               convertedString = rewriter.convertURLs(htmlReader, config.getURL());
  -            Log.debug("converted URL: " + config.getURL() );
  -
               pageCached = true;
               element = new ClearElement(convertedString);
  +
  +            //FIXME: We should do a clearContent() for the media type, not ALL media types
  +            this.clearContent();  // doing this because setContent() is not overwriting
current content.
               this.setContent(element);
   
  +            htmlReader.close();
  +
           } catch (Exception e) {
               Log.info("Exception occurred:" + e.toString());
               e.printStackTrace();
  -//            throw new PortletException( e.toString() );
           }        
   
           return element;
  
  
  
  1.6       +4 -0      jakarta-jetspeed/src/java/org/apache/jetspeed/util/HTMLRewriter.java
  
  Index: HTMLRewriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/HTMLRewriter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- HTMLRewriter.java	2001/10/18 18:17:40	1.5
  +++ HTMLRewriter.java	2001/11/09 07:11:59	1.6
  @@ -158,6 +158,10 @@
           HTMLEditorKit.Parser parse = new HTMLRewriter.ParserGetter().getParser();     
  
           String res ="";
           try {
  +            if (cb.result != null) {
  +              cb.result = null;
  +              cb.result = new StringWriter();
  +            }
               cb.baseUrl = new URL(BaseUrl);
               parse.parse(HTMLrdr,cb,true);
               res = cb.getResult(); 
  
  
  

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


Mime
View raw message