本文整理匯總了Java中org.apache.commons.httpclient.URIException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java URIException.getMessage方法的具體用法?Java URIException.getMessage怎麽用?Java URIException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.httpclient.URIException
的用法示例。
在下文中一共展示了URIException.getMessage方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testTooLongAfterEscaping
import org.apache.commons.httpclient.URIException; //導入方法依賴的package包/類
public final void testTooLongAfterEscaping() {
StringBuffer buffer = new StringBuffer("http://www.archive.org/a/");
// Append bunch of spaces. When escaped, they'll triple in size.
for (int i = 0; i < 1024; i++) {
buffer.append(" ");
}
buffer.append("/index.html");
String message = null;
try {
UsableURIFactory.getInstance(buffer.toString());
} catch (URIException e) {
message = e.getMessage();
}
assertTrue("Wrong or no exception: " + message, (message != null) &&
message.startsWith("Created (escaped) uuri >"));
}
示例2: getURI
import org.apache.commons.httpclient.URIException; //導入方法依賴的package包/類
public URI getURI() {
try {
return URI.create(this.httpMethod.getURI().getEscapedURI());
}
catch (URIException ex) {
throw new IllegalStateException("Could not get HttpMethod URI: " + ex.getMessage(), ex);
}
}
示例3: addResource
import org.apache.commons.httpclient.URIException; //導入方法依賴的package包/類
protected void addResource(String href, boolean isCollection)
throws ScanException
{
try {
String path = (Utils.createHttpURL(getBaseURL(), href)).getPath();
String relPath = path.substring(getBaseURL().getPath().length());
if (relPath.startsWith(SEPARATOR)) {
relPath = relPath.substring(1);
}
if (isCollection) {
if (isIncluded(relPath)) {
if (isExcluded(relPath)) {
dirsExcluded.add(relPath);
} else {
dirsIncluded.add(relPath);
}
} else {
dirsNotIncluded.add(relPath);
}
} else {
if (isIncluded(relPath)) {
if (isExcluded(relPath)) {
filesExcluded.add(relPath);
} else {
filesIncluded.add(relPath);
}
} else {
filesNotIncluded.add(relPath);
}
}
}
catch (URIException e) {
throw new ScanException(
"The XML response returned an invalid URL: " + e.getMessage(), e);
}
}
示例4: toURL
import org.apache.commons.httpclient.URIException; //導入方法依賴的package包/類
public URL toURL() throws MalformedURLException {
if(relPath!=null)
return null;
try {
return new URL(httpUrl.getURI());
} catch (URIException e) {
throw new MalformedURLException(e.getMessage());
}
}
示例5: addAuthentication
import org.apache.commons.httpclient.URIException; //導入方法依賴的package包/類
@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);
}
}