portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets WebPagePortlet2.java
Date Wed, 02 Jun 2004 03:10:24 GMT
taylor      2004/06/01 20:10:24

  Modified:    src/java/org/apache/jetspeed/portal/portlets
                        WebPagePortlet2.java
  Log:
  WebPage portlet cannot handle encoding correctly - patch applied
  
  http://nagoya.apache.org/jira/browse/JS1-481
  
  patch from Shinsuke Sugaya
  
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.6       +20 -4     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/WebPagePortlet2.java
  
  Index: WebPagePortlet2.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/WebPagePortlet2.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- WebPagePortlet2.java	23 Feb 2004 04:03:34 -0000	1.5
  +++ WebPagePortlet2.java	2 Jun 2004 03:10:24 -0000	1.6
  @@ -40,6 +40,7 @@
   import java.io.Reader;
   import java.net.URL;
   import java.net.URLConnection;
  +import java.util.StringTokenizer;
   
   /**
    * A class that loads a web page and filters it to have certain features
  @@ -121,14 +122,29 @@
           }
           
           long           pageExpiration = pageConn.getExpiration();
  -        String         encoding = pageConn.getContentEncoding();
  +        String         encoding = "iso-8859-1";
  +        String         contentType = pageConn.getContentType();
           String         tempString = null;
           String         noCache = "no-cache";
           
  -        if(encoding == null)
  +        if (contentType != null)
           {
  -            // Standard HTTP encoding
  -            encoding = "iso-8859-1";
  +            StringTokenizer st = new StringTokenizer(contentType, "; =");
  +            while (st.hasMoreTokens())
  +            {
  +                if (st.nextToken().equalsIgnoreCase("charset"))
  +                {
  +                    try
  +                    {
  +                        encoding = st.nextToken();
  +                        break;
  +                    }
  +                    catch (Exception e)
  +                    {
  +                        break;
  +                    }
  +                }
  +            }
           }
   
           /*
  
  
  

---------------------------------------------------------------------
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