import org.apache.commons.codec.EncoderException;
import org.apache.commons.codec.net.URLCodec;
public static String encodeURL(String url) {
try {
return new URLCodec().encode(url);
} catch (EncoderException e) {
return null;
}
}
or
String inputEnc= URLEncoder.encode(input,"UTF-8"); // jakarta-commons/commons-codec.jar
Friday, January 6, 2012
Wednesday, January 4, 2012
disable caching for Java servlet
// Set standard HTTP/1.1 no-cache headers.
response.setHeader("Cache-Control", "private, no-store, no-cache, must-revalidate");
// Set standard HTTP/1.0 no-cache header.
response.setHeader("Pragma", "no-cache");
Subscribe to:
Posts (Atom)