3 java web-applications protocols
你如何在JAVA中进行RAW/URL编码/解码?
得到了需要发送URLencoded或RAWURLencoded的内容.在这里和那里看后,没有找到任何url/rawurl编码器/解码器可用.你怎么做到的?
例:
String webBrowser = "how=WebRSS&what=Tandory chicken is nice with rice, lets cook for my honey";
String encoded = null;
/**
* Output: how%3DWebRSS%26what%3DTandory+chicken+is+nice+with+rice%2C+lets+cook+for+my+honey
*/
urlencode(webBrowser);
/**
* Output: how%3DWebRSS%26what%3DTandory%20chicken%20is%20nice%20with%20rice%2C%20lets%20cook%20for%20my%20honey
*/
rawurlencode(webBrowser);
postIt(encoded); //!!
Run Code Online (Sandbox Code Playgroud)
对于urlencode/ urldecode(application/x-www-form-urlencoded变体),您可以使用URLEncoder
和URLDecoder.
对于"原始"版本,您可以使用URI自动执行此任务的类.