/** * Return true if this URL ends with '/' */ public boolean hasTrailingSlash() { return metadata.hasTrailingSlash(); }
/** * Get this patterns pattern parser instance. */ public URLPatternParser getPatternParser() { if ((parser == null) && (pattern != null)) { this.parser = new URLPatternParser(pattern); } return parser; }
/** * Return an encoded form of this URL. */ public URL encode() { return new URL(getEncodedSegments(), metadata); }
/** * Return a copy of this Metadata */ public Metadata copy() { Metadata result = new Metadata(); result.setEncoding(encoding); result.setTrailingSlash(trailingSlash); result.setLeadingSlash(leadingSlash); return result; }
/** * Build a query string from the given list of {@link RequestParameter} objects. */ public static <T extends RequestParameter> QueryString build(final List<T> params) { QueryString queryString = new QueryString(); queryString.addParameters(params); return queryString; }
/** * Return a decoded form of this URL. */ public URL decode() { return new URL(getDecodedSegments(), metadata); }
@Override public String toString() { return toQueryString(); }
/** * Return a String representation of this URL */ @Override public String toString() { return toURL(); }
/** * Return true if this URL begins with '/' */ public boolean hasLeadingSlash() { return metadata.hasLeadingSlash(); }
/** * Get the character encoding of this URL (default UTF-8) */ public String getEncoding() { return metadata.getEncoding(); }
/** * Create a URL object for the given url segments (separated by '/' from the original url string), using the given * metadata object to represent the encoding and leading/trailing slash information about this URL. */ public URL(final List<String> segments, final Metadata metadata) { this.metadata = metadata; this.segments = segments; this.originalURL = metadata.buildURLFromSegments(segments); }
/** * Set the character encoding of this URL (default UTF-8) */ public void setEncoding(final String encoding) { metadata.setEncoding(encoding); }
/** * Build a query string from the given map of name=value pairs. For parameters with more than one value, each value * will be appended using the same name. */ public static QueryString build(final Map<String, String[]> params) { QueryString queryString = new QueryString(); queryString.addParameters(params); return queryString; }
/** * Return an encoded form of this URL. */ public URL encode() { return new URL(getEncodedSegments(), metadata); }
@Override public String toString() { return toQueryString(); }
/** * Return a String representation of this URL */ @Override public String toString() { return toURL(); }
/** * Return true if this URL ends with '/' */ public boolean hasTrailingSlash() { return metadata.hasTrailingSlash(); }
/** * Build a query string from the given URL. If a '?' character is encountered in the URL, the any characters up to * and including the first '?' will be ignored. */ public static QueryString build(final String url) { QueryString queryString = new QueryString(); queryString.addParameters(url); return queryString; }
@Override public String toString() { return toQueryString(); }
/** * Build a query string from the given list of {@link RequestParameter} objects. */ public static <T extends RequestParameter> QueryString build(final List<T> params) { QueryString queryString = new QueryString(); queryString.addParameters(params); return queryString; }