Here you can find the source of concaturl(final URL p_base, final String p_string)
Parameter | Description |
---|---|
p_base | base URL |
p_string | additional path |
Parameter | Description |
---|---|
URISyntaxException | thrown on syntax error |
MalformedURLException | thrown on malformat |
public static URL concaturl(final URL p_base, final String p_string) throws MalformedURLException, URISyntaxException
//package com.java2s; /*// w w w.ja v a 2 s. co m * @cond LICENSE * ###################################################################################### * # LGPL License # * # # * # This file is part of the Asimov - Agentbased Passenger Train Delay # * # This program is free software: you can redistribute it and/or modify # * # it under the terms of the GNU Lesser General Public License as # * # published by the Free Software Foundation, either version 3 of the # * # License, or (at your option) any later version. # * # # * # This program is distributed in the hope that it will be useful, # * # but WITHOUT ANY WARRANTY; without even the implied warranty of # * # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # * # GNU Lesser General Public License for more details. # * # # * # You should have received a copy of the GNU Lesser General Public License # * # along with this program. If not, see http://www.gnu.org/licenses/ # * ###################################################################################### * @endcond */ import java.net.MalformedURLException; import java.net.URISyntaxException; import java.net.URL; public class Main { /** * concats an URL with a path * * @param p_base base URL * @param p_string additional path * @return new URL * * @throws URISyntaxException thrown on syntax error * @throws MalformedURLException thrown on malformat */ public static URL concaturl(final URL p_base, final String p_string) throws MalformedURLException, URISyntaxException { return new URL(p_base.toString() + p_string).toURI().normalize() .toURL(); } }