本文整理匯總了Java中org.apache.commons.httpclient.URIException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java URIException.printStackTrace方法的具體用法?Java URIException.printStackTrace怎麽用?Java URIException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.httpclient.URIException
的用法示例。
在下文中一共展示了URIException.printStackTrace方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fromPlain
import org.apache.commons.httpclient.URIException; //導入方法依賴的package包/類
/**
* Given a plain URI or hostname/hostname+path, give its SURT form.
* Results may be unpredictable on strings that cannot
* be interpreted as URIs.
*
* UURI 'fixup' is applied to the URI before conversion to SURT
* form.
*
* @param u URI or almost-URI to consider
* @return implied SURT prefix form
*/
public static String fromPlain(String u) {
u = ArchiveUtils.addImpliedHttpIfNecessary(u);
boolean trailingSlash = u.endsWith("/");
// ensure all typical UURI cleanup (incl. IDN-punycoding) is done
try {
u = UsableURIFactory.getInstance(u).toString();
} catch (URIException e) {
e.printStackTrace();
// allow to continue with original string uri
}
// except: don't let UURI-fixup add a trailing slash
// if it wasn't already there (presence or absence of
// such slash has special meaning specifying implied
// SURT prefixes)
if(!trailingSlash && u.endsWith("/")) {
u = u.substring(0,u.length()-1);
}
// convert to full SURT
u = SURT.fromURI(u);
return u;
}
示例2: getRequestUrl
import org.apache.commons.httpclient.URIException; //導入方法依賴的package包/類
public String getRequestUrl() {
try {
String uri = request.getURI().toString();
String url = hc.getHostURL() + uri;
return url;
} catch (URIException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
示例3: addSeedIfLegal
import org.apache.commons.httpclient.URIException; //導入方法依賴的package包/類
/**
* Adds a url as a seed if possible. Otherwise just prints an error description and returns.
* @param tweetUrl The url to be added.
*/
private void addSeedIfLegal(String tweetUrl) {
try {
CandidateURI curi = CandidateURI.createSeedCandidateURI(UURIFactory.getInstance(tweetUrl));
System.out.println("Adding seed: '" + curi.toString() + "'");
addSeed(curi);
} catch (URIException e1) {
logger.log(Level.SEVERE, e1.getMessage());
e1.printStackTrace();
}
}
示例4: logRequestHistory
import org.apache.commons.httpclient.URIException; //導入方法依賴的package包/類
/**
* Log modified request
*
* @param httpMethodProxyRequest
* @param httpServletResponse
* @param history
*/
private void logRequestHistory(HttpMethod httpMethodProxyRequest, PluginResponse httpServletResponse,
History history) {
try {
if (requestInformation.get().handle && requestInformation.get().client.getIsActive()) {
logger.info("Storing history");
String createdDate;
SimpleDateFormat sdf = new SimpleDateFormat();
sdf.setTimeZone(new SimpleTimeZone(0, "GMT"));
sdf.applyPattern("dd MMM yyyy HH:mm:ss");
createdDate = sdf.format(new Date()) + " GMT";
history.setCreatedAt(createdDate);
history.setRequestURL(HttpUtilities.getURL(httpMethodProxyRequest.getURI().toString()));
history.setRequestParams(httpMethodProxyRequest.getQueryString() == null ? ""
: httpMethodProxyRequest.getQueryString());
history.setRequestHeaders(HttpUtilities.getHeaders(httpMethodProxyRequest));
history.setResponseHeaders(HttpUtilities.getHeaders(httpServletResponse));
history.setResponseCode(Integer.toString(httpServletResponse.getStatus()));
history.setResponseContentType(httpServletResponse.getContentType());
history.setResponseData(httpServletResponse.getContentString());
history.setResponseBodyDecoded(httpServletResponse.isContentDecoded());
HistoryService.getInstance().addHistory(history);
logger.info("Done storing");
}
} catch (URIException e) {
e.printStackTrace();
}
}
示例5: getHref
import org.apache.commons.httpclient.URIException; //導入方法依賴的package包/類
private String getHref(Response response) {
String href = response.getHref();
if (this.decodeResponseHrefs != null) {
try {
href = URIUtil.decode(href, this.decodeResponseHrefs);
}
catch (URIException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
return href;
}