List of usage examples for org.apache.commons.httpclient HttpMethodBase setRequestHeader
@Override public void setRequestHeader(String headerName, String headerValue)
From source file:com.manning.blogapps.chapter10.atomclient.AtomBlogConnection.java
/** * Add authentication to request for username/password *//*from w ww . j av a2 s .co m*/ public static void addAuthentication(HttpMethodBase method, String u, String p) { //method.setRequestHeader("X-WSSE", WSSEUtilities.generateWSSEHeader(u, p)); method.setRequestHeader("Authorization", generateBASICHeader(u, p)); }
From source file:net.bioclipse.cir.business.CirManager.java
private static HttpMethodBase addMethodHeaders(HttpMethodBase method, Map<String, String> extraHeaders) { // add other headers if (extraHeaders != null) { for (String header : extraHeaders.keySet()) { method.setRequestHeader(header, extraHeaders.get(header)); }/*from ww w . j av a 2 s. c om*/ } return method; }
From source file:net.bioclipse.opentox.api.HttpMethodHelper.java
public static HttpMethodBase addMethodHeaders(HttpMethodBase method, Map<String, String> extraHeaders) { // set the time out method.getParams().setParameter("http.socket.timeout", new Integer(Activator.TIME_OUT)); // log in on OpenTox if needed... if (Activator.getToken() != null) { method.setRequestHeader("subjectid", Activator.getToken()); }/*from w ww. j av a 2 s.c om*/ // add other headers if (extraHeaders != null) { for (String header : extraHeaders.keySet()) { method.setRequestHeader(header, extraHeaders.get(header)); } } return method; }
From source file:com.ning.http.client.providers.apache.TestableApacheAsyncHttpProvider.java
private static int computeAndSetContentLength(Request request, HttpMethodBase m) { int length = (int) request.getContentLength(); if (length == -1 && m.getRequestHeader("Content-Length") != null) { length = Integer.valueOf(m.getRequestHeader("Content-Length").getValue()); }//from w w w. jav a 2s .com if (length != -1) { m.setRequestHeader("Content-Length", String.valueOf(length)); } return length; }
From source file:com.sun.syndication.propono.atom.client.GDataAuthStrategy.java
public void addAuthentication(HttpClient httpClient, HttpMethodBase method) throws ProponoException { httpClient.getParams().setAuthenticationPreemptive(true); method.setRequestHeader("Authorization", authToken); }
From source file:com.ning.http.client.providers.apache.ApacheAsyncHttpProvider.java
private final static int computeAndSetContentLength(Request request, HttpMethodBase m) { int lenght = (int) request.getContentLength(); if (lenght == -1 && m.getRequestHeader("Content-Length") != null) { lenght = Integer.valueOf(m.getRequestHeader("Content-Length").getValue()); }/*from w ww. j a v a 2s .c o m*/ if (lenght != -1) { m.setRequestHeader("Content-Length", String.valueOf(lenght)); } return lenght; }
From source file:edu.ucsb.eucalyptus.cloud.ws.tests.CreateSnapshotTest.java
public void testSendDummy() throws Exception { HttpClient httpClient = new HttpClient(); String addr = System.getProperty(WalrusProperties.URL_PROPERTY) + "/meh/ttt.wsl?gg=vol&hh=snap"; HttpMethodBase method = new PutMethod(addr); method.setRequestHeader("Authorization", "Euca"); method.setRequestHeader("Date", (new Date()).toString()); method.setRequestHeader("Expect", "100-continue"); httpClient.executeMethod(method);//from www. j a v a 2s . co m String responseString = method.getResponseBodyAsString(); System.out.println(responseString); method.releaseConnection(); }
From source file:edu.ucsb.eucalyptus.cloud.ws.tests.CreateSnapshotTest.java
public void testGetSnapshotInfo() throws Exception { HttpClient httpClient = new HttpClient(); String addr = System.getProperty(WalrusProperties.URL_PROPERTY) + "/snapset-FuXLn1MUHJ66BkK0/snap-zVl2kZJmjhxnEg.."; HttpMethodBase method = new GetMethod(addr); method.setRequestHeader("Authorization", "Euca"); method.setRequestHeader("Date", (new Date()).toString()); method.setRequestHeader("Expect", "100-continue"); method.setRequestHeader("EucaOperation", "GetSnapshotInfo"); httpClient.executeMethod(method);/*from ww w . j a v a 2 s .co m*/ String responseString = method.getResponseBodyAsString(); System.out.println(responseString); method.releaseConnection(); }
From source file:com.rometools.propono.atom.client.GDataAuthStrategy.java
@Override public void addAuthentication(final HttpClient httpClient, final HttpMethodBase method) throws ProponoException { httpClient.getParams().setAuthenticationPreemptive(true); method.setRequestHeader("Authorization", authToken); }
From source file:com.sun.syndication.propono.atom.client.BasicAuthStrategy.java
public void addAuthentication(HttpClient httpClient, HttpMethodBase method) throws ProponoException { httpClient.getParams().setAuthenticationPreemptive(true); String header = "Basic " + credentials; method.setRequestHeader("Authorization", header); }