-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Android: Allow to provide a different HttpClient implementation
- Loading branch information
Showing
3 changed files
with
73 additions
and
18 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
31 changes: 31 additions & 0 deletions
31
...droid_build/maesdk/src/main/java/com/microsoft/applications/events/HttpClientRequest.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,31 @@ | ||
// | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
package com.microsoft.applications.events; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import java.io.IOException; | ||
import java.util.Map; | ||
|
||
public interface HttpClientRequest extends Runnable { | ||
|
||
interface Factory { | ||
HttpClientRequest create( | ||
@NonNull HttpClient parent, | ||
String url, | ||
String method, | ||
byte[] body, | ||
String request_id, | ||
@NonNull Map<String, String> headers | ||
) throws IOException; | ||
|
||
class AndroidUrlConnection implements HttpClientRequest.Factory { | ||
@Override | ||
public HttpClientRequest create(@NonNull HttpClient parent, String url, String method, byte[] body, String request_id, @NonNull Map<String, String> headers) throws IOException { | ||
return new Request(parent, url, method, body, request_id, headers); | ||
} | ||
} | ||
} | ||
} |