本文整理了Java中org.apache.commons.httpclient.URI.setPath()
方法的一些代码示例,展示了URI.setPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URI.setPath()
方法的具体详情如下:
包路径:org.apache.commons.httpclient.URI
类名称:URI
方法名:setPath
[英]Set the path.
[中]设定路径。
代码示例来源:origin: commons-httpclient/commons-httpclient
setRawPath(s.toCharArray());
} else {
setPath(s);
代码示例来源:origin: mguessan/davmail
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();
}
代码示例来源:origin: mguessan/davmail
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();
}
代码示例来源:origin: org.zaproxy/zap
msg.getRequestHeader().getURI().setPath(modifiedPath);
msg.getRequestHeader().getURI().setPath(path);
代码示例来源:origin: org.zaproxy/zap
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;
}
}
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient
setRawPath(s.toCharArray());
} else {
setPath(s);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient
setRawPath(s.toCharArray());
} else {
setPath(s);
代码示例来源:origin: org.apache.commons/httpclient
setRawPath(s.toCharArray());
} else {
setPath(s);
代码示例来源:origin: org.zaproxy/zap
setRawPath(s.toCharArray());
} else {
setPath(s);
代码示例来源:origin: org.wso2.commons-httpclient/commons-httpclient
setRawPath(s.toCharArray());
} else {
setPath(s);
代码示例来源:origin: org.zaproxy/zap
uri.setPath(path);
代码示例来源:origin: org.zaproxy/zap
String path = uri.getPath();
path = path.replaceAll("/[^/]*$", "");
uri.setPath(path);
if (sample == null) {
try {
uri.setPath(null);
代码示例来源:origin: org.zaproxy/zap
uri.setPath(path);
msg.getRequestHeader().setURI(uri);
String path2 = getRandomPathSuffix(node, uri2);
uri2 = (URI) baseUri.clone();
uri2.setPath(path2);
msg2.getRequestHeader().setURI(uri2);
sendAndReceive(msg2);
内容来源于网络,如有侵权,请联系作者删除!