-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into commcare_2.54
- Loading branch information
Showing
29 changed files
with
426 additions
and
151 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.commcare.util.screen; | ||
public class ScreenContext { | ||
|
||
private boolean respectRelevancy; | ||
|
||
public ScreenContext(boolean respectRelevancy) { | ||
this.respectRelevancy = respectRelevancy; | ||
} | ||
|
||
public boolean isRespectRelevancy() { | ||
return respectRelevancy; | ||
} | ||
} |
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
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
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
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 |
---|---|---|
|
@@ -33,7 +33,7 @@ | |
* | ||
* @author Phillip Mates ([email protected]) | ||
*/ | ||
public class ModernHttpRequester implements ResponseStreamAccessor { | ||
public class ModernHttpRequester { | ||
/** | ||
* How long to wait when opening network connection in milliseconds | ||
*/ | ||
|
@@ -87,7 +87,23 @@ public void makeRequestAndProcess() { | |
} | ||
try { | ||
response = makeRequest(); | ||
processResponse(responseProcessor, response.code(), this); | ||
final ModernHttpRequester requester = this; | ||
processResponse(responseProcessor, response.code(), new ResponseStreamAccessor() { | ||
/** | ||
* Only gets called if response processor is supplied | ||
* @return Input Stream from cache | ||
* @throws IOException if an io error happens while reading or writing to cache | ||
*/ | ||
@Override | ||
public InputStream getResponseStream() throws IOException { | ||
return requester.getResponseStream(response); | ||
} | ||
|
||
@Override | ||
public String getApiVersion() { | ||
return requester.getApiVersion(); | ||
} | ||
}); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
responseProcessor.handleIOException(e); | ||
|
@@ -153,7 +169,8 @@ public static void processResponse(HttpResponseProcessor responseProcessor, | |
responseProcessor.handleIOException(e); | ||
return; | ||
} | ||
responseProcessor.processSuccess(responseCode, responseStream); | ||
String apiVersion = streamAccessor.getApiVersion(); | ||
responseProcessor.processSuccess(responseCode, responseStream, apiVersion); | ||
} finally { | ||
StreamsUtil.closeStream(responseStream); | ||
} | ||
|
@@ -181,14 +198,8 @@ public InputStream getResponseStream(Response<ResponseBody> response) throws IOE | |
return cache.retrieveCache(); | ||
} | ||
|
||
/** | ||
* Only gets called if response processor is supplied | ||
* @return Input Stream from cache | ||
* @throws IOException if an io error happens while reading or writing to cache | ||
*/ | ||
@Override | ||
public InputStream getResponseStream() throws IOException { | ||
return getResponseStream(response); | ||
public String getApiVersion() { | ||
return response != null ? response.headers().get("x-api-current-version") : null; | ||
} | ||
|
||
public static RequestBody getPostBody(Multimap<String, String> inputs) { | ||
|
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
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
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
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
Oops, something went wrong.