List of usage examples for org.apache.commons.httpclient HttpMethod getDoAuthentication
public abstract boolean getDoAuthentication();
From source file:lucee.commons.net.http.httpclient3.HttpMethodCloner.java
/** * Clones a HttpMethod. <br>/*from w w w. ja v a2 s.co m*/ * <b>Attention:</b> You have to clone a method before it has * been executed, because the URI can change if followRedirects * is set to true. * * @param m the HttpMethod to clone * * @return the cloned HttpMethod, null if the HttpMethod could * not be instantiated * * @throws java.io.IOException if the request body couldn't be read */ public static HttpMethod clone(HttpMethod m) { HttpMethod copy = null; try { copy = m.getClass().newInstance(); } catch (InstantiationException iEx) { } catch (IllegalAccessException iaEx) { } if (copy == null) { return null; } copy.setDoAuthentication(m.getDoAuthentication()); copy.setFollowRedirects(m.getFollowRedirects()); copy.setPath(m.getPath()); copy.setQueryString(m.getQueryString()); Header[] h = m.getRequestHeaders(); int size = (h == null) ? 0 : h.length; for (int i = 0; i < size; i++) { copy.setRequestHeader(new Header(h[i].getName(), h[i].getValue())); } copy.setStrictMode(m.isStrictMode()); if (m instanceof HttpMethodBase) { copyHttpMethodBase((HttpMethodBase) m, (HttpMethodBase) copy); } if (m instanceof EntityEnclosingMethod) { copyEntityEnclosingMethod((EntityEnclosingMethod) m, (EntityEnclosingMethod) copy); } return copy; }
From source file:com.feilong.tools.net.httpclient3.HttpClientUtil.java
/** * ?log./* w ww.jav a 2 s.co m*/ * * @param httpMethod * the http method * @return the http method attribute map for log */ private static Map<String, Object> getHttpMethodRequestAttributeMapForLog(HttpMethod httpMethod) { Map<String, Object> map = new LinkedHashMap<String, Object>(); try { map.put("httpMethod.getName()", httpMethod.getName()); map.put("httpMethod.getURI()", httpMethod.getURI().toString()); map.put("httpMethod.getPath()", httpMethod.getPath()); map.put("httpMethod.getQueryString()", httpMethod.getQueryString()); map.put("httpMethod.getRequestHeaders()", httpMethod.getRequestHeaders()); map.put("httpMethod.getDoAuthentication()", httpMethod.getDoAuthentication()); map.put("httpMethod.getFollowRedirects()", httpMethod.getFollowRedirects()); map.put("httpMethod.getHostAuthState()", httpMethod.getHostAuthState().toString()); // HttpMethodParams httpMethodParams = httpMethod.getParams(); // map.put("httpMethod.getParams()", httpMethodParams); map.put("httpMethod.getProxyAuthState()", httpMethod.getProxyAuthState().toString()); } catch (Exception e) { log.error(e.getClass().getName(), e); } return map; }
From source file:org.alfresco.jive.impl.JiveOpenClientImpl.java
/** * Debugging method for obtaining the state of a request as a String. * /* w w w. ja v a 2 s.c o m*/ * @param method The method to retrieve the request state from <i>(may be null)</i>. * @return The request state as a human-readable string value <i>(will not be null)</i>. */ private String requestToString(final HttpMethod method, final String body) { StringBuffer result = new StringBuffer(128); if (method != null) { result.append("\n\tMethod: "); result.append(method.getName()); result.append("\n\tURL: "); try { result.append(String.valueOf(method.getURI())); } catch (final URIException ue) { result.append("unknown, due to: " + ue.getMessage()); } result.append("\n\tHeaders: "); for (final Header header : method.getRequestHeaders()) { result.append("\n\t\t"); result.append(header.getName()); result.append(" : "); result.append(header.getValue()); } result.append("\n\tAuthenticating? " + method.getDoAuthentication()); if (body != null) { result.append("\n\tBody: "); result.append(body); } } else { result.append("(null)"); } return (result.toString()); }