Java URL Build buildURLForParams(String... urlParams)

Here you can find the source of buildURLForParams(String... urlParams)

Description

Returns a URL created from the given params

License

Apache License

Parameter

Parameter Description
urlParams given params

Return

URL with the given params

Declaration

public static String buildURLForParams(String... urlParams) 

Method Source Code

//package com.java2s;
/*/*  ww w.  ja va 2  s.  c o m*/
   Copyright 2013 Rene Nowak 
    
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
    
   http://www.apache.org/licenses/LICENSE-2.0
    
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

public class Main {
    /**
     * Returns a URL created from the given params
     *
     * @param urlParams given params
     * @return URL with the given params
     */
    public static String buildURLForParams(String... urlParams) {
        String url = "/";
        for (String param : urlParams) {
            url += param + "/";
        }
        return url;
    }
}

Related

  1. buildUrl(String scheme, String base, String path, String query)
  2. buildUrl(String scheme, String host, int port)
  3. buildUrl(String uri)
  4. buildUrl(String[] indexNames, String[] types, String operationOrId)
  5. buildUrlAsString(String scheme, String host, int port, String path)
  6. buildURLForParamsWithPrefix(String prefix, String... urlParams)
  7. buildURLForPath(String[] _path)
  8. buildUrlFromParts(String... parts)
  9. buildUrlWithFilter(String url, String[] filterArrayString)