java url工具类,url工具类(转)

package ssh.util;

import java.io.BufferedReader;

import java.io.InputStreamReader;

import java.io.UnsupportedEncodingException;

import java.net.HttpURLConnection;

import java.net.URL;

import java.net.URLConnection;

import java.net.URLDecoder;

import java.net.URLEncoder;

import java.util.Iterator;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

/**

* URL工具

* @author gary

*

*/

public class URLUtil {

/**

* 对url进行编码

*/

public static String encodeURL(String url) {

try {

return URLEncoder.encode(url, "UTF-8");

} catch (UnsupportedEncodingException e) {

e.printStackTrace();

return null;

}

}

/**

* 对url进行解码

* @param url

你可能感兴趣的:(java,url工具类)