/** @return */ public ResourceQuery removePort() { // TODO: make this into a remove() method which then allows you to remove // parts of the URL like if (value == null) return ResourceQueries.resource(); return ResourceQueries.resource(value.replaceFirst(":[0-9]{2,4}", "")); }
/** * Compute the request path which is just the URL with path and query string. * * @return */ public ResourceQuery pathAndQuery() { if (value == null) return ResourceQueries.resource(); String result = value; result = result.replaceFirst("https?://", ""); int end = result.indexOf("/"); if (end > -1) { result = result.substring(end, result.length()); } else { return ResourceQueries.resource(""); } return ResourceQueries.resource(result); }
/** * Read the host part of the URL with just the host. * * <p>http://www.cnn.com/index.html * * <p>would return * * <p>http://www.cnn.com * * @return */ public ResourceQuery site() { if (value == null) return ResourceQueries.resource(); return ResourceQueries.resource(ResourceTokenizer.domainTokenize(value)); }
/** * Expand a relative link. * * @param relative * @return */ public ResourceQuery expand(String relative) { if (value == null) return ResourceQueries.resource(); return ResourceQueries.resource(ResourceExpander.expand(value, relative)); }
public ResourceQuery removeNamedAnchor() { if (value == null) return ResourceQueries.resource(); return ResourceQueries.resource(value.replaceFirst("#.*", "")); }
public ResourceQuery removeScheme() { if (value == null) return ResourceQueries.resource(); return ResourceQueries.resource(value.replaceFirst("https?://", "")); }
public ResourceQuery tokenize() { if (value == null) return ResourceQueries.resource(); return ResourceQueries.resource(ResourceTokenizer.tokenize4(value)); }