/** * @param url * @return String SURT which will match urls prefixed with the argument url * @throws URIException */ public static String prefixKey(String url) throws URIException { return getKey(url,true); } /**
public static String toSURT(String input) { if(input.startsWith("(")) { return input; } try { // String tmp = input; // if(tmp == null) { // throw new URIException(); // } String tmp = SURTTokenizer.prefixKey(input); if(tmp.contains("/")) { return tmp; } return tmp + ","; } catch (URIException e) { LOG.warning("URI Exception for(" + input + "):" + e.getLocalizedMessage()); // e.printStackTrace(); return input; } } public static void main(String[] args) {
private static String getKey(String url, boolean prefix) throws URIException { String key = addImpliedHttpIfNecessary(url); UsableURI uuri = UsableURIFactory.getInstance(key); key = uuri.getScheme() + "://" + uuri.getAuthority() + uuri.getEscapedPathQuery(); key = SURT.fromURI(key); int hashPos = key.indexOf('#'); if(hashPos != -1) { key = key.substring(0,hashPos); } if(key.startsWith("http://")) { key = key.substring(7); } if(prefix) { if(key.endsWith(",)/")) { key = key.substring(0,key.length()-3); } } return key; } }
/** * * @return * @throws JSONException */ @JsonIgnore public String getUrlAsSURT() throws JSONException { String url = this.getString(URL); try { return SURTTokenizer.exactKey(url); } catch (URIException e) { // Fall back on normal URI: return url; } }
public static String toSURT(String input) { if(input.startsWith("(")) { return input; } try { // String tmp = input; // if(tmp == null) { // throw new URIException(); // } String tmp = SURTTokenizer.prefixKey(input); if(tmp.contains("/")) { return tmp; } return tmp + ","; } catch (URIException e) { LOG.warning("URI Exception for(" + input + "):" + e.getLocalizedMessage()); // e.printStackTrace(); return input; } } public static void main(String[] args) {
private static String getKey(String url, boolean prefix) throws URIException { String key = addImpliedHttpIfNecessary(url); UsableURI uuri = UsableURIFactory.getInstance(key); key = uuri.getScheme() + "://" + uuri.getAuthority() + uuri.getEscapedPathQuery(); key = SURT.fromURI(key); int hashPos = key.indexOf('#'); if(hashPos != -1) { key = key.substring(0,hashPos); } if(key.startsWith("http://")) { key = key.substring(7); } if(prefix) { if(key.endsWith(",)/")) { key = key.substring(0,key.length()-3); } } return key; } }
/** * * @return * @throws JSONException */ @JsonIgnore public String getUrlAsSURT() throws JSONException { String url = this.getString(URL); try { return SURTTokenizer.exactKey(url); } catch (URIException e) { // Fall back on normal URI: return url; } }
/** * @param url * @return String SURT which will match exactly argument url * @throws URIException */ public static String exactKey(String url) throws URIException { return getKey(url,false); }
public static String toSURT(String input) { if(input.startsWith("(")) { return input; } try { // String tmp = input; // if(tmp == null) { // throw new URIException(); // } String tmp = SURTTokenizer.prefixKey(input); if(tmp.contains("/")) { return tmp; } return tmp + ","; } catch (URIException e) { LOG.warning("URI Exception for(" + input + "):" + e.getLocalizedMessage()); // e.printStackTrace(); return input; } } public static void main(String[] args) {
private static String getKey(String url, boolean prefix) throws URIException { String key = addImpliedHttpIfNecessary(url); UsableURI uuri = UsableURIFactory.getInstance(key); key = uuri.getScheme() + "://" + uuri.getAuthority() + uuri.getEscapedPathQuery(); key = SURT.fromURI(key); int hashPos = key.indexOf('#'); if(hashPos != -1) { key = key.substring(0,hashPos); } if(key.startsWith("http://")) { key = key.substring(7); } if(prefix) { if(key.endsWith(",)/")) { key = key.substring(0,key.length()-3); } } return key; } }
/** * @param url * @return String SURT which will match urls prefixed with the argument url * @throws URIException */ public static String prefixKey(String url) throws URIException { return getKey(url,true); } /**
/** * @param url * @return String SURT which will match exactly argument url * @throws URIException */ public static String exactKey(String url) throws URIException { return getKey(url,false); }
/** * @param url * @return String SURT which will match exactly argument url * @throws URIException */ public static String exactKey(String url) throws URIException { return getKey(url,false); }
/** * @param url * @return String SURT which will match urls prefixed with the argument url * @throws URIException */ public static String prefixKey(String url) throws URIException { return getKey(url,true); } /**
/** * constructor * * @param url String URL * @throws URIException */ public SURTTokenizer(final String url) throws URIException { if(url.startsWith("(")) { remainder = url; } else { remainder = getKey(url,false); } } /**
/** * constructor * * @param url String URL * @throws URIException */ public SURTTokenizer(final String url) throws URIException { if(url.startsWith("(")) { remainder = url; } else { remainder = getKey(url,false); } } /**
/** * constructor * * @param url String URL * @throws URIException */ public SURTTokenizer(final String url) throws URIException { if(url.startsWith("(")) { remainder = url; } else { remainder = getKey(url,false); } } /**