protected static String urlEncode ( String value , boolean path ) { try { value = URLEncoder . encode ( value , DEFAULT_ENCODING ) ; } catch ( Exception e ) { throw wrap ( e ) ; } value = replaceAll ( value , plusPtn , "%20" ) ; value = replaceAll ( value , asteriskPtn , "%2A" ) ; value = replaceAll ( value , pct7EPtn , "~" ) ; if ( path ) { value = replaceAll ( value , pct2FPtn , "/" ) ; } return value ; }
URL encode a value .