Class UrlBuilder
- java.lang.Object
-
- org.pentaho.reporting.libraries.base.util.UrlBuilder
-
public final class UrlBuilder extends Object
Utility class used to handle some of the messy items when building URLs
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
generateUrl(String server, String path, String params, String fragment)
Generates a URL using the server, path, paramters, and fragment items.
-
-
-
Method Detail
-
generateUrl
public static String generateUrl(String server, String path, String params, String fragment) throws URISyntaxException
Generates a URL using the server, path, paramters, and fragment items. The URL will be constructed by basic concatenations (with some glue):
server + path + "?" + params + "#" + fragment
Notes:- The method will make sure there is 1-and-only-1 slash between the server and the path
- The method will perform the proper encoding of the server and path fields
- If the params string is empty, the '?' will not be added
- If the fragment is empty, the '#' will not be added
- Parameters:
server
- (required) the server: i.e."http://source.pentaho.org/"
path
- (required) the path for that server: i.e."/viewvc/pentaho-reporting"
params
- (optional) any URL parameters to pass (already encoded): i.e. parameter=a+value+with+spaces&x=yfragment
- (optional) any fragment information to be appended to the URL- Returns:
- the URL generated from the parameters
- Throws:
URISyntaxException
- indicates an error trying to combine the fields
-
-