Logo Search packages:      
Sourcecode: jaminid version File versions  Download package

String com::prolixtech::jaminid::Request::unEscape ( String  s  )  [inline, private]

removes the HTTP escape sequence for the query (e.g. 20 and $)

Parameters:
s the string to unescape
Returns:
the unescaped string

Definition at line 312 of file Request.java.

References hex2int().

Referenced by processParamString().

                                      {
        if (s == null || s.equals(""))
            return "";
        int lastIndex = -1;

        do {
            lastIndex = s.indexOf('%', lastIndex + 1);

            if (lastIndex >= 0) {
                try {
                    String hex = s.substring(lastIndex + 1, lastIndex + 3);
                    char hin = (char) hex2int(hex);
                    System.out.println(lastIndex + " Hex is " + hex + " or "
                            + hin);
                    String sBefore = s.substring(0, lastIndex);
                    String sAfter = s.substring(lastIndex + 3);

                    s = sBefore + hin + sAfter;

                } catch (Exception e) {
                    SingletonLogger.Instance().exception("Escaping Error", e);
                }
            }
        } while (lastIndex >= 0);

        s = s.replaceAll("\\+", " ");
        return s;
    }


Generated by  Doxygen 1.6.0   Back to index