[Yanel-commits] rev 29437 - public/yanel/contributions/realms/foaf/src/resources/findfriend/src/java/org/wyona/yanel/impl/resources/findfriend

michi at wyona.com michi at wyona.com
Sat Dec 1 22:23:15 CET 2007


Author: michi
Date: 2007-12-01 22:23:15 +0100 (Sat, 01 Dec 2007)
New Revision: 29437

Modified:
   public/yanel/contributions/realms/foaf/src/resources/findfriend/src/java/org/wyona/yanel/impl/resources/findfriend/FindFriendResource.java
Log:
username as parameter added

Modified: public/yanel/contributions/realms/foaf/src/resources/findfriend/src/java/org/wyona/yanel/impl/resources/findfriend/FindFriendResource.java
===================================================================
--- public/yanel/contributions/realms/foaf/src/resources/findfriend/src/java/org/wyona/yanel/impl/resources/findfriend/FindFriendResource.java	2007-12-01 21:22:57 UTC (rev 29436)
+++ public/yanel/contributions/realms/foaf/src/resources/findfriend/src/java/org/wyona/yanel/impl/resources/findfriend/FindFriendResource.java	2007-12-01 21:23:15 UTC (rev 29437)
@@ -164,14 +164,20 @@
     private Transformer getTransformer() throws Exception {
         File xsltFile = org.wyona.commons.io.FileUtil.file(rtd.getConfigFile().getParentFile().getAbsolutePath(), "xslt" + File.separator + "foaf2xhtml.xsl");
         Transformer tf = TransformerFactory.newInstance().newTransformer(new StreamSource(xsltFile));
+
         if (getRequest().getParameter("q") != null) {
             tf.setParameter("query", getRequest().getParameter("q"));
         }
+
         if (getResourceConfigProperty("type") != null) {
             tf.setParameter("type", getResourceConfigProperty("type"));
         } else {
             tf.setParameter("type", "simple");
         }
+
+        String username = getUsername();
+        if (username != null) tf.setParameter("username", username);
+
         return tf;
     }
 
@@ -191,4 +197,13 @@
     private String withoutSuffix(String name) {
         return name.substring(0, name.lastIndexOf("."));
     }
+
+    /**
+     * Get username from session
+     */
+    private String getUsername() {
+        org.wyona.security.core.api.Identity identity = getEnvironment().getIdentity();
+        if (identity != null) return identity.getUsername();
+        return null;
+    }
 }



More information about the Yanel-commits mailing list