From 15b778fd79b9d99332260bd526c97efe0f374ce8 Mon Sep 17 00:00:00 2001 From: j2blake Date: Fri, 15 Apr 2011 14:38:43 +0000 Subject: [PATCH] NIHVIVO-2492 Add a convenience method to get the policies from a request. --- .../vitro/webapp/auth/policy/ServletPolicyList.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/ServletPolicyList.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/ServletPolicyList.java index bf5624945..20b3816dc 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/ServletPolicyList.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/ServletPolicyList.java @@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.auth.policy; import java.util.ListIterator; import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -20,6 +21,14 @@ public class ServletPolicyList { private static final String ATTRIBUTE_POLICY_LIST = ServletPolicyList.class.getName(); private static final Log log = LogFactory.getLog(ServletPolicyList.class); + /** + * Get a copy of the current list of policies. This method may return an + * empty list, but it never returns null. + */ + public static PolicyIface getPolicies(HttpServletRequest hreq) { + return getPolicies(hreq.getSession().getServletContext()); + } + /** * Get a copy of the current list of policies. This method may return an * empty list, but it never returns null.