myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1509111 - in /myfaces/tobago/branches/tobago-1.5.x/tobago-core/src: main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterBase.java test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java
Date Thu, 01 Aug 2013 08:31:20 GMT
Author: lofwyr
Date: Thu Aug  1 08:31:19 2013
New Revision: 1509111

URL: http://svn.apache.org/r1509111
Log:
TOBAGO-1288: writeURIAttribute not yet implemented in TobagoResponseWriterBase
- Thanks for the patch: Thomas Schmitz

Modified:
    myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterBase.java
    myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java

Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterBase.java?rev=1509111&r1=1509110&r2=1509111&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterBase.java
(original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterBase.java
Thu Aug  1 08:31:19 2013
@@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory;
 import javax.faces.component.UIComponent;
 import java.io.IOException;
 import java.io.Writer;
+import java.net.URI;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
@@ -251,9 +252,12 @@ public abstract class TobagoResponseWrit
     return stackTrace[i].toString();
   }
 
-  public void writeURIAttribute(final String s, final Object obj, final String s1)
+  public void writeURIAttribute(final String name, final Object value, final String property)
       throws IOException {
-    LOG.error("Not implemented yet!");
+    if (value != null) {
+      final URI uri = URI.create(value.toString());
+      writeAttribute(name, uri.toASCIIString(), property);
+    }
   }
 
 // interface TobagoResponseWriter //////////////////////////////////////////////////////////////////////////////////

Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java?rev=1509111&r1=1509110&r2=1509111&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java
(original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java
Thu Aug  1 08:31:19 2013
@@ -72,6 +72,15 @@ public class TobagoResponseWriterUnitTes
     writer.endElement(HtmlElements.SELECT);
     Assert.assertEquals("attr tag", "<select value=\"0\"\n></select>", stringWriter.toString());
   }
+  
+  @Test
+  public void testURIAttribute() throws IOException {
+    writer.startElement(HtmlElements.A, null);
+    writer.writeURIAttribute(HtmlAttributes.HREF, "http://example.org/web?text=äöüß",
null);
+    writer.endElement(HtmlElements.A);
+    Assert.assertEquals("uri attr tag", "<a href=\"http://example.org/web?text=%C3%A4%C3%B6%C3%BC%C3%9F\"\n></a>",
+            stringWriter.toString());
+  }
 
   @Test
   public void testAttributeQuoting() throws IOException {



Mime
View raw message