本文整理了Java中org.apache.commons.httpclient.URI.toString()
方法的一些代码示例,展示了URI.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URI.toString()
方法的具体详情如下:
包路径:org.apache.commons.httpclient.URI
类名称:URI
方法名:toString
[英]Get the escaped URI string.
On the document, the URI-reference form is only used without the userinfo component like http://jakarta.apache.org/ by the security reason. But the URI-reference form with the userinfo component could be parsed.
In other words, this URI and any its subclasses must not expose the URI-reference expression with the userinfo component like http://user:password@hostport/restricted_zone.
It means that the API client programmer should extract each user and password to access manually. Probably it will be supported in the each subclass, however, not a whole URI-reference expression.
[中]获取转义的URI字符串。
在文档中,URI引用表单仅在没有userinfo组件的情况下使用,如http://jakarta.apache.org/出于安全考虑。但是可以解析带有userinfo组件的URI引用表单。
换句话说,这个URI及其任何子类都不能使用userinfo组件公开URI引用表达式,比如http://user:password@主机端口/限制区。
这意味着API客户端程序员应该提取每个用户和密码以手动访问。不过,每个子类可能都支持它,而不是一个完整的URI引用表达式。
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Compare this URI to another object.
*
* @param obj the object to be compared.
* @return 0, if it's same,
* -1, if failed, first being compared with in the authority component
* @throws ClassCastException not URI argument
*/
public int compareTo(Object obj) throws ClassCastException {
URI another = (URI) obj;
if (!equals(_authority, another.getRawAuthority())) {
return -1;
}
return toString().compareTo(another.toString());
}
代码示例来源:origin: elastic/elasticsearch-hadoop
uri = http.getURI().toString();
} catch (URIException uriex) {
throw new EsHadoopTransportException("Invalid target URI " + request, uriex);
代码示例来源:origin: apache/cloudstack
public String getDownloadUrl() {
try {
return getMethod.getURI().toString();
} catch (URIException e) {
return null;
}
}
代码示例来源:origin: mttkay/signpost
public String getRequestUrl() {
try {
return httpMethod.getURI().toString();
} catch (URIException ex) {
throw new IllegalStateException(ex);
}
}
代码示例来源:origin: geotools/geotools
/**
* @param method
* @return the http status code of the execution
* @throws IOException
* @throws HttpException
*/
private int executeMethod(HttpMethod method) throws IOException, HttpException {
String host = method.getURI().getHost();
if (host != null && nonProxyHosts.contains(host.toLowerCase())) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine(
"Bypassing proxy config due to nonProxyHosts for "
+ method.getURI().toString());
}
return client.executeMethod(hostConfigNoProxy, method);
}
return client.executeMethod(method);
}
代码示例来源:origin: org.apache.abdera/abdera-client
/**
* Return the request URI
*/
public String getUri() {
try {
return method.getURI().toString();
} catch (URIException e) {
}
return null; // shouldn't happen
}
代码示例来源:origin: org.zaproxy/zap
@Override
protected void performHistoryReferenceActions (List<HistoryReference> hrefs) {
StringBuilder sb = new StringBuilder();
for (HistoryReference href : hrefs) {
sb.append(href.getURI().toString());
sb.append("\n");
}
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents( new StringSelection(sb.toString()), this );
}
代码示例来源:origin: edu.ucar/opendap
public String getPath()
{
try {
return (method == null ? null : method.getURI().toString());
} catch (URIException e) {return null;}
}
代码示例来源:origin: edu.ucar/netcdf
public String getPath()
{
try {
return (method == null ? null : method.getURI().toString());
} catch (URIException e) {
return null;
}
}
代码示例来源:origin: org.springframework.ws/spring-ws-core
@Override
public URI getUri() throws URISyntaxException {
try {
return new URI(postMethod.getURI().toString());
}
catch (URIException ex) {
throw new URISyntaxException("", ex.getMessage());
}
}
代码示例来源:origin: org.zaproxy/zap
/**
* Check if the parameter should be excluded by the scanner
* @param msg the message that is currently under scanning
* @param param the Value/Name param object thta is currently under scanning
* @return true if the parameter should be excluded
*/
public boolean isToExclude(HttpMessage msg, NameValuePair param) {
return ((paramType == NameValuePair.TYPE_UNDEFINED) || (param.getType() == paramType)) &&
((urlPattern == null) || urlPattern.matcher(msg.getRequestHeader().getURI().toString().toUpperCase(Locale.ROOT)).matches()) &&
(paramNamePattern.matcher(param.getName()).matches());
}
代码示例来源:origin: org.zaproxy/zap
/**
* Returns the FORM parameters for the given URL based on the parser associated with the
* first context found that includes the URL, or the default parser if it is not
* in a context
* @param uri
* @param formData
* @return
* @throws URIException
*/
public Map<String, String> getFormParams(URI uri, String formData) throws URIException {
return this.getFormParamParser(uri.toString()).parse(formData);
}
代码示例来源:origin: org.apache.any23/apache-any23-core
private String normalize(String uri) throws URISyntaxException {
try {
URI normalized = new URI(uri, DefaultHTTPClient.isUrlEncoded(uri));
normalized.normalize();
return normalized.toString();
} catch (URIException e) {
LOG.warn("Invalid uri: {}", uri);
LOG.error("Can not convert URL", e);
throw new URISyntaxException(uri, e.getMessage());
}
}
代码示例来源:origin: org.zaproxy/zap
/**
* Return the prime header (first line).
*/
@Override
public String getPrimeHeader() {
return getMethod() + " " + getURI().toString() + " " + getVersion();
}
/*
代码示例来源:origin: org.zaproxy/zap
/**
* Override if handling callbacks
* @param msg the HTTP message containing the API request and response
* @return the API response (set in the HTTP response body)
* @throws ApiException if an error occurred while handling the API callback
*/
public String handleCallBack(HttpMessage msg) throws ApiException {
throw new ApiException (ApiException.Type.URL_NOT_FOUND, msg.getRequestHeader().getURI().toString());
}
代码示例来源:origin: org.zaproxy/zap
/**
* Sets the {@code HttpMessage} that will be set to the new alert.
*
* @param httpMessage
* the {@code HttpMessage} that will be set to the new alert
*/
public void setHttpMessage(HttpMessage httpMessage) {
this.httpMessage = httpMessage;
setParamNames(httpMessage.getParamNames());
this.alertUrl.setText(httpMessage.getRequestHeader().getURI().toString());
this.historyRef = null;
}
代码示例来源:origin: com.atlassian.jira.plugins/jira-dvcs-connector-api
@Override
public void addAuthentication(HttpMethod forMethod, HttpClient forClient) {
try {
forMethod.addRequestHeader("Authorization", "token " + accessToken);
String url = forMethod.getURI().toString();
String separator = url.contains("?") ? "&" : "?";
url += separator + "access_token=" + getAccessToken();
forMethod.setURI(new URI(url, true));
} catch (URIException e) {
throw new SourceControlException("Failed to decode/encode given URI. " + e.getMessage(), e);
}
}
代码示例来源:origin: org.zaproxy/zap
private boolean isValidForCurrentMode(URI uri) {
switch (Control.getSingleton().getMode()) {
case safe:
return false;
case protect:
return Model.getSingleton().getSession().isInScope(uri.toString());
default:
return true;
}
}
代码示例来源:origin: org.zaproxy/zap
public void raiseAlert(int risk, int confidence, String name, String description, String uri,
String param, String attack, String otherInfo, String solution, String evidence,
int cweId, int wascId, HttpMessage msg) {
Alert alert = new Alert(getPluginId(), risk, confidence, name);
alert.setDetail(description, msg.getRequestHeader().getURI().toString(),
param, attack, otherInfo, solution, null, evidence, cweId, wascId, msg); // Left out reference to match ScriptsActiveScanner
this.parent.raiseAlert(currentHRefId, alert);
}
代码示例来源:origin: org.zaproxy/zap
private void showBrowser(HistoryReference ref) {
if (! supported) {
return;
}
try {
this.getBrowserLauncher().openURLinBrowser(ref.getURI().toString());
} catch (Exception e) {
extension.getView().showWarningDialog(Constant.messages.getString("history.browser.warning"));
}
}
内容来源于网络,如有侵权,请联系作者删除!