1 28 29 package org.apache.commons.transaction.file; 30 31 import java.io.UnsupportedEncodingException ; 32 import java.net.URLEncoder ; 33 34 import org.apache.commons.codec.binary.Base64; 35 36 41 public class URLEncodeIdMapper implements ResourceIdToPathMapper { 42 public String getPathForId(Object resourceId) { 43 String path = resourceId.toString(); 44 try { 45 path = new String (Base64.encodeBase64(path.getBytes("UTF-8")), "ASCII"); 54 path = URLEncoder.encode(path); 55 } catch (UnsupportedEncodingException e) { 56 } 58 return path; 59 } 60 } 61 | Popular Tags |