-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
239 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/com/brsanthu/googleanalytics/httpclient/BatchUrlEncodedFormEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.brsanthu.googleanalytics.httpclient; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
import java.util.List; | ||
|
||
import org.apache.http.NameValuePair; | ||
import org.apache.http.client.utils.URLEncodedUtils; | ||
import org.apache.http.entity.ContentType; | ||
import org.apache.http.entity.StringEntity; | ||
|
||
public class BatchUrlEncodedFormEntity extends StringEntity { | ||
|
||
public BatchUrlEncodedFormEntity(List<List<NameValuePair>> parameters) { | ||
super(constructCombinedEntityString(parameters), ContentType.create(URLEncodedUtils.CONTENT_TYPE)); | ||
} | ||
|
||
private static String constructCombinedEntityString(final List<List<NameValuePair>> parameters) { | ||
StringBuilder builder = new StringBuilder(); | ||
|
||
for (List<? extends NameValuePair> param : parameters) { | ||
builder.append(URLEncodedUtils.format(param, StandardCharsets.UTF_8)); | ||
builder.append("\r\n"); | ||
} | ||
|
||
return builder.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/java/com/brsanthu/googleanalytics/httpclient/HttpBatchResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
package com.brsanthu.googleanalytics.httpclient; | ||
|
||
public class HttpBatchResponse { | ||
private int statusCode; | ||
|
||
public int getStatusCode() { | ||
return statusCode; | ||
} | ||
|
||
public HttpBatchResponse setStatusCode(int statusCode) { | ||
this.statusCode = statusCode; | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.