ackage HLPPDB;
import org.apache.commons.codec.base64.Base64;/**
* 提供对 URL 进行处理的工具类
*/
public class queryBean
{
/**
* 将 URL 参数据进行安全编码
* @param s
* @return
*/
public final static String safeRequestParameter(String s)
{
byte[] b = Base64.encode(s.getBytes());
StringBuffer sb = new StringBuffer();
for(int i = 0; i < b.length; i++)
{
sb.append("%" + Integer.toHexString(b[i]));
}
return sb.toString(); }
/**
* 对 URL 参数据进行安全解码
* @param s
* @return
*/
public final static String decodeSafeRequestParameter(String s)
{
return new String(Base64.decode(s.getBytes()));
}
}
import org.apache.commons.codec.base64.Base64;/**
* 提供对 URL 进行处理的工具类
*/
public class queryBean
{
/**
* 将 URL 参数据进行安全编码
* @param s
* @return
*/
public final static String safeRequestParameter(String s)
{
byte[] b = Base64.encode(s.getBytes());
StringBuffer sb = new StringBuffer();
for(int i = 0; i < b.length; i++)
{
sb.append("%" + Integer.toHexString(b[i]));
}
return sb.toString(); }
/**
* 对 URL 参数据进行安全解码
* @param s
* @return
*/
public final static String decodeSafeRequestParameter(String s)
{
return new String(Base64.decode(s.getBytes()));
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货