Class ReqUtil

    • Field Detail

      • request

        protected javax.servlet.http.HttpServletRequest request
      • response

        protected javax.servlet.http.HttpServletResponse response
      • errFlag

        protected boolean errFlag
    • Constructor Detail

      • ReqUtil

        public ReqUtil​(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
        Parameters:
        request -
        response -
    • Method Detail

      • getRequest

        public javax.servlet.http.HttpServletRequest getRequest()
        Returns:
        HttpServletRequest
      • getResponse

        public javax.servlet.http.HttpServletResponse getResponse()
        Returns:
        HttpServletResponse
      • setErrFlag

        public void setErrFlag​(boolean val)
        Parameters:
        val -
      • getErrFlag

        public boolean getErrFlag()
        Returns:
        boolean
      • getReqPar

        public String getReqPar​(String name)
        Get a request parameter stripped of white space. Return null for zero length.
        Parameters:
        name - name of parameter
        Returns:
        String value
      • getReqPar

        public String getReqPar​(String name,
                                String def)
        Get a request parameter stripped of white space. Return default for null or zero length.
        Parameters:
        name - name of parameter
        def - default value
        Returns:
        String value
      • present

        public boolean present​(String name)
        See if a request parameter is present
        Parameters:
        name - name of parameter
        Returns:
        boolean true for present
      • notNull

        public boolean notNull​(String name)
                        throws Throwable
        See if a request parameter is present and not null or empty
        Parameters:
        name - name of parameter
        Returns:
        boolean true for present and not null
        Throws:
        Throwable
      • getReqPars

        public List<String> getReqPars​(String name)
                                throws Throwable
        Get a multi-valued request parameter stripped of white space. Return null for zero length.
        Parameters:
        name - name of parameter
        Returns:
        List or null
        Throws:
        Throwable
      • getIntReqPar

        public Integer getIntReqPar​(String name)
                             throws Throwable
        Get an Integer request parameter or null.
        Parameters:
        name - name of parameter
        Returns:
        Integer value or null
        Throws:
        Throwable
      • getIntReqPar

        public int getIntReqPar​(String name,
                                int defaultVal)
                         throws Throwable
        Get an integer valued request parameter.
        Parameters:
        name - name of parameter
        defaultVal -
        Returns:
        int value
        Throws:
        Throwable
      • getLongReqPar

        public Long getLongReqPar​(String name)
                           throws Throwable
        Get a Long request parameter or null.
        Parameters:
        name - name of parameter
        Returns:
        Long value or null
        Throws:
        Throwable
      • getLongReqPar

        public long getLongReqPar​(String name,
                                  long defaultVal)
                           throws Throwable
        Get an long valued request parameter.
        Parameters:
        name - name of parameter
        defaultVal -
        Returns:
        long value
        Throws:
        Throwable
      • getBooleanReqPar

        public Boolean getBooleanReqPar​(String name)
                                 throws Throwable
        Get a boolean valued request parameter.
        Parameters:
        name - name of parameter
        Returns:
        Boolean value or null for absent parameter
        Throws:
        Throwable
      • getBooleanReqPar

        public boolean getBooleanReqPar​(String name,
                                        boolean defVal)
                                 throws Throwable
        Get a boolean valued request parameter giving a default value.
        Parameters:
        name - name of parameter
        defVal - default value for absent parameter
        Returns:
        boolean value
        Throws:
        Throwable
      • setSessionAttr

        public void setSessionAttr​(String attrName,
                                   Object val)
        Set the value of a named session attribute.
        Parameters:
        attrName - Name of the attribute
        val - Object
      • removeSessionAttr

        public void removeSessionAttr​(String attrName)
        Remove a named session attribute.
        Parameters:
        attrName - Name of the attribute
      • getSessionAttr

        public Object getSessionAttr​(String attrName)
        Return the value of a named session attribute.
        Parameters:
        attrName - Name of the attribute
        Returns:
        Object Attribute value or null
      • setRequestAttr

        public void setRequestAttr​(String attrName,
                                   Object val)
        Set the value of a named request attribute.
        Parameters:
        attrName - Name of the attribute
        val - Object
      • getRequestAttr

        public Object getRequestAttr​(String attrName)
        Return the value of a named request attribute.
        Parameters:
        attrName - Name of the attribute
        Returns:
        Object Attribute value or null
      • getRemoteAddr

        public String getRemoteAddr()
        Returns:
        String remote address
      • getRemoteHost

        public String getRemoteHost()
        Returns:
        String remote host
      • getRemotePort

        public int getRemotePort()
        Returns:
        int remote port
      • getLocales

        public Collection<Locale> getLocales()
        If there is no Accept-Language header returns null, otherwise returns a collection of Locales ordered with preferred first.
        Returns:
        Collection of locales or null