Class RequestStorageImpl

  • All Implemented Interfaces:
    org.sakaiproject.entitybroker.entityprovider.extension.RequestStorage, org.sakaiproject.entitybroker.entityprovider.extension.RequestStorageWrite

    public class RequestStorageImpl
    extends Object
    implements org.sakaiproject.entitybroker.entityprovider.extension.RequestStorageWrite
    Impl for the request store, will store values in the request itself and will maintain a map of all request values in a threadlocal which should always be cleared at the end of the request
    Author:
    Aaron Zeckoski (azeckoski @ gmail.com)
    • Constructor Detail

      • RequestStorageImpl

        protected RequestStorageImpl()
      • RequestStorageImpl

        public RequestStorageImpl​(org.sakaiproject.entitybroker.entityprovider.extension.RequestGetter requestGetter)
    • Method Detail

      • setRequestGetter

        public void setRequestGetter​(org.sakaiproject.entitybroker.entityprovider.extension.RequestGetter requestGetter)
      • inRequest

        public boolean inRequest()
      • getStorageMapCopy

        public Map<String,​Object> getStorageMapCopy()
        Specified by:
        getStorageMapCopy in interface org.sakaiproject.entitybroker.entityprovider.extension.RequestStorage
      • getStoredValue

        public Object getStoredValue​(String key)
        Specified by:
        getStoredValue in interface org.sakaiproject.entitybroker.entityprovider.extension.RequestStorage
      • getStorageMapCopy

        public Map<String,​Object> getStorageMapCopy​(boolean includeInternal,
                                                          boolean includeHeaders,
                                                          boolean includeParams,
                                                          boolean includeAttributes)
        Special version which allows getting only the parts that are desired
        Specified by:
        getStorageMapCopy in interface org.sakaiproject.entitybroker.entityprovider.extension.RequestStorage
        Parameters:
        includeInternal - include the internal request values
        includeHeaders - include the request headers
        includeParams - include the request parameters
        includeAttributes - include the request attributes
        Returns:
        the map with the requested values
      • getStoredValueAsType

        public <T> T getStoredValueAsType​(Class<T> type,
                                          String key)
        Specified by:
        getStoredValueAsType in interface org.sakaiproject.entitybroker.entityprovider.extension.RequestStorage
      • setStoredValue

        public void setStoredValue​(String key,
                                   Object value)
        Specified by:
        setStoredValue in interface org.sakaiproject.entitybroker.entityprovider.extension.RequestStorageWrite
      • reset

        public void reset()
        Resets the request storage and purges all stored values (has no effect on the data in the request)
        Specified by:
        reset in interface org.sakaiproject.entitybroker.entityprovider.extension.RequestStorageWrite
      • setRequestValue

        public void setRequestValue​(String key,
                                    Object value)
        Allows user to set the value of a key directly, including reserved keys
        Specified by:
        setRequestValue in interface org.sakaiproject.entitybroker.entityprovider.extension.RequestStorageWrite
        Parameters:
        key -
        value -
      • setRequestValues

        public void setRequestValues​(Map<String,​Object> params)
        Place all these params into the request storage
        Specified by:
        setRequestValues in interface org.sakaiproject.entitybroker.entityprovider.extension.RequestStorageWrite
        Parameters:
        params - map of string -> value
      • getRequestValue

        protected Object getRequestValue​(String key)
      • getAllRequestValues

        protected Map<String,​Object> getAllRequestValues()
      • getRequestValues

        protected Map<String,​Object> getRequestValues​(boolean includeHeaders,
                                                            boolean includeParams,
                                                            boolean includeAttributes)
      • getRequestValues

        public static Map<String,​Object> getRequestValues​(javax.servlet.http.HttpServletRequest request,
                                                                boolean includeHeaders,
                                                                boolean includeParams,
                                                                boolean includeAttributes)