Class QuoteUtil


  • @Deprecated(since="2021-05-27")
    public class QuoteUtil
    extends java.lang.Object
    Deprecated.
    The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.
    Provide some consistent Http header value and Extension configuration parameter quoting support.

    While QuotedStringTokenizer exists in jetty-util, and works great with http header values, using it in websocket-api is undesired.

    • Using QuotedStringTokenizer would introduce a dependency to jetty-util that would need to be exposed via the WebAppContext classloader
    • ABNF defined extension parameter parsing requirements of RFC-6455 (WebSocket) ABNF, is slightly different than the ABNF parsing defined in RFC-2616 (HTTP/1.1).
    • Future HTTPbis ABNF changes for parsing will impact QuotedStringTokenizer
    It was decided to keep this implementation separate for the above reasons.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ABNF_REQUIRED_QUOTING
      Deprecated.
      ABNF from RFC 2616, RFC 822, and RFC 6455 specified characters requiring quoting.
    • Constructor Summary

      Constructors 
      Constructor Description
      QuoteUtil()
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.lang.String dequote​(java.lang.String str)
      Deprecated.
      Remove quotes from a string, only if the input string start with and end with the same quote character.
      static void escape​(java.lang.StringBuilder buf, java.lang.String str)
      Deprecated.
       
      static java.lang.String join​(java.lang.Object[] objs, java.lang.String delim)
      Deprecated.
       
      static java.lang.String join​(java.util.Collection<?> objs, java.lang.String delim)
      Deprecated.
       
      static void quote​(java.lang.StringBuilder buf, java.lang.String str)
      Deprecated.
      Simple quote of a string, escaping where needed.
      static void quoteIfNeeded​(java.lang.StringBuilder buf, java.lang.String str, java.lang.String delim)
      Deprecated.
      Append into buf the provided string, adding quotes if needed.
      static java.util.Iterator<java.lang.String> splitAt​(java.lang.String str, java.lang.String delims)
      Deprecated.
      Create an iterator of the input string, breaking apart the string at the provided delimiters, removing quotes and triming the parts of the string as needed.
      static java.lang.String unescape​(java.lang.String str)
      Deprecated.
       
      • Methods inherited from class java.lang.Object

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

      • ABNF_REQUIRED_QUOTING

        public static final java.lang.String ABNF_REQUIRED_QUOTING
        Deprecated.
        ABNF from RFC 2616, RFC 822, and RFC 6455 specified characters requiring quoting.
        See Also:
        Constant Field Values
    • Constructor Detail

      • QuoteUtil

        public QuoteUtil()
        Deprecated.
    • Method Detail

      • dequote

        public static java.lang.String dequote​(java.lang.String str)
        Deprecated.
        Remove quotes from a string, only if the input string start with and end with the same quote character.
        Parameters:
        str - the string to remove surrounding quotes from
        Returns:
        the de-quoted string
      • escape

        public static void escape​(java.lang.StringBuilder buf,
                                  java.lang.String str)
        Deprecated.
      • quote

        public static void quote​(java.lang.StringBuilder buf,
                                 java.lang.String str)
        Deprecated.
        Simple quote of a string, escaping where needed.
        Parameters:
        buf - the StringBuilder to append to
        str - the string to quote
      • quoteIfNeeded

        public static void quoteIfNeeded​(java.lang.StringBuilder buf,
                                         java.lang.String str,
                                         java.lang.String delim)
        Deprecated.
        Append into buf the provided string, adding quotes if needed.

        Quoting is determined if any of the characters in the delim are found in the input str.

        Parameters:
        buf - the buffer to append to
        str - the string to possibly quote
        delim - the delimiter characters that will trigger automatic quoting
      • splitAt

        public static java.util.Iterator<java.lang.String> splitAt​(java.lang.String str,
                                                                   java.lang.String delims)
        Deprecated.
        Create an iterator of the input string, breaking apart the string at the provided delimiters, removing quotes and triming the parts of the string as needed.
        Parameters:
        str - the input string to split apart
        delims - the delimiter characters to split the string on
        Returns:
        the iterator of the parts of the string, trimmed, with quotes around the string part removed, and unescaped
      • unescape

        public static java.lang.String unescape​(java.lang.String str)
        Deprecated.
      • join

        public static java.lang.String join​(java.lang.Object[] objs,
                                            java.lang.String delim)
        Deprecated.
      • join

        public static java.lang.String join​(java.util.Collection<?> objs,
                                            java.lang.String delim)
        Deprecated.