You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2013/10/08 13:46:41 UTC

svn commit: r1530241 - in /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago: portlet/PortletUtils.java webapp/Secret.java

Author: lofwyr
Date: Tue Oct  8 11:46:41 2013
New Revision: 1530241

URL: http://svn.apache.org/r1530241
Log:
TOBAGO-1320: SessionSecret not compatible with portlets
 - util method should return Object

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/portlet/PortletUtils.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/Secret.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/portlet/PortletUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/portlet/PortletUtils.java?rev=1530241&r1=1530240&r2=1530241&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/portlet/PortletUtils.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/portlet/PortletUtils.java Tue Oct  8 11:46:41 2013
@@ -19,8 +19,6 @@
 
 package org.apache.myfaces.tobago.portlet;
 
-import org.apache.myfaces.tobago.webapp.Secret;
-
 import javax.faces.context.FacesContext;
 import javax.portlet.ActionRequest;
 import javax.portlet.PortletContext;
@@ -104,10 +102,10 @@ public final class PortletUtils {
     }
   }
 
-  public static Secret getAttributeFromSessionForApplication(Object session, String name) {
+  public static Object getAttributeFromSessionForApplication(Object session, String name) {
 
     if (PORTLET_API_AVAILABLE && session instanceof PortletSession) {
-      return (Secret) ((PortletSession) session).getAttribute(name, PortletSession.APPLICATION_SCOPE);
+      return ((PortletSession) session).getAttribute(name, PortletSession.APPLICATION_SCOPE);
     } else {
       throw new IllegalArgumentException("Unknown session type: " + session.getClass().getName());
     }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/Secret.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/Secret.java?rev=1530241&r1=1530240&r2=1530241&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/Secret.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/Secret.java Tue Oct  8 11:46:41 2013
@@ -85,7 +85,7 @@ public class Secret implements Serializa
     if (session instanceof HttpSession) {
       secret = (Secret) ((HttpSession) session).getAttribute(Secret.KEY);
     } else {
-      secret = PortletUtils.getAttributeFromSessionForApplication(session, Secret.KEY);
+      secret = (Secret) PortletUtils.getAttributeFromSessionForApplication(session, Secret.KEY);
     }
     return secret != null && secret.secret.equals(fromRequest);
   }
@@ -103,7 +103,7 @@ public class Secret implements Serializa
     if (session instanceof HttpSession) {
       secret = (Secret) ((HttpSession) session).getAttribute(Secret.KEY);
     } else {
-      secret = PortletUtils.getAttributeFromSessionForApplication(session, Secret.KEY);
+      secret = (Secret) PortletUtils.getAttributeFromSessionForApplication(session, Secret.KEY);
     }
     writer.writeAttribute(HtmlAttributes.VALUE, secret.secret, false);
     writer.endElement(HtmlElements.INPUT);