Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_android_sdk_maven_plugin
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Panagiotis Triantafyllou
2023-01-17 18:21:32 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a354134a62cc0400e5d7dd592a52fc0b63f968ac
a354134a
1 parent
f8b3d1dc
crash fix
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
17 deletions
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/io/volley/Request.java
warply_android_sdk/build.gradle
View file @
a354134
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4.6rc3
7
'
PUBLISH_VERSION
=
'4.5.4.6rc3
8
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/volley/Request.java
View file @
a354134
...
...
@@ -22,6 +22,7 @@ import java.util.Collections;
import
java.util.Map
;
import
ly.warp.sdk.io.volley.VolleyLog.MarkerLog
;
import
android.net.TrafficStats
;
import
android.net.Uri
;
import
android.os.Handler
;
...
...
@@ -52,43 +53,67 @@ public abstract class Request<T> implements Comparable<Request<T>> {
int
DELETE
=
3
;
}
/** An event log tracing the lifetime of this request; for debugging. */
/**
* An event log tracing the lifetime of this request; for debugging.
*/
private
final
MarkerLog
mEventLog
=
MarkerLog
.
ENABLED
?
new
MarkerLog
()
:
null
;
/** Request method of this request. Currently supports GET, POST, PUT, and DELETE. */
/**
* Request method of this request. Currently supports GET, POST, PUT, and DELETE.
*/
private
final
int
mMethod
;
/** URL of this request. */
/**
* URL of this request.
*/
private
final
String
mUrl
;
/** Default tag for {@link TrafficStats}. */
/**
* Default tag for {@link TrafficStats}.
*/
private
final
int
mDefaultTrafficStatsTag
;
/** Listener interface for errors. */
/**
* Listener interface for errors.
*/
private
final
Response
.
ErrorListener
mErrorListener
;
/** Sequence number of this request, used to enforce FIFO ordering. */
/**
* Sequence number of this request, used to enforce FIFO ordering.
*/
private
Integer
mSequence
;
/** The request queue this request is associated with. */
/**
* The request queue this request is associated with.
*/
private
RequestQueue
mRequestQueue
;
/** Whether or not responses to this request should be cached. */
/**
* Whether or not responses to this request should be cached.
*/
private
boolean
mShouldCache
=
true
;
/** Whether or not this request has been canceled. */
/**
* Whether or not this request has been canceled.
*/
private
boolean
mCanceled
=
false
;
/** Whether or not a response has been delivered for this request yet. */
/**
* Whether or not a response has been delivered for this request yet.
*/
private
boolean
mResponseDelivered
=
false
;
// A cheap variant of request tracing used to dump slow requests.
private
long
mRequestBirthTime
=
0
;
/** Threshold at which we should log the request (even when debug logging is not enabled). */
/**
* Threshold at which we should log the request (even when debug logging is not enabled).
*/
private
static
final
long
SLOW_REQUEST_THRESHOLD_MS
=
3000
;
/** The retry policy for this request. */
/**
* The retry policy for this request.
*/
private
RetryPolicy
mRetryPolicy
;
/**
...
...
@@ -98,7 +123,9 @@ public abstract class Request<T> implements Comparable<Request<T>> {
*/
private
Cache
.
Entry
mCacheEntry
=
null
;
/** An opaque token tagging this request; used for bulk cancellation. */
/**
* An opaque token tagging this request; used for bulk cancellation.
*/
private
Object
mTag
;
/**
...
...
@@ -125,7 +152,17 @@ public abstract class Request<T> implements Comparable<Request<T>> {
mErrorListener
=
listener
;
setRetryPolicy
(
new
DefaultRetryPolicy
());
mDefaultTrafficStatsTag
=
TextUtils
.
isEmpty
(
url
)
?
0
:
Uri
.
parse
(
url
).
getHost
().
hashCode
();
if
(
TextUtils
.
isEmpty
(
url
))
{
mDefaultTrafficStatsTag
=
0
;
}
else
{
if
(
Uri
.
parse
(
url
)
!=
null
&&
!
TextUtils
.
isEmpty
(
Uri
.
parse
(
url
).
getHost
()))
{
mDefaultTrafficStatsTag
=
Uri
.
parse
(
url
).
getHost
().
hashCode
();
}
else
{
mDefaultTrafficStatsTag
=
0
;
}
}
// mDefaultTrafficStatsTag = TextUtils.isEmpty(url) ? 0: Uri.parse(url).getHost().hashCode();
}
/**
...
...
@@ -145,6 +182,7 @@ public abstract class Request<T> implements Comparable<Request<T>> {
/**
* Returns this request's tag.
*
* @see Request#setTag(Object)
*/
public
Object
getTag
()
{
...
...
@@ -283,6 +321,7 @@ public abstract class Request<T> implements Comparable<Request<T>> {
* Returns a list of extra HTTP headers to go along with this request. Can
* throw {@link AuthFailureError} as authentication may be required to
* provide these values.
*
* @throws AuthFailureError In the event of auth failure
*/
public
Map
<
String
,
String
>
getHeaders
()
throws
AuthFailureError
{
...
...
@@ -296,8 +335,8 @@ public abstract class Request<T> implements Comparable<Request<T>> {
*
* <p>Note that only one of getPostParams() and getPostBody() can return a non-null
* value.</p>
* @throws AuthFailureError In the event of auth failure
*
* @throws AuthFailureError In the event of auth failure
* @deprecated Use {@link #getParams()} instead.
*/
protected
Map
<
String
,
String
>
getPostParams
()
throws
AuthFailureError
{
...
...
@@ -333,7 +372,6 @@ public abstract class Request<T> implements Comparable<Request<T>> {
* Returns the raw POST body to be sent.
*
* @throws AuthFailureError In the event of auth failure
*
* @deprecated Use {@link #getBody()} instead.
*/
public
byte
[]
getPostBody
()
throws
AuthFailureError
{
...
...
@@ -479,6 +517,7 @@ public abstract class Request<T> implements Comparable<Request<T>> {
* and return an appropriate response type. This method will be
* called from a worker thread. The response will not be delivered
* if you return null.
*
* @param response Response from the network
* @return The parsed response, or null in the case of an error
*/
...
...
@@ -500,6 +539,7 @@ public abstract class Request<T> implements Comparable<Request<T>> {
* Subclasses must implement this to perform delivery of the parsed
* response to their listeners. The given response is guaranteed to
* be non-null; responses that fail to parse are not delivered.
*
* @param response The parsed response returned by
* {@link #parseNetworkResponse(NetworkResponse)}
*/
...
...
Please
register
or
login
to post a comment