NIHVIVO-2492 Add a convenience method to get the policies from a request.

This commit is contained in:
j2blake 2011-04-15 14:38:43 +00:00
parent ccdbee221b
commit 15b778fd79

View file

@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.auth.policy;
import java.util.ListIterator; import java.util.ListIterator;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; 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 String ATTRIBUTE_POLICY_LIST = ServletPolicyList.class.getName();
private static final Log log = LogFactory.getLog(ServletPolicyList.class); 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 * Get a copy of the current list of policies. This method may return an
* empty list, but it never returns null. * empty list, but it never returns null.