org.apache.http.message.AbstractHttpMessage Java Examples

The following examples show how to use org.apache.http.message.AbstractHttpMessage. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HttpPublisher.java    From logsniffer with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void httpAddons(final AbstractHttpMessage httpMessage,
		final Event event) {
	if (headers != null) {
		for (String headerKey : headers.keySet()) {
			httpMessage.addHeader(headerKey, headers.get(headerKey));
		}
	}
}
 
Example #2
Source File: SanityIT.java    From fcrepo-webapp-plus with Apache License 2.0 5 votes vote down vote up
private static void setAuth(final AbstractHttpMessage method, final String username, final String password) {
    final String creds = username + ":" + password;
    // in test configuration we don't need real passwords
    final String encCreds =
            new String(Base64.encodeBase64(creds.getBytes()));
    final String basic = "Basic " + encCreds;
    method.setHeader("Authorization", basic);
}
 
Example #3
Source File: Hosaka.java    From Onosendai with Apache License 2.0 5 votes vote down vote up
private void addAuth (final AbstractHttpMessage req) {
	try {
		req.setHeader("Authorization", "Basic " + Base64.encodeToString(
				(this.account.getAccessToken() + ":" + this.account.getAccessSecret()).getBytes("UTF-8"),
				Base64.NO_WRAP));
	}
	catch (final UnsupportedEncodingException e) {
		throw new IllegalStateException(e);
	}
}
 
Example #4
Source File: SolrCloudAuthTestCase.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
public static void setAuthorizationHeader(AbstractHttpMessage httpMsg, String headerString) {
  httpMsg.setHeader(new BasicHeader("Authorization", headerString));
  log.info("Added Authorization Header {}", headerString);
}
 
Example #5
Source File: BasicAuthStandaloneTest.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
public static void setBasicAuthHeader(AbstractHttpMessage httpMsg, String user, String pwd) {
  String userPass = user + ":" + pwd;
  String encoded = Base64.byteArrayToBase64(userPass.getBytes(UTF_8));
  httpMsg.setHeader(new BasicHeader("Authorization", "Basic " + encoded));
  log.info("Added Basic Auth security Header {}",encoded );
}
 
Example #6
Source File: SanityIT.java    From fcrepo-webapp-plus with Apache License 2.0 4 votes vote down vote up
private static void setAdminAuth(final AbstractHttpMessage method) {
    setAuth(method, "admin1", "password3");
}