portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sg...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets FileServerPortlet.java
Date Mon, 09 Apr 2001 23:31:01 GMT
sgala       01/04/09 16:31:01

  Modified:    src/java/org/apache/jetspeed/portal/portlets
                        FileServerPortlet.java
  Log:
  FileServerPortlet used the server encoding, instead of the url encoding.
  
  Revision  Changes    Path
  1.23      +14 -12    jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/FileServerPortlet.java
  
  Index: FileServerPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/FileServerPortlet.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- FileServerPortlet.java	2001/03/07 06:47:04	1.22
  +++ FileServerPortlet.java	2001/04/09 23:31:01	1.23
  @@ -79,9 +79,11 @@
   
   
   /**
  -
  -@author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
  -@version $Id: FileServerPortlet.java,v 1.22 2001/03/07 06:47:04 taylor Exp $ 
  + * <p>Serve a static URL (typically a HTML fragment)</p>
  + *
  + @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
  + @author <a href="mailto:sgala@apache.org">Santiago Gala</a>
  + @version $Id: FileServerPortlet.java,v 1.23 2001/04/09 23:31:01 sgala Exp $ 
   */
   public class FileServerPortlet extends FileWatchPortlet {
   
  @@ -95,8 +97,7 @@
   
           try {
   
  -            this.setContent( new ClearElement( this.getURL( JetspeedDiskCache.getInstance()
  -                .getEntry( this.getPortletConfig().getURL() ).getURL() ) ) );
  +            this.setContent( new ClearElement( this.getURL(  this.getPortletConfig().getURL()
) ) );
   
           } catch (Exception e) {
               throw new PortletException( e.getMessage() );
  @@ -111,19 +112,20 @@
   
           int CAPACITY = 1024;
   
  -        InputStream is = new URL( url ).openStream();
  -        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
  +        Reader rdr = JetspeedDiskCache.getInstance()
  +            .getEntry( url ).getReader();
  +        StringBuffer buffer = new StringBuffer();
   
  -        //now process the InputStream...
  -        byte[] bytes = new byte[CAPACITY];
  +        //now process the Reader...
  +        char[] chars = new char[CAPACITY];
   
           int readCount = 0;
  -        while( ( readCount = is.read( bytes )) > 0 ) {
  +        while( ( readCount = rdr.read( chars )) > 0 ) {
   
  -            buffer.write( bytes, 0, readCount);
  +            buffer.append( chars, 0, readCount);
           }
   
  -        is.close();
  +        rdr.close();
   
   
           return buffer.toString();
  
  
  

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


Mime
View raw message