Examples of URLCodec


Examples of org.apache.commons.codec.net.URLCodec

        return str;
      }
    }
   
    public static String sanitizeAndPreserveSlashes(String str) {
      URLCodec codec= new URLCodec();
      try {
        return codec.encode(str).replaceAll("\\+", "%20").replaceAll("%2F", "/");
       }
      catch (EncoderException ee) {
        logger.warn("Error trying to encode string for URI", ee);
        return str;
      }
View Full Code Here

Examples of org.apache.commons.codec.net.URLCodec

        return str;
      }
    }
   
    public static String unencodeURI(String str) {
         URLCodec codec= new URLCodec();
      try {
        return codec.decode(str);
      }
      catch (DecoderException ee) {
        logger.warn("Error trying to encode string for URI", ee);
        return str;
      }
View Full Code Here

Examples of org.apache.commons.codec.net.URLCodec

                }
            }

            // We're ready to decode the params
            Map<String, String[]> decodedParams = new LinkedHashMap<String, String[]>(params.size());
            URLCodec codec = new URLCodec();
            for (Map.Entry<String, String[]> e : params.entrySet()) {
                String key = e.getKey();
                try {
                    key = codec.decode(e.getKey(), charset);
                } catch (Throwable z) {
                    // Nothing we can do about, ignore
                }
                for (String value : e.getValue()) {
                    try {
                        Utils.Maps.mergeValueInMap(decodedParams, key, (value == null ? null : codec.decode(value, charset)));
                    } catch (Throwable z) {
                        // Nothing we can do about, lets fill in with the non decoded value
                        Utils.Maps.mergeValueInMap(decodedParams, key, value);
                    }
                }
View Full Code Here

Examples of org.apache.commons.codec.net.URLCodec

     */
    private static String doFormUrlEncode(NameValuePair[] pairs, String charset)
            throws UnsupportedEncodingException {
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < pairs.length; i++) {
            URLCodec codec = new URLCodec();
            NameValuePair pair = pairs[i];
            if (pair.getName() != null) {
                if (i > 0) {
                    buf.append("&");
                }
                buf.append(codec.encode(pair.getName(), charset));
                buf.append("=");
                if (pair.getValue() != null) {
                    buf.append(codec.encode(pair.getValue(), charset));
                }
            }
        }
        return buf.toString();
    }
View Full Code Here

Examples of org.apache.commons.codec.net.URLCodec

    @Rule
    public TemporaryFolder temporaryFolder = new TemporaryFolder();

    @Before
    public void setUp() throws Exception {
        encoder = new URLCodec();
        service = new RuleBaseElementPersistenceBackendService();
        storageFolder = temporaryFolder.newFolder("rules");
        service.setStorageFolderPath(storageFolder.getPath());
        service.init();
    }
View Full Code Here

Examples of org.apache.commons.codec.net.URLCodec

    public void setStorageFolderPath(String storageFolderPath) {
        storageFolder = new File(storageFolderPath);
    }

    public void init() throws PersistenceException {
        encoder = new URLCodec();
        if (!storageFolder.exists()) {
            try {
                FileUtils.forceMkdir(storageFolder);
            } catch (IOException e) {
                throw new PersistenceException(e);
View Full Code Here

Examples of org.apache.commons.codec.net.URLCodec

    public RuleBaseFileNameFilter(Map<String, String> metaData) {
        type = metaData.get(RuleBaseElement.META_RULE_TYPE);
        name = metaData.get(RuleBaseElement.META_RULE_NAME);
        pack = metaData.get(RuleBaseElement.META_RULE_PACKAGE);
        decoder = new URLCodec();
    }
View Full Code Here

Examples of org.apache.commons.codec.net.URLCodec

                }
            }

            // We're ready to decode the params
            Map<String, String[]> decodedParams = new HashMap<String, String[]>(params.size());
            URLCodec codec = new URLCodec();
            for (Map.Entry<String, String[]> e : params.entrySet()) {
                String key = e.getKey();
                try {
                    key = codec.decode(e.getKey(), charset);
                } catch (Throwable z) {
                    // Nothing we can do about, ignore
                }
                for (String value : e.getValue()) {
                    try {
                        Utils.Maps.mergeValueInMap(decodedParams, key, (value == null ? null : codec.decode(value, charset)));
                    } catch (Throwable z) {
                        // Nothing we can do about, lets fill in with the non decoded value
                        Utils.Maps.mergeValueInMap(decodedParams, key, value);
                    }
                }
View Full Code Here

Examples of org.apache.commons.codec.net.URLCodec

     * @return �^�ǽs�X�ᤧ�r��.
     * @throws Exception
     */
    public static String encode(String value) throws Exception {
      URLcodecTK.checkNull(value);
      URLCodec url = new URLCodec();
        return url.encode(value);
    }
View Full Code Here

Examples of org.apache.commons.codec.net.URLCodec

     * @return �^�ǽs�X�ᤧ�줸�հ}�C.
     * @throws Exception
     */
    public static byte[] encode(byte[] binaryData) throws Exception {
      URLcodecTK.checkNull(binaryData);
      URLCodec url = new URLCodec();
        return url.encode(binaryData);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.