Skip to content

Commit

Permalink
Renaming and documenting the new HttpHeaders configuration item (ACRA#76
Browse files Browse the repository at this point in the history
).
  • Loading branch information
KevinGaudin committed Apr 22, 2013
1 parent 18dbd03 commit 2761346
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
41 changes: 28 additions & 13 deletions src/main/java/org/acra/ACRAConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@
*/
package org.acra;

import org.acra.annotation.ReportsCrashes;
import org.acra.sender.HttpSender.Method;
import org.acra.sender.HttpSender.Type;

import java.lang.annotation.Annotation;
import java.util.Map;

import static org.acra.ACRAConstants.DEFAULT_APPLICATION_LOGFILE;
import static org.acra.ACRAConstants.DEFAULT_APPLICATION_LOGFILE_LINES;
import static org.acra.ACRAConstants.DEFAULT_CONNECTION_TIMEOUT;
Expand All @@ -44,6 +37,14 @@
import static org.acra.ACRAConstants.DEFAULT_STRING_VALUE;
import static org.acra.ACRAConstants.NULL_VALUE;

import java.lang.annotation.Annotation;
import java.util.Map;

import org.acra.annotation.ReportsCrashes;
import org.acra.sender.HttpSender;
import org.acra.sender.HttpSender.Method;
import org.acra.sender.HttpSender.Type;

/**
* This class is to be used if you need to apply dynamic settings. This is
* needed for example when using ACRA in an Android Library Project since ADT
Expand Down Expand Up @@ -101,16 +102,30 @@ public class ACRAConfiguration implements ReportsCrashes {
private Boolean mDisableSSLCertValidation = null;
private Method mHttpMethod = null;
private Type mReportType = null;
private Map<String,String> mHeaders;
private Map<String, String> mHttpHeaders;

public void setHeaders(Map<String,String> headers) {
this.mHeaders = headers;
/**
* Set custom HTTP headers to be sent by the provided {@link HttpSender}.
* This should be used also by third party senders.
*
* @param headers
* A map associating HTTP header names to their values.
*/
public void setHttpHeaders(Map<String, String> headers) {
this.mHttpHeaders = headers;
}

public Map<String,String> getHeaders() {
return mHeaders;
/**
* Retrieve HTTP headers defined by the application developer. These should
* be added to requests sent by any third-party sender (over HTTP of
* course).
*
* @return A map associating http header names to their values.
*/
public Map<String, String> getHttpHeaders() {
return mHttpHeaders;
}

/**
* @param additionalDropboxTags
* the additionalDropboxTags to set
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/acra/sender/HttpSender.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public void send(CrashReportData report) throws ReportSenderException {
request.setMaxNrRetries(ACRA.getConfig().maxNumberOfRequestRetries());
request.setLogin(login);
request.setPassword(password);
request.setHeaders(ACRA.getConfig().getHeaders());
request.setHeaders(ACRA.getConfig().getHttpHeaders());

String reportAsString = "";

Expand Down

0 comments on commit 2761346

Please sign in to comment.