All Downloads are FREE. Search and download functionalities are using the official Maven repository.

play.libs.URLs Maven / Gradle / Ivy

There is a newer version: 1.5.0
Show newest version
package play.libs;

import java.net.URLEncoder;
import play.exceptions.UnexpectedException;

public class URLs {

    public static String addParam(String originalUrl, String name, String value) {
        return originalUrl + (originalUrl.contains("?") ? "&" : "?") + encodePart(name) + "=" + encodePart(value);
    }

    public static String encodePart(String part) {
        try {
            return URLEncoder.encode(part, "utf-8");
        } catch (Exception e) {
            throw new UnexpectedException(e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy