List of usage examples for org.apache.commons.httpclient HttpMethodBase getRequestCharSet
public String getRequestCharSet()
From source file:de.juwimm.cms.common.http.HttpClientWrapper.java
public synchronized String getString(URL destUrl, String userName, String password) throws IOException { HttpMethodBase method = invoke(destUrl, userName, password); String charSet = method.getRequestCharSet(); String retString = new String(method.getResponseBodyAsString().getBytes(charSet)); method.releaseConnection();/*from ww w. jav a2 s . c om*/ return retString; }
From source file:com.sittinglittleduck.DirBuster.Worker.java
private Charset getCharsetFrom(HttpMethodBase httpMethod) { Charset chartSet;/*from w w w . j a v a2 s . c o m*/ try { chartSet = Charset.forName(httpMethod.getRequestCharSet()); } catch (Exception ex) { chartSet = Charset.forName("UTF-8"); } return chartSet; }
From source file:org.apache.ivy.util.url.HttpClientHandler.java
public URLInfo getURLInfo(URL url, int timeout) { HttpMethodBase method = null; try {//from ww w . j a v a 2s .co m if (getRequestMethod() == URLHandler.REQUEST_METHOD_HEAD) { method = doHead(url, timeout); } else { method = doGet(url, timeout); } if (checkStatusCode(url, method)) { return new URLInfo(true, getResponseContentLength(method), getLastModified(method), method.getRequestCharSet()); } } catch (HttpException e) { Message.error("HttpClientHandler: " + e.getMessage() + ":" + e.getReasonCode() + "=" + e.getReason() + " url=" + url); } catch (UnknownHostException e) { Message.warn("Host " + e.getMessage() + " not found. url=" + url); Message.info("You probably access the destination server through " + "a proxy server that is not well configured."); } catch (IOException e) { Message.error("HttpClientHandler: " + e.getMessage() + " url=" + url); } catch (IllegalArgumentException e) { // thrown by HttpClient to indicate the URL is not valid, this happens for instance // when trying to download a dynamic version (cfr IVY-390) } finally { if (method != null) { method.releaseConnection(); } } return UNAVAILABLE; }
From source file:org.eclipse.ecf.remoteservice.rest.client.RestClientService.java
protected String getResponseAsString(HttpMethod httpMethod) throws IOException { // Get response bytes byte[] responseBytes = httpMethod.getResponseBody(); String responseCharSet = null; if (httpMethod instanceof HttpMethodBase) { HttpMethodBase methodBase = (HttpMethodBase) httpMethod; responseCharSet = methodBase.getRequestCharSet(); }/*from ww w .ja va 2 s . c o m*/ return getResponseAsString(responseBytes, responseCharSet); }