Identifies the static query parameters in Uri resource path for and adds it to
request.

Returns the updated uriResourcePath.
779375
public static String addStaticQueryParamtersToRequest(final Request<?> request,
                                                        final String uriResourcePath) {

        if (request == null || uriResourcePath == null) {
            return null;
        }

        String resourcePath = uriResourcePath;

        int index = resourcePath.indexOf("?");
        if (index != -1) {
            String queryString = resourcePath.substring(index + 1);
            resourcePath = resourcePath.substring(0, index);

            for (String s : queryString.split("[;&]")) {
                index = s.indexOf("=");
                if (index != -1) {
                    request.addParameter(s.substring(0, index), s.substring(index + 1));
                } else {
                    request.addParameter(s, (String)null);
                }
            }
        }
        return resourcePath;
    }
1364286
private String attachRequestString(String resourceName) {

        StringBuffer result = new StringBuffer(resourceName);
        boolean firstParam = true;
        if (resourceName.indexOf('?') == -1) {
            // no params in uri yet?
            result.append('?');
        } else {
            firstParam = false;
        }

        @SuppressWarnings("unchecked")
        Map<String, String[]> params = getJsp().getRequest().getParameterMap();
        Iterator<Map.Entry<String, String[]>> it = params.entrySet().iterator();
        String[] values = null;
        while (it.hasNext()) {
            if (values == null) {
                // first iteration: check if params before so an & has to be used.
                if (!firstParam) {
                    result.append('&');
                }
            } else {
                result.append("&");
            }
            Map.Entry<String, String[]> entry = it.next();
            result.append(entry.getKey().toString()).append('=');
            values = entry.getValue();
            for (int i = 0; i < values.length; i++) {
                result.append(values[i]);
                if ((i + 1) < values.length) {
                    result.append(',');
                }
            }
        }
        return result.toString();
    }
1135980
def add_params_to_uri(uri, params, fragment=False):
    """"""
    sch, net, path, par, query, fra = urlparse.urlparse(uri)
    if fragment:
        fra = add_params_to_qs(fra, params)
    else:
        query = add_params_to_qs(query, params)
    return urlparse.urlunparse((sch, net, path, par, query, fra))
34732
static String uri(final String... paths) {
        StringBuilder sb = new StringBuilder();
        boolean firstPath = true;
        for (String s : paths) {
            if (s == null || s.isEmpty()) {
                continue;
            }
            if (!s.startsWith("/") && !firstPath) {
                sb.append("/");
            }
            sb.append(stripLeadingSlash(s));
            firstPath = false;
        }
        return sb.toString();
    }
618643
def _add_url(self, chunk):
        
        if 'url' in chunk:
            return chunk
        public_path = chunk.get('publicPath')
        if public_path:
            chunk['url'] = public_path
        else:
            fullpath = posixpath.join(self.state.static_view_path,
                                      chunk['name'])
            chunk['url'] = self._request.static_url(fullpath)
        return chunk
203076
def _append_params_to_uri(cls, uri, params):
        

        if params:
            return uri + cls._DELIMITER_URL_QUERY + urlencode(params)

        return uri
1320196
def resolve_request_path(requested_uri):
    
    from settings import PATH_ALIASES

    for key, val in PATH_ALIASES.items():
        if re.match(key, requested_uri):
            return re.sub(key, val, requested_uri)
    return requested_uri
1243278
def addResource(self, content, uri, headers):
        
        self.cache[uri] = CachedResource(content, headers)
182300
public static final String getRelativeURI( String contextPath, String uri )
    {
        String requestUrl = uri;
        int overlap = requestUrl.indexOf( contextPath + '/' );
        assert overlap != -1 : "contextPath: " + contextPath + ", uri: " + uri;
        return requestUrl.substring( overlap + contextPath.length() );
    }
290137
def get_query_uri(self):
        
        # Query URI has extra path we don't want so strip it off here
        query_uri = self.service.settings.data['query']['uri']
        query_uri = urlparse(query_uri)
        return query_uri.scheme + '://' + query_uri.netloc
703435
def add_urlhelpers(event):
    
    event['static_url'] = lambda x: static_path(x, event['request'])
    event['route_url'] = lambda name, *args, **kwargs: \
        route_path(name, event['request'], *args, **kwargs)
    event['parse_rest'] = parse_rest
    event['has_permission'] = event['request'].has_permission
103166
public static String modifyURIPath(String uri, String newPath) {
        try {
            URI uriObj = new URI(uri);
            return uriToString(URLUtils.modifyURIPath(uriObj, newPath));
        }
        catch (URISyntaxException e) {
            try {
                return (new NetworkInterfaceURI(uri)).modifyURIPath(newPath);
            }
            catch (IllegalArgumentException ne) {
                throw new IllegalArgumentException(ne.getMessage(), ne);
            }
        }
    }
606883
def add_uri(force_update_mode, onerror_mode, uri)
      fmode = force_update_mode.nil?
      uri += '&forceUpdateMode=' + force_update_mode unless fmode
      uri += '&onErrorMode=' + onerror_mode unless onerror_mode.nil?
      uri
    end
883647
public String path() {
    /* build the fully qualified url with all query parameters */
    StringBuilder path = new StringBuilder();
    if (this.target != null) {
      path.append(this.target);
    }
    if (this.uriTemplate != null) {
      path.append(this.uriTemplate.toString());
    }
    if (path.length() == 0) {
      /* no path indicates the root uri */
      path.append("/");
    }
    return path.toString();

  }
874602
public URI changesUri(Map<String, Object> query) {
        String base_uri = String.format(
                "%s/%s",
                this.rootUriString,
                "_changes"
        );

        //lets find the since parameter
        if(query.containsKey("since")){
            Object since = query.get("since");
            if(!(since instanceof String)){
                //json encode the seq number since it isn't a string
                query.put("since", JSONUtils.toJson(since));
            }
        }

        String uri = appendQueryString(base_uri, query);
        return uriFor(uri);
    }
395136
public static URI buildUri(String httpOrHttps, String host, String path,
            Map<String, String> paramMap) {
        try {
            return new URIBuilder().setScheme(httpOrHttps).setHost(host)
                    .setPath(path)
                    .setParameters(buildNameValuePareList(paramMap)).build();
        } catch (URISyntaxException e) {
            throw JMExceptionManager.handleExceptionAndReturnRuntimeEx(log, e,
                    "getResponseAsString", httpOrHttps, host, path, paramMap);
        }
    }
941453
def _build_url(self, query_params):
        
        url = ''
        count = 0
        while count < len(self._url_path):
            url += '/{}'.format(self._url_path[count])
            count += 1

        # add slash
        if self.append_slash:
            url += '/'

        if query_params:
            url_values = urlencode(sorted(query_params.items()), True)
            url = '{}?{}'.format(url, url_values)

        if self._version:
            url = self._build_versioned_url(url)
        else:
            url = '{}{}'.format(self.host, url)
        return url