Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
9b37d893
Commit
9b37d893
authored
Aug 03, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete unused methods.
parent
7a81eb12
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
40 deletions
+1
-40
OkHttpHelper.java
...rc/main/java/chat/rocket/android/helper/OkHttpHelper.java
+1
-40
No files found.
app/src/main/java/chat/rocket/android/helper/OkHttpHelper.java
View file @
9b37d893
package
chat
.
rocket
.
android
.
helper
;
package
chat
.
rocket
.
android
.
helper
;
import
android.content.Context
;
import
android.content.Context
;
import
android.support.annotation.NonNull
;
import
com.facebook.stetho.okhttp3.StethoInterceptor
;
import
com.facebook.stetho.okhttp3.StethoInterceptor
;
import
java.io.IOException
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
chat.rocket.android.RocketChatCache
;
import
chat.rocket.android.RocketChatCache
;
import
chat.rocket.android.api.rest.CookieInterceptor
;
import
chat.rocket.android.api.rest.CookieInterceptor
;
import
chat.rocket.android.api.rest.DefaultCookieProvider
;
import
chat.rocket.android.api.rest.DefaultCookieProvider
;
import
okhttp3.Call
;
import
okhttp3.Callback
;
import
okhttp3.OkHttpClient
;
import
okhttp3.OkHttpClient
;
import
okhttp3.Request
;
import
okhttp3.Response
;
/**
/**
* Helper class for OkHttp client.
* Helper class for OkHttp client.
*/
*/
public
class
OkHttpHelper
{
public
class
OkHttpHelper
{
private
static
OkHttpClient
defaultHttpClient
;
private
static
OkHttpClient
httpClientForUploadFile
;
private
static
OkHttpClient
httpClientForUploadFile
;
private
static
OkHttpClient
httpClientForDownloadFile
;
private
static
OkHttpClient
httpClientForDownloadFile
;
private
static
OkHttpClient
httpClientForWS
;
private
static
OkHttpClient
httpClientForWS
;
private
static
String
contentType
;
public
static
OkHttpClient
getDefaultHttpClient
()
{
if
(
defaultHttpClient
==
null
)
{
defaultHttpClient
=
new
OkHttpClient
();
}
return
defaultHttpClient
;
}
public
static
OkHttpClient
getClientForDownloadFile
(
Context
context
)
{
public
static
OkHttpClient
getClientForDownloadFile
(
Context
context
)
{
if
(
httpClientForDownloadFile
==
null
)
{
if
(
httpClientForDownloadFile
==
null
)
{
...
@@ -63,28 +48,4 @@ public class OkHttpHelper {
...
@@ -63,28 +48,4 @@ public class OkHttpHelper {
}
}
return
httpClientForWS
;
return
httpClientForWS
;
}
}
public
static
String
getContentType
(
String
uri
)
{
Request
request
=
new
Request
.
Builder
()
.
url
(
uri
)
.
head
()
.
build
();
getDefaultHttpClient
().
newCall
(
request
).
enqueue
(
new
Callback
()
{
@Override
public
void
onFailure
(
@NonNull
Call
call
,
@NonNull
IOException
ioException
)
{
ioException
.
printStackTrace
();
}
@Override
public
void
onResponse
(
@NonNull
Call
call
,
@NonNull
final
Response
response
)
throws
IOException
{
if
(!
response
.
isSuccessful
())
{
throw
new
IOException
(
"Unexpected code: "
+
response
);
}
else
{
contentType
=
response
.
header
(
"Content-Type"
);
}
}
});
return
contentType
;
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment