tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mindbri...@apache.org
Subject cvs commit: jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/popup PopupLink.java
Date Wed, 07 Jan 2004 01:11:20 GMT
mindbridge    2004/01/06 17:11:20

  Modified:    contrib/src/org/apache/tapestry/contrib/popup PopupLink.java
  Log:
  Modifying PopupLink to properly encode URLs using the expected charset
  
  Revision  Changes    Path
  1.2       +17 -3     jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/popup/PopupLink.java
  
  Index: PopupLink.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/src/org/apache/tapestry/contrib/popup/PopupLink.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PopupLink.java	5 Mar 2003 23:02:35 -0000	1.1
  +++ PopupLink.java	7 Jan 2004 01:11:20 -0000	1.2
  @@ -55,10 +55,13 @@
   
   package org.apache.tapestry.contrib.popup;
   
  -import java.net.URLEncoder;
  +import java.io.UnsupportedEncodingException;
   
  +import org.apache.commons.codec.net.URLCodec;
  +import org.apache.tapestry.ApplicationRuntimeException;
   import org.apache.tapestry.BaseComponent;
   import org.apache.tapestry.IBinding;
  +import org.apache.tapestry.Tapestry;
   
   /**
    * This component provides a popup link to launch a new window using a given
  @@ -74,6 +77,7 @@
   {
   	/** The default popup window name 'popuplink_window'. */
   	public static final String DEFAULT_WINDOW_NAME = "popuplink_window";
  +    private static final URLCodec _urlCodec = new URLCodec();
   
   	//	Instance variables
   	private IBinding _hrefBinding;
  @@ -116,7 +120,17 @@
   
   		if (aHrefBinding != null)
   		{
  -			return URLEncoder.encode(aHrefBinding.getString());
  +            String encoding = getPage().getEngine().getOutputEncoding();
  +            try
  +            {
  +                return _urlCodec.encode(aHrefBinding.getString(), encoding);
  +            }
  +            catch (UnsupportedEncodingException e)
  +            {
  +                throw new ApplicationRuntimeException(
  +                    Tapestry.format("illegal-encoding", encoding),
  +                    e);
  +            }
   		}
   
   		return null;
  
  
  

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


Mime
View raw message