Class WebConsoleUtil


  • @Deprecated
    public final class WebConsoleUtil
    extends java.lang.Object
    Deprecated.
    Some of the methods can be replaced with direct Servlet API calls.
    The WebConsoleUtil provides various utility methods for use by Web Console plugins.
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.lang.String escapeHtml​(java.lang.String text)
      Deprecated.
      It is better to use specialized encoders instead
      static java.lang.String getParameter​(javax.servlet.http.HttpServletRequest request, java.lang.String name)
      Deprecated.
      Use the Servlet API for uploads
      static int getParameterInt​(javax.servlet.http.HttpServletRequest request, java.lang.String name, int _default)
      Deprecated.
      Retrieves a request parameter and converts it to int.
      static VariableResolver getVariableResolver​(javax.servlet.ServletRequest request)
      Deprecated.
      Use the RequestVariableResolver instead.
      static void sendRedirect​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String redirectUrl)
      Deprecated.
      Utility method to handle relative redirects.
      static void setNoCache​(javax.servlet.http.HttpServletResponse response)
      Deprecated.
      Sets response headers to force the client to not cache the response sent back.
      static void setVariableResolver​(javax.servlet.ServletRequest request, VariableResolver resolver)
      Deprecated.
      Use the RequestVariableResolver instead.
      static java.lang.String toString​(java.lang.Object value)
      Deprecated.
      This method will stringify a Java object.
      static java.lang.String urlDecode​(java.lang.String value)
      Deprecated.
      Decode the given value expected to be URL encoded.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getParameter

        @Deprecated
        public static final java.lang.String getParameter​(javax.servlet.http.HttpServletRequest request,
                                                          java.lang.String name)
        Deprecated.
        Use the Servlet API for uploads
        An utility method to get a parameter value
        Parameters:
        request - the HTTP request coming from the user
        name - the name of the parameter
        Returns:
        The value or null.
      • sendRedirect

        public static final void sendRedirect​(javax.servlet.http.HttpServletRequest request,
                                              javax.servlet.http.HttpServletResponse response,
                                              java.lang.String redirectUrl)
                                       throws java.io.IOException
        Deprecated.
        Utility method to handle relative redirects. Some application servers like Web Sphere handle relative redirects differently therefore we should make an absolute URL before invoking send redirect.
        Parameters:
        request - the HTTP request coming from the user
        response - the HTTP response, where data is rendered
        redirectUrl - the redirect URI.
        Throws:
        java.io.IOException - If an input or output exception occurs
        java.lang.IllegalStateException - If the response was committed or if a partial URL is given and cannot be converted into a valid URL
      • setNoCache

        public static final void setNoCache​(javax.servlet.http.HttpServletResponse response)
        Deprecated.
        Sets response headers to force the client to not cache the response sent back. This method must be called before the response is committed otherwise it will have no effect.

        This method sets the Cache-Control, Expires, and Pragma headers.

        Parameters:
        response - The response for which to set the cache prevention
      • escapeHtml

        @Deprecated
        public static final java.lang.String escapeHtml​(java.lang.String text)
        Deprecated.
        It is better to use specialized encoders instead
        Escapes HTML special chars like: <>&\r\n and space
        Parameters:
        text - the text to escape
        Returns:
        the escaped text
      • getParameterInt

        public static final int getParameterInt​(javax.servlet.http.HttpServletRequest request,
                                                java.lang.String name,
                                                int _default)
        Deprecated.
        Retrieves a request parameter and converts it to int.
        Parameters:
        request - the HTTP request
        name - the name of the request parameter
        _default - the default value returned if the parameter is not set or is not a valid integer.
        Returns:
        the request parameter if set and is valid integer, or the default value
      • urlDecode

        public static java.lang.String urlDecode​(java.lang.String value)
        Deprecated.
        Decode the given value expected to be URL encoded.

        This method first tries to use the Java 1.4 method URLDecoder.decode(String, String) method and falls back to the now deprecated URLDecoder.decode(String, String) which uses the platform character set to decode the string. This is because the platforms before 1.4 and most notably some OSGi Execution Environments (such as Minimum EE) do not provide the newer method.

        Parameters:
        value - the value to decode
        Returns:
        the decoded string
      • toString

        public static final java.lang.String toString​(java.lang.Object value)
        Deprecated.
        This method will stringify a Java object. It is mostly used to print the values of unknown properties. This method will correctly handle if the passed object is array and will property display it. If the value is byte[] the elements are shown as Hex
        Parameters:
        value - the value to convert
        Returns:
        the string representation of the value