org.hisp.dhis.UriBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dhis2-java-client Show documentation
Show all versions of dhis2-java-client Show documentation
DHIS 2 API client for Java.
package org.hisp.dhis;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.client.utils.URLEncodedUtils;
public class UriBuilder
extends URIBuilder
{
public UriBuilder( URI uri )
{
super( uri );
}
public UriBuilder( String uri )
throws URISyntaxException
{
super( uri );
}
/**
* Appends the given path segment to the URI. The path string
* may contain multiple segments.
*
* @param path the path segment.
* @return a {@link UriBuilder}.
*/
public UriBuilder pathSegment( String path )
{
List segments = URLEncodedUtils.parsePathSegments( path );
appendPathSegments( segments );
return this;
}
/**
* Appends the given path segments.
*
* @param segments the path segments.
*/
private void appendPathSegments( List segments )
{
List paths = new ArrayList<>( getPathSegments() );
paths.addAll( segments );
setPathSegments( paths );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy