Class MultipartWrapper

  • All Implemented Interfaces:
    IParameterActivity, IPasswordMapperActivity, IPostParameters

    public class MultipartWrapper
    extends java.lang.Object
    implements IPostParameters
    This class provides abstract parameter service, including support for uploaded files and multipart forms. It is styled much like HttpServletRequest, but wraps this interface so that code can access either standard post data or multipart data transparently.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String _rcsid  
      protected AdminProfile adminProfile
      The Admin Profile bean, for password mapping.
      protected java.lang.String characterEncoding  
      protected javax.servlet.http.HttpServletRequest request
      This is the HttpServletRequest object, which will be used for parameters only if the form is not multipart.
      protected java.util.Map variableMap  
    • Constructor Summary

      Constructors 
      Constructor Description
      MultipartWrapper​(javax.servlet.http.HttpServletRequest request, AdminProfile adminProfile)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getBinaryBytes​(java.lang.String name)
      Get file parameter, as a byte array.
      BinaryInput getBinaryStream​(java.lang.String name)
      Get a file parameter, as a binary input.
      java.lang.String getParameter​(java.lang.String name)
      Get single parameter value.
      java.lang.String[] getParameterValues​(java.lang.String name)
      Get multiple parameter values.
      java.lang.String mapKeyToPassword​(java.lang.String key)
      Convert a key, created by mapPasswordToKey, back to the original password, within the lifetime of the browser session.
      java.lang.String mapPasswordToKey​(java.lang.String password)
      Map a password to a unique key.
      void setParameter​(java.lang.String name, java.lang.String value)
      Set a parameter value
      void setParameterValues​(java.lang.String name, java.lang.String[] values)
      Set an array of parameter values
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • adminProfile

        protected final AdminProfile adminProfile
        The Admin Profile bean, for password mapping.
      • request

        protected javax.servlet.http.HttpServletRequest request
        This is the HttpServletRequest object, which will be used for parameters only if the form is not multipart.
      • variableMap

        protected java.util.Map variableMap
      • characterEncoding

        protected java.lang.String characterEncoding
    • Method Detail

      • getParameterValues

        public java.lang.String[] getParameterValues​(java.lang.String name)
        Get multiple parameter values.
        Specified by:
        getParameterValues in interface IParameterActivity
        Parameters:
        name - is the parameter name.
        Returns:
        the array of values, or null if it doesn't exist.
      • getParameter

        public java.lang.String getParameter​(java.lang.String name)
        Get single parameter value.
        Specified by:
        getParameter in interface IParameterActivity
        Parameters:
        name - is the parameter name.
        Returns:
        the value, or null if it doesn't exist.
      • getBinaryBytes

        public byte[] getBinaryBytes​(java.lang.String name)
        Get file parameter, as a byte array.
        Specified by:
        getBinaryBytes in interface IParameterActivity
        Parameters:
        name - is the parameter name.
        Returns:
        the binary parameter as an array of bytes.
      • setParameter

        public void setParameter​(java.lang.String name,
                                 java.lang.String value)
        Set a parameter value
        Specified by:
        setParameter in interface IParameterActivity
        Parameters:
        name - is the parameter name.
        value - is the desired value.
      • setParameterValues

        public void setParameterValues​(java.lang.String name,
                                       java.lang.String[] values)
        Set an array of parameter values
        Specified by:
        setParameterValues in interface IParameterActivity
        Parameters:
        name - is the parameter name.
        values - is the array of desired values.
      • mapPasswordToKey

        public java.lang.String mapPasswordToKey​(java.lang.String password)
        Map a password to a unique key. This method works within a specific given browser session to replace an existing password with a key which can be used to look up the password at a later time.
        Specified by:
        mapPasswordToKey in interface IPasswordMapperActivity
        Parameters:
        password - is the password.
        Returns:
        the key.
      • mapKeyToPassword

        public java.lang.String mapKeyToPassword​(java.lang.String key)
        Convert a key, created by mapPasswordToKey, back to the original password, within the lifetime of the browser session. If the provided key is not an actual key, instead the key value is assumed to be a new password value.
        Specified by:
        mapKeyToPassword in interface IPasswordMapperActivity
        Parameters:
        key - is the key.
        Returns:
        the password.