/** * Creates a builder with the specified URL fragment. The URL will be used as the start of the URL generated by this * builder. * * @param urlFragment the URL fragment for the builder. This parameter will not be escaped in the resulting URL. * @param querySnippet whether or not this URL is complete or just a query snippet. * @param encoding the character encoding to use for parameter names and values. Can be left null (recommended) to indicate JIRA default encoding. * @throws IllegalArgumentException if <code>urlFragment</code> is null */ public UrlBuilder(final String urlFragment, @Nullable String encoding, boolean querySnippet) { notNull("urlFragment", urlFragment); if (querySnippet) { this.pathBuilder = new StringBuilder(); this.queryBuilder = new StringBuilder(urlFragment); } else { PathQueryHolder holder = parseBaseUrl(urlFragment); this.pathBuilder = new StringBuilder(holder.path); this.queryBuilder = new StringBuilder(holder.query); } this.anchorBuilder = new StringBuilder(); this.encoding = encoding; this.querySnippet = querySnippet; }