setRawPath(s.toCharArray()); } else { setPath(s);
protected String getScriptBasedFormURL(HttpMethod initmethod, String pathQuery) throws URIException { URI initmethodURI = initmethod.getURI(); int queryIndex = pathQuery.indexOf('?'); if (queryIndex >= 0) { if (queryIndex > 0) { // update path String newPath = pathQuery.substring(0, queryIndex); if (newPath.startsWith("/")) { // absolute path initmethodURI.setPath(newPath); } else { String currentPath = initmethodURI.getPath(); int folderIndex = currentPath.lastIndexOf('/'); if (folderIndex >= 0) { // replace relative path initmethodURI.setPath(currentPath.substring(0, folderIndex + 1) + newPath); } else { // should not happen initmethodURI.setPath('/' + newPath); } } } initmethodURI.setQuery(pathQuery.substring(queryIndex + 1)); } return initmethodURI.getURI(); }
protected String getAbsoluteUri(HttpMethod method, String path) throws URIException { URI uri = method.getURI(); if (path != null) { // reset query string uri.setQuery(null); if (path.startsWith("/")) { // path is absolute, replace method path uri.setPath(path); } else if (path.startsWith("http://") || path.startsWith("https://")) { return path; } else { // relative path, build new path String currentPath = method.getPath(); int end = currentPath.lastIndexOf('/'); if (end >= 0) { uri.setPath(currentPath.substring(0, end + 1) + path); } else { throw new URIException(uri.getURI()); } } } return uri.getURI(); }
private String setParameter(HttpMessage msg, NameValuePair originalPair, String name, String value, boolean escaped) { URI uri = msg.getRequestHeader().getURI(); String[] paths = uri.getEscapedPath().split("/"); if (originalPair.getPosition() < paths.length) { String encodedValue = (escaped) ? value : getEscapedValue(value); paths[originalPair.getPosition()] = encodedValue; String path = String.join("/", paths); try { uri.setEscapedPath(path); } catch (URIException e) { // Looks like it wasn't escaped after all try { uri.setPath(path); } catch (URIException e1) { LOGGER.debug(e1.getMessage(), e1); } LOGGER.warn(e.getMessage(), e); } } return value; } }
setRawPath(s.toCharArray()); } else { setPath(s);
setRawPath(s.toCharArray()); } else { setPath(s);
setRawPath(s.toCharArray()); } else { setPath(s);
setRawPath(s.toCharArray()); } else { setPath(s);
setRawPath(s.toCharArray()); } else { setPath(s);
uri.setPath(path);